ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   opening files (https://www.excelbanter.com/excel-programming/276189-re-opening-files.html)

Dan E[_2_]

opening files
 
Brian,

What you need is the GetOpenFileName function.

Use it like

TheFileToOpen = Application.GetOpenFileName

TheFileToOpen will contain a string
Look in the help menu as you can use filters with it (among other things)
(ie only look for xls or txt files)
OpenWhat = Application.GetOpenFilename("Microsoft Excel Spreadsheets (*.xls), *.xls")

Dan E

"Brian" wrote in message ...
How do I write the VBA code to prompt the user to select a
file to open? In other words, I want the code to make
the Excel 'Open' window appear in order for the user to
browse for the appropriate file to open.

Thanks in advance!

Brian





All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com