|
-
Apr 19th, 2005, 03:12 PM
#1
Thread Starter
New Member
Filestamp template is driving me crazy
Hello,
I've inherited a Word template that is integrated with my firm's document management software (iManage). Whenever the document is saved (either by the user or autosave) the footer.dot kicks in and places a "filestamp" with the assigned document number in the footer. All of this works fine. The problem is when the footer.dot is finished running it returns focus back to the document at the insertion point and not the page taht was currently being viewed. Here is the problem code:
VB Code:
UserView = ActiveWindow.View.Type
Set thisdocument = ActiveDocument
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="dfwhere"
End With
ViewState = ActiveWindow.View.ShowAll
ActiveWindow.View.ShowAll = True 'show all codes
For Each aSection In thisdocument.Sections
For Each aFooter In aSection.Footers
If aFooter.Exists = True Then
aFooter.Range.Fields.Update
End If
Next aFooter
Next aSection
Selection.GoTo What:=wdGoToBookmark, Name:="dfwhere"
Selection.Find.ClearFormatting
ActiveDocument.Bookmarks("dfwhere").Delete
ActiveWindow.View.ShowAll = ViewState
ActiveWindow.View.Type = UserView
Application.ScreenUpdating = True
End If
ActiveWindow.View.Type = wdNormalView
ActiveWindow.View.Type = wdPrintView
ActiveWindow.View.Type = UserView
Application.ScreenUpdating = True
End Sub
The question is, can I set the focus back to the document without having to go back to the insertion point? I basically just want it to work like a regular save.
Please keep in mind that I'm a noob and I didn't write this code, I'm only trying to fix it.
Thanks,
-
Apr 21st, 2005, 07:59 AM
#2
Addicted Member
Re: Filestamp template is driving me crazy
is this all of the code? or just a section?
if you fail to plan, you plan to fail
-
Apr 21st, 2005, 08:10 AM
#3
Addicted Member
Re: Filestamp template is driving me crazy
you could use the following code to get the current page and section before carrying out the code you posted..(code from MS knowledge base, not my own)
then go back to the page when it is complete.
VB Code:
Public Sub rPageSectionNumber()
Dim sCurPage As String
Dim sCurSection as String
' Obtain page number.
sCurPage = Selection.Information(wdActiveEndPageNumber)
' Obtain section number.
sCurSection = Selection.Information(wdActiveEndSectionNumber)
' Display results.
MsgBox "Page " & sCurPage & ": " & "Section " & sCurSection
End Sub
if you fail to plan, you plan to fail
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|