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 FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
JorgenNM wrote:
> 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:
>
>> Jorgen wrote:
>>> 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.