Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all...
I would like to record a macro that will pause while I browse to locate a spreadsheet. I need to perform the same functions on many spreadsheets that have different names, so I would like to start the macro, have it do a function or two, then pause while browse or type in a file name, then continue with the rest of the functions. Any ideas? Thanks! John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have you looked at GetOpenFilename in VBA Help?
-- HTH RP (remove nothere from the email address if mailing direct) "JohnnyJomp" wrote in message ... Hi all... I would like to record a macro that will pause while I browse to locate a spreadsheet. I need to perform the same functions on many spreadsheets that have different names, so I would like to start the macro, have it do a function or two, then pause while browse or type in a file name, then continue with the rest of the functions. Any ideas? Thanks! John |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Johnny, I use the following code to prompt me to browse for two files
and then it procedes with the rest of the codes. (This code is modified from a kind soul who posted to this user group). I think that you will be best served letting the code run and prompt you when it is appropriate for the file names. Dim FirstFile$, SecFile$ Dim fd As FileDialog Dim vrtSelectedItem As Variant FirstFile = "" SecFile = "" Set fd = Application.FileDialog(msoFileDialogFilePicker) On Error GoTo 0 With fd .InitialFileName = Sheets("Unique Items").Cells(16, 2) .InitialView = msoFileDialogViewDetails MsgBox "Select 'Previous Budget' file." If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems FirstFile = vrtSelectedItem Next vrtSelectedItem End If MsgBox "Select 'Current Budget' file." If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems SecFile = vrtSelectedItem Next vrtSelectedItem End If End With Err.Clear Set fd = Nothing HTH -- Lonnie M. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob's suggestion is probably easier to use/learn. The reason I like
this method is that it lets me specify a default directory to start browsing -- using ".InitialFileName". Both get the job done. Good luck! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob:
I have never done anything with macros before. I will look into this to see if I can figure it out. Thanks for the tip! John "Bob Phillips" wrote: Have you looked at GetOpenFilename in VBA Help? -- HTH RP (remove nothere from the email address if mailing direct) "JohnnyJomp" wrote in message ... Hi all... I would like to record a macro that will pause while I browse to locate a spreadsheet. I need to perform the same functions on many spreadsheets that have different names, so I would like to start the macro, have it do a function or two, then pause while browse or type in a file name, then continue with the rest of the functions. Any ideas? Thanks! John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
pause a macro | Excel Discussion (Misc queries) | |||
Pause Macro 2 | Excel Discussion (Misc queries) | |||
Pause a Macro? | Excel Programming | |||
Pause during a Macro | Excel Programming | |||
Pause macro | Excel Programming |