|
Home > Archive > MS SQL Server DTS > July 2005 > VB Printer Collection in DTS ActiveX VB Script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
VB Printer Collection in DTS ActiveX VB Script
|
|
| Leslie 2005-07-26, 8:24 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:
| |
| Ilya Margolin 2005-07-27, 9:23 am |
| Leslie,
ActiveX task takes VBScript, not VB. Take a look at:
http://msdn.microsoft.com/library/d...sstmexecute.asp
Ilya
"Leslie" <Leslie@discussions.microsoft.com> wrote in message
news:6F3C0DC6-A892-46DB-83A0- 0FB391B53F5D@microso
ft.com...
> 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:
>
>
>
|
|
|
|
|