Solved

To print a Excel's  worksheet with VB

Posted on 1999-01-11
10
274 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Input past end of file vbs script 9 82
VBA: perform index match based on config sheet with two additional parameters. 9 55
Adding to a VBA? 6 61
MsgBox 4 47
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now