excel-vba

Excel VBA - Get corresponding Range for Button interface object

。_饼干妹妹 提交于 2019-12-31 03:38:13
问题 How can I get the row the clicked button? Hello everyone i need some help over here ;) I'm a newbie in VBA I am trying to make a button in Excel but I am stumped on how to figure out the row of the clicked button. Like in the photo I want that when I click the button "Sélectionner un poste" then he will tell me his position (The button which i clicked in which row) Here is my code to create the button: Sub AjouterBoutonPoste(positionX As Integer, positionY As Integer, nom As String) Set t =

Optimize Speed of Recursive File Search in Subdirectories?

泪湿孤枕 提交于 2019-12-31 03:36:07
问题 I'm looking for the fastest-performing method to recursively search subdirectories for a filepattern using an Excel macro. Excel VBA seems to be rather slow at this. Things I've tried so far (some based on other stackoverflow suggestions): Exclusive use of Dir to recurse through subdirectories and search for the filepattern in each folder. (slowest) Iterating through FileSystemObject Folders using Folder.Files collection, checking each file against filepattern. (better, but still slow)

How to add pictures to Powerpoint Presentation Picture PlaceHolder?

女生的网名这么多〃 提交于 2019-12-31 03:28:24
问题 I have created some code in Excel VBA to create a PowerPoint presentation 1 slide for each row of Excel, and populate in a specific text box in PowerPoint. I now want to add in all the images that match the description. These are all Jpegs and not charts etc. How can I do this, and is it better to do this in excel, or is it better to do this Powerpoint VBA itself? Eitherway, would anyone be able to help me out with some code on how to do this please? The image frames already exist in

Implementing a change event to check for changes to textbox values and enabling the “apply” button

心已入冬 提交于 2019-12-31 03:21:30
问题 I need your help, Is it possible in Excel VBA to apply some sort of a global change event handler for a specified userform for all textboxes and comboboxes. I know it would be possible to do them 1 by 1 but if you have around 20 textboxes this would be overkill for writing code _change for each of the userform controls no? I'd essentially like to enable an apply button after the user has typed in any textboxes or selected any new values from a combo box and change a button enabled property

Enter Key simulate click not working for checkboxes

可紊 提交于 2019-12-31 02:42:08
问题 I have copied and slightly modified the code found at the bottom of this post to allow tabbing between form controls on a worksheet form I have created. Here is the segment relating to the KeyCode = vbKeyEnter: Select Case KeyCode Case vbKeyTab Dim Backward As Boolean Backward = (Shift And fmShiftMask) Call MoveFocus(Cntrl:=Cntrl, TabIndex:=TabIndex, Backward:=Backward) Case vbKeyEnter Select Case TypeName(Cntrl) Case TxtBoxType If Not (Cntrl.EnterKeyBehavior And Cntrl.MultiLine) Then Call

Array() = range().value

僤鯓⒐⒋嵵緔 提交于 2019-12-31 02:35:04
问题 I saw array() = range().value in an example and I'm trying to understand how it works. Sub test() Dim arr() As Variant arr() = Range("E5:E7").Value For i = 0 To UBound(arr) Debug.Print arr(i) Next i End Sub First, above code is giving me subscript out of range error. How come ? Second, what part of the documentation would let me know how array() = range().value would play out without testing it ? My hypothesis is that it will go through the cells from the top left to the bottom right and add

Convert numbers to words with VBA

99封情书 提交于 2019-12-31 02:32:08
问题 I have a column of numbers. In the next column, I want the text/word conversion of the numbers. Example : 123.561 would convert to One hundred twenty three point five six one . I do not want to convert to currency, just number to text, with any number of decimal places. How can I do this? 回答1: Edit: I've adapted the procedure below to non-currency, unlimited decimal places. Edit 2 considers internationalisation via two changes in (1) Function SpellNumber and (2) Function fractionWords to make

Excel-VBA - Is there anything like Javas Set container in VBA?

旧街凉风 提交于 2019-12-31 01:55:06
问题 Is there anything like Java's Set container in VBA? I can't find anything and Google doesn't seem to helpful since set is a reserved work in VBA. Any ideas would be great. Right now my only options are Dictionary or Array. Thanks. 回答1: VBA has a 'Collection' object built in, and many people consider the 'Dictionary' object from the MS Scripting Runtime to be sufficiently standard that it's essentially part of VBA. However, neither will enforce uniqueness for general objects. Whether or not

VBA MKDIR in SharePoint fails

天涯浪子 提交于 2019-12-31 01:54:22
问题 Here is my issue: I am trying to make a folder in a SharePoint shared document library. But it only works after I enter my credentials using the "open with windows explorer" menu item. My users will not understand if I tell them they need to do this first. So, my questions is either: (A) is there a way to force this credential popup from VBA OR... (B) is there a way to pass these credentials through VBA myWorkbookBasePath= "\\sharepoint.buckeye.com\sites\transportation\cc

Import semicolon separated CSV file using VBA

徘徊边缘 提交于 2019-12-31 01:07:26
问题 I have a problem with opening .csv files with Excel by VBA code. I have data organised like: Number;Name;Price1;Price2;City 1234;"John Smith";"1,75 EUR";"2,15 EUR";"New Mexico" 3456;"Andy Jahnson";"12,45 EUR";"15,20 EUR";London 3456;"James Bond";"42,34 EUR";"9,20 EUR";Berlin When I open this file manually by Excel from Windows Explorator, everything looks fine, all values are separated correctly. It looks like that: When I try to open this by VBA, using Workbooks.Open fileName:=strPath &