Browse and select file on Macintosh

L

Larry Sulky

Mac:Word 2004 VBA:

How do I browse for and select a file on a Mac? I don't need to open
the selected file -- I need to capture the name of the file and return
it to the routine. GetOpenFileName would be perfect but it doesn't
exist for Mac... or does it? TIA --
---larry
 
P

Peter Jamieson

How about something based on

Sub getfilename()
Dim dlgFileOpen As Word.Dialog
Dim lngResult As Long
Set dlgFileOpen = Word.Dialogs(wdDialogFileOpen)
lngResult = dlgFileOpen.Display
Select Case lngResult
Case -2, -1 ' close, OK ("Open")
MsgBox dlgFileOpen.Name
Case 0 ' cancel
MsgBox "user cancelled"
Case Else ' other command button
MsgBox "other command button, value " & CStr(lngResult)
End Select
Set dlgFileOpen = Nothing
End Sub

Peter Jamieson

http://tips.pjmsn.me.uk
 

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