• adding a line in a footer (office 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » adding a line in a footer (office 2000)

    Author
    Topic
    #411476

    Hello,
    I want to add a graphic line to my footer. I have defined the range. In a normal paragraph I use:

    Set T1Line = ActiveDocument.Shapes.AddLine(96#, 256.5, 554.25, 256.5, T1Range)

    I don’t know what to use in a footer. Please help. Tks

    Viewing 1 reply thread
    Author
    Replies
    • #892338

      Each Header and Footer is a Range, so if you can insert Shapes to any Range you like, it should work in the footer. We recently had a thread on inserting a field code into a footer, perhaps that code will get you started with adding a shape.

      • #892387

        Tks. That was me yesterday. I managed to put a field into the footer now I want a graphic line. Can’t seem to find the right code for it.
        Set Line = activedocument.shapes.addline won’t work because I am in a range and
        Set Line = .range.shapes.addline won’t work either. My VBA knowledge is very limited. Could you help please.
        tks.

        • #892397

          Sorry, I don’t understand Shapes and Ranges well enough to work this out. I get the same error as you, and recording a macro uses the Selection object, which you seem to be trying to avoid. I don’t suppose you could get by with a top border on that paragraph, instead of a line? Much easier. smile

          • #892419

            Yep, I thought of the paragraph border in the style but this template will end up on a Mac that uses Word 98 and there is a very limited choice of color for paragraph borders in Word 98. I think I will just let it go for now and when they upgrade the software I will put a paragraph border with the right color.

            tks alot.

            • #892555

              Here’s a working example for you to start from…


              Dim shpLine As Shape

              With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary)
              .Range.Fields.Add Range:=.Range, Type:=wdFieldPage
              .Range.InsertBefore ("Page ")
              Set shpLine = .Shapes.AddLine(BeginX:=1, BeginY:=1, EndX:=100, EndY:=1, Anchor:=.Range)
              End With

              StuartR

            • #892638

              This worked just fine. Tks alot.
              jc

            • #892639

              This worked just fine. Tks alot.
              jc

            • #892556

              Here’s a working example for you to start from…


              Dim shpLine As Shape

              With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary)
              .Range.Fields.Add Range:=.Range, Type:=wdFieldPage
              .Range.InsertBefore ("Page ")
              Set shpLine = .Shapes.AddLine(BeginX:=1, BeginY:=1, EndX:=100, EndY:=1, Anchor:=.Range)
              End With

              StuartR

          • #892420

            Yep, I thought of the paragraph border in the style but this template will end up on a Mac that uses Word 98 and there is a very limited choice of color for paragraph borders in Word 98. I think I will just let it go for now and when they upgrade the software I will put a paragraph border with the right color.

            tks alot.

        • #892398

          Sorry, I don’t understand Shapes and Ranges well enough to work this out. I get the same error as you, and recording a macro uses the Selection object, which you seem to be trying to avoid. I don’t suppose you could get by with a top border on that paragraph, instead of a line? Much easier. smile

      • #892388

        Tks. That was me yesterday. I managed to put a field into the footer now I want a graphic line. Can’t seem to find the right code for it.
        Set Line = activedocument.shapes.addline won’t work because I am in a range and
        Set Line = .range.shapes.addline won’t work either. My VBA knowledge is very limited. Could you help please.
        tks.

    • #892339

      Each Header and Footer is a Range, so if you can insert Shapes to any Range you like, it should work in the footer. We recently had a thread on inserting a field code into a footer, perhaps that code will get you started with adding a shape.

    Viewing 1 reply thread
    Reply To: adding a line in a footer (office 2000)

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

    Your information: