<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Pause / wait for a sub before execute in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/pause-wait-for-a-sub-before-execute/m-p/13038435#M336</link>
    <description>&lt;P&gt;You would always get "AutoCAD is not ready..." because your code is running!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you did not show the code in PrintFromDSD(), did you set "BackgroundPlot" system variable to 0? if not, you should do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2024 13:54:58 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2024-09-23T13:54:58Z</dc:date>
    <item>
      <title>Pause / wait for a sub before execute</title>
      <link>https://forums.autodesk.com/t5/vba-forum/pause-wait-for-a-sub-before-execute/m-p/13036927#M335</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am experiencing an issue with the execution of a vba . This vba is executed each time a drawing is opended.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;It seem that the "PrintFromDSD(dsdfile)" is execute before the drawing is fully open.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The subroutine works perfectly when I start it manually.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added a "wait" ,&amp;nbsp; with message box to&amp;nbsp; see if where is the problem, &lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;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 &amp;lt; 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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But I still receive the MsgBox: "AutoCAD is not ready. did not work :(."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any&amp;nbsp; suggestion&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2024 21:05:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/pause-wait-for-a-sub-before-execute/m-p/13036927#M335</guid>
      <dc:creator>joh.richard</dc:creator>
      <dc:date>2024-09-22T21:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pause / wait for a sub before execute</title>
      <link>https://forums.autodesk.com/t5/vba-forum/pause-wait-for-a-sub-before-execute/m-p/13038435#M336</link>
      <description>&lt;P&gt;You would always get "AutoCAD is not ready..." because your code is running!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you did not show the code in PrintFromDSD(), did you set "BackgroundPlot" system variable to 0? if not, you should do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 13:54:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/pause-wait-for-a-sub-before-execute/m-p/13038435#M336</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-09-23T13:54:58Z</dc:date>
    </item>
  </channel>
</rss>

