How to assign a name to Mailmerge document

T

TOM

I use the Execute method of the Mailnerge object and it
creates a new document called "Form Letters1".

This is a default name that Word creates.

How do I explicitly give the new word document a name?

I am not referring to the name of the original word doc
containing all the 'mergefields' but to the NEW document
that Word creates.

(hm, now what ambiguity will be found?)
 
D

Doug Robbins - Word MVP

I don't think it is possible to give the document a name as part of the
mailmerge process. However, the new document does become the
activedocument, so you can include

ActiveDocument.SaveAs "[filename]"

which will give it a name, or, if you merely want a way of referring to the
document for further code execution, you can declare a variable as Document
and then use

Set mydoc = ActiveDocument.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
T

TOM

OK the object of the exercise is to NOT prompt for saving
when a user CLOSES a new 'Form Letter' document.

I know the code for this if I know a document name and
where to put it (I think) but how do I do this without
risking losing document changes on closure for ALL other
docs.

I was hoping to name the appropriate docs as "xyz no
save" during the merge proces (somewhere in the merge
process) and then on closure search for 'no save' in the
name and execute the code.
-----Original Message-----
I don't think it is possible to give the document a name as part of the
mailmerge process. However, the new document does become the
activedocument, so you can include

ActiveDocument.SaveAs "[filename]"

which will give it a name, or, if you merely want a way of referring to the
document for further code execution, you can declare a variable as Document
and then use

Set mydoc = ActiveDocument.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
I use the Execute method of the Mailnerge object and it
creates a new document called "Form Letters1".

This is a default name that Word creates.

How do I explicitly give the new word document a name?

I am not referring to the name of the original word doc
containing all the 'mergefields' but to the NEW document
that Word creates.

(hm, now what ambiguity will be found?)

.
 
D

Doug Robbins - Word MVP

Instead of searching for "no save", search for "Form Letters"

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
TOM said:
OK the object of the exercise is to NOT prompt for saving
when a user CLOSES a new 'Form Letter' document.

I know the code for this if I know a document name and
where to put it (I think) but how do I do this without
risking losing document changes on closure for ALL other
docs.

I was hoping to name the appropriate docs as "xyz no
save" during the merge proces (somewhere in the merge
process) and then on closure search for 'no save' in the
name and execute the code.
-----Original Message-----
I don't think it is possible to give the document a name as part of the
mailmerge process. However, the new document does become the
activedocument, so you can include

ActiveDocument.SaveAs "[filename]"

which will give it a name, or, if you merely want a way of referring to the
document for further code execution, you can declare a variable as Document
and then use

Set mydoc = ActiveDocument.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
I use the Execute method of the Mailnerge object and it
creates a new document called "Form Letters1".

This is a default name that Word creates.

How do I explicitly give the new word document a name?

I am not referring to the name of the original word doc
containing all the 'mergefields' but to the NEW document
that Word creates.

(hm, now what ambiguity will be found?)

.
 
T

TOM

Yes and I have done so but there may be a small danger
that it might bite me on the backside as it might be not
unique enough.
-----Original Message-----
Instead of searching for "no save", search for "Form Letters"

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
OK the object of the exercise is to NOT prompt for saving
when a user CLOSES a new 'Form Letter' document.

I know the code for this if I know a document name and
where to put it (I think) but how do I do this without
risking losing document changes on closure for ALL other
docs.

I was hoping to name the appropriate docs as "xyz no
save" during the merge proces (somewhere in the merge
process) and then on closure search for 'no save' in the
name and execute the code.
-----Original Message-----
I don't think it is possible to give the document a
name
as part of the
mailmerge process. However, the new document does become the
activedocument, so you can include

ActiveDocument.SaveAs "[filename]"

which will give it a name, or, if you merely want a way of referring to the
document for further code execution, you can declare a variable as Document
and then use

Set mydoc = ActiveDocument.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
I use the Execute method of the Mailnerge object and it
creates a new document called "Form Letters1".

This is a default name that Word creates.

How do I explicitly give the new word document a name?

I am not referring to the name of the original word doc
containing all the 'mergefields' but to the NEW document
that Word creates.

(hm, now what ambiguity will be found?)

.

.
 
D

Doug Robbins - Word MVP

If the purpose of the exercise was to execute the merge to the printer
without the Print dialog appearing, then execute it to a document, use
ActiveDocument.PrintOut and then ActiveDocument.Close wdDoNotSaveChanges.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
TOM said:
Yes and I have done so but there may be a small danger
that it might bite me on the backside as it might be not
unique enough.
-----Original Message-----
Instead of searching for "no save", search for "Form Letters"

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
OK the object of the exercise is to NOT prompt for saving
when a user CLOSES a new 'Form Letter' document.

I know the code for this if I know a document name and
where to put it (I think) but how do I do this without
risking losing document changes on closure for ALL other
docs.

I was hoping to name the appropriate docs as "xyz no
save" during the merge proces (somewhere in the merge
process) and then on closure search for 'no save' in the
name and execute the code.

-----Original Message-----
I don't think it is possible to give the document a name
as part of the
mailmerge process. However, the new document does
become the
activedocument, so you can include

ActiveDocument.SaveAs "[filename]"

which will give it a name, or, if you merely want a way
of referring to the
document for further code execution, you can declare a
variable as Document
and then use

Set mydoc = ActiveDocument.

--
Please post any further questions or followup to the
newsgroups for the
benefit of others who may be interested. Unsolicited
questions forwarded
directly to me will only be answered on a paid
consulting basis.

Hope this helps
Doug Robbins - Word MVP
message
I use the Execute method of the Mailnerge object and it
creates a new document called "Form Letters1".

This is a default name that Word creates.

How do I explicitly give the new word document a name?

I am not referring to the name of the original word doc
containing all the 'mergefields' but to the NEW
document
that Word creates.

(hm, now what ambiguity will be found?)

.

.
 

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