Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have written the following Macro:
Sub Cycle()
set APP = ActiveDocument.GetApplication
For i=0 TO 3
if ActiveDocument.ActiveSheet.GetProperties.SheetID="Document\SH34" then
ActiveDocument.GetSheetByID("SH35").Activate
ActiveDocument.Fields("Team Leader").Select "Ashain Singh"
APP.Sleep 5000
'msgbox("B")
APP.Refresh
ActiveDocument.GetSheetByID("SH35").Activate
ActiveDocument.Fields("Team Leader").Select "Byron Cowley"
APP.Sleep 5000
'msgbox("C")
APP.Refresh
ActiveDocument.GetSheetByID("SH35").Activate
ActiveDocument.Fields("Team Leader").Select "Dave van Vuuren"
APP.Sleep 5000
'msgbox("D")
APP.Refresh
ActiveDocument.GetSheetByID("SH35").Activate
ActiveDocument.Fields("Team Leader").Select "Ingrid Dyson"
APP.Sleep 5000
'msgbox("E1")
Else
if ActiveDocument.ActiveSheet.GetProperties.SheetID="Document\SH35" then
ActiveDocument.GetSheetByID("SH34").Activate
ActiveDocument.Fields("Team Leader").SelectAll
ActiveDocument.GetSheetByID("SH34").Activate
APP.Sleep 10000
'msgbox("Hello2")
End if
End if
next
End Sub
the problem being that it does not return an error and it runs for the duration. If we un-comment the msgbox's the macro runs and we can follow every step, but a human action is required, we are looking for this thing to run by itself once the button is clicked.
Hello,
Try function WaitForIdle rather than sleep.
hth,
Thilo
Hi there,
Thanks it helped solved the problem except that it ran too fast, so i added Sleep to the makro anyway and it seems to be working now, just that some of the objects on the sheet dont seem to refresh fast enough.