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
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