View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Conan Kelly Conan Kelly is offline
external usenet poster
 
Posts: 419
Default Macro to select files and then run different macro on selected file

beginner1,

You could try adding this to your "strips data and makes graphs" macro near
the top so this stuff happens before any of the other lines of code get
executed:

dim pstrFilePath as string
pstrFilePath = Application.GetOpenFilename
Application.Workbooks.Open pstFilePath


Now everytime that macro is run, it will prompt you for a file to open, open
that file, and continue on with the code.

If you want to be able to run this macro without being prompted, then put
those 3 lines of code in a separate sub procedure/routine and then call your
other macro as the last line of code in this separate sub.

HTH,

Conan





wrote in message
...
I am familiar with using the record macro function in excel, but I
would like to have excel prompt me as to what file I would like to
select to run a different macro (a macro that strips data and makes
graphs). Ideally, I would like excel to prompt me to select a folder
(which has all raw excel files) and then run the macro (to make
graphs) on all the .xls files in the folder. Is this possible?