I have made a programme to print chaques through excel report.
i have network printer “Xerox Phaser 3435 PCL 6” (inkjet) which is my default printer
I have local printer is “Epson LQ-300 ESC/P 2” (dot-matrix) and used only to print chaques.
every time when i want to print chq. i have to change my default printer and againt after printing reset default printer.
How can i print cheaques to local printer without selecting printer and without changing my default printer.
Private Sub Command1_Click()
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
oSheet.Range("A1").RowHeight = 12#
oSheet.Range("A2").RowHeight = 12#
oSheet.Range("A3").RowHeight = 18#
oSheet.Range("R3:U3").MergeCells = True
oSheet.Range("R3:U3").Font.Size = 12
oSheet.Range("R3:U3").HorizontalAlignment = xlLeft
oSheet.Range("R3:U3").VerticalAlignment = xlCenter
oSheet.Range("R3:U3").Font.Name = "Times New Roman"
oSheet.Range("R3").Value = Text1.Text
oSheet.Range("A4").RowHeight = 15.75
oSheet.Range("A5").RowHeight = 19.5
oSheet.Range("A6").RowHeight = 24
oSheet.Range("D6:S6").MergeCells = True
oSheet.Range("D6:S6").Font.Size = 12
oSheet.Range("D6:S6").HorizontalAlignment = xlLeft
oSheet.Range("D6:S6").VerticalAlignment = xlCenter
oSheet.Range("D6:S6").Font.Name = "Times New Roman"
oSheet.Range("D6").Value = Text2.Text
oSheet.Range("A7").RowHeight = 20.25
oSheet.Range("B7:N7").MergeCells = True
oSheet.Range("B7:N7").Font.Size = 12
oSheet.Range("B7:N7").HorizontalAlignment = xlLeft
oSheet.Range("B7:N7").Font.Name = "Times New Roman"
oSheet.Range("B7").Value = " " & Text4.Text
oSheet.Range("R7:U8").MergeCells = True
oSheet.Range("R7:U8").Font.Size = 12
oSheet.Range("R7:U8").HorizontalAlignment = xlLeft
oSheet.Range("R7:U8").VerticalAlignment = xlCenter
oSheet.Range("R7:U8").Font.Name = "Times New Roman"
oSheet.Range("R7").Value = Text3.Text
oSheet.Range("A8").RowHeight = 24
oSheet.Range("A8: P8").MergeCells = True
oSheet.Range("A8: P8").Font.Size = 12
oSheet.Range("A8: P8").HorizontalAlignment = xlLeft
oSheet.Range("A8: P8").VerticalAlignment = xlCenter
oSheet.Range("A8: P8").Font.Name = "Times New Roman"
oSheet.Range("A8").Value = Text5.Text
oSheet.PageSetup.PrintArea = "$A$1:$U$11"
oSheet.PrintOut
oExcel.Quit
Set oBook = Nothing
Set oExcel = Nothing
MsgBox "done"
End Sub