Thread: Variable Macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ronbo ronbo is offline
external usenet poster
 
Posts: 36
Default Variable Macro


-----Original Message-----
"Ronbo" wrote:


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.

This will print X number of reports of whichever type

you need.

Sub PrintMaster(Report as String, Number as integer)
Dim i as integer
For i = 1 to Number Step 1
Select Case Report
Case "A": PrnReportA
Case "B": PrnReportB
Case "C": PrnReportC
'add more cases for more reports
End Select
Next i
End Sub

For your example (2 of A and 5 of C), you would have to

call PrintMaster twice. Not sure how you are getting the
input from the user. If you post more info about how
you are getting the input, I might be able to come up
with the rest of what you need.
.


Marcotte:

Thanks for your offer to help. First of all, I am
importing text data, manipulating it and reporting it.
What I am trying to do is completely automate the
procedure. It sounds to me that the process you
suggested would still have to be watched over with manual
input.

I think you understand what I am looking for, a "print
master macro" that can figure out what it needs to
print. In the following situation I want the "print
master macro" to print 2-A, 0-B, 5-C,etc using the macros
assigned to them. Again, the next request will be
different.

Report A B C D E
Copies 2 0 5 1 10