My boss wants to set up our internal templates so that the user is forced to save the new document immediately upon opening it. In some of them the only VBA will be the save-forcer, in others there are macros that should be preserved. Here's what I have:
Code:
Private Sub Document_New()
Dim intChoice As Integer
Dim strPathName As String
intChoice = 0
While intChoice = 0
intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
If intChoice <> 0 Then
strPathName = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
If Right$(strPathName, 1) = "x" Then
strPathName = Left$(strPathName, Len(strPathName) - 1) & "m"
End If
ActiveDocument.SaveAs2 FileName:=strFileName, FileFormat:=wdFormatXMLDocumentMacroEnabled
End If
Wend
End Sub
But this saves as a docx (I don't trust the users to select docm).
Suggestions on how to delete this code after running are welcome.