Word 2003 Autorun won't run on template .dot

S

Sarella

Hi,

I have a word 2003 template (.dot) that has a macro in it that provides a
sequential number /creates new doc with same number file name each time I
open the template.

This works perfectly, providing I select Tools, Macro, Run after opening,
however I want the macro to run automatically when the template is accessed (
creating a new document with the given filename/number).

This is my macro:

Sub autonew()

Order =
System.PrivateProfileString("\\ukbelsv01\groups$\Everyone\Sarellas\Keep!\Settings.Txt", _
"MacroSettings", "Order")

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString("\\ukbelsv01\groups$\Everyone\Sarellas\Keep!\Settings.txt", "MacroSettings", _
"Order") = Order

ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="DeconCert" & Format(Order, "00#")



End Sub

This template is on a shared network, as I need other people to be able to
access the file. The settings.txt file is in a location where any user can
read/write to

Can anyone help me?

Many thanks - Sarella
 
S

Stefan Blom

Is the template in a trusted location? If not, the macro won't run as a
result of macro security.
 

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