Printing multiple copies

  • Thread starter Thread starter kdev
  • Start date Start date
K

kdev

I am looking to print X copies of a single sheet using VBA. The numbe
of copies (X) is entered into a cell on the Home worksheet and th
module gets this value and stores it in the variable prtquant.

Getting the value from the Home sheet (in cell G23) works fine but a
error is thrown up in the sht.PrintOut line:

Run-time error '91':
Object variable or With block variable not set

I have set prtquant as an integer using the line:


Code
-------------------

Dim prtquant As Integer

-------------------



Code
-------------------

prtquant = Worksheets("Home").Range("G23").Value

sht.PrintOut Copies:=prtquant, Collate:=True

-------------------


Can anyone suggest a working solution?

Thanks
 
This is working for me

Sub test()
Dim prtquant As Long
prtquant = Worksheets("Home").Range("G23").Value

ActiveSheet.PrintOut Copies:=prtquant, Collate:=True
End Sub

I don't know what sht is in your example
 
Thanks ! (again!!)

You were right in asking what sht was, it was supposed to be the activ
workbook but I hadn't set it so!

The code works just fine now, thank-you
 

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

Back
Top