Connecting Tech Pros Worldwide Help | Site Map

Word Macro to detect a following page

AllusiveKitten's Avatar
Member
 
Join Date: Feb 2007
Location: Australia
Posts: 43
#1: 4 Weeks Ago
Hi All

Program:
Microsoft Word 2003

Back ground
I am trying to write a macro to insert a landscape page into a portrait document.

Firstly the code must find out if there is a following page after the current cursor point. If there is a following page, the code need to enter extra section breaks to ensure the footers remain correct, other wise the code will just add an extra page making it landscape.

Question:
My question is, is it possible to write code that will find out if there is a following page or not?
Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#2: 2 Weeks Ago

re: Word Macro to detect a following page


Hey there!

I don't have to much info on Macros, but I suspect it is possible. Let's see if the Access forum has an idea...

If you have a bit of code, post it for a quicker response:-)

In a bit!
Delerna's Avatar
Expert
 
Join Date: Jan 2008
Location: Sydney
Posts: 787
#3: 2 Weeks Ago

re: Word Macro to detect a following page


Code to get the number of pages
Expand|Select|Wrap|Line Numbers
  1. Dim varNumberPages as Variant
  2. varNumberPages = ActiveDocument.Content.Information(wdActiveEndAdjustedPageNumber)
  3.  
Code to get the current page number
Expand|Select|Wrap|Line Numbers
  1. CurPage = Selection.Information(wdActiveEndAdjustedPageNumber)
  2.  

compare current page number with number of pages
if not equal then more pages follow.

PS
I got these codes using google so I don't know if they work as is or not.
They look correct...


VBA in word..........shiver................
Reply