ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open Folder Help required (https://www.excelbanter.com/excel-programming/396582-open-folder-help-required.html)

Ayo

Open Folder Help required
 
I was wondering if VBA as a method that allows you to open a folder directly
use the Open File Dialog.
For example if I use this code:
Application.GetOpenFilename("Text Files (*.txt), *.txt")
I want aspecific folder to be opened in the Open file dialog.

Jim Cone

Open Folder Help required
 
Give this a try...

With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "C:\" 'Specify folder path
If .Show = -1 Then
'do it
Else
'don't do it
End If
End With

Helpful advice here...
http://www.cpearson.com/excel/newposte.htm

--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Ayo"
wrote in message
I was wondering if VBA as a method that allows you to open a folder directly
use the Open File Dialog.
For example if I use this code:
Application.GetOpenFilename("Text Files (*.txt), *.txt")
I want aspecific folder to be opened in the Open file dialog.

Ayo

Open Folder Help required
 
Thanks a million Jim. This is exactly wjat I was look for. Thank you very much.

"Jim Cone" wrote:

Give this a try...

With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "C:\" 'Specify folder path
If .Show = -1 Then
'do it
Else
'don't do it
End If
End With

Helpful advice here...
http://www.cpearson.com/excel/newposte.htm

--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Ayo"
wrote in message
I was wondering if VBA as a method that allows you to open a folder directly
use the Open File Dialog.
For example if I use this code:
Application.GetOpenFilename("Text Files (*.txt), *.txt")
I want aspecific folder to be opened in the Open file dialog.



All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com