Hot Topic (More than 10 Replies) Wordmerge Question (Read 1305 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Wordmerge Question
Feb 22nd, 2008 at 5:57pm
Print Post Print Post  
I would like wordmerge program to print without stopping to show dialog box stating that it will merge with SQL... so and so file and then display the merged document and I have to press Printer icon to print it. Is it possible with wordmerge to have the task completely seamless, no stopping anywhere?

  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wordmerge Question
Reply #1 - Feb 22nd, 2008 at 9:42pm
Print Post Print Post  
Last time I looked, you  have to edit the registry to get rid of the SQL warning.
http://support.microsoft.com/default.aspx?scid=KB;EN-US;825765

I'm not sure where WordMerge goes from there, but there is VBA you can drop into a Word doc to make it print itself, then close. Let me know if that's what you want and I'll post it.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Wordmerge Question
Reply #2 - Feb 22nd, 2008 at 10:53pm
Print Post Print Post  
Yes, that is what I am looking for. Thanks Erika, for your suggestion and help.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wordmerge Question
Reply #3 - Feb 22nd, 2008 at 11:27pm
Print Post Print Post  
Here you are. Change the DSName to your data source and you should be good to go. Note the code expects the data source file to be in the same directory as the Word doc. If that is not the case, edit accordingly.

Code
Select All
Private Sub Document_Open()
Dim DSName As String

' Change this to use a different data file
DSName = "rating.txt"

    ActiveDocument.MailMerge.OpenDataSource ActiveDocument.Path + "\" + DSName
    ActiveDocument.MailMerge.Destination = wdSendToPrinter
    ActiveDocument.MailMerge.Execute
    Application.Quit wdDoNotSaveChanges

End Sub
 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Wordmerge Question
Reply #4 - Feb 23rd, 2008 at 2:35pm
Print Post Print Post  
Erika,
Where did I go wrong? It did not work. Let me confess, I do not know anything about VBA.  So most likely I might have missed some simple steps. Sorry but you will have to hold my hand on every step if I ever hope to get it to work.

Private Sub Document_Open()
Dim DSName As String

' Change this to use a different data file
DSName = "MergeData.txt"

    ActiveDocument.MailMerge.OpenDataSource "C:\Sesame2\Docs\" + DSName
    ActiveDocument.MailMerge.Destination = wdSendToPrinter
    ActiveDocument.MailMerge.Execute
    Application.Quit wdDoNotSaveChanges
   
End Sub

   1. Copy the code above.
   2. Open the document.
   3. Hit Alt+F11 to open the Visual Basic Editor (VBE).
   4. On the left, double-click the document you opened.
   5. Underneath it, double-click "ThisDocument".
   6. Paste the code into the window that appears at right.
   7. Hit the Save diskette on the toolbar and close the VBE.

Am I supposed to place anything in Word document, such as Document_Open ( )?
ActiveDocument.MailMerge.OpenDataSource "C:\Sesame2\Docs\" + DSName - Is this line is redundant as the document was saved with this mergedata information from the subject merge data file already specified when the word document was created?

When I open the document, I expected it to print automatically. Other question: If the document on open, prints and closes without saving, how can I ever edit it? You will have to forgive me to ask you stupid question like this but I do not know jack about this VBA business!!!
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wordmerge Question
Reply #5 - Feb 26th, 2008 at 9:38pm
Print Post Print Post  
Bharat,

I'm sorry I haven't gotten back to you on this. Your VBA procedure sounds right, but I'll have to check it step by step.

Is your document set up in Word as a merge document?

What does it do when you open it?

BTW, you can open it without running the macro by holding down Shift as you open it.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Wordmerge Question
Reply #6 - Feb 26th, 2008 at 9:49pm
Print Post Print Post  
Thanks. When I open the document, first it gives the SQL merging warning since I did not change the Registry setting yet, and then it opens in the normal way with merged fields displayed properly but does not take the next step of printing and closing the document.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wordmerge Question
Reply #7 - Feb 26th, 2008 at 10:19pm
Print Post Print Post  
Bharat_Naik wrote on Feb 26th, 2008 at 9:49pm:
Thanks. When I open the document, first it gives the SQL merging warning since I did not change the Registry setting yet, and then it opens in the normal way with merged filled displayed properly but does not take the next step of printing and closing the document.


Do you have macro security set to a level that prevents macros from running? Try setting it to Low and see if it works. If it does, we take it from there. Let me know!
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Wordmerge Question
Reply #8 - Feb 27th, 2008 at 8:19am
Print Post Print Post  
With Low Security setting it works fine. With Medium Security setting it works but gives one more dialog box to deal with - Enable or Disable Macro.

The following workaround was suggested to deal with the above Macro dialog box.  So far so good. Opening while pressing shift key disable the Macro as you suggested.  Still will have to deal with SQL warning! Appreciate all your help. Is there any method other than Registry modification? Just wondering.

Quote:
To avoid macro warnings, attach a digital signature to each macro project and add that signature to your list of trusted sources. If the macros are already signed and if you are willing to trust all macros signed with that certificate, add the signer to your list of trusted sources. This will stop macro warnings when your Security setting is set to High or Medium.

A less secure option is to change the security level to Low. If you do use Low, you use Microsoft Word in its least secure setting. Be sure to take the following precautions to minimize your risk of getting a macro virus infection on your computer:



Thanks for all your help. When you have to print hundred of single document daily such interruptions in the form of warning and dialog box really become annoying at best.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wordmerge Question
Reply #9 - Feb 27th, 2008 at 12:29pm
Print Post Print Post  
Bharat_Naik wrote on Feb 27th, 2008 at 8:19am:
With Low Security setting it works fine. With Medium Security setting it works but gives one more dialog box to deal with - Enable or Disable Macro.

The following workaround was suggested to deal with the above Macro dialog box.  So far so good. Opening while pressing shift key disable the Macro as you suggested.  Still will have to deal with SQL warning! Appreciate all your help. Is there any method other than Registry modification? Just wondering.

AFAIK, the only way to get rid of that warning is the registry entry. As to signing the macros, I have a page with instructions for that bookmarked right next to the one for the SQL warning. It comes up a lot.  Smiley  I'll post the link when I get to the office.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wordmerge Question
Reply #10 - Feb 27th, 2008 at 1:57pm
Print Post Print Post  
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged