View Single Post
 
Old 03-19-2016, 12:10 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Your document also saves as strFilename, which doesn't exist in your code. As Paul indicates the document should be docx format and the code is in the template. The code when edited to
Code:
Option Explicit
Private Sub Document_New()
Dim intChoice As Integer
Dim strPathName As String
    intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
    If intChoice <> 0 Then
        strPathName = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
        ActiveDocument.SaveAs2 Filename:=strPathName, FileFormat:=wdFormatXMLDocument
    End If
End Sub
saves as docx and the document can certainly be opened without error.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote