Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Setting a header margin with a Word Macro

Avatar of Brandon Garnett
Brandon Garnett asked on
Microsoft WordVB Script
1 Comment1 Solution636 ViewsLast Modified:
I am trying to add an image in the header of a document and have NO left margin and NO top margin.

I have successfully wrote a macro that inserts the image in the header and applies the NO left margin but can't get it to get rid of the top margin (see snippet below).

If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    End If
    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
    Selection.InlineShapes.AddPicture FileName:= _
        "W:\Administration\images\location\Office 2007 Macros\header.jpg", _
         LinkToFile:=False, SaveWithDocument:=True
    With Selection.ParagraphFormat
        .LeftIndent = InchesToPoints(-1)
        .SpaceBeforeAuto = True
        .SpaceAfterAuto = True
    End With
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
        ActivePane.View.Type = wdOutlineView Then
        If ActiveWindow.Panes.Count = 2 Then
        End If
        ActiveWindow.View.SplitSpecial = wdPaneCurrentPageHeader
        ActiveWindow.View.SeekView = wdSeekCurrentPageHeader
    End If
Avatar of jostrander
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers