default suggested filename

N

nienberg

I've read the MVP document at

http://word.mvps.org/faqs/MacrosVBA/SetDefFilename.htm

but it doesn't work for me with regard to the problem with delimiters. The
workaround shows how to change spaces to underscores in the document title
using chr(95) to represent the underscore. In my tests though, Word 2002 SP3
uses a suggested filename consisting of everything up to the first
underscore, just like it would if you used the underscore directly, instead
of the chr(95).

Using the exact code in the example, I see the title in document properties
XXXX_Form_Options_Specs.doc

But when I save the document, the suggested filename is
XXXX.doc

Is there any other workaround that will let me program a suggested filename
that includes delimeters? I would like to have filenames like
2008013-23.pr.doc.

Thanks,
 
D

Doug Robbins - Word MVP

Why don't you just supply the desired filename to the ActiveDocument.SaveAs
command.

Or use

SendKeys "My_File"
With Dialogs(wdDialogFileSaveAs)
.Show
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jay Freedman

Or, since the SendKeys method is notoriously unreliable,

With Dialogs(wdDialogFileSaveAs)
.Name = "XXX_Form_Options_Specs.doc"
.Show
End With

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all
may benefit.
 
N

nienberg

Doug Robbins - Word MVP said:
Why don't you just supply the desired filename to the ActiveDocument.SaveAs
command.

I want to set the default filename when the user creates the document from a
template. Then the correct filename should show up if and when the user
decides to save the document. If I use the method you suggest, the user will
be prompted to save the document immediately upon creating it, which isn't
the end of the world, but isn't what I was asking for.

Thanks,
 
D

Doug Robbins - Word MVP

Actually, using that method, the document will be saved with that name
without any action on the part of the user.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
N

nienberg

So in summary:

1. The article on the MVP site it wrong.
2. There is no known workaround.

Forgive the long delay between my postings. I am trying to do it with the
web interface, which doesn't really work, so I have to keep looking for
specific OS and browser combinations.
 
D

Doug Robbins - Word MVP

No. You should re-read all of the responses to your posts. Both mine and
Jay Freedman's

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

Tony Jollans

I would have to agree that the article is a little misleading.

You can set the Title to anything you want, with or without underscores, via
the UI or with VBA, but when Word comes to use it as a suggested file name,
Word will truncate it at the first delimiter. This is not a VBA problem,
it's just the way Word works and, AFAIK, there is nothing you can do about
it without intercepting the various Save commands.

As a side note, I prefer to use the old Wordbasic command rather than the
dialogue, but Word will still not prompt including the delimiters; it just
doesn't work that way.
 

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