B
Barb
I am trying to set up a purchase order template. I need
to include a macro that will cause it to come up with the
next consecutive P.O. number each time the template is
opened. A friend found me some instructions on the
internet but I get an error message when I try to create
the macro and when I try to run it, obviously. Here's
what I have:
Sub autonumber()
Dim MyString, autoNumb
FileToOpen = "c:\windows\autonumberfile.txt"
Open FileToOpen for Input As #1
Input #1, autoNumb
Close #1
ActiveDocument.Bookmarks("autonumb").Select
Selection.InsertAfterText:=autoNumb
autoNumb = autoNumb + 1
Open FileToOpen For Output As #1
Write #1, autoNumb
Close #1
End Sub
I rarely use macros so I have no idea what is wrong with
this one. Maybe it was written for a different Word
version and doesn't work in 2002. I would appreciate any
guidance anyone can give me.
Thanks!
Barb
to include a macro that will cause it to come up with the
next consecutive P.O. number each time the template is
opened. A friend found me some instructions on the
internet but I get an error message when I try to create
the macro and when I try to run it, obviously. Here's
what I have:
Sub autonumber()
Dim MyString, autoNumb
FileToOpen = "c:\windows\autonumberfile.txt"
Open FileToOpen for Input As #1
Input #1, autoNumb
Close #1
ActiveDocument.Bookmarks("autonumb").Select
Selection.InsertAfterText:=autoNumb
autoNumb = autoNumb + 1
Open FileToOpen For Output As #1
Write #1, autoNumb
Close #1
End Sub
I rarely use macros so I have no idea what is wrong with
this one. Maybe it was written for a different Word
version and doesn't work in 2002. I would appreciate any
guidance anyone can give me.
Thanks!
Barb