Debug error on autonew macro

T

Tracy

hello
I am trying to create a one page document template that
each time it is used reflects a sequential number e.g 001..
I tried using the copy and pasting this macro I found on
this site(see below) and got the following error: runtime
error -2147467259 (80004005)method private profile string
of object'system failed' (no VB experience :))
Sub AutoNew()

Order = System.PrivateProfileString
("C:\DocumentsandSettings\tracy12.Txt", _
"MacroSettings", "Order")

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

System.PrivateProfileString
("C:\Settings.txt", "MacroSettings", _
"Order") = Order

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

End Sub
 
W

Word Heretic

G'day "Tracy" <[email protected]>,

isnt it supposed to be "C:\Documents and Settings\tracy12.Txt"

you've missed the spaces to either side of the and.

Steve Hudson - Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: steve at wordheretic.com


Tracy reckoned:
 

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