Variable Macro

  • Thread starter Thread starter Ronbo
  • Start date Start date
R

Ronbo

I am trying to create a way to automatically print
reports as ordered. I have a worksheet with numerous
reports and a client may want various reports and in
various quantities. I have a list of what they want i.e.
2ea. - reportA: 5ea. - reportC, etc. I have macros to
print each report such as
macro "PrnReportA" , "PrnReportC", ect. What I want is
to find a way to run 2-reportA:'s and 5-reportC's
automatically.. Next time the request will be different
and the process needs to change to what is then
requested. So it would be something

Any suggestions will be appreciated.
 
-----Original Message-----
-----Original Message-----


If the requested number of reports is in the range
A1:C1
on Sheet1, then this (combined with PrintMaster) will
work. Of course to *completely* automate the process you
will have to an event function (probably
Workbook_BeforeClose) call PrintRequest.
Sub PrintRequest()
Dim NumA As Integer, NumB As Integer, NumC As Integer
With Worksheets("sheet1")
NumA = .[a1]
NumB = .[b1]
NumC = .[c1] 'add NumD, NumE etc for more reports
End With
PrintMaster "A", NumA
PrintMaster "B", NumB
PrintMaster "C", NumC
End Sub
.

Thanks a lot. It looks like it can help me.

I have modified to

Dim NumA As Integer, NumB As Integer, NumC As Integer
With Worksheets("Input")
NumA = .[E8]
NumB = .[F8]
NumC = .[G8] 'add NumD, NumE etc for more reports
End With
Application.Run "PRN1", NumA
Application.Run "PRN2", NumB
Application.Run "PRN3", NumC
End Sub


But, it stops at application.run.

Any ideas?
 

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