Auto generate serial no and saving addres

J

Jorgen

I want to assign a serial number to a form when I open the template Form.dot
The serial value shall increase one each time the template Form.doc is
opened by anyone with access to the forms template folder.
I would like the serial number to show up in the header of the Form.
Then I would like to save the Fom.doc as Formâ€serial numberâ€.doc in a
predefined folder for this type of forms.
Any subsequent editing and saving of say Form123.doc shall be overwriting
the existing Form123.doc

Where do I find a description of this kind of functionality?

Thanks in advance

Jorgen
 
J

Jay Freedman

Jorgen said:
I want to assign a serial number to a form when I open the template
Form.dot The serial value shall increase one each time the template
Form.doc is opened by anyone with access to the forms template folder.
I would like the serial number to show up in the header of the Form.
Then I would like to save the Fom.doc as Form"serial number".doc in a
predefined folder for this type of forms.
Any subsequent editing and saving of say Form123.doc shall be
overwriting the existing Form123.doc

Where do I find a description of this kind of functionality?

Thanks in advance

Jorgen

Look at http://www.word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm. You will
need to modify the line in the macro that saves the document, to make the
file name and path into the format you want.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

JorgenNM

Hi

This macro works fine, when I use it in an unprotected Form.
I would like to use it in a protected form where the user only is able to
fill in the designated fields.
Is that possible??

Thanks in advance

Jorgen


"Jay Freedman" skrev:
 
J

Jay Freedman

Near the end of the macro, insert lines as shown below and replace the
sample password with a real one in two places:

If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="OpenSesame"
End If

ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#")

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True, Password:="OpenSesame"

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

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

JorgenNM

Thanks

I shall try this out in a couple of days.
Regards

Jorgen

"Jay Freedman" skrev:
 

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