Word 2003/2007 VBScript fails in 2010 (background printing) – help!

5 pts.
Tags:
PDF Files
RTF
Scripting
VBScript
Visual Basic Script
Hi script wizzards...,

i cobbled this together from info on the web but i dont know hardly anything about scripting - i'm a COBOL propgrammer! Works with word 2003/2007 (has been for some time) but not in word 2010. The background printing commands fail (e.g. objWord.Options.PrintBackground = False). It works without them but then word is not invisible. I'd like one script that works in all versions. Help!

My script...

'*** This script converts all of the rtf files in the '*** current folder to pdf files for use with adBooker '*** email invoicing. Microsoft Word and PDFCreator '*** must already be installed on the same computer.

'*** Developed by Linden Rowland, October 2009. '*** Generated automatically by adBooker v2.08.

Set objFSO = CreateObject("Scripting.FileSystemObject")

If False = objFSO.FileExists("RGL7089_email_merge_data.csv") Then     MSGBOX "Merge files missing! If you are " + _            "running from a zip folder, you need " + _            "to extract all of the files first " + _            "and run from there. Click OK to exit. "     Wscript.Quit End If

If objFSO.FolderExists("C:EMAIL_INVOICE_MERGE") Then     MSGBOX "About to empty folder, C:EMAIL_INVOICE_MERGE. If you need any of the files, move them now BEFORE clicking OK."     objFSO.DeleteFile("C:EMAIL_INVOICE_MERGE*.*") Else     MSGBOX "Ooops! - you may have tried to run this program by mistake - it can only be run on the computer that will send the email invoices. Click OK to exit."     Wscript.Quit End If

strFolderName = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName))) Set objFolder = objFSO.GetFolder(strFolderName)

Set objWord = CreateObject("Word.Application") objWord.Visible = False strActivePrinter = objWord.ActivePrinter objWord.ActivePrinter = "PDFCreator"

For Each objFile In objFolder.Files   IF right(objFile,4) = ".rtf" THEN     strFileName = strFolderName & objFile.Name     Set objDoc = objWord.Documents.Open(strFileName)     objWord.Options.PrintBackground = False     objDoc.PrintOut()     objWord.Options.PrintBackground = True     objDoc.Close()   End if Next

objWord.ActivePrinter = strActivePrinter objWord.Quit

Const OverwriteExisting = True objFSO.CopyFile "*_email_merge_data.csv" , "C:EMAIL_INVOICE_MERGE", OverwriteExisting

MSGBOX "Before you run Pegasus, please check the PDFs in folder, C:EMAIL_INVOICE_MERGE. There may be a short delay before all of the PDFs appear."

THANKS, Linden

ASKED: November 4, 2010  6:59 PM
UPDATED: November 15, 2010  8:02 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

I have many close familiars, who use MS Word, but once I by chance observed a tool, which was interested for me. And to my great surprise the software resolved my old issues simply just like would help in this problem to my mind – <a href=”http://www.recoverytoolbox.com/word.html”>repair word</a>.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following