MSCE PrintOrganizer: ActiveFile not added at first attempt

I have a VBA macro that prints the current DGN on several pages.

We design various rectangles on a specific level with a specific cell name. The print style specifies that the contents of each of these rectangles ends up on a separate page. The print style is defined in a .dgnlib that is loaded by means of the MS_DGNLIBLIST_PRINTING configuration variable.

So far so good.

The macro is composed as follows:

ActiveDesignFile.Views(<myView>).ShowLevel <myLevel>
CadInputQueue.SendKeyin "filedesign"
ActiveDesignFile.Save
CadInputQueue.SendKeyin "MDL LOAD bentley.printorganizer.dll"
CadInputQueue.SendKeyin "PRINTORGANIZER NEW"
CadInputQueue.SendKeyin "PRINTORGANIZER PRINTERDRIVER pdf.pltcfg"
CadInputQueue.SendKeyin "PRINTORGANIZER ADD ACTIVEFILE " & <myStyleName>
CadInputQueue.SendKeyin "PRINTORGANIZER PRINTDESTINATION " & <myPdfName>
CadInputQueue.SendKeyin "PRINTORGANIZER SUBMITAS SINGLE"
CadInputQueue.SendKeyin "PRINTORGANIZER PRINT ALL"
CadInputQueue.SendKeyin "PRINTORGANIZER DELETE ALL"

The problem is that MicroStation reports error "Unable to load design file <myDgnName>" when executing the line CadInputQueue.SendKeyin "PRINTORGANIZER ADD ACTIVEFILE " & <myStyleName>.

It takes 10 to 20 seconds to run this statement.

The funny thing is that everything goes well if the very same statement is executed twice in a row. Even when I put CadInputQueue.SendKeyin "PRINTORGANIZER DELETE ALL" between the 2 "ADD" statements, the active file is loaded correctly at the second attempt.

I get the same results when executing the statements directly from within the "Key-in" dialog or even from within the PrintOrganizer dialog.

Also in case I use PRINTORGANIZER ADD FILE <myDgnName> <myStyleName>, the first attempt fails and the second succeeeds.

I'm quite sure I'm missing something trivial but I would really appreciate it if somebody could help me.

Using MicroStation Connect Edition, version 10.16.1.56

Parents Reply Children
No Data