Chase
 
I haven't read your code too closely but could your problem be because
you have these two lines of code in your BWS script:
 
' Uncomment the next line of code to print the document.
' WordDoc.PrintOut Background:=False
 
Doesn't that mean that BWS never gets a print command?
 
Sorry if I misunderstood your code.
David Gibbs 
Analyst, Laboratory Information Systems 
Fraser Health, Burnaby, BC 

________________________________

From: [email protected] [mailto:[email protected]] 
Sent: January 29, 2009 3:09 PM
To: [email protected]
Subject: [talkbws] RE: Printing a TXT file in Word using Boston
Workstation


I'm running into a wall on this one.
When I run the Macro in Word, it works like a charm.
When I run the Boston script below, that calls the save macro, it looks
like it is doing everything the macro does (opens word, opens document,
etc), but nothing is sent to the printer.
What gives?

Here is the Word macro code (without all the formatting code):
Sub PrintDMR001_Admin()
' PrintDMR001_Admin Macro
    ChangeFileOpenDirectory "S:\Accounting\Ascii\DMR001\"
    Documents.Open FileName:="PADMR001.txt"
    ActivePrinter = "\\wpshare2\MCPLE1SFIP01"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=
_
        wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
    ActiveDocument.SaveAs FileName:="PADMR001.doc", FileFormat:= _
        wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
        True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
        False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False
    ActiveDocument.Close
End Sub
 
Here is the BWS code:
Sub PrintDMR001_Admin()
Dim WordApp As Object
Dim WordDoc As Object
Set WordApp = CreateObject("Word.Application")
'Set WordDoc =
WordApp.Documents.Open("S:\Accounting\Ascii\DMR001\PADMR001.txt")  '
Replace here with your file name.
WordApp.Visible = True
WordApp.Run "PrintDMR001_Admin"
' Uncomment the next line of code to print the document.
' WordDoc.PrintOut Background:=False
' Uncomment the next line of code to save the modified document.
  ' WordDoc.Save
WordApp.Quit SaveChanges:=wdDoNotSaveChanges
Set WordApp = Nothing
End Sub
 
 
Any suggestion is much appreciated.
Thanks,
Chase Rodgers 
Financial Reporting Manager 
Medical Center of Plano 
*214-473-7490 
*[email protected] 
 <rtfimage://> 
From: [email protected] [mailto:[email protected]] 
Sent: Wednesday, January 28, 2009 10:12 AM
To: [email protected]
Subject: [talkbws] RE: Printing a TXT file in Word using Boston
Workstation
 
Greetings,
Found this...
http://support.microsoft.com/kb/212890
<http://support.microsoft.com/kb/212890> 
Their code however won't run as is without setting a reference so I
modified it and it worked for me!
Function RunWordMacro()
 Dim WordApp As Object
 Dim WordDoc As Object
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open ("C:\Macro.docx") 'Replace here
with your file name.
 WordApp.Visible = True
WordApp.Run "mymacro"
 ' Uncomment the next line of code to print the document.
' WordDoc.PrintOut Background:=False
 ' Uncomment the next line of code to save the modified document.
  ' WordDoc.Save
 WordApp.Quit SaveChanges:=wdDoNotSaveChanges
 Set WordApp = Nothing
End Function
Thom C. Blackwell
Product Manager
Boston Software Systems
(866) 653-5105 ex 807
www.bossoft.com <http://www.bossoft.com/> 
Sign up for my weekly webinar!
<http://www.bostonworkstation.com/customer_center/special_events.aspx> 
 
LEGAL NOTICE Unless expressly stated otherwise, this message is
confidential and may be privileged. It is intended for the addressee(s)
only. Access to this E-mail by anyone else is unauthorized. If you are
not an addressee, any disclosure or copying of the contents of this
E-mail or any action taken (or not taken) in reliance on it is
unauthorized and may be unlawful. If you are not an addressee, please
inform the sender immediately, then delete this message and empty from
your trash.
 
From: [email protected] [mailto:[email protected]] 
Sent: Wednesday, January 28, 2009 10:46
To: Talk
Subject: [talkbws] Printing a TXT file in Word using Boston Workstation
 
Does anyone use Boston to print TXT files using Word?
I have a macro in Word built to format and print a daily TXT file (same
name, same folder location) to a network printer.
I guess I could use Windows Scheduled Tasks to run it each morning, but
I would like to have Boston call this Word macro and run it.
Any information is much appreciated.
Thanks,
Chase Rodgers 
Financial Reporting Manager 
Medical Center of Plano 
*214-473-7490 
*[email protected] 
--- 
To post a message to this list, send mail to: [email protected] 

You are currently subscribed as: [email protected] 

Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 
--- 
To post a message to this list, send mail to: [email protected] 

You are currently subscribed as: [email protected] 

Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 
 
--- 
To post a message to this list, send mail to: [email protected] 

You are currently subscribed as: [email protected] 

Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 



---
To post a message to this list, send mail to: [email protected]

You are currently subscribed as: [email protected]

Unsubscribe in the customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx

Reply via email to