<?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: Progress Meter in VBA?? in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/9723200#M9721</link>
    <description>&lt;P&gt;I tried that but I cannot find Microsoft Progress Bar in References? Can you please explain how to add Progress Bar in Autocad VBA User Form.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2020 14:03:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-09-01T14:03:20Z</dc:date>
    <item>
      <title>Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/5622641#M9714</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello Everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When i was looking for a way to add a ProgressBar control to my program, i came across this thing called "Progress Meter". After few "googlings" it seems to be refering to the blue progress bar that appears at the bottom right of the screen (AutoCAD 2014+) when we use a long command (Saving a File / ScaleListEdit/...).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So i'm asking how could we access to this object via VBA (if it's possible of course).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tried to use the "&lt;/SPAN&gt;&lt;SPAN&gt;Microsoft ProgressBar Control" but apparently it's not available on 64bits OS.&lt;BR /&gt;&lt;BR /&gt;I know there is the traditional way of making a custome progress bar using a label in a userform and control the length but i just want to know if there any other possibility.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your answers ^^&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 11:33:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/5622641#M9714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-06T11:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/6212286#M9715</link>
      <description>&lt;P&gt;Hello Nour!&lt;/P&gt;&lt;P&gt;In the Visual Basic Editor in AutoCAD, you can add a Form and then go to the menu Tools--&amp;gt;Additional Controls... and choose Microsoft Progress Bar.&lt;/P&gt;&lt;P&gt;Press Ok and the Progress Bar control would be visible in the ToolBox. Add it to your Form and your done.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2016 07:53:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/6212286#M9715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-12T07:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8486900#M9716</link>
      <description>&lt;P&gt;Did you find the solution?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 09:33:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8486900#M9716</guid>
      <dc:creator>Goodymun</dc:creator>
      <dc:date>2018-12-25T09:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8488064#M9718</link>
      <description>&lt;P&gt;Let's assume you are using AutoCAD2014 or later, 64-bit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly AutoCAD COM API does not expose AutoCAD built-in Progress Meter. Secondly, with 64-bit VBA, there is no Progress Bar component available as it is in 32-bit VBA. So, if you are developing somewhat advanced, missio-critical AutoCAD app, you might not want to waste time/effort with poorly supported 64-bit VBA; moving to AutoCAD .NET API development is the direction to go (or somehow moving to Autodesk's cloud services, if applicable).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With that said, if you only need a progress bar to enhance your existing VBA app a bit, then it is fairly easy to use VBA built-in control to create one. Following code use a label control and an image control to play as a progress bar with quite good visual effect (you can see the UserForm design from attached video clip):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly, code module with a macro "Test" and a helper method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Option Explicit

Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)

Public Sub Test()

    UserForm1.show

End Sub

Public Sub Pause(miliSec As Integer)
    Sleep miliSec
End Sub&lt;/PRE&gt;
&lt;P&gt;Then this is the code of UserFrom1:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Option Explicit

Private mStop As Boolean

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub cmdStart_Click()
    
    mStop = False
    cmdStop.Enabled = True
    cmdStart.Enabled = False
    cmdClose.Enabled = False
    
    ShowProgress 50
    
    mStop = True
    cmdClose.Enabled = True
    cmdStop.Enabled = False
    cmdStart.Enabled = True
    
End Sub

Private Sub cmdStop_Click()
    mStop = True
End Sub

Private Sub ShowProgress(steps As Integer)
    
    Dim width As Integer
    width = imgProgress.width
    
    lblProgress.Visible = True
    imgProgress.Visible = True
    
    Dim count As Integer
    For count = 0 To steps
    
        ShowLabelProgress count, steps
        ShowImageProgress count, steps, width
        Me.Repaint
        
        '' Do each step of real work here
        Pause 200
        
        '' allow user to click "Stop"
        DoEvents
        If mStop Then Exit For
        
    Next
    
    lblProgress.Visible = False
    imgProgress.width = width
    imgProgress.Visible = False
    
End Sub

Private Sub ShowLabelProgress(current As Integer, total As Integer)
    lblProgress.Caption = current &amp;amp; " of " &amp;amp; total
End Sub

Private Sub ShowImageProgress(current As Integer, total As Integer, totalWidth As Integer)

    Dim w As Integer
    w = Fix((current / total) * totalWidth)
    imgProgress.width = w
    
End Sub

Private Sub UserForm_Initialize()
    '' Initialize
    mStop = True
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    '' prevent user to accidentally close the UserForm while
    '' the processing is in progress
    If Not mStop Then
        Cancel = 1
    End If
