<?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: Do Loop Error in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325879#M91981</link>
    <description>Dear David M. Gardner&lt;BR /&gt;
    Check the following code it will help you.&lt;BR /&gt;
In the code you had written having 2 errore&lt;BR /&gt;
    1.    it was closing all drawing includeing the active drawing, so&lt;BR /&gt;
automatically the VBA editor also goes out of scope&lt;BR /&gt;
    2.    all the drawings in the specified path gets loaded one by one. If&lt;BR /&gt;
the directory is having many drawings then it is difficult to load all&lt;BR /&gt;
drawings, machine may hang&lt;BR /&gt;
&lt;BR /&gt;
    try the following on your machine, and send me the feedback&lt;BR /&gt;
SAJJAD&lt;BR /&gt;
sajjad_mulla@onwardgroup.com&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
'Dim insertionpnt(0 To 2) As Double&lt;BR /&gt;
'Dim blkscale(0 To 2) As Double&lt;BR /&gt;
Dim respon As String&lt;BR /&gt;
'Dim tmpPoint&lt;BR /&gt;
'Dim BlkName As String&lt;BR /&gt;
'Public blockrefobj As AcadBlockReference&lt;BR /&gt;
'Dim intSizeNew As Integer&lt;BR /&gt;
'Dim scale1 As Double&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
Dim atts As Variant&lt;BR /&gt;
Dim I As Long&lt;BR /&gt;
Dim j As Long&lt;BR /&gt;
Dim fType(0 To 1) As Integer&lt;BR /&gt;
Dim fData(0 To 1) As Variant&lt;BR /&gt;
'Dim Csize1 As Boolean&lt;BR /&gt;
'Dim strgroup As String, strtitle1 As String, strtitle2 As String, strprojno&lt;BR /&gt;
As String, strDwnBy As String&lt;BR /&gt;
'Dim dtmdatedwn As Date, strDwgNo As String, strDwgScale, strChkBy As&lt;BR /&gt;
String, strRevision As String, strNextAssy As String, strBillMatl As String&lt;BR /&gt;
Public intBlocksize As Integer&lt;BR /&gt;
&lt;BR /&gt;
Sub FormCheck()&lt;BR /&gt;
    Dim dirName As String&lt;BR /&gt;
    Dim tmp As String, acadApp As AcadApplication&lt;BR /&gt;
    dirName = "c:\My_project\"&lt;BR /&gt;
    If Right(dirName, 1) &amp;lt;&amp;gt; "\" Then dirName = dirName &amp;amp; "\"&lt;BR /&gt;
    Set acadApp = ThisDrawing.Application&lt;BR /&gt;
'   acadApp.Documents.Close&lt;BR /&gt;
    tmp = Dir(dirName &amp;amp; "*.dwg")&lt;BR /&gt;
    Dim flag As Boolean&lt;BR /&gt;
    flag = False&lt;BR /&gt;
    Do While tmp &amp;lt;&amp;gt; ""&lt;BR /&gt;
    If flag Then&lt;BR /&gt;
        Application.ActiveDocument.Close&lt;BR /&gt;
    End If&lt;BR /&gt;
    Application.Documents.Open dirName &amp;amp; tmp&lt;BR /&gt;
    Dim intBlocksize      As Integer&lt;BR /&gt;
    intBlocksize = ThisDrawing.GetVariable("useri1")&lt;BR /&gt;
    If intBlocksize = 0 Then&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
    Set ss = ThisDrawing.SelectionSets("ss")&lt;BR /&gt;
    If Err Then&lt;BR /&gt;
        Err.Clear&lt;BR /&gt;
        On Error GoTo 0&lt;BR /&gt;
        Set ss = ThisDrawing.SelectionSets.Add("ss")&lt;BR /&gt;
    End If&lt;BR /&gt;
    ss.Clear&lt;BR /&gt;
    fType(0) = 0: fData(0) = "INSERT"&lt;BR /&gt;
    fType(1) = 2: fData(1) = "ba-*"&lt;BR /&gt;
    ss.Select acSelectionSetAll, , , fType, fData&lt;BR /&gt;
&lt;BR /&gt;
    If ss.Count = 0 Then&lt;BR /&gt;
'    Me.Hide&lt;BR /&gt;
    respon = MsgBox("You must insert a Drawing form First.", vbOKOnly,&lt;BR /&gt;
"Drawing Form")&lt;BR /&gt;
'    Drawingforminsert.Show&lt;BR /&gt;
'    End&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-c1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1 new" Then&lt;BR /&gt;
'        csize = True&lt;BR /&gt;
'        intBlocksize = 2&lt;BR /&gt;
        ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
'        BlkName = "buffind-c1 new"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name = "BUFFIND-c1"&lt;BR /&gt;
Then&lt;BR /&gt;
'            csize = True&lt;BR /&gt;
'            intBlocksize = 22&lt;BR /&gt;
            ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
'            BlkName = "buffind-c1"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-d1 new" Or ss.Item(0).ObjectName =&lt;BR /&gt;
"BUFFIND-d1 new" Then&lt;BR /&gt;
'                dsize = True&lt;BR /&gt;
'                intBlocksize = 3&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
'                BlkName = "buffind-d1 new"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-d1" Or ss.Item(0).Name = "BUFFIND-d1"&lt;BR /&gt;
Then&lt;BR /&gt;
'                    dsize = True&lt;BR /&gt;
'                    intBlocksize = 33&lt;BR /&gt;
                    ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
