Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Marty Marty is offline
external usenet poster
 
Posts: 28
Default additional copy of document is generated

Hi-

I have a mailmerge template in Word2003 which uses MS Visual Basic macros.
These macros ask for data input which is used to populate the template. After
the document is generated, there is a second copy. Why am I getting 2
documents?

I have other similar templates which work correctly by producing only 1
document.

Thanks,
Marty
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default additional copy of document is generated

It is not possible to tell without your showing us the code that is being
run.

--
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

"Marty" wrote in message
...
Hi-

I have a mailmerge template in Word2003 which uses MS Visual Basic macros.
These macros ask for data input which is used to populate the template.
After
the document is generated, there is a second copy. Why am I getting 2
documents?

I have other similar templates which work correctly by producing only 1
document.

Thanks,
Marty



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default additional copy of document is generated

Maybe you could spell out a few more things - e.g., is your "template" a
..dot or a .doc? Are the macros VB or VBA? What is "generating" the document?
Are you talking about the process where you use File|New to create a new
document from a tempalte, or the process where you are performing a
mailmerge

It really isn't clear what you are doing and what you expect to happen as a
result - remember, we can't see your template, its macros, and so on.

Peter Jamieson
"Marty" wrote in message
...
Hi-

I have a mailmerge template in Word2003 which uses MS Visual Basic macros.
These macros ask for data input which is used to populate the template.
After
the document is generated, there is a second copy. Why am I getting 2
documents?

I have other similar templates which work correctly by producing only 1
document.

Thanks,
Marty



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Marty Marty is offline
external usenet poster
 
Posts: 28
Default additional copy of document is generated

Peter-

It is a .dot When I open the macros it just says "MS Visual Basic" on top,
so I am not sure if it is VB or VBA (how do I tell the difference?)

When I delete about 99% of the bottom of the template, then run the
mail-merge macros, I get only 1 copy. I'm trying to see at what point it
gives me a second copy of the document.

I thought that it was because I had a section break, but apparently this is
not the cause.

Here is the code that produces the finished document:

WordBasic.MailMergeMainDocumentType 0
WordBasic.MailMergeOpenDataSource Name:="", ConfirmConversions:=0,
ReadOnly:=0, LinkToSource:=0, AddToMru:=0, PasswordDoc:="", PasswordDot:="",
Revert:=0, WritePasswordDoc:="", WritePasswordDot:="",
Connection:="DSN=NCR-SQL;UID=sa;PWD=;APP=Microsoft
Query;WSID=SHIVAINDRA;LANGUAGE=us_english;DATABASE =lp_patents",
SQLStatement:="execute splp_lppci_US " & Chr(34) & OrderLetterNumber &
Chr(34), SQLStatement1:=""
WordBasic.MailMerge CheckErrors:=1, Destination:=0, MergeRecords:=0,
From:="", To:="", Suppression:=0, MailMerge:=1, MailSubject:="",
MailAsAttachment:=0, MailAddress:=""

Then I check some inputted variables to see if I need to delete any parts of
the document:


If LPPCI0.AddedPages.Value True Then
With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[transmittal]"
.ExtendMode = True
.Find.Execute FindText:="[added pages]"
.Delete
End With
End If

If LPPCI3.OptionButton17 True Then
With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[added pages]"
.ExtendMode = True
.Find.Execute FindText:="[cover sheet]"
.Delete
End With
End If

With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[transmittal]"
.ExtendMode = True
.Find.Execute FindText:="[transmittal]"
.Delete
End With

With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[added pages]"
.ExtendMode = True
.Find.Execute FindText:="[added pages]"
.Delete
End With

With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[cover sheet]"
.ExtendMode = True
.Find.Execute FindText:="[cover sheet]"
.Delete
End With



Thanks,
Marty


"Peter Jamieson" wrote:

Maybe you could spell out a few more things - e.g., is your "template" a
..dot or a .doc? Are the macros VB or VBA? What is "generating" the document?
Are you talking about the process where you use File|New to create a new
document from a tempalte, or the process where you are performing a
mailmerge

It really isn't clear what you are doing and what you expect to happen as a
result - remember, we can't see your template, its macros, and so on.

Peter Jamieson
"Marty" wrote in message
...
Hi-

I have a mailmerge template in Word2003 which uses MS Visual Basic macros.
These macros ask for data input which is used to populate the template.
After
the document is generated, there is a second copy. Why am I getting 2
documents?

I have other similar templates which work correctly by producing only 1
document.

Thanks,
Marty




  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default additional copy of document is generated

