Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

A simple VBA question (I think)

Posted by Adam S on November 21, 2001 12:17 PM
Hi all,

I'm trying to create a macro that (at the end) kicks up an Excel File\Open window.

The idea is that the user can select a specific file (out of several listed in a specific directory) which feeds into a built-in analysis.

Sadly I'm pretty inexperienced VBA wise. My usual method is to record what I can and then tweak the code from there. My attempts at that method this time have failed badly tho.

Does anyone know how to get a macro to kick up the File\Open prompt without actually openning a specific file (I'd like the user to choose)? Any advice would be appreciated.

Thanks all!
Adam


Check out our Excel VBA Resources

Re: A simple VBA question (I think)

Posted by Craig on November 21, 2001 12:22 PM

You can try ;

filename = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If filename <> False Then
MsgBox "Open " & filename
End If

this is in the Excel online help.


Right on! Thanks Craig

Posted by Adam S. -nt on November 21, 2001 1:05 PM
nt

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.