'                    BlkName = "buffind-d1"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-b1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-b1 new" Then&lt;BR /&gt;
'                        bsize = True&lt;BR /&gt;
'                        intBlocksize = 1&lt;BR /&gt;
                        ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
'                        BlkName = "buffind-b1 new"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name = "BUFFIND-c1"&lt;BR /&gt;
Then&lt;BR /&gt;
'                            bsize = True&lt;BR /&gt;
'                            intBlocksize = 11&lt;BR /&gt;
                            ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
'                            BlkName = "buffind-b1"&lt;BR /&gt;
    End If&lt;BR /&gt;
    tmp = Dir()&lt;BR /&gt;
    End If&lt;BR /&gt;
    flag = True&lt;BR /&gt;
    Loop&lt;BR /&gt;
End Sub</description>
    <pubDate>Thu, 27 Jul 2000 11:56:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-07-27T11:56:31Z</dc:date>
    <item>
      <title>Do Loop Error</title>
      <link>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325876#M91978</link>
      <description>Why do I get a "Compile Error: Loop without Do"?&lt;BR /&gt;
&lt;BR /&gt;
&lt;CLIP&gt;&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
'Dim insertionpnt(0 To 2) As Double&lt;BR /&gt;
'Dim blkscale(0 To 2) As Double&lt;BR /&gt;
Dim respon As String&lt;BR /&gt;
'Dim tmpPoint&lt;BR /&gt;
'Dim BlkName As String&lt;BR /&gt;
'Public blockrefobj As AcadBlockReference&lt;BR /&gt;
'Dim intSizeNew As Integer&lt;BR /&gt;
'Dim scale1 As Double&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
Dim atts As Variant&lt;BR /&gt;
Dim I As Long&lt;BR /&gt;
Dim j As Long&lt;BR /&gt;
Dim fType(0 To 1) As Integer&lt;BR /&gt;
Dim fData(0 To 1) As Variant&lt;BR /&gt;
'Dim Csize1 As Boolean&lt;BR /&gt;
'Dim strgroup As String, strtitle1 As String, strtitle2 As String, strprojno&lt;BR /&gt;
As String, strDwnBy As String&lt;BR /&gt;
'Dim dtmdatedwn As Date, strDwgNo As String, strDwgScale, strChkBy As&lt;BR /&gt;
String, strRevision As String, strNextAssy As String, strBillMatl As String&lt;BR /&gt;
Public intBlocksize As Integer&lt;BR /&gt;
&lt;BR /&gt;
Sub FormCheck()&lt;BR /&gt;
    Dim dirName As String&lt;BR /&gt;
    Dim tmp As String, acadApp As AcadApplication&lt;BR /&gt;
    dirName = "F:\"&lt;BR /&gt;
    If Right(dirName, 1) &amp;lt;&amp;gt; "\" Then dirName = dirName &amp;amp; "\"&lt;BR /&gt;
    Set acadApp = ThisDrawing.Application&lt;BR /&gt;
    acadApp.Documents.Close&lt;BR /&gt;
    tmp = Dir$(dirName &amp;amp; "*.dwg")&lt;BR /&gt;
&lt;BR /&gt;
    Do While tmp &amp;lt;&amp;gt; ""&lt;BR /&gt;
    Application.Documents.Open dirName &amp;amp; tmp&lt;BR /&gt;
    intBlocksize = ThisDrawing.GetVariable("useri1")&lt;BR /&gt;
    If intBlocksize = 0 Then&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
    Set ss = ThisDrawing.SelectionSets("ss")&lt;BR /&gt;
    If Err Then&lt;BR /&gt;
        Err.Clear&lt;BR /&gt;
        On Error GoTo 0&lt;BR /&gt;
        Set ss = ThisDrawing.SelectionSets.Add("ss")&lt;BR /&gt;
    End If&lt;BR /&gt;
    ss.Clear&lt;BR /&gt;
    fType(0) = 0: fData(0) = "INSERT"&lt;BR /&gt;
    fType(1) = 2: fData(1) = "buffind-*"&lt;BR /&gt;
    ss.Select acSelectionSetAll, , , fType, fData&lt;BR /&gt;
&lt;BR /&gt;
    If ss.Count = 0 Then&lt;BR /&gt;
'    Me.Hide&lt;BR /&gt;
    respon = MsgBox("You must insert a Drawing form First.", vbOKOnly,&lt;BR /&gt;
"Drawing Form")&lt;BR /&gt;
'    Drawingforminsert.Show&lt;BR /&gt;
'    End&lt;BR /&gt;
        ElseIf ss.Item(0).Name = "buffind-c1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1 new" Then&lt;BR /&gt;
'        csize = True&lt;BR /&gt;
'        intBlocksize = 2&lt;BR /&gt;
        ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
'        BlkName = "buffind-c1 new"&lt;BR /&gt;
            ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1" Then&lt;BR /&gt;
'            csize = True&lt;BR /&gt;
'            intBlocksize = 22&lt;BR /&gt;
            ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
'            BlkName = "buffind-c1"&lt;BR /&gt;
                ElseIf ss.Item(0).Name = "buffind-d1 new" Or ss.Item(0).Name&lt;BR /&gt;
= "BUFFIND-d1 new" Then&lt;BR /&gt;
'                dsize = True&lt;BR /&gt;
'                intBlocksize = 3&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
'                BlkName = "buffind-d1 new"&lt;BR /&gt;
                    ElseIf ss.Item(0).Name = "buffind-d1" Or ss.Item(0).Name&lt;BR /&gt;
= "BUFFIND-d1" Then&lt;BR /&gt;
'                    dsize = True&lt;BR /&gt;
'                    intBlocksize = 33&lt;BR /&gt;
                    ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
'                    BlkName = "buffind-d1"&lt;BR /&gt;
                        ElseIf ss.Item(0).Name = "buffind-b1 new" Or&lt;BR /&gt;
ss.Item(0).Name = "BUFFIND-b1 new" Then&lt;BR /&gt;
'                        bsize = True&lt;BR /&gt;
'                        intBlocksize = 1&lt;BR /&gt;
                        ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
'                        BlkName = "buffind-b1 new"&lt;BR /&gt;
                            ElseIf ss.Item(0).Name = "buffind-c1" Or&lt;BR /&gt;
ss.Item(0).Name = "BUFFIND-c1" Then&lt;BR /&gt;
'                            bsize = True&lt;BR /&gt;
'                            intBlocksize = 11&lt;BR /&gt;
                            ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
'                            BlkName = "buffind-b1"&lt;BR /&gt;
    End If&lt;BR /&gt;
    tmp = Dir$()&lt;BR /&gt;
    Loop&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;CLIP&gt;&lt;/CLIP&gt;&lt;/CLIP&gt;</description>
      <pubDate>Thu, 13 Jul 2000 12:29:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325876#M91978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-13T12:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Error</title>
      <link>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325877#M91979</link>
      <description>You were missing an end if statement. I would suggest outdenting all you&lt;BR /&gt;
control statements. It makes it easier to identify beginning and end of&lt;BR /&gt;
control logic.&lt;BR /&gt;
&lt;BR /&gt;
example:&lt;BR /&gt;
if bla bla bla then&lt;BR /&gt;
     bla bla......&lt;BR /&gt;
     bla bla......&lt;BR /&gt;
end if&lt;BR /&gt;
&lt;BR /&gt;
here is the compilable (is that a word).&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
'Dim insertionpnt(0 To 2) As Double&lt;BR /&gt;
'Dim blkscale(0 To 2) As Double&lt;BR /&gt;
Dim respon As String&lt;BR /&gt;
'Dim tmpPoint&lt;BR /&gt;
'Dim BlkName As String&lt;BR /&gt;
'Public blockrefobj As AcadBlockReference&lt;BR /&gt;
'Dim intSizeNew As Integer&lt;BR /&gt;
'Dim scale1 As Double&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
Dim atts As Variant&lt;BR /&gt;
Dim I As Long&lt;BR /&gt;
Dim j As Long&lt;BR /&gt;
Dim fType(0 To 1) As Integer&lt;BR /&gt;
Dim fData(0 To 1) As Variant&lt;BR /&gt;
'Dim Csize1 As Boolean&lt;BR /&gt;
'Dim strgroup As String, strtitle1 As String, strtitle2 As String, strprojno&lt;BR /&gt;
As String, strDwnBy As String&lt;BR /&gt;
'Dim dtmdatedwn As Date, strDwgNo As String, strDwgScale, strChkBy As&lt;BR /&gt;
String, strRevision As String, strNextAssy As String, strBillMatl As String&lt;BR /&gt;
Public intBlocksize As Integer&lt;BR /&gt;
&lt;BR /&gt;
Sub FormCheck()&lt;BR /&gt;
    Dim dirName As String&lt;BR /&gt;
    Dim tmp As String, acadApp As acadapplication&lt;BR /&gt;
    dirName = "F:\"&lt;BR /&gt;
    If Right(dirName, 1) &amp;lt;&amp;gt; "\" Then dirName = dirName &amp;amp; "\"&lt;BR /&gt;
    Set acadApp = ThisDrawing.Application&lt;BR /&gt;
    acadApp.Documents.Close&lt;BR /&gt;
    tmp = Dir$(dirName &amp;amp; "*.dwg")&lt;BR /&gt;
    Do While tmp &amp;lt;&amp;gt; ""&lt;BR /&gt;
        Application.Documents.Open dirName &amp;amp; tmp&lt;BR /&gt;
        intBlocksize = ThisDrawing.GetVariable("useri1")&lt;BR /&gt;
        If intBlocksize = 0 Then&lt;BR /&gt;
            On Error Resume Next&lt;BR /&gt;
            Set ss = ThisDrawing.SelectionSets("ss")&lt;BR /&gt;
                If Err Then&lt;BR /&gt;
                    Err.Clear&lt;BR /&gt;
                    On Error GoTo 0&lt;BR /&gt;
                    Set ss = ThisDrawing.SelectionSets.Add("ss")&lt;BR /&gt;
                End If&lt;BR /&gt;
            ss.Clear&lt;BR /&gt;
            fType(0) = 0: fData(0) = "INSERT"&lt;BR /&gt;
            fType(1) = 2: fData(1) = "buffind-*"&lt;BR /&gt;
            ss.Select acSelectionSetAll, , , fType, fData&lt;BR /&gt;
