Template Macro to Save Documents

P

philr

I’m recording a macro, within a template, that will save the values of the
bookmarks as part of the file names. While I’m recording I get the save as
dialog box to show but the file type says template.dot. I don’t want to save
the template file, .dot, within my macro, I want the .doc file to be saved.

If I change the file type to .doc and change the file location, away from
the template subdirectoy, the macro disappears when I go to reopen the
template. Word doesn’t allow me to stop the macro when the SaveAs dialog box
is open. Pressing the cancel button in the SaveAs dialog box, records the
cancel within the macro. (I’m also recording encryption in the Save As box
but that seems to work fine.)

How can I save the macro in the template and still save the file as a
document? (Leaving the Save As dialog box open with the proper file location
and file name where all the user has to do is press Save is great?)

Thanks,
Phil
 
H

Helmut Weber

Hi Phil,
why not open the doc with the bookmarks,
and do the programming in normal.dot?
Once it is working, you can copy it to
any template you like. I usually don't
open dots directly.
 
P

philr

Thank you Helmut,

Maybe I was unclear or I don't quite understand your response.

I want my users to do File > New > chose template.

This template currently has a working dialog box which enters value into the
bookmarks. (This I've done and it works well.)

My problem is when I'm working in the template creating the macro for my
users, I can't seem to save the entire macro. While the recorder is working
and I chose File > SaveAs the default condition is file type = template .dot.
I don't want the user to save a file with a .dot extension. If I change the
..dot to .doc and press save, it saves the template to a location as a .doc.
When I go back to the macro in the template, for debugging, it's not there.

TIA,
Phil
 
H

Helmut Weber

Hi,
my suggestion was, not to open the template at all,
manually. Create a new document, based on your template.
Record a macro, if neccessary. Unfortunately,
the recorder doesn't offer a way to store the
macro in the template project (your template),
but among other possibilities in normal.dot.
Let it go there, copy it to your template.
Delete it from normal.dot. If the macro looks
like:
Dim oDlg As Dialog
Set oDlg = Dialogs(wdDialogFileSaveAs)
With oDlg
.Show
End With
the suggested extension would be ".doc", as long
as a doc is the activedocument. But as no dot was
openend manually here, no dot can be the activedocument.
 

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