none
Problem when switching from protected mode by clicking on Enable Printing RRS feed

  • Question

  • Hello,
    I am using Word version 14.0.6112.5000.


    I have a Word add-in which updates several fields when opening a document, for example, title, footer, etc. ..

    The problem is:

    I run a word document in view mode (protected mode).

    Then I click "Enable printing" and the line "Window.view.splitspecial word.wdspecialpane.wdpanecurrentPageHeader =" crashes.

    However I switch from protected mode in edit mode by clicking "Enable Editing", it does not crash.

    Is there a property whether it is in print preview mode?

    I already tried properties Application.PrintPreview and Window.view.type but they do not work.

    Is there a way to know if you clicked the button "Enable Print" or if we currently in the print tab (where we define the properties of the printer) ?

    thank you,

    Anoushka


    • Edited by Anoushka77 Thursday, May 17, 2012 9:46 AM
    Thursday, May 17, 2012 9:45 AM

Answers

  • Hi Anoushka

    I think you have to determine whether the document is in protected mode before you try to run lines of code that are not available while in that mode. You can check using the Application.ActiveProtectedViewWindow property; it's null/nothing then the document is not in protected mode.


    Cindy Meister, VSTO/Word MVP

    Monday, May 21, 2012 9:29 AM
    Moderator

All replies

  • Hi Anoushka,

    Is the button "Enable priting" a custom button? If so, please show us more code you use.

    Thanks.

    Monday, May 21, 2012 8:25 AM
  • Hi Anoushka

    I think you have to determine whether the document is in protected mode before you try to run lines of code that are not available while in that mode. You can check using the Application.ActiveProtectedViewWindow property; it's null/nothing then the document is not in protected mode.


    Cindy Meister, VSTO/Word MVP

    Monday, May 21, 2012 9:29 AM
    Moderator