Input Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written a macro to retrieve a specific text file from our network and
import it into excel and perform several functions. The scenario has changed
so now the users need to select from several network files, so to
systematically "point" to the one file no longer meets the need. So, can
anyone tell me how to utilize an inputbox, with hopefully some sort of
elipse, so the user can begin the macro to display the input box, via an
elipse, locate/point to the text file and then inport the file via the valued
input box? (it's the input box part I really need help with, since the code
already exist to import and sort the text file data).

Any and all help will be greatly appreciated. Thanks in advance.
 
fname = Application.GetOpenFileName()

Will display the file=>Open dialog and allow the user to navigate and select
a file. The fully qualified name of the file (name and path) are returned
to the variable fname (as shown above - the file is not opened) and you can
use that variable to pass the name to the code that does open and process
the file.

See help on GetOpenFileName for additional arguments and options.

If you want to start in a specific directory, before showing the dialog, use
chdrive and chdir to make the start directory the default.
 
Thank You Tom - I will try your suggestion.

Tom Ogilvy said:
fname = Application.GetOpenFileName()

Will display the file=>Open dialog and allow the user to navigate and select
a file. The fully qualified name of the file (name and path) are returned
to the variable fname (as shown above - the file is not opened) and you can
use that variable to pass the name to the code that does open and process
the file.

See help on GetOpenFileName for additional arguments and options.

If you want to start in a specific directory, before showing the dialog, use
chdrive and chdir to make the start directory the default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cancel Input Box error 16
Input box display 2
Input Box Cancel function 4
Drawing Elipses 3
Autofilter - Contains 3
Input Box 3
Can an input box do this 3
input box prompt 1

Back
Top