Microsoft
Software
Hardware
Network
Question : How to change open directory in msoFileDialogOpen (Excel Vba)
Hello All,
I'm using a file open dialog which I need for open multiple files and do some operations on it.
My problem is that everytime its open the intial directory is "My Documents". How do I change the Intial Directory (for example c:\temp)?
I'm using FileDialog(msoFileDialogOp
en) but I cant find the property that I need.
Here is my code:
--------------------------
-----
UserForm1.ListBox2.Clear
Dim lngCount As Long
Dim strFileNames() As String
Dim objExcel As Excel.Application
Set objExcel = New Excel.Application
Call DoesDirExist
' Open the file dialog
With objExcel.FileDialog(msoFil
eDialogOpe
n)
.AllowMultiSelect = True
.Show
For lngCount = 1 To .SelectedItems.count
ReDim Preserve strFileNames(lngCount - 1) 'Array starts at zero.
UserForm1.ListBox2.AddItem
.SelectedItems(lngCount)
Next lngCount
End With
objExcel.quit
Set objExcel = Nothing
---------------------
Thanks,
Eyal Keren
Answer : How to change open directory in msoFileDialogOpen (Excel Vba)
Hi Eyal,
Have you tried this?
With objExcel.FileDialog(msoFil
eDialogOpe
n)
.AllowMultiSelect = True
.InitialFileName = "C:\NicoReport\" ' Initial starting directory...
.Show
For lngCount = 1 To .SelectedItems.Count
ReDim Preserve strFileNames(lngCount - 1) 'Array starts at zero.
UserForm1.ListBox2.AddItem
.SelectedItems(lngCount)
Next lngCount
End With
Jim
Random Solutions
Access 2007 runtime spell check options
file mountmgr.sys caused an unexpected error 256 at line 5964
Access Report to PDF without Save As Dialog
restoring database window
Sort a SortedDictionary based on value, not key - C#.net MVC
Renumbering Primary key after delete
Microsoft, Office, 2007, Change User Menus & interfaces to English
I need to strip out every vbCrLF from a field
Slow Logon
VBA Loop through record names