I'm trying to use the CorelDraw progress bar in a macro, but I'm having trouble.
I've tried this as a simple test:
Sub testing_appstatus()Dim count1 As LongApplication.Status.BeginProgressFor count1 = 1 To 10Application.Status.progress = count1 / 10 * 100MsgBox "The count is " & count1Next count1Application.Status.EndProgressEnd Sub
If I just run the above macro, then I never see the progress bar appear.
If I FIRST run the following macro:
Sub show_progressbar()Application.Status.BeginProgressEnd Sub
then the progress bar is displayed (and stays displayed; I haven't turned it back off).
If I THEN run the macro shown earlier, the progress bar works the way I would expect it to. Each time that it stops, waiting for me to dismiss the message box, I can see that the progress bar has advanced as it should based on count1.
What I'd like to do, of course, is to be able to display, use, and then turn off the progress bar within one macro.
I'm testing this with X7 and X8.
Anybody willing (and able) to help a Corel VBA noob make his ignorance a little bit smaller?
For a correct use you will need create a background worker in your macro, normal loop freeze the CorelDraw UI thread for this reason your progress bar not move. Little code using Task for a C# Macro in CorelDraw X8 64bit (VSTA) [CgsAddInMacro] public void ProgressBar() { this.app.ActiveDocument.Unit = cdrUnit.cdrCentimeter; var t = Task.Run(() => { this.app.Status.BeginProgress(); for (int i = 0; i < 100; i++) { this.app.ActiveDocument.ActiveLayer.CreateRectangle(0+i, 0+i, 1+i, 1+i); this.app.Status.UpdateProgress(1); Thread.Sleep(100); } this.app.Status.EndProgress(); }); } Demo for this code:
Thank you for showing that.
I don't think I'm having a problem with the progress bar updating during the macro. It does move. I'm having a problem with getting the progress bar to initially display during the macro.
If I display the progress bar using one macro, and don't turn it back off, then it seems to update properly during the next macro I run.
Just thought I would post this tutorial if anyone is looking to add a progress bar to a macro. https://wellsr.com/vba/2017/excel/beautiful-vba-progress-bar-with-step-by-step-instructions/