View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default How do I write an Excel macro to open a file using the CommonDial.

In Excel,

Dim fName as Variant
fName = Application.GetOpenFileName( _
FilterIndex:="Excel Files (*.xls),*.xls")
if fName = False then
msgbox "You hit cancel"
exit sub
else
set wkbk = workbooks.Open(fName)

End if



--
Regards,
Tom Ogilvy


"Lynn" wrote in message
...
I am writing a macro. I have one spreadsheet open. I want the user to be
prompted to open a second spreadsheet by opening the Open Dialog Box and
having the user click on the file they want to open.
VB has a ShowOpen command, but I am having trouble using it with excel.