Change "Save As" Default Text

S

Scott Turner

I am launching Word programatically from a .NET application. It that
application, I create an active document, window, etc...

I seem to be able to control everything in the code. However, I cant
seem to find a way to force the default "Save As" text to be what I
want.

When the "Save As" dialog box pops up, it defaults to saving the
document as:

<first few words of text>.doc

Does anyone know of property settings on the Application, Document,
Window, etc... objects which would allow me to control this? Ideally I
would like to control the default extension type also (i.e.
doc,xml,txt,etc...).

Thanks,
Scott
 
J

Jonathan West

Hi Scott,

If you set the Title property of the unsaved document, the Save As dialog
defaults to that title for the filename.

Alternatively, you can set the SaveAs name in code if you display the Save
As dialog under code control. The following is a VBA example, but you should
be able to adapt it to running under your .NET language.

With Dialogs(wdDialogFileSaveAs)
.Name = "Testing"
.Show
End With

You can also set the Format property of the dialog to control the default
save format.
 
S

Scott Turner

Thanks Jonathan!

I attempted a c# version of the code you gave. I tried the following,
but it complains that "Name" is not a property of the object I am
using. Any ideas?

Word.Dialog Dlg;
Dlg = Application.Dialogs[Word.WdWordDialog.wdDialogFileSaveAs];
Dlg.Name = "Test";


Scott
 
J

Jonathan West

Hi Scott,

Each member of the dialogs collection has a different set of properties,
which are not common to the Dialog object. I suggest you try again defining
Dlg as Objcet.

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup

Scott Turner said:
Thanks Jonathan!

I attempted a c# version of the code you gave. I tried the following,
but it complains that "Name" is not a property of the object I am
using. Any ideas?

Word.Dialog Dlg;
Dlg = Application.Dialogs[Word.WdWordDialog.wdDialogFileSaveAs];
Dlg.Name = "Test";


Scott


"Jonathan West" <[email protected]> wrote in message
Hi Scott,

If you set the Title property of the unsaved document, the Save As dialog
defaults to that title for the filename.

Alternatively, you can set the SaveAs name in code if you display the Save
As dialog under code control. The following is a VBA example, but you should
be able to adapt it to running under your .NET language.

With Dialogs(wdDialogFileSaveAs)
.Name = "Testing"
.Show
End With

You can also set the Format property of the dialog to control the default
save format.


--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top