Trying to set margins and header off first page.

Started by whwaldrep, January 21, 2009, 06:45:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

whwaldrep

I would like to copy settings form the first page to the rest.  But my code just hangs when I enable the margins.

Sub CopyPageSettings()


    Dim p1Headerleft As String
    Dim p1HeaderCenter As String
    Dim p1HeaderRight As String
    Dim p1FooterCenter As String
    Dim p1TopMargin As String
    Dim p1BottomMargin As String
    Dim p1LeftMargin As String
    Dim p1RightMargin As String

   

    p1FooterCenter = ActiveWindow.Document.FooterCenter
    p1Headerleft = ActiveWindow.Document.HeaderLeft
    p1HeaderCenter = ActiveWindow.Document.HeaderCenter
    p1HeaderRight = ActiveWindow.Document.HeaderRight
    p1TopMargin = ActiveWindow.Document.TopMargin
    p1BottomMargin = ActiveWindow.Document.BottomMargin
    p1LeftMargin = ActiveWindow.Document.LeftMargin
    p1RightMargin = ActiveWindow.Document.RightMargin


        Dim PageToIndex As Visio.Page
        Dim curPage As Visio.Page
        Set curPage = ActivePage
   
   
        For Each PageToIndex In ActiveDocument.Pages
            ActiveWindow.Page = ActiveDocument.Pages(PageToIndex.Index).Name
            With ActiveWindow.Document
                .FooterCenter = p1FooterCenter
                .HeaderLeft = p1Headerleft
                .HeaderCenter = p1HeaderCenter
                .HeaderRight = p1HeaderRight
                .TopMargin = p1TopMargin
                .BottomMargin = p1BottomMargin
                .LeftMargin = p1LeftMargin
                .RightMargin = p1RightMargin
            End With
        Next
   
ActiveWindow.Page = curPage

End Sub