1 Attachment(s)
SaveAs Dialog box in Word 2016
Hi everyone,
I need your help. I'm trying to get the VBA code to call the SaveAs dialog box so that when a user saves the document for the first time the name (based on the information of the Content Control in the file) and file format (.docm) are preloaded and the user simply needs to manually choose the folder where to save the file (I used an event to intercept printing which works wonderfully - I didn't include it in the attached because I want to keep the focus on the SaveAs dialog box). I didn't have any issues at all using the code below with Word 2010 (see the attached file): In fact, I can call the SaveAs dialog with preset File Name and Format:
-------------------------------------------------------------------------------------------------------------------
Sub SaveAs_Dialog()
Dim dlgsaveas As Dialog
Set dlgsaveas = Dialogs(wdDialogFileSaveAs)
With dlgsaveas
.Name = ActiveDocument.SelectContentControlsByTag("Name").Item(1).Range.Text & " - " & ActiveDocument.SelectContentControlsByTag("Number").Item(1).Range.Text
.Format = wdFormatXMLDocumentMacroEnabled
.Show
End With
End Sub
-------------------------------------------------------------------------------------------------------------------
Unfortunately though this code doesn't work with Word 2016 since the dialog box is different and I guess it's triggered through a different code. I found some code to call the SaveAs Dialog in Word 2016 but I couldn't fine any code where I can set the "Name" and "Format" as I was able to easily do in in the code above.
Thank you in advance for your support!
Regards
Massimo