&lt;BR /&gt;
            If ss.Count = 0 Then&lt;BR /&gt;
            '   Me.Hide&lt;BR /&gt;
                respon = MsgBox("You must insert a Drawing form First.",&lt;BR /&gt;
vbOKOnly, "Drawing Form")&lt;BR /&gt;
            '   Drawingforminsert.Show&lt;BR /&gt;
            '   End&lt;BR /&gt;
            ElseIf ss.Item(0).Name = "buffind-c1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1 new" Then&lt;BR /&gt;
            '   csize = True&lt;BR /&gt;
            '   intBlocksize = 2&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
            '   BlkName = "buffind-c1 new"&lt;BR /&gt;
            ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1" Then&lt;BR /&gt;
            '   csize = True&lt;BR /&gt;
            '   intBlocksize = 22&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
            '   BlkName = "buffind-c1"&lt;BR /&gt;
            ElseIf ss.Item(0).Name = "buffind-d1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-d1 new" Then&lt;BR /&gt;
            '   dsize = True&lt;BR /&gt;
            '   intBlocksize = 3&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
            '   BlkName = "buffind-d1 new"&lt;BR /&gt;
            ElseIf ss.Item(0).Name = "buffind-d1" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-d1" Then&lt;BR /&gt;
            '   dsize = True&lt;BR /&gt;
            '   intBlocksize = 33&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
            '   BlkName = "buffind-d1"&lt;BR /&gt;
            ElseIf ss.Item(0).Name = "buffind-b1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-b1 new" Then&lt;BR /&gt;
            '   bsize = True&lt;BR /&gt;
            '   intBlocksize = 1&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
            '   BlkName = "buffind-b1 new"&lt;BR /&gt;
            ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1" Then&lt;BR /&gt;
            '   bsize = True&lt;BR /&gt;
            '   intBlocksize = 11&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
            '   BlkName = "buffind-b1"&lt;BR /&gt;
            End If&lt;BR /&gt;
            tmp = Dir$()&lt;BR /&gt;
        End If 'this is the missing end if&lt;BR /&gt;
    Loop&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
&lt;BR /&gt;
Sergio DeAlbuquerque&lt;BR /&gt;
President&lt;BR /&gt;
&lt;BR /&gt;
Matrix Technical Services Inc.&lt;BR /&gt;
172 N.Bicycle Path&lt;BR /&gt;
Selden, NY 11784&lt;BR /&gt;
&lt;BR /&gt;
Ph: 631-736-9001&lt;BR /&gt;
Fax: 631-696-8538&lt;BR /&gt;
&lt;BR /&gt;
http://www.matrixengg.com&lt;BR /&gt;
sdealbuquerq@matrixengg.com&lt;BR /&gt;
"CAD services, machine design, and VBA application development"</description>
      <pubDate>Thu, 13 Jul 2000 13:05:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325877#M91979</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-13T13:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Error</title>
      <link>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325878#M91980</link>
      <description>Have you considered using a Select Case to replace all those If statements?&lt;BR /&gt;
Sure would make it easier to read. In addition, rather than repeating all&lt;BR /&gt;
the same statements in every case, I would recommend you use an itermediate&lt;BR /&gt;
variable then make your changes outside the Select Case structure:&lt;BR /&gt;
&lt;BR /&gt;
Select Case x&lt;BR /&gt;
    Case 1&lt;BR /&gt;
        tmp = 5&lt;BR /&gt;
&lt;BR /&gt;
    Case 2, 3&lt;BR /&gt;
        tmp = 10&lt;BR /&gt;
&lt;BR /&gt;
   Case Else&lt;BR /&gt;
        tmp = 15&lt;BR /&gt;
