Think I hit a small snag?
I want the document to only force the saving as a .docm file on the initial save as. The orginal code seemed to want to force a SaveAs during each save of the document as..
So I modded the If Statement to check if the SaveAsUI is true, and that seems to work, but......
What is strange is that you edit the document, then attempt to close the file and chose not to save, vba throws an error; runtime error 4248.
It appears to happen only if the document is open by itself as Word attempts to close the application and gives the error. If there are other word files open, it does not give the error.
I think I just need to tweak the If Statement some
Code:
Private Sub m_ThisApp_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
Dim oDialog As Dialog
If SaveAsUI = True And ActiveDocument.AttachedTemplate = ThisDocument.AttachedTemplate Then
Cancel = True
Set oDialog = Dialogs(wdDialogFileSaveAs)
With oDialog
.Format = 13
.Show
End With
End If
End Sub