Re:Set Name in Word via OLE
I think If I understand you correctly this can be done reasonably simply. IF
all you want is that when the user clicks save it puts a name specified by
you into the filename box then do this. If you want it to automatically save
then do what the other people who replied to this post suggested.
I dont have the specific details here so this will be pseudo code.
Word has a dialogs property that allows you access to stuff on dialogs that
are opened in word. One of them is FileSummaryInfo - which contains the
Title property which is used by Word97 and 2000 as the default filename when
the saveas dialog is opened.
search for "Built-in dialog box argument lists" in your Word VBA help files
to get a list of possible arguments for each dialog then you do this.
This is the VBA code, I'll write some delphi code below
Public Sub mysuf()
With Dialogs(wdDialogFileSummaryInfo)
MsgBox .Title
.Title = "This is a new title"
.Execute
.Update
End With
End Sub
You must change the title Execute the dialog and update the values (I know
it seems funny but thats the only way I could get it to work).
In Delphi it would be something like this.
With WrdApp.Dialogs(wdDialogFileSummaryInfo) do
begin
Title := 'My Title';
Exectute;
Update;
end;
{When you call save you will find that "My Title.doc" is the default file
name. }
WrdApp.Save;
Hope this helps
Toby
"Kim G. Pedersen" <grund...@computer.dk> wrote in message
<news:84mh3n$8kr9@bornews.borland.com>...
Quote
> Hallo
> I Open a Document via OLE to MS WORD
> I would like to change the name of my active document , so
> then the user is pressing SAVE , The document already has the correct
name.
Quote
> I'm using D5
> Regards
> Kim G. Pedersen
> grund...@computer.dk
"