so I am not sure if it is VB or VBA (how do I tell the difference?)

From that description, it's VBA.

When I delete about 99% of the bottom of the template, then run the
mail-merge macros, I get only 1 copy. I'm trying to see at what point it
gives me a second copy of the document.


From that description, my best guess is that there is some corruption in the
template. And that really is a guess. Does it contain a /lot/ of macros?
Perhaps more than your other templates that work? Either way, it may be
worth trying to reconstitute your template from scratch if possible. I think
you should be able to export the macros from the VB Editor and re-import
them in a new version of the template.

I don't think the code in your macro is particularly relevant - if it's
similar to the code in macros in your other documents then it's probably
irrelevant. But I'd be interested to know whether your other merge documents
all use an execute command in their OpenDataSource method call, and whether
they also use the WordBasic object or have been converted to native VBA.

(That may be a handful to answer, but do your best!)

Peter Jamieson

"Marty" wrote in message
...
Peter-

It is a .dot When I open the macros it just says "MS Visual Basic" on
top,
so I am not sure if it is VB or VBA (how do I tell the difference?)

When I delete about 99% of the bottom of the template, then run the
mail-merge macros, I get only 1 copy. I'm trying to see at what point it
gives me a second copy of the document.

I thought that it was because I had a section break, but apparently this
is
not the cause.

Here is the code that produces the finished document:

WordBasic.MailMergeMainDocumentType 0
WordBasic.MailMergeOpenDataSource Name:="", ConfirmConversions:=0,
ReadOnly:=0, LinkToSource:=0, AddToMru:=0, PasswordDoc:="",
PasswordDot:="",
Revert:=0, WritePasswordDoc:="", WritePasswordDot:="",
Connection:="DSN=NCR-SQL;UID=sa;PWD=;APP=Microsoft
Query;WSID=SHIVAINDRA;LANGUAGE=us_english;DATABASE =lp_patents",
SQLStatement:="execute splp_lppci_US " & Chr(34) & OrderLetterNumber &
Chr(34), SQLStatement1:=""
WordBasic.MailMerge CheckErrors:=1, Destination:=0, MergeRecords:=0,
From:="", To:="", Suppression:=0, MailMerge:=1, MailSubject:="",
MailAsAttachment:=0, MailAddress:=""

Then I check some inputted variables to see if I need to delete any parts
of
the document:


If LPPCI0.AddedPages.Value True Then
With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[transmittal]"
.ExtendMode = True
.Find.Execute FindText:="[added pages]"
.Delete
End With
End If

If LPPCI3.OptionButton17 True Then
With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[added pages]"
.ExtendMode = True
.Find.Execute FindText:="[cover sheet]"
.Delete
End With
End If

With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[transmittal]"
.ExtendMode = True
.Find.Execute FindText:="[transmittal]"
.Delete
End With

With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[added pages]"
.ExtendMode = True
.Find.Execute FindText:="[added pages]"
.Delete
End With

With Selection
.HomeKey Unit:=wdStory
.Find.Execute FindText:="[cover sheet]"
.ExtendMode = True
.Find.Execute FindText:="[cover sheet]"
.Delete
End With



Thanks,
Marty


"Peter Jamieson" wrote:

Maybe you could spell out a few more things - e.g., is your "template" a
..dot or a .doc? Are the macros VB or VBA? What is "generating" the
document?
Are you talking about the process where you use File|New to create a new
document from a tempalte, or the process where you are performing a
mailmerge

It really isn't clear what you are doing and what you expect to happen as
a
result - remember, we can't see your template, its macros, and so on.

Peter Jamieson
"Marty" wrote in message
...
Hi-

I have a mailmerge template in Word2003 which uses MS Visual Basic
macros.
These macros ask for data input which is used to populate the template.
After
the document is generated, there is a second copy. Why am I getting 2
documents?

I have other similar templates which work correctly by producing only 1
document.

Thanks,
Marty






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The document name or path is not valid freely001 Microsoft Word Help 11 December 22nd 08 08:49 PM
How is it possible to copy over an entire formatted document? Jason Microsoft Word Help 3 June 9th 06 10:50 AM
I would like the title page of a document to indicate copy # bodhran Microsoft Word Help 2 June 8th 06 02:44 AM
How to add additional copies of template to document Jim Cant Mailmerge 3 February 22nd 05 12:29 AM
Moving templates to other computer GeorgeMar Microsoft Word Help 10 February 19th 05 04:59 AM


All times are GMT +1. The time now is 12:34 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"