WORD: Working with Header/Footer Shapes in Document with Multiple Orientations RRS feed

  • Question

  • I have a project that I'm working on that compiles a single document from multiple other document files.  I insert each file's contents into the project file with:

    Selection.InsertFile FileName:=FileSourceName, Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False

    Each file inserted is a new section.  After the file's content is entered, I insert rectangular shapes to hold the chapter tile, paging and some other information. A rectangular header and footer are added. I use this method to add the shapes:

    Dim objShape As Shape
    Dim myTable As Table
    With ActiveDocument.Sections.Last.Footers(wdHeaderFooterFirstPage)
        If ActiveDocument.Sections(ActiveDocument.Sections.Count).PageSetup.Orientation=wdOrientLandscape Then
                Set objShape = ActiveDocument.Shapes.AddShape(1, 144, 550, 504, 36, .Range) 'Landscape Orientation
        ElseIf ActiveDocument.Sections(ActiveDocument.Sections.Count).PageSetup.Orientation = wdOrientPortrait Then
                Set objShape = ActiveDocument.Shapes.AddShape(1, 54, 725, 504, 36, .Range) 'Portrait
        End If

    After the shapes are added, they're formatted, etc.

    All of this works just fine until I insert contents of a file that has a landscape orientation. When I add a footer,  I cannot control where it goes on the page even if I use absolute values for the location.  What's more is that it will mess up the location of shapes in previous sections (move them around).

    I've been told this may be a bug (using MS Word 2013).  I just wondered if anyone on this forum knew what was going on with this?

    As an alternative, I tried to use a table in the footer to see if I could get it close to the shape that I've been using, but even the table won't work properly.

    • Edited by MavilaJay Tuesday, August 25, 2015 5:35 AM
    Tuesday, August 25, 2015 4:43 AM