Group:  Microsoft Word ยป microsoft.public.word.vba.beginners
Thread: Programmatically setting the Save As filename in a Word doc via VB6

Programmatically setting the Save As filename in a Word doc via VB6
"Laphan" <please[ at ]dont.spam.com> 12/31/2008 7:06:08 PM
Hi All

First of all I know the SaveAs command would enable me to pre-set the
filename of a word doc, but unfortunately it will auto save it somewhere and
this won't do in my case.

A perfect solution for me is that the Word doc appears (from a word template
I have created so it's a fresh copy with a bit of dynamic data every time)
and when the user goes to File / Save or File / Save As a pre-defined
(dynamically put together) filename is already in the box so 9/10 they can
just find the location that they want to save it and click Save.

I cannot do SaveAs because the user must have the ability to go and put it
in a particular location. Each user will definetely save it in a different
location to another user.

I have tried:

ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = "My title"

but it doesn't change the filename in the Save dialogue.

I have tried various combos using the below:

With Dialogs(wdDialogFileSummaryInfo)
.Title = "My Title"
.Execute
End With

For example, I tried it as is, but this just doesn't work when you run it.
I started to type oWord.Dialogs(wdDialogFileSummaryInfo), but I didn't get
..Title in the Intellisense and when I type it literally it still doesn't
work.

I've seen something called FileDialog, but when you enter the
(msoFileSaveAs).InitialFilename bit it run time errors.

Am I right in saying that what I want to do is not possible?

Has anybody found a fudge/botch/cludge to get round this?

I don't want to do SaveAs and then say to the user that by the way there
will be a million unnecessary word docs in your My Docs because I needed to
do this to pre-populate the box.

Any ideas?

Happy New Year by the way!!





Home | Search | Terms | Imprint
Newsgroups Reader