&lt;BR /&gt;
End Select&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing.SetVariable("Whatever", tmp)&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Attitudes are contagious. Is yours worth catching?&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
"David M. Gardner" &lt;WHOOBIE&gt; wrote in message&lt;BR /&gt;
news:ef2aeab.-1@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; Why do I get a "Compile Error: Loop without Do"?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; &lt;CLIP&gt;&lt;BR /&gt;
&amp;gt; Option Explicit&lt;BR /&gt;
&amp;gt; 'Dim insertionpnt(0 To 2) As Double&lt;BR /&gt;
&amp;gt; 'Dim blkscale(0 To 2) As Double&lt;BR /&gt;
&amp;gt; Dim respon As String&lt;BR /&gt;
&amp;gt; 'Dim tmpPoint&lt;BR /&gt;
&amp;gt; 'Dim BlkName As String&lt;BR /&gt;
&amp;gt; 'Public blockrefobj As AcadBlockReference&lt;BR /&gt;
&amp;gt; 'Dim intSizeNew As Integer&lt;BR /&gt;
&amp;gt; 'Dim scale1 As Double&lt;BR /&gt;
&amp;gt; Dim ss As AcadSelectionSet&lt;BR /&gt;
&amp;gt; Dim atts As Variant&lt;BR /&gt;
&amp;gt; Dim I As Long&lt;BR /&gt;
&amp;gt; Dim j As Long&lt;BR /&gt;
&amp;gt; Dim fType(0 To 1) As Integer&lt;BR /&gt;
&amp;gt; Dim fData(0 To 1) As Variant&lt;BR /&gt;
&amp;gt; 'Dim Csize1 As Boolean&lt;BR /&gt;
&amp;gt; 'Dim strgroup As String, strtitle1 As String, strtitle2 As String,&lt;BR /&gt;
strprojno&lt;BR /&gt;
&amp;gt; As String, strDwnBy As String&lt;BR /&gt;
&amp;gt; 'Dim dtmdatedwn As Date, strDwgNo As String, strDwgScale, strChkBy As&lt;BR /&gt;
&amp;gt; String, strRevision As String, strNextAssy As String, strBillMatl As&lt;BR /&gt;
String&lt;BR /&gt;
&amp;gt; Public intBlocksize As Integer&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Sub FormCheck()&lt;BR /&gt;
&amp;gt;     Dim dirName As String&lt;BR /&gt;
&amp;gt;     Dim tmp As String, acadApp As AcadApplication&lt;BR /&gt;
&amp;gt;     dirName = "F:\"&lt;BR /&gt;
&amp;gt;     If Right(dirName, 1) &amp;lt;&amp;gt; "\" Then dirName = dirName &amp;amp; "\"&lt;BR /&gt;
&amp;gt;     Set acadApp = ThisDrawing.Application&lt;BR /&gt;
&amp;gt;     acadApp.Documents.Close&lt;BR /&gt;
&amp;gt;     tmp = Dir$(dirName &amp;amp; "*.dwg")&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Do While tmp &amp;lt;&amp;gt; ""&lt;BR /&gt;
&amp;gt;     Application.Documents.Open dirName &amp;amp; tmp&lt;BR /&gt;
&amp;gt;     intBlocksize = ThisDrawing.GetVariable("useri1")&lt;BR /&gt;
&amp;gt;     If intBlocksize = 0 Then&lt;BR /&gt;
&amp;gt;     On Error Resume Next&lt;BR /&gt;
&amp;gt;     Set ss = ThisDrawing.SelectionSets("ss")&lt;BR /&gt;
&amp;gt;     If Err Then&lt;BR /&gt;
&amp;gt;         Err.Clear&lt;BR /&gt;
&amp;gt;         On Error GoTo 0&lt;BR /&gt;
&amp;gt;         Set ss = ThisDrawing.SelectionSets.Add("ss")&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt;     ss.Clear&lt;BR /&gt;
&amp;gt;     fType(0) = 0: fData(0) = "INSERT"&lt;BR /&gt;
&amp;gt;     fType(1) = 2: fData(1) = "buffind-*"&lt;BR /&gt;
&amp;gt;     ss.Select acSelectionSetAll, , , fType, fData&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     If ss.Count = 0 Then&lt;BR /&gt;
&amp;gt; '    Me.Hide&lt;BR /&gt;
&amp;gt;     respon = MsgBox("You must insert a Drawing form First.", vbOKOnly,&lt;BR /&gt;
&amp;gt; "Drawing Form")&lt;BR /&gt;
&amp;gt; '    Drawingforminsert.Show&lt;BR /&gt;
&amp;gt; '    End&lt;BR /&gt;
&amp;gt;         ElseIf ss.Item(0).Name = "buffind-c1 new" Or ss.Item(0).Name =&lt;BR /&gt;
&amp;gt; "BUFFIND-c1 new" Then&lt;BR /&gt;
&amp;gt; '        csize = True&lt;BR /&gt;
&amp;gt; '        intBlocksize = 2&lt;BR /&gt;
&amp;gt;         ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
&amp;gt; '        BlkName = "buffind-c1 new"&lt;BR /&gt;
&amp;gt;             ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name =&lt;BR /&gt;
&amp;gt; "BUFFIND-c1" Then&lt;BR /&gt;
&amp;gt; '            csize = True&lt;BR /&gt;
&amp;gt; '            intBlocksize = 22&lt;BR /&gt;
&amp;gt;             ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
&amp;gt; '            BlkName = "buffind-c1"&lt;BR /&gt;
&amp;gt;                 ElseIf ss.Item(0).Name = "buffind-d1 new" Or&lt;BR /&gt;
ss.Item(0).Name&lt;BR /&gt;
&amp;gt; = "BUFFIND-d1 new" Then&lt;BR /&gt;
&amp;gt; '                dsize = True&lt;BR /&gt;
&amp;gt; '                intBlocksize = 3&lt;BR /&gt;
&amp;gt;                 ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
&amp;gt; '                BlkName = "buffind-d1 new"&lt;BR /&gt;
&amp;gt;                     ElseIf ss.Item(0).Name = "buffind-d1" Or&lt;BR /&gt;
ss.Item(0).Name&lt;BR /&gt;
&amp;gt; = "BUFFIND-d1" Then&lt;BR /&gt;
&amp;gt; '                    dsize = True&lt;BR /&gt;
&amp;gt; '                    intBlocksize = 33&lt;BR /&gt;
&amp;gt;                     ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
&amp;gt; '                    BlkName = "buffind-d1"&lt;BR /&gt;
&amp;gt;                         ElseIf ss.Item(0).Name = "buffind-b1 new" Or&lt;BR /&gt;
&amp;gt; ss.Item(0).Name = "BUFFIND-b1 new" Then&lt;BR /&gt;
&amp;gt; '                        bsize = True&lt;BR /&gt;
&amp;gt; '                        intBlocksize = 1&lt;BR /&gt;
&amp;gt;                         ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
&amp;gt; '                        BlkName = "buffind-b1 new"&lt;BR /&gt;
&amp;gt;                             ElseIf ss.Item(0).Name = "buffind-c1" Or&lt;BR /&gt;
&amp;gt; ss.Item(0).Name = "BUFFIND-c1" Then&lt;BR /&gt;
&amp;gt; '                            bsize = True&lt;BR /&gt;
&amp;gt; '                            intBlocksize = 11&lt;BR /&gt;
&amp;gt;                             ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
&amp;gt; '                            BlkName = "buffind-b1"&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt;     tmp = Dir$()&lt;BR /&gt;
&amp;gt;     Loop&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt; &lt;CLIP&gt;&lt;BR /&gt;
&amp;gt;&lt;/CLIP&gt;&lt;/CLIP&gt;&lt;/WHOOBIE&gt;</description>
      <pubDate>Thu, 13 Jul 2000 16:38:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325878#M91980</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-13T16:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Error</title>
      <link>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325879#M91981</link>
      <description>Dear David M. Gardner&lt;BR /&gt;
    Check the following code it will help you.&lt;BR /&gt;
