Thread: Open a folder
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Open a folder

Hi Ayo,

See if the following example helps. However I have not tested it with your
specific requirement.

Sub Return_Set_Path()

'Return the current default file path
MsgBox Application.DefaultFilePath

'Set the default file path
'Note:The following resets the default file path
'to save/open all Excel files as if it has been set in options.

strpath = Application.DefaultFilePath & "\Test"
Application.DefaultFilePath = strpath
MsgBox Application.DefaultFilePath

End Sub

Regards,

OssieMac

"Ayo" wrote:

I am trying to find if VBA has a utility that makes it possible to set the
Open File Dialog to a specific folder.
For example, if I use this code
Application.GetOpenFilename("Text Files (*.txt), *.txt")