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 / June 2007

Tip: Looking for answers? Try searching our database.

Inserting landscape pages, formatting headers/footers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cmbrown - 05 Jun 2007 23:48 GMT
In my code, I:
  insert two section breaks (now three sections)
  format headers and footers in section 3: no link to previous
  move up to section 2
  make it landscape
  format headers footers: no link to previous
  format headers footers: tabs

This all works fine until the last step. Even though my cursor is in the
proper (i.e. the landscape page) header, and turning off link to prev works,
when I try to do anything (in this case set some tabs) the cursor jumps up to
the header in the previous section (which is portrait).

I can't figure it out, you can step through the code and see the cursor in
the landscape page header, you can see the proper link to prev get turned
off, but then, as soon as it executes the next line of code (in this case
format tabs), the cursor jumps up to the previous section. I have tried other
formatting things, like selecting all, inserting text, etc., but no matter
what I do the cursor jumps to the prev section. I have even tried exiting the
header and going back in, no luck.

Any help would be most appreciated!
Thanks,
Chris
Signature

cmbrown

ArchieDog - 17 Jun 2007 12:56 GMT
Hi there

If you haven't already found a more elegant solution this might help ... I
have had something similar and solved it by using realtively clumsy lonf
winded code & closing the headers between actions.  For example:

Insert the section breaks
Physically move to Section 3
Change the header
Close it
Change the footer
Close it
Physically move to Section 2
Make it landscape
(You may need to go to Section 2 again at this point)
Change the header - no link to previous
Close the header
Change the footer
Close the footer
Open the header - add tabs
Close the header
Open the footer - add tabs
Close the footer

If you have already found a more elegant solution, what was it :-)

Archie Dog

>In my code, I:
>   insert two section breaks (now three sections)
[quoted text clipped - 20 lines]
>Thanks,
>Chris
Russ - 17 Jun 2007 21:31 GMT
If you're recording a macro to do these things, they can be unreliable
because they are depending on the 'selection' object.
It is usually better to use 'ranges' and address the particular collection
object by its index and/or range.

   With ActiveDocument.Sections(2).Footers(wdHeaderFooterPrimary).Range
       .ParagraphFormat.TabStops.Add Position:=InchesToPoints(2), _
           Alignment:=wdAlignTabCenter
   End With

> In my code, I:
>    insert two section breaks (now three sections)
[quoted text clipped - 20 lines]
> Thanks,
> Chris

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
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.