In the code you had written having 2 errore&lt;BR /&gt;
    1.    it was closing all drawing includeing the active drawing, so&lt;BR /&gt;
automatically the VBA editor also goes out of scope&lt;BR /&gt;
    2.    all the drawings in the specified path gets loaded one by one. If&lt;BR /&gt;
the directory is having many drawings then it is difficult to load all&lt;BR /&gt;
drawings, machine may hang&lt;BR /&gt;
&lt;BR /&gt;
    try the following on your machine, and send me the feedback&lt;BR /&gt;
SAJJAD&lt;BR /&gt;
sajjad_mulla@onwardgroup.com&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
'Dim insertionpnt(0 To 2) As Double&lt;BR /&gt;
'Dim blkscale(0 To 2) As Double&lt;BR /&gt;
Dim respon As String&lt;BR /&gt;
'Dim tmpPoint&lt;BR /&gt;
'Dim BlkName As String&lt;BR /&gt;
'Public blockrefobj As AcadBlockReference&lt;BR /&gt;
'Dim intSizeNew As Integer&lt;BR /&gt;
'Dim scale1 As Double&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
Dim atts As Variant&lt;BR /&gt;
Dim I As Long&lt;BR /&gt;
Dim j As Long&lt;BR /&gt;
Dim fType(0 To 1) As Integer&lt;BR /&gt;
Dim fData(0 To 1) As Variant&lt;BR /&gt;
'Dim Csize1 As Boolean&lt;BR /&gt;
'Dim strgroup As String, strtitle1 As String, strtitle2 As String, strprojno&lt;BR /&gt;
As String, strDwnBy As String&lt;BR /&gt;
'Dim dtmdatedwn As Date, strDwgNo As String, strDwgScale, strChkBy As&lt;BR /&gt;
String, strRevision As String, strNextAssy As String, strBillMatl As String&lt;BR /&gt;
Public intBlocksize As Integer&lt;BR /&gt;
&lt;BR /&gt;
Sub FormCheck()&lt;BR /&gt;
    Dim dirName As String&lt;BR /&gt;
    Dim tmp As String, acadApp As AcadApplication&lt;BR /&gt;
    dirName = "c:\My_project\"&lt;BR /&gt;
    If Right(dirName, 1) &amp;lt;&amp;gt; "\" Then dirName = dirName &amp;amp; "\"&lt;BR /&gt;
    Set acadApp = ThisDrawing.Application&lt;BR /&gt;
'   acadApp.Documents.Close&lt;BR /&gt;
    tmp = Dir(dirName &amp;amp; "*.dwg")&lt;BR /&gt;
    Dim flag As Boolean&lt;BR /&gt;
    flag = False&lt;BR /&gt;
    Do While tmp &amp;lt;&amp;gt; ""&lt;BR /&gt;
    If flag Then&lt;BR /&gt;
        Application.ActiveDocument.Close&lt;BR /&gt;
    End If&lt;BR /&gt;
    Application.Documents.Open dirName &amp;amp; tmp&lt;BR /&gt;
    Dim intBlocksize      As Integer&lt;BR /&gt;
    intBlocksize = ThisDrawing.GetVariable("useri1")&lt;BR /&gt;
    If intBlocksize = 0 Then&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
    Set ss = ThisDrawing.SelectionSets("ss")&lt;BR /&gt;
    If Err Then&lt;BR /&gt;
        Err.Clear&lt;BR /&gt;
        On Error GoTo 0&lt;BR /&gt;
        Set ss = ThisDrawing.SelectionSets.Add("ss")&lt;BR /&gt;
    End If&lt;BR /&gt;
    ss.Clear&lt;BR /&gt;
    fType(0) = 0: fData(0) = "INSERT"&lt;BR /&gt;
    fType(1) = 2: fData(1) = "ba-*"&lt;BR /&gt;
    ss.Select acSelectionSetAll, , , fType, fData&lt;BR /&gt;
&lt;BR /&gt;
    If ss.Count = 0 Then&lt;BR /&gt;
'    Me.Hide&lt;BR /&gt;
    respon = MsgBox("You must insert a Drawing form First.", vbOKOnly,&lt;BR /&gt;
"Drawing Form")&lt;BR /&gt;
'    Drawingforminsert.Show&lt;BR /&gt;
'    End&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-c1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1 new" Then&lt;BR /&gt;
'        csize = True&lt;BR /&gt;
'        intBlocksize = 2&lt;BR /&gt;
        ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
'        BlkName = "buffind-c1 new"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name = "BUFFIND-c1"&lt;BR /&gt;
Then&lt;BR /&gt;
'            csize = True&lt;BR /&gt;
'            intBlocksize = 22&lt;BR /&gt;
            ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
