Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

anchoring a textbox in a footer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Liz - 27 Apr 2007 16:58 GMT
We have a macro that inserts a textbox with the docID in all the
footers of a document.  When I use a certain template, after I add a
page break, the doc id appears at the top of the pages of the document
with the primary footer.  I don't think it's related to the template
itself because I've heard users complain of the problem in other
circumstances.  It's only with template I can replicate it.  My
suspicion is that it's an anchoring issue. The code has the textbox
anchored to the first character in the footer.  I tried to anchor it
to the first paragraph instead but when I try to set the range, I get
a mismatch error.  Can anybody tell me what I'm doing wrong?  (code is
below)

thanks.

   Dim objSEC As Word.Section
   Dim objFTR As Word.HeaderFooter
   Dim objTBL As Word.Table
   Dim objRNG As Word.Range
   Dim oShape As Word.Shape
   Dim fs As Object
   Set fs = CreateObject("Scripting.FileSystemObject")

   For Each objSEC In ActiveDocument.Sections
       For Each objFTR In objSEC.Footers

           If objFTR.LinkToPrevious = False Or objFTR.Index =
wdHeaderFooterFirstPage Then

               If objFTR.Exists = True Then

<snip>

                 Set objRNG = objFTR.Range.Paragraphs(1)
                 Set tbox =
objFTR.Shapes.AddTextbox(msoTextOrientationHorizontal,
InchesToPoints(0.25), _
                   0, InchesToPoints(1.2), InchesToPoints(0.4),
objRNG )
Jean-Guy Marcil - 27 Apr 2007 17:48 GMT
Liz was telling us:
Liz nous racontait que :

> We have a macro that inserts a textbox with the docID in all the
> footers of a document.  When I use a certain template, after I add a
[quoted text clipped - 34 lines]
>                    0, InchesToPoints(1.2), InchesToPoints(0.4),
> objRNG )

Set objRNG = objFTR.Range.Paragraphs(1)
should be
Set objRNG = objFTR.Range.Paragraphs(1).Range

Also, you declare oShape, but you use tBox?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.