Alternative to Try-Catch in Navision 6.0(CC) [Member call failed]

While trying to print a document in Navision, we get the error: Error message provided

Translation: This message is for C/AL programmers: The call to member ActivePrinter failed. Microsoft Word returned the following message: Printer error.

Error occurs in this line:

wrdApp.ActivePrinter := InteractLogEntry."Printer Name";

InteractLogEntry is a list, which is filled with every printer installed on the local system.

My Question: How can I get an handle this exception(Navision does not support exception handling through try-catch)

Can I use a if-else statement to solve this issue?


  • The best working try/catch replacement in classic client is to put the crashing code into the OnRun part of a seperate codeunit.

    You can then call the code from another object (codeunit, form, report, etc) with an if-clause

    IF NOT MyCrashyCodeunit.RUN THEN BEGIN
      // Errror handling here