I developed an Excel macro using XP (Office 10.0 Object Library).
Now the users are asking to run it with previous Excel versions (Excel 95, 97).
Now the problem is that I used Application.FileDialog(msoFileDialogFilePicker) to browse for files and I don't know how this could be replaced with older libraries (actually I could use a simple InputBox, but then I discovered this forum... ).
thanks for help,that's actually a good hint. The fact is that I should allow multiple selections...something like:
Dim FileDlg As FileDialog
Set FileDlg = Application.FileDialog(msoFileDialogFilePicker)
FileDlg.Title = "Select which files to use"
FileDlg.InitialView = msoFileDialogViewList
FileDlg.InitialFileName = "C:\"
NumberOfSelections = FileDlg.SelectedItems.Count
If NumberOfSelections = 0 Then
Selection = MsgBox("No file selected." & vbCrLf & _
If Selection = vbYes Then
Loop While (NumberOfSelections = 0)
I think Application.GetOpenFilename let you select only one file...
you can actually select multiplefiles with getopenfilename
Dim aryOpenFiles As Variant, i As Integer
aryOpenFiles = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(aryOpenFiles) Then
For i = LBound(aryOpenFiles) To UBound(aryOpenFiles)
'insert your code here
i threw in a messagebox but put your own code in there
how can I dinamically let the user browse for a directory starting from a defined path?
I mean...just suppose someone opens a.xls in C:\whoknows\.
How can I make the browser starting from C:\whoknows\ ?
Before you make a call to the application.getopenfilename
just change the directory to what you want,
I they have opened a previous example use the LEFT function to get the Path store it as a variable(myFilePath) then use