B
Brian
I am building a macro that will prevent users from changing original docs. I
only write simple macros as I haven't done many.
The problem is that when the document is saved - forced on user- I want the
new document's template re-assigned to normal.dot otherwise every time they
open their document it will run the macro again. Re-assigning Normal.dot to
their document works, however it also re-assigns the normal.dot to the
original; which I assumed would be closed. The code is as follows:
Sub AutoOpen()
' Automatically runs when Word starts
'With ActiveDocument.ActiveWindow
MsgBox "Please save this document, with your document name before
continuing", vbOKOnly
If vbOK = 1 Then
With Dialogs(wdDialogFileSaveAs)
.Show
End With
End If
With Dialogs(wdDialogFileSaveAs)
If ActiveDocument.Saved = False Then
ActiveDocument.Close
Else
If ActiveDocument.Saved = True Then
ActiveDocument.AttachedTemplate = NormalTemplate
End If
End If
If SendKey = ESC Then
End
End If
End With
End Sub
Any advice would be gratefully recieved. There are many of these docs
containing the basic format and layout for requirements, design etc for
applications.
Thanks
Brian
PS, Their are some clever clogs who un-check the read-only, hense forcing
the save
only write simple macros as I haven't done many.
The problem is that when the document is saved - forced on user- I want the
new document's template re-assigned to normal.dot otherwise every time they
open their document it will run the macro again. Re-assigning Normal.dot to
their document works, however it also re-assigns the normal.dot to the
original; which I assumed would be closed. The code is as follows:
Sub AutoOpen()
' Automatically runs when Word starts
'With ActiveDocument.ActiveWindow
MsgBox "Please save this document, with your document name before
continuing", vbOKOnly
If vbOK = 1 Then
With Dialogs(wdDialogFileSaveAs)
.Show
End With
End If
With Dialogs(wdDialogFileSaveAs)
If ActiveDocument.Saved = False Then
ActiveDocument.Close
Else
If ActiveDocument.Saved = True Then
ActiveDocument.AttachedTemplate = NormalTemplate
End If
End If
If SendKey = ESC Then
End
End If
End With
End Sub
Any advice would be gratefully recieved. There are many of these docs
containing the basic format and layout for requirements, design etc for
applications.
Thanks
Brian
PS, Their are some clever clogs who un-check the read-only, hense forcing
the save