Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Hey Ya,

How can I display a window similar to the "File-Open" one within
Excel-Macro to make the user selecting a file?
I am looking for any more convenient method to get a filename tha
using a InputBox in which the user had to type the complete filenam
including it's path...

Thanks!

Pete

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Using a "File-Open"-Window in a Excel Macro?

Look at GetOpenFilename in VBA Help.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"PeterBrinkrolf " wrote in
message ...
Hey Ya,

How can I display a window similar to the "File-Open" one within a
Excel-Macro to make the user selecting a file?
I am looking for any more convenient method to get a filename than
using a InputBox in which the user had to type the complete filename
including it's path...

Thanks!

Peter


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Using a "File-Open"-Window in a Excel Macro?

Take a look at

Application.GetOpenFileName

in the help file.

--
Regards,

Juan Pablo González

"PeterBrinkrolf " wrote in
message ...
Hey Ya,

How can I display a window similar to the "File-Open" one within a
Excel-Macro to make the user selecting a file?
I am looking for any more convenient method to get a filename than
using a InputBox in which the user had to type the complete filename
including it's path...

Thanks!

Peter


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Thanks, that's exactly the method I've been looking for

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Here ya go Peter!

Attached is a workbook with the code to accomplish what you want. Jus
run the "BrowseForFolder" macro and you will be presented with
Windows Explorer window which will allow you to select a directory o
your choice. Once selected, click OK and the path to the director
will be placed in both a text box in the included form as well as i
the next available cell in column A of the workbook. Just step throug
the code and make whatever changes you need.

The original code which I obtained from a former co-worker wa
initially found on the internet last year. It was originally develope
as a stand-alone VB6 application but I modified it so that it could b
used with VBA for Excel. I have been using this code with severa
Excel macros I have written and it works great!! I hope you find it a
useful as me!

Rolli

Attachment filename: browse for folder.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=52086
--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Here ya go Peter!

Attached is a workbook with the code to accomplish what you want. Jus
run the "BrowseForFolder" macro and you will be presented with
Windows Explorer window which will allow you to select a directory o
your choice. Once selected, click OK and the path to the director
will be placed in both a text box in the included form as well as i
the next available cell in column A of the workbook. After obtainin
the directory path of your choice, the code will loop through th
directory and add each of the individual filenames to a listbox on th
same form. Just step through the code and make whatever changes yo
need.

The original code which I obtained from a former co-worker was found o
the internet and was originally developed as a stand-alone VB
application used for obtaining paths of only root directories.
modified the code so that it would also list each individual file
within a specific directory and also modified it so that it would wor
with Excel VBA. I have been using this code with several Excel macro
I have written and it works great!!

I hope you find it as useful as me!

Rolli

Attachment filename: browse for folder.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=52090
--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Here you go Peter!

Attached is a workbook with the code to accomplish what you want. Jus
run the "BrowseFolder" macro and you will be presented with a Window
Explorer window which will allow you to select a directory of you
choice. Once selected, click OK and the path to the directory you jus
selected will be placed in the text box on the included form. The inf
from this text box will then be used with a loop to add each of th
individual filenames to a listbox on the same form. After selectin
one of the files from the list box and clicking the submit button, yo
will write both the directory path and the selected filename to column
A and B of the worksheet. Just step through the code and make whateve
changes you need.

The original code which I obtained from a former co-worker was found o
the internet and was originally developed as a stand-alone VB
application. The original version of this project could only be use
to obtaining the directory path but I modified the code so that i
would also list each individual files within a specific directory. Th
code was also modified by me so that it would work with Excel VBA.
have been using this code with several Excel macros I have written an
it works great!! The macro will crash if you run the applicatio
straight from the provided link below so make sure to right click th
link and save the workbook before running it. Good luck, I hope thi
helps! :)



Rolli

Attachment filename: browse for folder.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=52131
--
Message posted from http://www.ExcelForum.com

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Here you go Peter!

Attached is a workbook with the code to accomplish what you want. Jus
run the "BrowseFolder" macro and you will be presented with a Window
Explorer window which will allow you to select a directory of you
choice. Once selected, click OK and the path to the directory you jus
selected will be placed in the text box on the included form. The inf
from this text box will then be used with a loop to populate a listbo
on the same form with each of the filenames found within that specifi
directory. After selecting one of the files from the list box an
clicking the submit button, you will write the directory path, th
selected filename, and the full file path to cells in columns A, B, an
C of the worksheet. Just step through the code and make whateve
changes you need.

The original code which I obtained from a former co-worker was found o
the internet and was originally developed as a stand-alone VB
application. The original version of this project could only be use
to obtaining the directory path but I modified the code so that i
would also list each individual files within a specific directory. Th
code was also modified by me so that it would work with Excel VBA.
have been using this code with several Excel macros I have written an
it works great!! The macro will crash if you run the applicatio
straight from the provided link below so make sure to right click th
link and save the workbook before running it. Good luck, I hope thi
helps! :)



Rolli

Attachment filename: browse for folder.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=52134
--
Message posted from http://www.ExcelForum.com

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Here you go Peter!

Attached is a workbook with the code to accomplish what you want. Jus
run the "BrowseFolder" macro and you will be presented with a Window
Explorer window which will allow you to select a directory of you
choice. Once selected, click OK and the path to the directory you jus
selected will be placed in the text box on the included form. The inf
from this text box will then be used with a loop to populate a listbo
on the same form with each of the filenames found within that specifi
directory. After selecting one of the files from the list box an
clicking the submit button, you will write the directory path, th
selected filename, and the full file path to cells in columns A, B, an
C of the worksheet. Just step through the code and make whateve
changes you need.

The original code which I obtained from a former co-worker was found o
the internet and was originally developed as a stand-alone VB
application. The original version of this project could only be use
for obtaining the directory path but I modified the code so that i
would also list each individual files within a specific directory. Th
code was also modified by me so that it would work with Excel VBA.
have been using this code with several Excel macros I have written an
it works great!! The macro will crash if you run the applicatio
straight from the provided link below so make sure to right click th
link and save the workbook before running it. Good luck, I hope thi
helps! :)



Rolli

Attachment filename: browse for folder.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=52136
--
Message posted from http://www.ExcelForum.com

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
I am trying to open a ".gz" file with a macro in Excel 2003. Joe D Excel Discussion (Misc queries) 25 May 10th 09 12:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
modify how files are displyed in the "file open" window Brett Excel Discussion (Misc queries) 3 February 23rd 08 01:59 AM
How to change the font of Display window of "Open File" Windows Font Excel Discussion (Misc queries) 0 January 6th 06 03:10 AM


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