'            BlkName = "buffind-c1"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-d1 new" Or ss.Item(0).ObjectName =&lt;BR /&gt;
"BUFFIND-d1 new" Then&lt;BR /&gt;
'                dsize = True&lt;BR /&gt;
'                intBlocksize = 3&lt;BR /&gt;
                ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
'                BlkName = "buffind-d1 new"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-d1" Or ss.Item(0).Name = "BUFFIND-d1"&lt;BR /&gt;
Then&lt;BR /&gt;
'                    dsize = True&lt;BR /&gt;
'                    intBlocksize = 33&lt;BR /&gt;
                    ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
'                    BlkName = "buffind-d1"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-b1 new" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-b1 new" Then&lt;BR /&gt;
'                        bsize = True&lt;BR /&gt;
'                        intBlocksize = 1&lt;BR /&gt;
                        ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
'                        BlkName = "buffind-b1 new"&lt;BR /&gt;
    ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name = "BUFFIND-c1"&lt;BR /&gt;
Then&lt;BR /&gt;
'                            bsize = True&lt;BR /&gt;
'                            intBlocksize = 11&lt;BR /&gt;
                            ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
'                            BlkName = "buffind-b1"&lt;BR /&gt;
    End If&lt;BR /&gt;
    tmp = Dir()&lt;BR /&gt;
    End If&lt;BR /&gt;
    flag = True&lt;BR /&gt;
    Loop&lt;BR /&gt;
End Sub</description>
      <pubDate>Thu, 27 Jul 2000 11:56:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325879#M91981</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-27T11:56:31Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325880#M91982</link>
      <description>I don't not recall what exactly changed but I had and extra if statement&lt;BR /&gt;
