how automaticly print excel sheet.

P

Paul Robichaud

How can I automaticly print a spreadsheet from another software calling
excel.

ie: in Dbase, If I type run(.t., "excel.exe"), it will load excel, but what
I would like to do is load the file and print it without human intervention.

would be something like this:
excel.exe/open"myfile.xls"/print it.
- it would launch excel, open myfile.xls, then print it. Hoping it will also
close automaticly.

I really hope you can help me with this one.

Thanking you in advance.

Paul
 
J

Jim Rech

One way to do that is to use the Windows ShellExecute API call. This
essentially does the same thing as right-clicking an XLS file in Windows
Explorer and picking Print. I don't know what the dBase syntax is for
making API calls (or if it's supported at all) but this is how it could be
done from another app that supports VB like Word:

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub LaunchXLS()
ShellExecute 0, "Print", "c:\book1.xls", "", "C:\", 0
End Sub
 
P

Paul Robichaud

I made it work with DBase+

Thank you very much !!!!!!
Very appreciated !

Paul.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top