1
123xxxxx
can some1 tell me wots wrong wiv the coding i got from microsoft office
site. i am trying to get the code for the printing size but it just comes
out with the number on it
' 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.
Dim accObj As AccessObject
' Fill the printer list.
' Make sure the RowSource is empty.
Me!cmbPrinter.RowSource = ""
Me!lbxSelectReport.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
Me![cmbPaperSize] = 1
' Fill the report list.
For Each accObj In CurrentProject.AllReports
Me!lbxSelectReport.AddItem accObj.Name
Next
' Set the list box to the first report.
Me!lbxSelectReport.SetFocus
Me!lbxSelectReport.ListIndex = 0
i am assuming the author of this code knew wot he/she was doing, can you
tell me if this is correct
as i know little about vba, i.e. i am just a beginner
site. i am trying to get the code for the printing size but it just comes
out with the number on it
' 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.
Dim accObj As AccessObject
' Fill the printer list.
' Make sure the RowSource is empty.
Me!cmbPrinter.RowSource = ""
Me!lbxSelectReport.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
Me![cmbPaperSize] = 1
' Fill the report list.
For Each accObj In CurrentProject.AllReports
Me!lbxSelectReport.AddItem accObj.Name
Next
' Set the list box to the first report.
Me!lbxSelectReport.SetFocus
Me!lbxSelectReport.ListIndex = 0
i am assuming the author of this code knew wot he/she was doing, can you
tell me if this is correct
as i know little about vba, i.e. i am just a beginner