Word 2003 sub autonew() won't run in template .dot / sharing templ

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
 
D

Doug Robbins - Word MVP

Are you creating the document from the template by selecting New from the
File menu and then selecting the template as the basis of the document that
you want to create?

From your use of the word "opening", I suspect that you are actually opening
the template, rather than creating a new document from it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Sarella

Hi Doug,

As the template is not stored on the C:drive I can't access it via file/new.
I did create a shortcut to the .dot in the C: templates folder, but the
same problem occurred. The macro didn't run.

The template needs to be shared by several people, hence it being stored on
a shared drive. Is there another alternative.

Many thanks - Sarella
 
M

mohit_ranka

You need to add the .dot file as Global Template/Addin in order to run
the Autonew() macro.

Hope it helps.

Regards,
Mohit
 
D

Doug Robbins - Word MVP

That is not correct.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins - Word MVP

You need to set the location of the Workgroup Templates Folder to the folder
on the network where the template is stored.

You do that via Tools>Options>File Locations.

After doing that, the template will be available when you select New from
the File menu.

Ignore the response posted by Mohit_ranka as it is not correct.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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