Hi all
I am creating a macro for a friend, but haven't dealt with Word Forms
before. I have a Template document that has form fields on it. The first
section is locked (that holds the form fields) and it has another section
underneath that isn't locked.
What I would like to do is open the Template from the current document that
I am in, and insert all of the text from the current document into the
second section of the template.
In my current document I am launching the Template form using:
Documents.Add Template:="C:\MyTemplate.dot", NewTemplate:=False
This opens another document with the form fields being displayed. How do I
then insert all of the text in my current document so that it displays in
section 2, the un-protected section, so that the first page in the new
document is my form page and the rest of the pages are the pages in the
current document?
Alternatively, is there a way in which I can insert the Template page as the
first page of the current document rather than creating a new document? This
would actually be preferable, but I don't know how much work would be
involved. The current document is a CV, all I want to do is insert the Form
Fields in the template into the first page of the CV so that the form fields
act as a cover note. Is this possible?
Kind Regards,
Steve
Doug Robbins - Word MVP - 04 Jan 2006 14:24 GMT
Dim NewDoc as Document
Source as Document
Set Source = ActiveDocument
Set NewDoc = Documents.Add("C:\MyTemplate.dot")
NewDoc.Sections(2).Range = Source.Range

Signature
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
> Hi all
>
[quoted text clipped - 25 lines]
> Kind Regards,
> Steve
Steve Amey - 04 Jan 2006 15:18 GMT
Hi Doug
Thank you, that works great.
1 more question if that's ok, is it possible to retain the formatting of the
Source.Range? When it goes into the new document, it gets re-formatted to
that documents format. I don't want to change the Section 1 format, just the
Section 2.
Thank you again for your help.
Kind regards,
Steve.
> Dim NewDoc as Document
> Source as Document
[quoted text clipped - 31 lines]
>> Kind Regards,
>> Steve
Doug Robbins - Word MVP - 05 Jan 2006 18:59 GMT
Try
NewDoc.Sections(2).Range.FormattedText = Source.Range.FormattedText

Signature
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
> Hi Doug
>
[quoted text clipped - 45 lines]
>>> Kind Regards,
>>> Steve