I am getting an error when trying to set the ActivePrinter using Excel (9.0 object library). I'm on W2000 using VB6.
Here is my code in a test project:
Private Sub Timer1_Timer()
Timer1.Enabled = False
On Error GoTo Error_Handler:
Dim xl As Excel.Application
Dim wb As Excel.Workbook
Set xl = New Excel.Application
Set wb = xl.Workbooks.Open("c:\test.xls")
xl.ActivePrinter = "Print-2-Image" 'Name of the printer i wish to use ' ERROR HERE!!!!!!!!!!!!!!!!!!
Set xl = Nothing
If Err.Number <> 0 Then
MsgBox CStr(Err.Number) & ": " & Err.Description
The error that I get is: "1004: Application-defined or object-defined error"
A few things to note...
-- I am using Print-2-Image as the printer, so the Excel file will be saved as a TIF.
-- I can do the same exact thing using the Word 9.0 object library and get no problems.
-- When I debug this code, on the line that errors, when I hover on the ActivePrinter, it says "unknown printer (check your Control Panel)" pretty odd message there
-- I can manually open my test file in Excel and print it. It does find Print-2-Image and creates the expected tif...
although, if I open the Print... diaolg window, there is no default printer, but i can choose Print-2-Image from a list
Anyone have a clue on this?