Macros not firing in a derived document

R

Roger Shuttleworth

Hello

Warning: VBA beginner here...

I have a template called request.dot that contains the
following macros:

Public Sub SaveDoc()
Dim strDate As String
Dim dlgMySave As Dialog
strDate = Format(Date, "yyyy-mm-dd")
Set dlgMySave = Dialogs(wdDialogFileSaveAs)
dlgMySave.Name = strDate & " - " & txtDept.Value
dlgMySave.Show
End Sub

Sub FileSave()
'Saves the active document or template
SaveDoc
End Sub

The idea is the the FileSave command is intercepted to
open the Save As dialog, then insert a filename that
consists of the date followed by the value of the txtDept
control.

When I create a doc from the template, and click Save, the
SaveAs dialog doesn't pick up the value of txtDept from
the derived doc; instead it picks it up from the template,
where the value is "". How can I force it to use the value
in the new document instead?

Thanks for your help.

Roger Shuttleworth
 
C

Charles Kenyon

Where is textDept dimmed? How is it defined? How are values inserted into
it?

Option Explicit

would be a good idea.
 

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