using VBA in Excel to check if something can be printed out

R

Rudolf Galfi

Hello,

I want to automatically print out Excel files.
When the file is ready, the printer driver notifies by callback.
The problem: if an Excel worksheet is empty nothing is sent to the printer.
That means the programme waits forever, because there is no callback from
the driver.

That's what I have tried so far:

Dim r As Excel.Range
Set r = oWS.UsedRange ' oWs is a worksheet


If r.rows.count = 1 And r.Columns.count = 1 Then
If r.cells(1, 1).Value = "" Then
r.cells(1, 1).Value = "<<empty sheet from the original file>>"
End If
End If

It's not exactly correct, because there could be "Shapes" in the sheet,
that are printed as well, for example.

I'd rather like to check if there is something being sent to the printer at
all.
How can I do that?

Many thanks!

LosBubos (Rudolf Galfi)
 

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