If no file is returned (hits the close or cancel buttons)
the function returns a string: "False"
instead of:
Application.Dialogs.Item(xlDialogOpen).Show
try:
UserResponse = Application.Dialogs.Item(xlDialogOpen).Show
If UserResponse = "False" then Exit Sub
FileName = ActiveWindow.Caption
You might also check in to using a different open dialog such as:
FileName = Application.GetOpenFileName (....)
that way you can return the file full path more easily
Last edited by crispbd; 03-11-2005 at 07:14 PM.
|