Solved

To print a Excel's  worksheet with VB

Posted on 1999-01-11
10
273 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now