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 / January 2005

Tip: Looking for answers? Try searching our database.

Macro to create section

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 08 Jan 2005 03:07 GMT
Hello,

I'm hoping someone might be able to "donate" some code for two seperate
case:

1- Create a page after the last page in the document wish would be in a new
section.
2- Change the page setup of the current document so that the current page
would be the start of a new section

Thanks for the help.  I'm having a really hard time programming anything to
do with section management?!

Daniel
Sabaka - 08 Jan 2005 05:35 GMT
Sub AddSect()
'add a new section at end of document
Dim char As Range
'set char to the last character in the document
Set char = ActiveDocument.Range.Characters.Last
'With sections collection object, use add method to add a section
ActiveDocument.Sections.Add Range:=char
End Sub

> Hello,
>
[quoted text clipped - 10 lines]
>
> Daniel
Daniel - 14 Jan 2005 02:41 GMT
Thank you for the help, it was exactly what I was looking for!

> Sub AddSect()
> 'add a new section at end of document
[quoted text clipped - 19 lines]
> >
> > Daniel
Sabaka - 14 Jan 2005 02:51 GMT
you're welcome!

> Thank you for the help, it was exactly what I was looking for!
>
[quoted text clipped - 24 lines]
> > >
> > > Daniel
Daniel - 17 Jan 2005 02:08 GMT
Sabaka,

   After testing the code you gave me, I have one more request to ask of
you.  Could you illustrate how I can insert a section but having a different
header and footer than the previous section?

Thank you once again,

Daniel

> you're welcome!
>
[quoted text clipped - 26 lines]
> > > >
> > > > Daniel
Sabaka - 08 Jan 2005 05:51 GMT
About your second question, what do you mean by "current page"?  My
understanding is that Word isn't really designed around pages.  As I
understand it, Word sees a document as a collection of sections, ranges,
paragraphs and characters.  If the "current page" is just the one where the
cursor is blinking, then why not just use the insert menu to insert a break
at the cursor?  If the current page is something else, I think you need to
define it in terms of a range or a section or something Word understands.

> Hello,
>
[quoted text clipped - 10 lines]
>
> Daniel
 
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.