Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Finding file

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
mcg mcg is offline
external usenet poster
 
Posts: 18
Default Finding file


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Finding file

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Finding file

Give this a try...

Sub test()
Dim strFile As String

strFile = Application.GetOpenFilename

If strFile = "False" Then
MsgBox "No file selected"
Exit Sub
End If
'The rest of your code...
End Sub
--
HTH...

Jim Thomlinson


"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




  #6   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Finding file

Thanks to all for the help. It works.

"DKS" wrote:

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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filesearch finding the same file twice? anathema Excel Programming 2 July 18th 06 09:58 PM
finding a file Q Excel Discussion (Misc queries) 1 May 7th 06 10:56 AM
finding the right file lou sanderson Excel Programming 1 May 23rd 05 06:20 PM
Finding a File on the C Drive John Baker Excel Programming 9 January 11th 05 12:28 AM
Finding the last cell used in a file... Jesterhoz Excel Programming 2 February 28th 04 01:29 AM


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"