• Coding the view of a document (W97)

    Author
    Topic
    #384381

    I have a toolbar button for references. When the user opens the document, it appears in normal view. How can I code it open in Page View? (or a specific view)

    Viewing 0 reply threads
    Author
    Replies
    • #659217

      How was the document or template from which document derives last saved?
      Open it, change the view to Page (called Print in 200X), then save it.

      In code you can change the view with this:

      ActiveWindow.View.Type = wdNormalView

      If you record a macro that changes the view, you’ll see .Pane object
      statements too. You may need those.

      I hope that helps??

      • #659256

        So I could put the
        ActiveWindow.View.Type=wdNormalView
        into the WordObject/Document Open ? Will have to try it , Thanks.

        • #659260

          Sure. But what about the saved state of the template or doc?

          • #659385

            It is a read only file…. Therefor, if I last saved it as Page View, it will open in Page View?
            And If I last Viewed it at 80%, it will reopen at 80%….. How does it “remember”/Store it’s last “state of being”?

            • #659556

              Yes and Yes unless there’s autoexec or document_open code that makes changes to settings.

              How? By design, I guess.

            • #660188

              One other thing to bear in mind when manually changing the viewstate of a template or document: the changes won’t ‘stick’ unless you dirty the document and save it, before closing it (all you need to do is type a space at the end of the document, then backspace, and then save).

              If you want to enforce it via code, I think the constant in Word 97 was called “wdPageView” (which changed to “wdPrintView” in Word 2000 and later; they kept the ‘wdPageView’ though for backward compatibility).

              Gary

            • #804828

              I am doing a similar thing to force the view of a Word XP document:

              Public Sub ShowBlackline()
              
                  With ActiveWindow.View
                      .ShowRevisionsAndComments = True
                      .RevisionsView = wdRevisionsViewFinal
                  End With
                  
                  ActiveDocument.Saved = False  
              
                  ActiveDocument.Save
              End Sub

              I’m using ActiveDocument.Saved=False to dirty the document – it seems to work great so far.
              Does anyone have a better way or know of any issues doing it this way?

            • #804829

              I am doing a similar thing to force the view of a Word XP document:

              Public Sub ShowBlackline()
              
                  With ActiveWindow.View
                      .ShowRevisionsAndComments = True
                      .RevisionsView = wdRevisionsViewFinal
                  End With
                  
                  ActiveDocument.Saved = False  
              
                  ActiveDocument.Save
              End Sub

              I’m using ActiveDocument.Saved=False to dirty the document – it seems to work great so far.
              Does anyone have a better way or know of any issues doing it this way?

    Viewing 0 reply threads
    Reply To: Coding the view of a document (W97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: