Auto-save document to specific location (dir) and with spec. name?

  • Thread starter Thread starter oystlars
  • Start date Start date
O

oystlars

Situation:

- Have a template that needs to be saved to a specific location and
with a specific filename after use. How?


Name and location:


c:\referees\060222 Personalmeeting.doc


06 = year
02 = month
22 = day


There are a lot of people saving these documents, but hardly any know
how a file structure is organized.. Problem!


Thanks,
Øystein
 
Hi Øystein,

Record any macro, say record clicking the B-button on the Standard toolbar,
and be sure to choose the template under 'Store macro in'.
Choose Tools | Macro > Macro's..., select your macro and choose Edit. The
VBA-editor opens.
Replace the entire macro by the following:

Sub AutoNew()
Dim dlg As Dialog

Set dlg = Application.Dialogs(wdDialogFileSaveAs)
With dlg
.Name = "C:\referees\" & Format(Date, "yyMMdd") & "
pesonalmeeting.doc"
.Show
End With

End Sub

Click the Save button in the VBA editor to save the template. As soon as a
user makes a new document based on the template, the SaveAs-dialog appears,
suggesting the standard name.

Note that if "C:\referees" does not exist, the macro suggests to save the
file in My Documents.

Good luck,
Cooz
 

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

Back
Top