View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Pranav Vaidya[_2_] Pranav Vaidya[_2_] is offline
external usenet poster
 
Posts: 59
Default Make these macros available at all times even if normal.dot is rep

please see my answer to your question under Programming
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"a.e.neuman" wrote:

Hello experts,

I have two macros that I want to be available at all times (and secondly for
all users - or easlily portable to users). These macros instruct Word to
show the document's FULL PATH in Word's title bar - VERY useful indeed (I'll
show the macros below). The macros run automatically when a document is
opened and/or saved.

Several times now Normal.dot has become corrupt and had to be replaced - and
we lost these macros and had to re-create them and they seem to go into
Normal.dot.

How can we make these macros available at all times (and secondly for all
users) and have them reside outside of Normal.dot?

Here are the macros;

------------------------------------------------
Sub AutoOpen()
'
' Macro added
'
ActiveWindow.Caption = ActiveDocument.FullName

End Sub

Sub FileSaveAs()
'
' Macro added
'

Dim pRange As Word.Range
Dim oFld As Field
On Error GoTo Handler
Retry:
With Dialogs(wdDialogFileSaveAs)
If .Show = 0 Then Exit Sub
End With
System.Cursor = wdCursorNormal
ActiveWindow.Caption = ActiveDocument.FullName
For Each pRange In ActiveDocument.StoryRanges
Do
For Each oFld In pRange.Fields
If oFld.Type = wdFieldFileName Then
oFld.Update
End If
Next oFld
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
ActiveDocument.Save
Exit Sub
Handler:
If Err.Number = 5155 Or Err.Number = 5153 Then
MsgBox Err.Decription, vbOKOnly
Resume Retry
End If

End Sub
----------------------------------------------------------

Thank you in advance for help/tricks/pointers