Hi. I'd like to add a progress bar to this macro so I know it worked or is processing. Any help out there?
code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Sub Go() Dim dn As String, ps As PDFVBASettings Set ps = ActiveDocument.PDFSettings If ActiveDocument.Dirty Then ActiveDocument.Save On Error GoTo ErrHandler 'ps.ShowDialog dn = Left$(ActiveDocument.FullFileName, Len(ActiveDocument.FullFileName) - 4) & ".pdf" ActiveDocument.PublishToPdf dn ExitSub: Exit Sub ErrHandler: MsgBox "Error occured: " & Err.Description & Err.Number Resume ExitSub End Sub
Public Sub RunTask() Implements ICUIBackgroundTask.RunTask Running = True SavePDF End Sub Protected Sub SavePDF() Try app.ActiveDocument.PublishToPDF(filename) Catch ex As Exception app.FrameWork.ShowMessageBox(ex.Message) End Try Return End Sub
What about something using this ------^
PublishToPDF is an internal procedure, performed by background process,so I think you will not be able to use the progress bar.It can only be used in user cycles with counter. But you can check size of yourpdf-file or try to open it. If opens then pdf export is completed
Would you be willing to share a simple VBA example that uses the CorelDRAW progress bar?
I have tried to use it, but without success.
Sub TestProgressBar()Const Max = 10000000Dim stat As AppStatus, z& Set stat = Application.Status stat.BeginProgress "Working...", True ' word "working" for some reason is not shown, in X3 - shows For z = 1 To Max stat.Progress = (z / Max) * 100 Next stat.EndProgressEnd Sub
Thank you for sharing that.
That works for me in X5, but not in X7 (or newer) versions of CorelDRAW.
Try this:
Sub TestProgressBar() Const Max = 1000000 Dim stat As AppStatus, z& Set stat = Application.Status stat.BeginProgress For z = 1 To Max stat.Progress = (z / Max) * 100 stat.UpdateProgress Next stat.EndProgress End Sub
Just tested in X8 - all is working, draws color line which has fills by green color (:
shark_ said:Just tested in X8 - all is working, draws color line which has fills by green color (:
I just tried it in X8, and the macro runs, but I see no progress bar.
Are you running 64-bit CorelDRAW? Or 32-bit?