none
Need to change default zoom level on open for protected documents in Word RRS feed

  • Question

  • I asked this question in a general Office forum but could not get a needed solution. I work on a help desk and we get lots of emails daily. Many of these have a Word document "production issue form" attached. When I open them in Word they often open in a "Protected View" mode. I have to click Enable editing to do anything with them, like change the zoom level to a more readable size. That's what I'm trying to do, put code into the AutoOpen macro that will handle these kinds of documents and allow me to set the default zoom level to 140% (easy on my old eyes). I tried the code below but it breaks to code when I hope one of those documents:

    Sub AutoOpen()
        With ActiveWindow.View
            .Type = wdPrintView
            .Zoom = 100
        End With
    End Sub

    Any ideas how this can be changed to handle those types of documents and set the default zoom level to 140%?

    Thanks!
    Dave

    Wednesday, November 14, 2012 9:59 PM

Answers

  • So, now I have...

    Sub AutoOpen()
        If Application.ProtectedViewWindows.Count > 0 Then
            Application.ActiveProtectedViewWindow. _
              Document.ActiveWindow.View.Zoom = 140
        End If
        With ActiveWindow.View
            .Type = wdPrintView
            .Zoom = 140
        End With
    End Sub
    Works like a charm. My eyes thank you!! :D

    Dave Englund

    • Marked as answer by dbe6347wf Friday, November 16, 2012 2:20 PM
    Friday, November 16, 2012 2:20 PM

All replies

  • Hi Dave

    See my response in this thread about working with ProtectedView mode:
    http://social.msdn.microsoft.com/Forums/en-US/worddev/thread/f3160b46-46ae-4413-acb5-691fa9b69329


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, November 15, 2012 12:55 PM
    Moderator
  • Thanks for the information Cindy. Unfortunately, I am not a programmer. So I am unsure what to do with it :( Would you be able to update my AutoOpen code with what is needed to open a protected document to a specific zoom level (e.g. 140%)?

    Dave Englund

    Thursday, November 15, 2012 3:35 PM
  • Hi Dave

    Try this:

    Sub AutoOpen()
        If Application.ProtectedViewWindows.Count > 0 Then
            Application.ActiveProtectedViewWindow. _
              Document.ActiveWindow.View.Zoom = 100
        End If
    End Sub


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, November 16, 2012 9:09 AM
    Moderator
  • So, now I have...

    Sub AutoOpen()
        If Application.ProtectedViewWindows.Count > 0 Then
            Application.ActiveProtectedViewWindow. _
              Document.ActiveWindow.View.Zoom = 140
        End If
        With ActiveWindow.View
            .Type = wdPrintView
            .Zoom = 140
        End With
    End Sub
    Works like a charm. My eyes thank you!! :D

    Dave Englund

    • Marked as answer by dbe6347wf Friday, November 16, 2012 2:20 PM
    Friday, November 16, 2012 2:20 PM
  • Cindy (or anyone),

    I'm trying to make this script work so that all docs open at 100% zoom.  I edited the AutoOpen macro, but got the following error, which opened in Visual Basic:

    Compile error:  Method or data member not found.

    In the background, the macro was open with the ".ProtectedViewWindows" portion of the script highlighted.

    Can you help?

    Thank you!

    Thursday, July 25, 2013 4:03 PM
  • Which version of Word are you using?

    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, July 25, 2013 4:27 PM
    Moderator
  • I'm embarrassed to say...but I cannot find that information.  Where should I look to determine the version?
    Thursday, July 25, 2013 7:25 PM
  • In the splash screen that appears while Word is loading?

    You can also go to the VBA Editor (Alt+F11), type the following in the Immediate Windows (Ctrl+G) then press ENTER:

    ?Application.Version

    The version number should appear below the line of code in the Immediate Window.

    There'd be other places, as well, but I need to know the version in order to give the menu commands...


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 26, 2013 11:05 AM
    Moderator
  • Thank you Cindy.

    The Splash screen was too fast, so I ran VBA Editor as you suggested.

    The version is 10.0.

    Friday, July 26, 2013 1:06 PM
  • Gee, I wish I could say Word opened so fast I couldn't see the splash screen... But then, I'm using a much later version, which probably makes a significant difference!

    Office 10.0 = Office 2000. This means you should also be able to see the version information in Help/About.

    The part of the object model to which ProtectedViewWindows belongs was introduced in Word 2010 (14.0). Try it with the last part of the macro:

       With ActiveWindow.View
           
    .Type = wdPrintView
           
    .Zoom = 140
       
    End With


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 26, 2013 1:48 PM
    Moderator
  • That's it!  Thanks so much.
    Friday, July 26, 2013 2:20 PM