Solved

To print a Excel's  worksheet with VB

Posted on 1999-01-11
10
276 Views
Last Modified: 2010-05-03
How can I  print a Excel's worksheet with VB instructions?
If it's posible I don't want to open the Excel to do it.
Thanks
0
Comment
Question by:abautistat
10 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 200 total points
ID: 1455430
VB is not going to understand the in's & out's of an Excel spreadsheet. Easist way is to go ahead and fire up Excel and then use SendKeys to tell it what file to open and print. This is *MUCH* less work than trying to decipher the internals of an .XLS file.

Even if you simply "drag & drop" an .XLS file to the printer, the *OS* will open Excel to print it!

M

0
 
LVL 3

Expert Comment

by:cognition
ID: 1455431
Another solution would be to create an excel object within VB, and use the methods to open the workbook, and print method to print it. You don't have to make the Excel object visible.

Using an excel object will also allow you to handle any errors that occur, and to select ranges, or set the print range.
0
 

Expert Comment

by:trillian30
ID: 1455432
I agree with cognition.
I have an app that uses an Excel object to create an excel worksheet, print out the worksheet and save the whole thing without the user ever seeing Excel.
It works very nicely.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 12

Expert Comment

by:mark2150
ID: 1455433
Ok, reject me and give the points to Cognition.

M
0
 
LVL 1

Expert Comment

by:BETTY
ID: 1455434
If I were abautistat and I had enough points, I would give BOTH the points: to cognition 'cause it's the best answer, but to mark2150 too because it's not frequent to see someone that works for free helping other people, and furthermore is capable of give the only reward (the points) to a third person.

This is the way all experts and contributors in Experts-Exchange ought to be.

¿No crees que es así, abautistat?
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1455435
Thanks! (Small smile and tip o' the hat!)

M

0
 

Author Comment

by:abautistat
ID: 1455436
I agree with Betty, but I have to give the points to mark2150. I hope that mark gives some points to cognition...
Thank you.

Creo que es lo justo, ¿qué te parece Betty?
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1455437
Fair enough! I'll split em out!
M

0
 
LVL 12

Expert Comment

by:mark2150
ID: 1455438
Did you see that happened to the points I posted for cognition! Some people don't understand!

http://www.experts-exchange.com/Q.10116558

M

0
 
LVL 1

Expert Comment

by:BETTY
ID: 1455439
Unfortunately, really some people don't understand.

But we have to keep fighting for supporting this great system of interchange and collaboration. We can't prevent from these "viruses" acting this way!

And, as I suspected, abautistat is Spanish as I. It's fantastic look outside and see our people working with English-speaking ones! We're starting, but let's look at the future.

Saludos desde Barcelona, EEC!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question