End Sub
&lt;/PRE&gt;
&lt;P&gt;See this video:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="iframe-container"&gt;&lt;IFRAME width="640" height="590" src="https://screencast.autodesk.com/Embed/Timeline/138aa0e0-b1f2-4e91-8392-2a7ee44ff769" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Dec 2018 17:04:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8488064#M9718</guid>
      <dc:creator>Norman_Yuan</dc:creator>
      <dc:date>2018-12-26T17:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8488077#M9719</link>
      <description>&lt;P&gt;Let's assume you are using AutoCAD2014 or later, 64-bit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly AutoCAD COM API does not expose AutoCAD built-in Progress Meter. Secondly, with 64-bit VBA, there is no Progress Bar component available as it is in 32-bit VBA. So, if you are developing somewhat advanced, missio-critical AutoCAD app, you might not want to waste time/effort with poorly supported 64-bit VBA; moving to AutoCAD .NET API development is the direction to go (or somehow moving to Autodesk's cloud services, if applicable).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With that said, if you only need a progress bar to enhance your existing VBA app a bit, then it is fairly easy to use VBA built-in control to create one. Following code use a label control and an image control to play as a progress bar with quite good visual effect (you can see the UserForm design from attached video clip):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code module with a macro "Test" and a help method:&lt;/P&gt;
&lt;PRE&gt;Option Explicit

Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)

Public Sub Test()

    UserForm1.show

End Sub

Public Sub Pause(miliSec As Integer)
    Sleep miliSec
End Sub&lt;/PRE&gt;
&lt;P&gt;The code of UserForm1:&lt;/P&gt;
&lt;PRE&gt;Option Explicit

Private mStop As Boolean

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub cmdStart_Click()
    
    mStop = False
    cmdStop.Enabled = True
    cmdStart.Enabled = False
    cmdClose.Enabled = False
    
    ShowProgress 50
    
    mStop = True
    cmdClose.Enabled = True
    cmdStop.Enabled = False
    cmdStart.Enabled = True
    
End Sub

Private Sub cmdStop_Click()
    mStop = True
End Sub

Private Sub ShowProgress(steps As Integer)
    
    Dim width As Integer
    width = imgProgress.width
    
    lblProgress.Visible = True
    imgProgress.Visible = True
    
    Dim count As Integer
    For count = 0 To steps
    
        ShowLabelProgress count, steps
        ShowImageProgress count, steps, width
        Me.Repaint
        
        '' Do each step of real work here
        Pause 200
        
        '' allow user to click "Stop"
        DoEvents
        If mStop Then Exit For
        
    Next
    
    lblProgress.Visible = False
    imgProgress.width = width
    imgProgress.Visible = False
    
End Sub

Private Sub ShowLabelProgress(current As Integer, total As Integer)
    lblProgress.Caption = current &amp;amp; " of " &amp;amp; total
End Sub

Private Sub ShowImageProgress(current As Integer, total As Integer, totalWidth As Integer)

    Dim w As Integer
    w = Fix((current / total) * totalWidth)
    imgProgress.width = w
    
End Sub

Private Sub UserForm_Initialize()
    '' Initialize
    mStop = True
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    '' prevent user to accidentally close the UserForm while
    '' the processing is in progress
    If Not mStop Then
        Cancel = 1
    End If
End Sub
&lt;/PRE&gt;
&lt;P&gt;The video clip:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="screencast_placeholder"&gt;Screencast will be displayed here after you click Post.
&lt;P class="screencast_id"&gt;138aa0e0-b1f2-4e91-8392-2a7ee44ff769&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Dec 2018 17:08:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8488077#M9719</guid>
      <dc:creator>Norman_Yuan</dc:creator>
      <dc:date>2018-12-26T17:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8488094#M9720</link>
      <description>&lt;P&gt;Here is the screencast video:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="iframe-container"&gt;&lt;IFRAME width="640" height="590" src="https://screencast.autodesk.com/Embed/Timeline/138aa0e0-b1f2-4e91-8392-2a7ee44ff769" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Dec 2018 17:17:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/8488094#M9720</guid>
      <dc:creator>Norman_Yuan</dc:creator>
      <dc:date>2018-12-26T17:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/9723200#M9721</link>
      <description>&lt;P&gt;I tried that but I cannot find Microsoft Progress Bar in References? Can you please explain how to add Progress Bar in Autocad VBA User Form.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 14:03:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/9723200#M9721</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-01T14:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Progress Meter in VBA??</title>
      <link>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/9723280#M9722</link>
      <description>&lt;P&gt;You did not say, but I assume that by now, everyone (including you, uses 64-bit AutoCAD. So, if you have read the reply I did, you would have known that there is no ProgressBar control from Microsoft for 64-bit VBA.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 14:37:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/progress-meter-in-vba/m-p/9723280#M9722</guid>
      <dc:creator>Norman_Yuan</dc:creator>
      <dc:date>2020-09-01T14:37:36Z</dc:date>
    </item>
  </channel>
</rss>

