Tips how to deal huge files / longer lasting macros

By default each step you do within a macro is also shown on the docker 'Object Manager'. This is very useful when you design a macro but slows down the entire duration of the run. Most of you most likely know, that with the Application.Optimization = True this feature can be deactivated and activated again. The disadvantage of having this on, is, than you have no clue how far the progress of your macro is.

I know at least two possibilities how you can get also an information about the progress of your program:

The first is to write it in a file. Here you need as precondition the document stored in a variable (here OutDoc, using 'ActiveDocument' may not work in all situations).

Then you need a sub routine like this somewhere in your macros:

Sub InfoOutF(ByVal pText As String)

Dim fOut As Integer, fOutN As String, DotPos As String

DotPos = InStrRev(OutDoc.FullFileName, ".")
fOutN = Left(OutDoc.FullFileName, DotPos) + "Txt"
fOut = FreeFile
Open fOutN For Output As #fOut
Print #fOut, pText
Close #fOut

End Sub

and call it during the macro a few times with a line like:
InfoOutF ActivePage.Name+" created"
If you use:
Open fOutN For Append As #fOut
instead, you even will create a log file. But for that it would make sense to add at least the time stamp to each output:
Print #fOut, Format(Now(),"hhmmss")+" "+pText

If you did this, you see in the explorer at the same location of your document a file with the same name but ".Txt" at the end which you can open to see the progress.

One other method is, to make Corel speak to you. But for that you need to have a TTS (Text to Speech) program on your computer. I'm using Balabolka_Console.Exe. This is a free program you can download and save on any place on your computer. It does not need any installation and works by default with the English standard voice coming with windows. If you want to have this in your native language, you need to install such a voice and this will work as well.
Then you need a sub routine like:

Sub InfoOutV(ByVal pText As String)

Dim CurCmd As String

CurCmd = Chr(34) + "C:\Tools\Balabolka\balabolka_console.exe" + Chr(34) + " -t " + Chr(34) + pText + Chr(34)
Shell CurCmd, vbHide

End Sub

and call it as described before.

Maybe this methods are new to some of you. I'm using them and they are very helpful for me, maybe you also have a benefit of it.