Message 1 of 2
Pause / wait for a sub before execute
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am experiencing an issue with the execution of a vba . This vba is executed each time a drawing is opended.
FileName = ThisDrawing.FullName
If UCase(FileName) = UCase("C:\Users\xxx\123.dwg") Then
WaitForAutoCAD
dsdfile = "C:\Users\xxx\123.dsd"
Call PrintFromDSD(dsdfile) 'in this sub a send command publish is made
It seem that the "PrintFromDSD(dsdfile)" is execute before the drawing is fully open.
The subroutine works perfectly when I start it manually.
I added a "wait" , with message box to see if where is the problem,
Sub WaitForAutoCAD()
Dim State As AcadState
Dim EndTime As Double
Dim Seconde As Double
Set State = GetAcadState
Seconde = 60 'le nombre de seconde de l'attente
EndTime = Timer + Seconde
If State.IsQuiescent Then
MsgBox "AutoCAD is fully open"
Else
MsgBox "AutoCAD is not ready."
Do While Timer < EndTime
DoEvents 'permet à autocad de contimuer de répondre
Loop
'test pour valider qu'il a compte
If State.IsQuiescent Then
MsgBox "AutoCAD is fully after timer"
Else
MsgBox "AutoCAD is not ready. did not work :(."
End If
End If
End Sub
But I still receive the MsgBox: "AutoCAD is not ready. did not work :(."
Any suggestion
Thanks