Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA macro- alignment problems

Status
Not open for further replies.

DotNetGnat

Programmer
Mar 10, 2005
5,548
IN
Hello All,

Ok, I will try my best to describe my problem.
I have a VB macro that modifies a word document. Everything works fine.

I needed some specific image, text and page number alignment in the footer.But the alignment is currently skewed. If the text is smaller in length...alignment of image, text and page number works fine...but this gets skewed if the text is longer. Image hides the text...

then i thought of making the image inline and below is the function i wrote...now when the text is longer the page number is pushed down..also height is increased...

The other option i thought of is having like 3 containers in which i can i have image, text and page number respectively which stay in their fixed position all the time...but i am not sure how to implement it...

any suggestions...

below is my current code...

Code:
Sub FormatFooterLogo()
    Dim bFoundFirst As Boolean
    Selection.HomeKey unit:=wdStory
    If ActiveWindow.ActivePane.View.Type = wdNormalView _
        Or ActiveWindow.ActivePane.View.Type = wdOutlineView Then
        ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    For Each Section In ActiveDocument.Sections
        With Section

             For Each Shape In .Footers(wdHeaderFooterPrimary).Shapes
                Shape.Select
                Debug.Print "Primary:: " & Shape.Name & " :: " & Shape.Visible
                If UCase(Left(Shape.Name, 7)) = "PICTURE" And Shape.Visible = True Then

                        Shape.ConvertToInlineShape

                End If
            Next

            For Each Shape In .Footers(wdHeaderFooterFirstPage).Shapes
                Shape.Select
                Debug.Print "First Page:: " & Shape.Name & " :: " & Shape.Visible
                If UCase(Left(Shape.Name, 7)) = "PICTURE" And Shape.Visible = True Then

                        Shape.ConvertToInlineShape

                End If
            Next
        End With
    Next
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top