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 / May 2008

Tip: Looking for answers? Try searching our database.

macro to create and mnipulate sections in word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
iris - 27 May 2008 12:23 GMT
Hello everyone.

I need to create a macro that:
1. open a new section in the middle of the document, so the first section
will be section 1, the second section section 2, and the third section
section 3.

2. Changes the layout of section2 to - landscape.
3. Deletes the footers of section 2 and section 3 (and not of section1).

I have succeeded to create this manually, but when I'm trying to make a
macro from this, I cant get the footers right...

Please Help me!!
Doug Robbins - Word MVP - 27 May 2008 23:27 GMT
Use when the cursor is located where you want to insert the first section
break.:

Selection.InsertBreak wdSectionBreakNextPage
Selection.InsertBreak wdSectionBreakNextPage
ActiveDocument.Sections(2).PageSetup.Orientation = wdOrientLandscape
For i = 2 To 3
   With ActiveDocument.Sections(i)
       With .Footers(wdHeaderFooterFirstPage)
           .LinkToPrevious = False
           .Range.Delete
       End With
       With .Footers(wdHeaderFooterPrimary)
           .LinkToPrevious = False
           .Range.Delete
       End With
   End With
Next i

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hello everyone.
>
[quoted text clipped - 10 lines]
>
> Please Help me!!
 
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.