Printing Reports

hainejo

Board Regular
Joined
Jun 27, 2002
Messages
57
I have a report that is anywhere from 20 to 100 pages in length.
I would like to print the report to multiple files so I can convert them to PDFs.
I need to break the report down into 2 page increments. For example, If I have a 20 page report, I need to create 10 PDF files of 2 pages each.
Every 2 pages of the report represents info about one of our products.

I figured out how to print the report in 2 page increments, but since I am printing them to file, I would like to name each file by the product name.

I can't figure out how to capture the product names.

Any Ideas?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You could try:

1) Create a query that identifies each unique product name within VBA as a recordset. (DISTINCT ROW)

2) Walk through that recordset and on each entry, (re)create a query that uses that product name as a parameter (WHERE fldname = productname)

3) Assign that query as the RecordSource for the Report
Set qdf = dbs.CreateQueryDef(querytouse, query)
(Reports!reportname.RecordSource = "querytouse")

4) Use the productname (in #1) during the automated export portion of the function to name the output file (you could also name/rename anything in the report including headers/footers/titles/etc)
(Reports!reportname.MyRepTitle.Caption = "Recap")

Iterate through the list. As you're creating queries and saving them this could take awhile to save everything.

Alternatively, you don't really have to create a query, you could just have the full query passed directly to the form recordsource property.

Mike
 
Upvote 0

Forum statistics

Threads
1,221,622
Messages
6,160,887
Members
451,676
Latest member
Assy Bissy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top