-1

I establish filename base on file content (first paragraph). When user click on ribbon file>Save As I want to prompt proper file name (even there is other name). How to handle and put in file name in window on attached screen? My SaveAs backstage window

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
deku
  • 85
  • 10

1 Answers1

0

Try:

Sub FileSaveAs()
With Application.Dialogs(wdDialogFileSaveAs)
  .Name = Split(ActiveDocument.Paragraphs(1).Range.Text, vbCr)(0)
  .Show
End With
End Sub

The above code intercepts the Save As dialogue.

macropod
  • 12,757
  • 2
  • 9
  • 21
  • Your solution doesn't solve my problem (I already do this like in your code, but my problem is in other window). Thanks anyway. – deku Jul 30 '18 at 07:17
  • The perhaps you should explain more clearly what the problem is and show us *your* code. Your description referred to "user click on ribbon file>Save As", which is what the macro I posted intercepts, but your screenshot doesn't actually show the SaveAs dialogue... – macropod Jul 30 '18 at 08:12
  • As you can see on my screenshot in primary post, I didn't have a dialogue form yet (after clicking File>SaveAs). I don't have any code. I know and use code above (overide FileSave and FileSaveAs procedure) but this is triggered when icon or shortcut is using. – deku Oct 30 '18 at 09:55