B
BIRDSPEED
I have a Printer Selection form which works fine at home (Windows and Office
2003) but when I bring it into the office (Network is Windows 2003, and also
using Office 2003).
I have the following code set up for the Printer Selection form
Private Sub Form_Open(Cancel As Integer)
' Variable to hold the default printer index.
Dim strDefaultPrinter As String
' Variable to hold the printer object.
Dim Prt As Printer
' Variable to hold the report object while cycling
' through the AllReports collection.
' Fill the printer list.
' Make sure the RowSource is empty.
Me!CmbPrinter.RowSource = ""
' Cycle through the printers installed on the machine and add them to the
combo box.
For Each Prt In Application.Printers
' Use the new AddItem method to add the printer name to the combo box.
Me!CmbPrinter.AddItem Prt.DeviceName
Next
' Remember the default printer.
strDefaultPrinter = Application.Printer.DeviceName
' Set the combo box to the default printer.
Me!CmbPrinter = strDefaultPrinter
End Sub
As I have said this compiles fine at home but comes up with a compile error
highlighting
"Dim Prt As Printer" - "User-defined type not defined" when I try the code
at the office.
Do I need to add a reference or is there something else that I need to do?
2003) but when I bring it into the office (Network is Windows 2003, and also
using Office 2003).
I have the following code set up for the Printer Selection form
Private Sub Form_Open(Cancel As Integer)
' Variable to hold the default printer index.
Dim strDefaultPrinter As String
' Variable to hold the printer object.
Dim Prt As Printer
' Variable to hold the report object while cycling
' through the AllReports collection.
' Fill the printer list.
' Make sure the RowSource is empty.
Me!CmbPrinter.RowSource = ""
' Cycle through the printers installed on the machine and add them to the
combo box.
For Each Prt In Application.Printers
' Use the new AddItem method to add the printer name to the combo box.
Me!CmbPrinter.AddItem Prt.DeviceName
Next
' Remember the default printer.
strDefaultPrinter = Application.Printer.DeviceName
' Set the combo box to the default printer.
Me!CmbPrinter = strDefaultPrinter
End Sub
As I have said this compiles fine at home but comes up with a compile error
highlighting
"Dim Prt As Printer" - "User-defined type not defined" when I try the code
at the office.
Do I need to add a reference or is there something else that I need to do?