Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro with Variable Data jeannie v Excel Worksheet Functions 15 June 23rd 07 01:48 PM
Variable Data within a Macro jeannie v Excel Worksheet Functions 6 June 18th 07 02:57 AM
Variable Macro Heather O'Malley Excel Discussion (Misc queries) 2 August 2nd 06 04:19 PM
Range used in a macro needs to be variable DaveP Excel Worksheet Functions 3 November 4th 05 03:23 PM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM


All times are GMT +1. The time now is 05:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"