record a macro to open a folder, not a file

L

labelladonna

Dear folks:

Is it possible to record, or create, a macro that opens a folder only (Word
2003)? I tried to record all the necessary steps but it didn't allow me to
stop recording unless I chose a specific file within the folder. Can anyone
please teach me on this?

Thank you!
 
A

Anand.V.V.N

Hi,

You want to opne the same folder always? You can write a macro the would
display the inbuilt file open dialog box and pass the folder which it has to
open. I assume that you are using the file open dialog box.

Anand
 
M

Michael Bednarek

Dear folks:

Is it possible to record, or create, a macro that opens a folder only (Word
2003)? I tried to record all the necessary steps but it didn't allow me to
stop recording unless I chose a specific file within the folder. Can anyone
please teach me on this?

In VBA Help, look for "FileDialog Object". Example:

Dim objFD As FileDialog

Set objFD = Application.FileDialog(msoFileDialogFolderPicker)
If objFD.Show Then
Debug.Print objFD.SelectedItems(1)
Else
Debug.Print "Nothing selected."
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top