Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Pause a macro?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Pause a macro?

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Pause a macro?

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!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Pause a macro?

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Pause a macro?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pause a macro tsmith Excel Discussion (Misc queries) 9 January 22nd 09 12:47 AM
Pause Macro 2 Ollie Excel Discussion (Misc queries) 3 June 15th 06 04:49 AM
Pause a Macro? Jimbo Excel Programming 2 October 14th 04 04:21 AM
Pause during a Macro Marie[_3_] Excel Programming 6 January 18th 04 12:18 PM
Pause macro Bill Barclift Excel Programming 0 September 30th 03 09:22 PM


All times are GMT +1. The time now is 09:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"