473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Print an Excel file in VB

Have a previously created an Excel file and want to print on default printer.

Want to initiate printing from within my application.

Thanks
Jul 29 '06 #1
1 12697
Hi Gavin-

1) Add a reference to Excel Object Library in .NET
2) Include (with Imports statments)
Imports Excel = Microsoft.Office.Interop.Excel 'Reference: Excel Object
Library" 3) Add (with Class member variable statements)
Friend WithEvents exWB As Excel.Workbook
Friend WithEvents exAPP As Excel.Application
Friend WithEvents exWS As Excel.Worksheet
4) Open the excel file (using OpenFileDialog)
exAPP.Workbooks.Open(ofd.FileName)
5) Use the PrintOut method for object you want to print.
exApp.ActiveSheet.PrintOut

John
"gavin" wrote:
Have a previously created an Excel file and want to print on default printer.

Want to initiate printing from within my application.

Thanks
Aug 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: phuongpv | last post by:
How to print an excel file in asp?
12
by: kath | last post by:
How do I read an Excel file in Python? I have found a package to read excel file, which can be used on any platform. http://www.lexicon.net/sjmachin/xlrd.htm I installed and working on the...
1
by: yucefrizk | last post by:
hello all, I'm trying to write a code to retreive data from a database to an excel file, I achieved my code and everything is going good by running it through unix, but when I create a webpage to...
13
by: araman | last post by:
Hello, Is it possible to print an excel file from a command button? Thanks Lance
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
15
by: patf | last post by:
Hi - experienced programmer but this is my first Python program. This URL will retrieve an excel spreadsheet containing (that day's) msci stock index returns. ...
2
by: vijayarl | last post by:
Hi Everyone, Am trying to collate the individual xls files into a single xls file.i have written this code. use strict; use Spreadsheet::WriteExcel; use Spreadsheet::ParseExcel; use...
1
by: farhana | last post by:
Hi experts, Need ur help and advice, My excel file is for user to upload their product listing. I have created a macro programming in the excel file. To use the file, user need to download...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.