Hello
I am trying to run the following off a button on a userform. If I progress it one step at a time it works but if I run it from the button it stops at
Workbooks("DEFG Macro plus.xls").Sheets("Sheet1").Activate
I think it might be running too fast but haven't a clue how to insert a pause between steps

[vba]Private Sub ABCDSortedView_Click()

Workbooks("Search tool2Southall.xls").Close

Workbooks("DEFG Macro plus.xls").Sheets("Sheet1").Activate

ActiveWindow.WindowState = xlMinimized

Application.Run "'DEFG Macro plus.xls'!DEFGFiltering2"

Options.Hide

End Sub[/VBA]

I did try this off the net but coudn't get it to work.I don't know if I was barking up the wrong tree or just barking.


  1. [VBA]
    1. Option Compare Database
    2. Option Explicit
    3. Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    [/VBA]Then put this where you want to wait:
Expand|Select|Wrap|Line Numbers
[vba]
  1. Sleep (10000)[/vba]
This waits 10 seconds before moving to the next line

Obviously I don't want it to wait that long but it was a try.
All help gratefully acknowledged in advance.

Gil