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

Tip: Looking for answers? Try searching our database.

Macro which will run if doc goes to more than one page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jacqui - 17 Aug 2007 12:58 GMT
I have a document template which may or may not be two or more pages
long but in some case only 1.  What I want to do is create a macro
that will show text eg 'Continued on next page ...) only if the
document goes to page 2 and beyond. I can't do it with a macro prompt
button because in the template there is only one page. I'm not
experience enough to write code such as "if doc pages are more than 1
then .... etc etc.  Can anyone help?

thanks
Beeawwb - 20 Aug 2007 08:02 GMT
Hi Jacqui,

I have code in some of my macros to check if there is more than 1 page, and
run specified code depending. The code I use is...

NumOfPages = oDoc.BuiltInDocumentProperties("Number of Pages")
If NumOfPages > 1 Then GoTo ShrinkDoc

Where NumOfPages is Dim'ed as an integer, and oDoc is
Word.Application.ActiveDocument  

What this does is checks how many pages there are, and then compares if
"NumOfPages" is more than 1. If there is, it goes to another block of code
(ShrinkDoc:) and executes that.

Hope that helps!

-Bob

> I have a document template which may or may not be two or more pages
> long but in some case only 1.  What I want to do is create a macro
[quoted text clipped - 5 lines]
>
> thanks
 
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.