|
-
May 27th, 2008, 10:29 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [vb.net2k5] printing excel worksheet
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.
-
May 27th, 2008, 10:38 AM
#2
Re: [vb.net2k5] printing excel worksheet
Hi,
You can try this:
vb Code:
Globals.Sheet1.PrintOut(From:=1, To:=1, Copies:=2, Preview:=True)
Hope it helps,
sparrow1
-
May 27th, 2008, 01:32 PM
#3
Re: [vb.net2k5] printing excel worksheet
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 28th, 2008, 12:28 AM
#4
Thread Starter
Fanatic Member
Re: [vb.net2k5] printing excel worksheet
hi jack: code work perfect in my case.
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
hi rob. the printing works but the DATA i send to the excel sheet were not include in the printout.
tnx +rep to both of you
-
May 28th, 2008, 03:04 AM
#5
Re: [RESOLVED] [vb.net2k5] printing excel worksheet
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 28th, 2008, 04:05 AM
#6
Thread Starter
Fanatic Member
Re: [RESOLVED] [vb.net2k5] printing excel worksheet
hi rob. thnx for the info. anyway, im using excel object in the application.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|