Thread: Pause a macro?
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Lonnie M. Lonnie M. is offline
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.