Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Browse and select file on Macintosh

3 views
Skip to first unread message

Larry Sulky

unread,
Mar 16, 2009, 9:38:56 AM3/16/09
to
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

Peter Jamieson

unread,
Mar 20, 2009, 6:04:54 AM3/20/09
to
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

0 new messages