I have a template that I would like to save automatically as a macro enabled document with the file name "iSolved Newsletter Release"in the following location: M:\2019 Email Campaigns\iSolved Release upon the open of a new document. I'm having difficulty with some code I have found to help set the document as macro enabled, but I cannot get the name and location to set.
I am unable to upload the .docm file so below is my current code. I would also like to make this new file delete altogether after a date I have set as content control. Thank you so much in advance!
Option Explicit
Dim WithEvents App As Application
Private Sub App_DocumentBeforeSave(ByVal Doc As Document, _
SaveAsUI As Boolean, Cancel As Boolean)
'This event runs on all documents, so be sure we get our own
If Doc.AttachedTemplate.Name = ThisDocument.Name Then
'If never saved or user does a "save as"
If SaveAsUI Then
With Application.FileDialog(msoFileDialogSaveAs)
'The second filter is the DOCM filetype
.FilterIndex = 2
'Show the dialog
.Show
'Save the file as the user has choosen
.Execute
End With
'Cancel the original dialog
Cancel = True
End If
End If
End Sub
Private Sub Document_New()
Set App = Application
With Dialogs(wdDialogFileSaveAs)
.Name = "M:\2019 Email Campaigns\iSolved Release"
.Show
End With
ActiveDocument.SaveAs FileName:="M:\2019 Email Campaigns\iSolved Release"
End Sub
Private Sub Document_Open()
Set App = Application
End Sub
Bookmarks