title: How to open a Save As dialog in MS Word showing SharePoint Online Locations by using VBA or AppleScript?
body: <p>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.</p>
  <p>In Word 2016 on MacOS you can open a Save As dialog by using VBA or AppleScript. I have tried the following code:</p>
  <p>VBA</p>
  <pre><code>With Application.Dialogs(wdDialogFileSaveAs)
      .Name = &quot; testdoc.docx&quot;
      .Show
  End With
  </code></pre>
  <p>AppleScript</p>
  <pre><code>tell application &quot;Microsoft Word&quot;
      activate
      set tmpDialog to get dialog dialog file save as
      display Word dialog tmpDialog
  end tell
  </code></pre>
  <p>But this code opens a dialog showing only local storage options. See the print screen below.
  <a href="https://i.stack.imgur.com/QfD6X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QfD6X.png" alt="enter image description here" /></a></p>
  <p>What I need is the following dialog opened by code.
  <a href="https://i.stack.imgur.com/EfG3d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EfG3d.png" alt="enter image description here" /></a></p>
  <p>This is the dialog when you manually click Save As in Word.</p>
  <p>How can you open this Word dialog by using VBA or AppleScript?</p>