GetOpenFilename problem

K

KK

Private Sub OriginalFile_Click()

'Returns your full file name.
File_Name = Application.GetOpenFilename("Word Document
(*.doc;*.docx),*.doc;*.docx")

'Hence no len, no name...
If Len(File_Name) = 0 Then Exit Sub

Original_File.Value = File_Name

End Sub


I had try this in excel macro , it works,but it doesn't work in word macro
,why ?
 
D

Doug Robbins - Word MVP

In Word, use the following:

Dim File_Name As String
File_Name = ActiveDocument.FullName
If InStr(File_Name, "\") = 0 Then
MsgBox "The active document has not been saved."
Else
MsgBox "The path\filename of the active document is " & File_Name & "."
End If


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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