#1   Report Post  
GWB Direct
 
Posts: n/a
Default Find File

Can I create a macro that would go to the C: Drive and allow me to pick a
file and open it. I want to be able to choose the file after I hit the macro
button.
--
Gary Baker
  #2   Report Post  
Nick Hodge
 
Posts: n/a
Default

Gary

The code below, throws the standard Open File dialog, allows you to find the
file, clicking OK captures the name in the variable fName, but does not open
it. The next line does that, using the name in the variable to identify the
file to open

Sub OpenFile()
Dim fName As String
fName = Application.GetOpenFilename()
Workbooks.Open Filename:=fName
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"GWB Direct" wrote in message
...
Can I create a macro that would go to the C: Drive and allow me to pick a
file and open it. I want to be able to choose the file after I hit the
macro
button.
--
Gary Baker



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
Can't always find XLA file Carl L Excel Discussion (Misc queries) 0 May 6th 05 03:53 PM
looking for a way to find a Missing file Microsoft Office 2000 D. tjsebree Excel Discussion (Misc queries) 1 April 22nd 05 09:04 PM
the system cannot find file specified Jodi Excel Discussion (Misc queries) 1 January 13th 05 12:07 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
Windows cannot find file message Morpheus Excel Discussion (Misc queries) 5 December 15th 04 06:49 AM


All times are GMT +1. The time now is 06:31 AM.

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"