0
votes

I have a Word Template containing VBA in a content type on SharePoint online. When a new document is created based on this content type Word desktop starts and VBA opens a dialog. The user can enter some values in the dialog and click on a custom Save button. The save button opens a Save As dialog in Word containing a filename derived from the user input. The new document needs to be saved in the SharePoint online library where it was created.

In Word 2016 on MacOS you can open a Save As dialog by using VBA or AppleScript. I have tried the following code:

VBA

With Application.Dialogs(wdDialogFileSaveAs)
    .Name = " testdoc.docx"
    .Show
End With

AppleScript

tell application "Microsoft Word"
    activate
    set tmpDialog to get dialog dialog file save as
    display Word dialog tmpDialog
end tell

But this code opens a dialog showing only local storage options. See the print screen below. enter image description here

What I need is the following dialog opened by code. enter image description here

This is the dialog when you manually click Save As in Word.

How can you open this Word dialog by using VBA or AppleScript?

1

1 Answers

0
votes

To get to the dialog you are showing as your goal, it currently has to be accessed using the Online Locations button from the Word SaveAs dialog. That is if in Word > Preferences > Save ... the property of Turn On AutoSave by Default is marked.

However, I don’t see the Online Locations button on the clip of the dialog you have shared. So ... go to Word > Preferences > Save and clear the checkbox on the AutoSave by Default setting, then shutdown, restart, and try Word again. That process will force Word to save your new Save setting.

I don’t know if this behavior is by design or is a bug, but I have reported it to Microsoft as being at a minimum, confusing.