dbTalk Databases Forums  

VB Printer Collection in DTS ActiveX VB Script

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss VB Printer Collection in DTS ActiveX VB Script in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Leslie
 
Posts: n/a

Default VB Printer Collection in DTS ActiveX VB Script - 07-26-2005 , 03:56 PM






I'm trying to print a job to a specific network printer. I'm using an
ActiveX Script Task to execute to execute the print job. However, when I
compile the code, I get an error on the Dim statement "as printer". However,
when I go to my VB reference book, it notes that "as printer" is a valid
argument for VB Built-In Collections (e.g. Printers or Forms).

Does anyone have experience with this? Can someone help me with this? Is
there any other VB source in a DTS package?

Dim XLPrinter as Printer
'PROCESS (PRINT) WORKSHEET:
For Each XLPrinter In Printers
If XLPrinter.DeviceName = "AcctPrint" Then
' Set printer as system default.
Set Printer = XLPrinter
XLApp.Echo "Printer Name is " + XLPrinter
' Stop looking for a printer.
Exit For
End If
Next
xlapp.workbooks.open XLWkb
xlapp.activeworkbook.worksheets(XLWkSht).printout

I'm trying to print a job to a specific network printer. I'm using an
ActiveX Script Task to execute the following code:




Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: VB Printer Collection in DTS ActiveX VB Script - 07-27-2005 , 08:41 AM






Leslie,

ActiveX task takes VBScript, not VB. Take a look at:
http://msdn.microsoft.com/library/de...stmexecute.asp

Ilya

"Leslie" <Leslie (AT) discussions (DOT) microsoft.com> wrote

Quote:
I'm trying to print a job to a specific network printer. I'm using an
ActiveX Script Task to execute to execute the print job. However, when I
compile the code, I get an error on the Dim statement "as printer".
However,
when I go to my VB reference book, it notes that "as printer" is a valid
argument for VB Built-In Collections (e.g. Printers or Forms).

Does anyone have experience with this? Can someone help me with this? Is
there any other VB source in a DTS package?

Dim XLPrinter as Printer
'PROCESS (PRINT) WORKSHEET:
For Each XLPrinter In Printers
If XLPrinter.DeviceName = "AcctPrint" Then
' Set printer as system default.
Set Printer = XLPrinter
XLApp.Echo "Printer Name is " + XLPrinter
' Stop looking for a printer.
Exit For
End If
Next
xlapp.workbooks.open XLWkb
xlapp.activeworkbook.worksheets(XLWkSht).printout

I'm trying to print a job to a specific network printer. I'm using an
ActiveX Script Task to execute the following code:






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.