ive seen other works but i was not able to follow there code sample. anyway i need a complete sample how to print excel worksheet in vb.net.
thnx +rep.
Printable View
ive seen other works but i was not able to follow there code sample. anyway i need a complete sample how to print excel worksheet in vb.net.
thnx +rep.
Hi,
You can try this:
vb Code:
Globals.Sheet1.PrintOut(From:=1, To:=1, Copies:=2, Preview:=True)
Hope it helps,
sparrow1
You can substiture the file to an Excel file but it works on just about all documents.
From my FAQ
http://www.vbforums.com/showpost.php...59&postcount=2
hi jack: code work perfect in my case.
hi rob. the printing works but the DATA i send to the excel sheet were not include in the printout.Code:With xlsTemplate
.Worksheets("sheet1").Cells(11, 10).Value() = ": " & _myemployee.refnum.ToString
.Worksheets("sheet1").Cells(14, 4).Value() = ": " & _myemployee.categoryid.ToString
.Worksheets("sheet1").Cells(15, 4).Value() = ": " & _myemployee.empno.ToString
.Worksheets("sheet1").Cells(16, 4).Value() = ": " & _myemployee.cprno.ToString
.Worksheets("sheet1").Cells(17, 4).Value() = ": " & _myemployee.fullname.ToString
.Worksheets("sheet1").Cells(18, 4).Value() = ": " & _myemployee.designation.ToString
.Worksheets("sheet1").Cells(19, 4).Value() = ": " & _myemployee.ccode.ToString
.Worksheets("sheet1").Cells(20, 4).Value() = ": " & _myemployee.designation.ToString
.Worksheets("Sheet1").PrintOut(From:=1, To:=1, Copies:=1, Preview:=False)
End With
tnx +rep to both of you
If you send the data to the xls then you need to save it too otherwise its just printing out the file as it was before you made your modifications.
ps, wasnt sure if you were using the Excel Object Model or not. ;)
hi rob. thnx for the info. anyway, im using excel object in the application.