that did not have an end if.  I would post my new code but it would be not&lt;BR /&gt;
do any good as the code changed as I cleaned it up.  Thanks for the help&lt;BR /&gt;
though.&lt;BR /&gt;
&lt;BR /&gt;
David M. Gardner&lt;BR /&gt;
&lt;BR /&gt;
"SAJJAD" &lt;SAJJAD_MULLA&gt; wrote in message&lt;BR /&gt;
news:ef2aeab.2@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; Dear David M. Gardner&lt;BR /&gt;
&amp;gt;     Check the following code it will help you.&lt;BR /&gt;
&amp;gt; In the code you had written having 2 errore&lt;BR /&gt;
&amp;gt;     1.    it was closing all drawing includeing the active drawing, so&lt;BR /&gt;
&amp;gt; automatically the VBA editor also goes out of scope&lt;BR /&gt;
&amp;gt;     2.    all the drawings in the specified path gets loaded one by one.&lt;BR /&gt;
If&lt;BR /&gt;
&amp;gt; the directory is having many drawings then it is difficult to load all&lt;BR /&gt;
&amp;gt; drawings, machine may hang&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     try the following on your machine, and send me the feedback&lt;BR /&gt;
&amp;gt; SAJJAD&lt;BR /&gt;
&amp;gt; sajjad_mulla@onwardgroup.com&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Option Explicit&lt;BR /&gt;
&amp;gt; 'Dim insertionpnt(0 To 2) As Double&lt;BR /&gt;
&amp;gt; 'Dim blkscale(0 To 2) As Double&lt;BR /&gt;
&amp;gt; Dim respon As String&lt;BR /&gt;
&amp;gt; 'Dim tmpPoint&lt;BR /&gt;
&amp;gt; 'Dim BlkName As String&lt;BR /&gt;
&amp;gt; 'Public blockrefobj As AcadBlockReference&lt;BR /&gt;
&amp;gt; 'Dim intSizeNew As Integer&lt;BR /&gt;
&amp;gt; 'Dim scale1 As Double&lt;BR /&gt;
&amp;gt; Dim ss As AcadSelectionSet&lt;BR /&gt;
&amp;gt; Dim atts As Variant&lt;BR /&gt;
&amp;gt; Dim I As Long&lt;BR /&gt;
&amp;gt; Dim j As Long&lt;BR /&gt;
&amp;gt; Dim fType(0 To 1) As Integer&lt;BR /&gt;
&amp;gt; Dim fData(0 To 1) As Variant&lt;BR /&gt;
&amp;gt; 'Dim Csize1 As Boolean&lt;BR /&gt;
&amp;gt; 'Dim strgroup As String, strtitle1 As String, strtitle2 As String,&lt;BR /&gt;
strprojno&lt;BR /&gt;
&amp;gt; As String, strDwnBy As String&lt;BR /&gt;
&amp;gt; 'Dim dtmdatedwn As Date, strDwgNo As String, strDwgScale, strChkBy As&lt;BR /&gt;
&amp;gt; String, strRevision As String, strNextAssy As String, strBillMatl As&lt;BR /&gt;
String&lt;BR /&gt;
&amp;gt; Public intBlocksize As Integer&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Sub FormCheck()&lt;BR /&gt;
&amp;gt;     Dim dirName As String&lt;BR /&gt;
&amp;gt;     Dim tmp As String, acadApp As AcadApplication&lt;BR /&gt;
&amp;gt;     dirName = "c:\My_project\"&lt;BR /&gt;
&amp;gt;     If Right(dirName, 1) &amp;lt;&amp;gt; "\" Then dirName = dirName &amp;amp; "\"&lt;BR /&gt;
&amp;gt;     Set acadApp = ThisDrawing.Application&lt;BR /&gt;
&amp;gt; '   acadApp.Documents.Close&lt;BR /&gt;
&amp;gt;     tmp = Dir(dirName &amp;amp; "*.dwg")&lt;BR /&gt;
&amp;gt;     Dim flag As Boolean&lt;BR /&gt;
&amp;gt;     flag = False&lt;BR /&gt;
&amp;gt;     Do While tmp &amp;lt;&amp;gt; ""&lt;BR /&gt;
&amp;gt;     If flag Then&lt;BR /&gt;
&amp;gt;         Application.ActiveDocument.Close&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt;     Application.Documents.Open dirName &amp;amp; tmp&lt;BR /&gt;
&amp;gt;     Dim intBlocksize      As Integer&lt;BR /&gt;
&amp;gt;     intBlocksize = ThisDrawing.GetVariable("useri1")&lt;BR /&gt;
&amp;gt;     If intBlocksize = 0 Then&lt;BR /&gt;
&amp;gt;     On Error Resume Next&lt;BR /&gt;
&amp;gt;     Set ss = ThisDrawing.SelectionSets("ss")&lt;BR /&gt;
&amp;gt;     If Err Then&lt;BR /&gt;
&amp;gt;         Err.Clear&lt;BR /&gt;
&amp;gt;         On Error GoTo 0&lt;BR /&gt;
&amp;gt;         Set ss = ThisDrawing.SelectionSets.Add("ss")&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt;     ss.Clear&lt;BR /&gt;
&amp;gt;     fType(0) = 0: fData(0) = "INSERT"&lt;BR /&gt;
&amp;gt;     fType(1) = 2: fData(1) = "ba-*"&lt;BR /&gt;
&amp;gt;     ss.Select acSelectionSetAll, , , fType, fData&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     If ss.Count = 0 Then&lt;BR /&gt;
&amp;gt; '    Me.Hide&lt;BR /&gt;
&amp;gt;     respon = MsgBox("You must insert a Drawing form First.", vbOKOnly,&lt;BR /&gt;
&amp;gt; "Drawing Form")&lt;BR /&gt;
&amp;gt; '    Drawingforminsert.Show&lt;BR /&gt;
&amp;gt; '    End&lt;BR /&gt;
&amp;gt;     ElseIf ss.Item(0).Name = "buffind-c1 new" Or ss.Item(0).Name =&lt;BR /&gt;
&amp;gt; "BUFFIND-c1 new" Then&lt;BR /&gt;
&amp;gt; '        csize = True&lt;BR /&gt;
&amp;gt; '        intBlocksize = 2&lt;BR /&gt;
&amp;gt;         ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
&amp;gt; '        BlkName = "buffind-c1 new"&lt;BR /&gt;
&amp;gt;     ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1"&lt;BR /&gt;
&amp;gt; Then&lt;BR /&gt;
&amp;gt; '            csize = True&lt;BR /&gt;
&amp;gt; '            intBlocksize = 22&lt;BR /&gt;
&amp;gt;             ThisDrawing.SetVariable "useri1", 2&lt;BR /&gt;
&amp;gt; '            BlkName = "buffind-c1"&lt;BR /&gt;
&amp;gt;     ElseIf ss.Item(0).Name = "buffind-d1 new" Or ss.Item(0).ObjectName =&lt;BR /&gt;
&amp;gt; "BUFFIND-d1 new" Then&lt;BR /&gt;
&amp;gt; '                dsize = True&lt;BR /&gt;
&amp;gt; '                intBlocksize = 3&lt;BR /&gt;
&amp;gt;                 ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
&amp;gt; '                BlkName = "buffind-d1 new"&lt;BR /&gt;
&amp;gt;     ElseIf ss.Item(0).Name = "buffind-d1" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-d1"&lt;BR /&gt;
&amp;gt; Then&lt;BR /&gt;
&amp;gt; '                    dsize = True&lt;BR /&gt;
&amp;gt; '                    intBlocksize = 33&lt;BR /&gt;
&amp;gt;                     ThisDrawing.SetVariable "useri1", 3&lt;BR /&gt;
&amp;gt; '                    BlkName = "buffind-d1"&lt;BR /&gt;
&amp;gt;     ElseIf ss.Item(0).Name = "buffind-b1 new" Or ss.Item(0).Name =&lt;BR /&gt;
&amp;gt; "BUFFIND-b1 new" Then&lt;BR /&gt;
&amp;gt; '                        bsize = True&lt;BR /&gt;
&amp;gt; '                        intBlocksize = 1&lt;BR /&gt;
&amp;gt;                         ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
&amp;gt; '                        BlkName = "buffind-b1 new"&lt;BR /&gt;
&amp;gt;     ElseIf ss.Item(0).Name = "buffind-c1" Or ss.Item(0).Name =&lt;BR /&gt;
"BUFFIND-c1"&lt;BR /&gt;
&amp;gt; Then&lt;BR /&gt;
&amp;gt; '                            bsize = True&lt;BR /&gt;
&amp;gt; '                            intBlocksize = 11&lt;BR /&gt;
&amp;gt;                             ThisDrawing.SetVariable "useri1", 1&lt;BR /&gt;
&amp;gt; '                            BlkName = "buffind-b1"&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt;     tmp = Dir()&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt;     flag = True&lt;BR /&gt;
&amp;gt;     Loop&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt;&lt;/SAJJAD_MULLA&gt;</description>
      <pubDate>Thu, 27 Jul 2000 12:45:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/do-loop-error/m-p/325880#M91982</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-27T12:45:11Z</dc:date>
    </item>
  </channel>
</rss>

