Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default browse to find file

Hello. Is it possible to have excel via vba allow a user to browse through
folders (like when a user clicks on FileOpen), but instead of actually
opening the file they select, I would like the file to be copied to a
specified location (variable called infopath) AND also have the name of the
file selected inserted into cell A1?

Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default browse to find file

fname = Application.GetOpenfileName

This will display the fileopen dialog and return the name and path of the
file selected (or typed in). It will not open the file. You can then use
the results to copy the file. The dichotomy here is that it is unclear what
file is being copied.

--
Regards,
Tom Ogilvy



"Steph" wrote in message
...
Hello. Is it possible to have excel via vba allow a user to browse

through
folders (like when a user clicks on FileOpen), but instead of actually
opening the file they select, I would like the file to be copied to a
specified location (variable called infopath) AND also have the name of

the
file selected inserted into cell A1?

Thanks!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default browse to find file

Check out GetOpenFilename in VBA help to show how to browse a file.

If you open it, you can then saveas to the new location and close it
immediately, after saving the name

ActiveWorkbook.SaveAs Filename:= ....
ThisWorkbook.Range("A1").Value = ActiveWorkbook.FullName
ActiveWorkbook.Close

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Steph" wrote in message
...
Hello. Is it possible to have excel via vba allow a user to browse

through
folders (like when a user clicks on FileOpen), but instead of actually
opening the file they select, I would like the file to be copied to a
specified location (variable called infopath) AND also have the name of

the
file selected inserted into cell A1?

Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default browse to find file

Thanks guys!

"Bob Phillips" wrote in message
...
Check out GetOpenFilename in VBA help to show how to browse a file.

If you open it, you can then saveas to the new location and close it
immediately, after saving the name

ActiveWorkbook.SaveAs Filename:= ....
ThisWorkbook.Range("A1").Value = ActiveWorkbook.FullName
ActiveWorkbook.Close

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Steph" wrote in message
...
Hello. Is it possible to have excel via vba allow a user to browse

through
folders (like when a user clicks on FileOpen), but instead of actually
opening the file they select, I would like the file to be copied to a
specified location (variable called infopath) AND also have the name of

the
file selected inserted into cell A1?

Thanks!






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
Browse File for Mac John Vickers Excel Discussion (Misc queries) 1 February 17th 06 06:23 PM
can't browse file k_anucha Excel Discussion (Misc queries) 1 September 29th 05 01:51 AM
excel vba browse file jazzy Excel Programming 0 August 5th 04 10:07 PM
excel vba browse file jazzy Excel Programming 3 August 5th 04 09:30 PM
File Browse Box JONNIE Excel Programming 2 February 5th 04 05:22 PM


All times are GMT +1. The time now is 08:05 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"