I'm searching for a way to preset the proposed filename in the SaveAs
dialog of Ms Word 2010 from an COM AddIn. (Additionally I'd like to set also the default store path, but that is just secondary.)
I'm using the default SaveAs
commandButton
of the word, because the file should be stored in a SharePoint-Environment and the .Net SaveFileDialog
doesn't support that. Code I'm using:
var match = Application.CommandBars.FindControl(
MsoControlType.msoControlButton, 748, null, null);
match.Execute();
Things I've tried:
- The
Application.Document.Name
andFullName
properties only provide getters, so those are not available to set (why, I can't imagine). - Searching for the default
FileName
which can be set in the Word Settings (so set it to some value and then revert it later on) - Checked if there are other API operations available to set the document name.
- A very dirty solution would be to store the document to a temp dir with the
Document.SaveAs("fileName.doc")
operation, so when executing theSaveAs
button the name is already set.
Any ideas or solutions would be greatly appreciated.
Thanks, Chris