Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Macro
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Macro
-----Original Message----- "Ronbo" wrote: 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. 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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Macro
-----Original Message----- -----Original Message----- "Ronbo" wrote: 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. 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? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro with Variable Data | Excel Worksheet Functions | |||
Variable Data within a Macro | Excel Worksheet Functions | |||
Variable Macro | Excel Discussion (Misc queries) | |||
Range used in a macro needs to be variable | Excel Worksheet Functions | |||
Help with macro formula and variable | Excel Worksheet Functions |