change macro from SaveAs docx to docm

Hi, I have the following two macros - work well but saves files as docx

what changes do I have to make to save the files as docm?

 

Sub FileSaveAs()
Dim oCC As ContentControl
Dim strFilename As String
For Each oCC In ActiveDocument.ContentControls
    If oCC.Title = "Filename" Then
        If oCC.ShowingPlaceholderText = True Then
            MsgBox "ðà ìøùåí ùí"
            oCC.Range.Select
       
        ElseIf InStr(oCC.Range.Text, "\") > 0 Or InStr(oCC.Range.Text, "/") > 0 Or InStr(oCC.Range.Text, ":") > 0 _
        Or InStr(oCC.Range.Text, "*") > 0 Or InStr(oCC.Range.Text, "?") > 0 Or InStr(oCC.Range.Text, """") > 0 _
        Or InStr(oCC.Range.Text, "|") > 0 Or InStr(oCC.Range.Text, "<") > 0 Or InStr(oCC.Range.Text, ">") > 0 Then
 
  
   MsgBox "úååéí ìà çå÷ééí áùãä ùí ÷åáõ. /:\*|?""""<>"
   oCC.Range.Select
 
       
        Else
            With Dialogs(wdDialogFileSaveAs)
                .Name = oCC.Range.Text
                .Show
            End With
        End If
    Exit For
    End If
Next oCC
End Sub

Sub FileSave()
Dim oCC As ContentControl
Dim strFilename As String
    If ActiveDocument.Path = vbNullString Then
        For Each oCC In ActiveDocument.ContentControls
            If oCC.Title = "Filename" Then
                If oCC.ShowingPlaceholderText = True Then
                    MsgBox "ðà ìøùåí ùí"
                    oCC.Range.Select
                   
        ElseIf InStr(oCC.Range.Text, "\") > 0 Or InStr(oCC.Range.Text, "/") > 0 Or InStr(oCC.Range.Text, ":") > 0 _
        Or InStr(oCC.Range.Text, "*") > 0 Or InStr(oCC.Range.Text, "?") > 0 Or InStr(oCC.Range.Text, """") > 0 _
        Or InStr(oCC.Range.Text, "|") > 0 Or InStr(oCC.Range.Text, "<") > 0 Or InStr(oCC.Range.Text, ">") > 0 Then
 
  
   MsgBox "úååéí ìà çå÷ééí áùãä ùí ÷åáõ. /:\*|?""""<>"
   oCC.Range.Select
 

                Else
                    With Dialogs(wdDialogFileSaveAs)
                        .Name = oCC.Range.Text
                        .Show
                    End With
                End If
                Exit For
            End If
        Next oCC
    Else
        ActiveDocument.Save
       
    End If
End Sub

 

 

Thanks

Answer
Answer
Changing

With Dialogs(wdDialogFileSaveAs)
    .Name = oCC.Range.Text
    .Show
End With


to

With Dialogs(wdDialogFileSaveAs)
    .Name = oCC.Range.Text
    .Format = 13 
   
    .Show
End With


should do the trick.
Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 340 Applies to: