specifying name of the document while saving

B

Basavaraj

Hi,
I open a Document template using C++ program (without using MFC),
Now, the templete is opened as a document. Upon attempting to save the
document, MS Word suggest a file name to be saved to..I mean, this file name
will be same as that of Temple but with an extension of .doc. mabe be if
template name is Template.dot then file name what MS Word suggests will be
Template.doc or Templete1.doc if the first one is already present ans so on..

Can i have a control in my program to specify a name to displayed by MS Word
while user attempts to save that doc..?

To be clear a simple, if i give a string like "customname.doc" , MS Word
should display this name in the save as dialog when user attempts to save the
document. Is this possible to do programatically .? can anyone help me in
this regard.?

Thanks in advance.

Regards,
-Basavaraj
 
H

Helmut Weber

Hi,
don't know what you are doing in detail, but
I open a Document template using C++ program,
Now, the templete is opened as a document.

here and now, if I open a template,
it stays a template.

Or am I missing the point?

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
B

Basavaraj

Hi,
I hope you didn't understand what i wrote.
Let me explain you a bit clear..We can open a document template in two ways.
Either as template or Document. If you open any word doc and perform
File->New you will see list of templates and then on right hand side you can
see two radio buttons as create new template or document. Hope this step is
fine for you.

Then if i open as document, and then i make some changes and then when i
attempt save, it displays a file name similar to templates name + with .doc
extension. This i wanted to control programatically..I mean,i want to give a
name programatically that MS Word should display that name when user attempts
to save.. If you are still not clear abt something, please do ask me.

Thanks and regards,
-Basavaraj
 
H

Helmut Weber

Hi,
must be my Word-version.
Can't find any radio button
in the document new task pane.

Anyway, have a look at this one, to get you going.

Sub FileSaveAs()
Dim oDlg As Dialog
Dim sTmp As String
sTmp = ActiveDocument.AttachedTemplate
Set oDlg = Dialogs(wdDialogFileSaveAs)
oDlg.Display
' compare proposed name to attached template
If Left(oDlg.Name, Len(oDlg.Name) - 3) = _
Left(sTmp, Len(sTmp) - 3) Then
MsgBox "noway"
Else
oDlg.Execute
End If
End Sub


Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 

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