Pause Macro

J

Jennifer

Is there a way to force a macro to pause when using the runmacro, repeat x
times.

It seems that excel is unable to paste the exported data quickly enough, so
the exports are not working when the runmacro is used. Manually re-running
the macro works perfectly.

Open Query (30) Make HSD3 based pm Form)
Rename (=[Forms]![County with Contracts]![County])
Transfer Spreadsheet (="O:\Ovations\_ReoccurringProjects\CMS\_Current
Deliverables\" & [Forms]![County with Contracts]![ContractNbr] & " HSD3.xls")
DeleteObject:=[Forms]![County with Contracts]![County]
GoToRecord (next)

I can run the macro manually without errors, but if I use a runmacro with a
repeat count the exports are all screwed up. The exports end up in one excel
file with the first contract number and only some of the counties are in the
export.
 
S

S.Clark

Create a VBA function to Sleep.

Function Sleep (lngTimes as long) as Boolean
Dim i as Long

For i = 1 to lngTimes
DoEvents
Next i

End Function

Call the function from the Macro. Send the value depending on how much time
you need. e.g. RunCode Sleep(1000)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top