Thread: Finding file
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Finding file

Dim file as String
file = Application.GetOpenFilename
if file = "False" then
msgbox "You hit cancel"
exit sub
end if

--
Regards,
Tom Ogilvy


"DKS" wrote:

Thanks this does the trick. Nevertheless on testing it, when clicking on
cancel the resulting value is FALSE. Thus, how do I test for this in the
macro? If I put

IF NOT file

then the above works well when I click cancel but not at all when I select a
good file name; I get a 'type mismatch" error.

Thanks for your previous tip.

"mcg" wrote:


DKS napisal(a):
Hi,

Via a macro is there any means to have a DIALOG box popped up that would
permit the user to browse the folders and select a file (or cancel the dialog
box). Once the file is identified, I want the macro to be able to get the
entire path including the file name BUT NOT OPEN the file. Thus the
xlDialogOpen... is not useful for me.

Any suggestions?


file = Application.GetOpenFilename
mcg