Hi Steff,
The following sub & function shows how you can browse for a folder:
Sub Browse()
MyFolder GetFolder(Title:="Find a Folder", RootFolder:=&H11)
End Sub
Function GetFolder(Optional Title As String, Optional RootFolder As Variant)
As String
On Error Resume Next
GetFolder = CreateObject("Shell.Application").BrowseForFolder(0, Title, 0,
RootFolder).Items.Item.Path
End Function
The selected folder name is stored in the variable 'MyFolder'.
To have the sub run automatically, you could rename it 'Document_Open'. For
other options, look under 'Auto Macros' in Word's help
file. You might also want to add some code to check that a folder has
actually been selected.
Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------
Steff said:
I would like to pop up a form when the document open and asking user
the working folder by browsing until the folder. Store the folder path
into a public variable.
Stephane Vial- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -