Getting open file name w/o opening file 
Author Message
 Getting open file name w/o opening file

I'd like to be able to ask the user to pick a folder name (if necessary, a file
in that folder) so I can add the folder to a favourites list. But I don't want to
actually open the file.

Excel has a dialog box to get a filename from the user without opening the file.
I can't find this in Word.

Can anyone help me?

TIA

dermot balson



Tue, 07 Oct 2003 09:21:58 GMT  
 Getting open file name w/o opening file
Hi Dermot

To choose a filename without opening a file, try this

With Dialogs(wdDialogFileOpen)
    If .Display Then
        MsgBox .Name
    Else
        MsgBox "No file selected"
    End If
End With

If you want the full pathname, do it this way

With Dialogs(wdDialogFileOpen)
    If .Display Then
        MsgBox WordBasic.FilenameInfo$(.Name, 1)
    Else
        MsgBox "No file selected"
    End If
End With

If you want to pick a folder without the opportunity to pick a file, then
take a look at this article

How to allow the user to browse to and select a folder
http://www.mvps.org/word/FAQs/MacrosVBA/BrowsDialog.htm

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email


I'd like to be able to ask the user to pick a folder name (if necessary, a
file
in that folder) so I can add the folder to a favourites list. But I don't
want to
actually open the file.

Excel has a dialog box to get a filename from the user without opening the
file.
I can't find this in Word.

Can anyone help me?

TIA

dermot balson



Tue, 07 Oct 2003 16:43:19 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting API file handle to open file

2. Opening a File Open window for file selection in VBA

3. File/Opens sees file names as ?????????1

4. opening / saving files with MS rich text box control (viewing open files)

5. Saving open file and opening new file at a specified time of day

6. Getting short file name from long file name:

7. Open a file open dialog in Project

8. Using VBA Automation to Open Word at the File Open Locatiion

9. Getting an open Word file in C++

10. Open an Open File

11. How to open a file for read that is already open by another application

12. Opening a PDF file w/o opening acrobat first

 

 
Powered by phpBB® Forum Software