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

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.



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

Right on! Thanks Craig

nt