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

Tip: Looking for answers? Try searching our database.

"Page 2 of 1" annoyance

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
elle0612 - 11 Jul 2007 22:30 GMT
I have coded a document template with userform.

Why is it that the second page of my "New" .doc from the template states
"Page 2 of 1" yet when I double click straight in the footer on the page
number, it changes to the correct state of "Page 2 of 2", as if it required a
kick start.

This is a puzzling problem.  Any answers out there?

thanks
Russ - 12 Jul 2007 03:24 GMT
Elle,

This code, that someone else wrote, will update every field in a document.
You can run it from another macro by
Call UpdateAllFields

Sub UpdateAllFields()
Dim oStory As Range
 For Each oStory In ActiveDocument.StoryRanges
   oStory.Fields.Update
   If oStory.StoryType <> wdMainTextStory Then
     While Not (oStory.NextStoryRange Is Nothing)
       Set oStory = oStory.NextStoryRange
       oStory.Fields.Update
     Wend
   End If
 Next oStory
 Set oStory = Nothing
End Sub

> I have coded a document template with userform.
>
[quoted text clipped - 6 lines]
>
> thanks

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Doug Robbins - Word MVP - 12 Jul 2007 03:59 GMT
Or use

With ActiveDocument
   .PrintPreview
   .ClosePrintPreview
End With

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

>I have coded a document template with userform.
>
[quoted text clipped - 7 lines]
>
> thanks
elle0612 - 13 Jul 2007 14:18 GMT
Where do you recommend putting this code?

I suppose I would somehow need an if statement, if pages >1 then do the code
you advised.

There would be no point putting this code anywhere within the modal userform
code, as the form is gone before the user starts typing on the actual
document.

What about somehow within the "this document" code?

Thanks

> Or use
>
[quoted text clipped - 14 lines]
> >
> > thanks
Doug Robbins - Word MVP - 14 Jul 2007 04:31 GMT
I had thought that your application was creating a two page document.  If
the second page is only added because the user continues past the first
page, then the field should update automatically.  Does that not happen for
you with an ordinary document (one created without the use of your
template.)?

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

> Where do you recommend putting this code?
>
[quoted text clipped - 31 lines]
>> >
>> > thanks
elle0612 - 14 Jul 2007 09:46 GMT
Yes, it does normally happen ok.  I've now tried it on the actual template
iteself and I get "Page 2 of 2" like I'm supposed to, but on creating a new
docment from the template I get "Page 2 of 1" - but on double clicking in the
footer on second page, it correctly reverts to "Page 2 of 2".  

I have tried using both the autotext Page x of y, and also " Page CtrlF9
{PAGE} OF Ctrl F9 {NUMPAGES}" within the template itself.  I have stopped it
showing on first page.  

Thanks

> I had thought that your application was creating a two page document.  If
> the second page is only added because the user continues past the first
[quoted text clipped - 37 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.