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
Jacqui - 17 Aug 2007 13:01 GMT
On Aug 17, 12:58 pm, Jacqui <jacqueline.ful...@semplefraser.co.uk>
wrote:
> 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

I should have said - I already have the macro to find the bookmark on
page 1 then add the text, my problem is how to start this running when
the doc goes to page 2.  Hope this makes sense.
Graham Mayor - 17 Aug 2007 13:30 GMT
You don't need a macro for this, you need a conditional field in the first
page footer of the document:

{IF {NUMPAGES} > 1 "Continued on next page ..." }

or if you have a running footer you could conditionally put it on the first
page only

{IF { PAGE } = 1 "{IF {NUMPAGES} > 1 "Continued on next page ..." }"}

If the document may run to more than two pages, you would need a variation

{ IF { PAGE  } < { NUMPAGES } "{ IF { NUMPAGES } > 1 "Continued on next page
..."  }" }

so that it doesn't print on the last page

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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
Jacqui - 17 Aug 2007 14:36 GMT
> You don't need a macro for this, you need a conditional field in the first
> page footer of the document:
[quoted text clipped - 32 lines]
>
> - Show quoted text -

This is fantastic Graham - thanks for your help.  However...... It's
not working - when I put the field in the first page footer, the test
{PAGENUM} shows whether it's 1 page or not, and nothing happens when I
add a new page.  I'm obviously missing something simple!
Graham Mayor - 17 Aug 2007 15:08 GMT
There is no PAGENUM field! It is either PAGE (the current page number)  or
NUMPAGES (the total number of pages in the document). My guess is that this
was a typo and that you have not used CTRL+F9 for the curly brackets {} that
surround each field.

I think on reflection I would use my third example as it works for all
likely circumstances and you don't need to set a separate first page
footer..
Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

>> You don't need a macro for this, you need a conditional field in the
>> first page footer of the document:
[quoted text clipped - 38 lines]
> {PAGENUM} shows whether it's 1 page or not, and nothing happens when I
> add a new page.  I'm obviously missing something simple!
Jacqui - 17 Aug 2007 15:49 GMT
> There is no PAGENUM field! It is either PAGE (the current page number)  or
> NUMPAGES (the total number of pages in the document). My guess is that this
[quoted text clipped - 56 lines]
>
> - Show quoted text -

Sorry - I did make a typo but it was in my reply to you, I didn't put
that in my code.  Here's the code I'm using (updated to your third
suggestion:

{IF {PAGE} < {NUMPAGES} "IF {NUMPAGES} > 1 "Continued over the
page...."}"}

This shows the text Continued on my footer (I want it to show nothing
if there is only one page) and when I create page 2 it still shows
this text.   I must be missing somthing!
Graham Mayor - 17 Aug 2007 16:09 GMT
> Sorry - I did make a typo but it was in my reply to you, I didn't put
> that in my code.  Here's the code I'm using (updated to your third
[quoted text clipped - 6 lines]
> if there is only one page) and when I create page 2 it still shows
> this text.   I must be missing somthing!

You are a bracket short

{ IF {  PAGE } < { NUMPAGES } "{ IF { NUMPAGES } > 1 "Continued over the
page...." }" }

If that too was a typo and your document contains only one page, then
nothing should appear in the footer. Nor should it appear in the footer of
the last page.

If you have tested this by inserting text to spill over to the second page
then removed the text leaving the entry on the first page. Switch to print
preview and back to update the field.

It should update automatically as the text spills over to the second page.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Jacqui - 17 Aug 2007 16:28 GMT
> > Sorry - I did make a typo but it was in my reply to you, I didn't put
> > that in my code.  Here's the code I'm using (updated to your third
[quoted text clipped - 29 lines]
> Word MVP web sitehttp://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>

I added the bracket and now I get this .... help
Error! Missing second part of test condition.
Edward Thrashcort - 17 Aug 2007 18:03 GMT
I guess you are just typing-in the braces {} rather than inserting fields
into the formula

You have mail <<Example to show calculated footer.doc>>

Eddie
> *From:* Jacqui <jacqueline.fulton@semplefraser.co.uk>
> *Date:* Fri, 17 Aug 2007 08:28:57 -0700
[quoted text clipped - 39 lines]
> I added the bracket and now I get this .... help
> Error! Missing second part of test condition.
Graham Mayor - 18 Aug 2007 08:37 GMT
As Edward posted after I had packed up for the night, you cannot simply type
in the brackets. Each pair signifies a field and field boundaries are
inserted (as I said earlier in the thread) with CTRL+F9. No doubt you have
received Edward's document and copied the field to yours, but as you posted
your e-mail address in a public forum it will not be long before you are
inundated with spam. You may find yourself needing something like
http://www.gmayor.com/use_google_gmail_to_remove_spam.htm before long ;)

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

>>> Sorry - I did make a typo but it was in my reply to you, I didn't
>>> put that in my code.  Here's the code I'm using (updated to your
[quoted text clipped - 33 lines]
> I added the bracket and now I get this .... help
> Error! Missing second part of test condition.
Russ - 19 Aug 2007 03:42 GMT
Jacqui,
Yes, don't leave your real or unadulterated email address on the web.
Doing a google search for 'mung email hide' gives information like this
site:
<http://www.by-users.co.uk/archive/faqs/email/spam/>

I set up a NOSPAM pop account in my email client to reply to newsgroups. The
outgoing SMTP server address was the only 'real' thing in that account setup
to send replies. I left the incoming mail information part empty because I
'subscribe' to newsgroups to messages through another newsgroup function of
the email client. It was told to use my special NOSPAM signature as well.

To those who have made it this far, you may have noticed that I use angle
brackets around my links. What's up with that? :)
<http://blog.entourage.mvps.org/2007/07/insert_urls_into_a_message.html>
I use to use snipurl or cuturl or tinyurl because I was worried about broken
long links. The angle brackets seem to be working.

> As Edward posted after I had packed up for the night, you cannot simply type
> in the brackets. Each pair signifies a field and field boundaries are
[quoted text clipped - 3 lines]
> inundated with spam. You may find yourself needing something like
> http://www.gmayor.com/use_google_gmail_to_remove_spam.htm before long ;)

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Russ - 19 Aug 2007 04:01 GMT
Sorry, for my bad grammar. "use to" should be "used to" and I should try to
avoid that phrase anyway.

> use to

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Jacqui - 20 Aug 2007 15:58 GMT
> As Edward posted after I had packed up for the night, you cannot simply type
> in the brackets. Each pair signifies a field and field boundaries are
[quoted text clipped - 50 lines]
>
> - Show quoted text -

Thanks for all your help Graham.  Your code had an extra quotation
mark (before the second {IF ..which seemed to be the problem.   FYI I
didn't type the brackets etc.   I've learned loads here though, so
thanks.

Just need to figure out how to post to this group without showing my e-
mail address....  Thanks again
Graham Mayor - 21 Aug 2007 09:37 GMT
> Just need to figure out how to post to this group without showing my
> e- mail address....  Thanks again

See http://www.gmayor.com/MSNews.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

 
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.