G
Gwen H
I've posted a question about this issue before, but received limited
response, so I'm trying again. I have a fully functional VBA module that
prints a series of reports to PDF. I would like to add another feature to it.
The module prints about 10 different reports to about 40 different PDF files.
One report, the code for which I am pasting below, consists of three pages.
Each page is the sales incentive worksheet for one banker. So, page one is
Alene's worksheet, page two is Don's worksheet, and page three is John's
worksheet. Each banker's name is a field at the top of each page of the
report.
Currently the VBA module I've written opens the report, prints page 1, then
prints page 2, then prints page 3. What code do I need to add so that it
opens the report, finds Alene's sheet, prints Alene's sheet to PDF, then
finds Don's sheet, prints it to PDF, then finds John's sheet, prints it to
PDF, and then closes the report? What I am trying to ensure does not happen
is that Alene's sheet doesn't get printed to Don's file, and so on. The
current VBA module is only looking at page numbers, not at whose name is at
the top of the report. If we were to delete Don from the data on which the
report is based, then John's worksheet becomes page 2 and gets printed to
Don's file.
Am I making sense? Here's the code I have now:
'Print the Commercial Banker-Large Market Worksheets.
DoCmd.OpenReport "Commercial Banker Incentive Worksheet-Large Market",
acViewPreview
MsgBox "Save As ""Alene Worksheet Month 2006""", vbOKOnly, "Alene's
Worksheet"
DoCmd.PrintOut acPages, 1, 1, acHigh, 1, True
MsgBox "Save As ""Don Worksheet Month 2006""", vbOKOnly, "Don's Worksheet"
DoCmd.PrintOut acPages, 2, 2, acHigh, 1, True
MsgBox "Save As ""John's Worksheet Month 2006""", vbOKOnly, "John's
Worksheet"
DoCmd.PrintOut acPages, 3, 3, acHigh, 1, True
DoCmd.Close acReport, "Commercial Banker Incentive Worksheet-Large Market"
And here's how I want to modify the code:
'Print the Commercial Banker-Large Market Worksheets.
DoCmd.OpenReport "Commercial Banker Incentive Worksheet-Large Market",
acViewPreview
MsgBox "Save As ""Alene Worksheet Month 2006""", vbOKOnly, "Alene's
Worksheet"
GoTo Banker_Name "Alene"
DoCmd.PrintOut currentPage only
MsgBox "Save As ""Don Worksheet Month 2006""", vbOKOnly, "Don's Worksheet"
GoTo Banker_Name "Don"
DoCmd.PrintOut currentPage only
MsgBox "Save As ""John's Worksheet Month 2006""", vbOKOnly, "John's
Worksheet"
GoTo Banker_Name "John"
DoCmd.PrintOut currentPage only
DoCmd.Close acReport, "Commercial Banker Incentive Worksheet-Large Market"
Any help you can give would be greatly appreciated.
GwenH
response, so I'm trying again. I have a fully functional VBA module that
prints a series of reports to PDF. I would like to add another feature to it.
The module prints about 10 different reports to about 40 different PDF files.
One report, the code for which I am pasting below, consists of three pages.
Each page is the sales incentive worksheet for one banker. So, page one is
Alene's worksheet, page two is Don's worksheet, and page three is John's
worksheet. Each banker's name is a field at the top of each page of the
report.
Currently the VBA module I've written opens the report, prints page 1, then
prints page 2, then prints page 3. What code do I need to add so that it
opens the report, finds Alene's sheet, prints Alene's sheet to PDF, then
finds Don's sheet, prints it to PDF, then finds John's sheet, prints it to
PDF, and then closes the report? What I am trying to ensure does not happen
is that Alene's sheet doesn't get printed to Don's file, and so on. The
current VBA module is only looking at page numbers, not at whose name is at
the top of the report. If we were to delete Don from the data on which the
report is based, then John's worksheet becomes page 2 and gets printed to
Don's file.
Am I making sense? Here's the code I have now:
'Print the Commercial Banker-Large Market Worksheets.
DoCmd.OpenReport "Commercial Banker Incentive Worksheet-Large Market",
acViewPreview
MsgBox "Save As ""Alene Worksheet Month 2006""", vbOKOnly, "Alene's
Worksheet"
DoCmd.PrintOut acPages, 1, 1, acHigh, 1, True
MsgBox "Save As ""Don Worksheet Month 2006""", vbOKOnly, "Don's Worksheet"
DoCmd.PrintOut acPages, 2, 2, acHigh, 1, True
MsgBox "Save As ""John's Worksheet Month 2006""", vbOKOnly, "John's
Worksheet"
DoCmd.PrintOut acPages, 3, 3, acHigh, 1, True
DoCmd.Close acReport, "Commercial Banker Incentive Worksheet-Large Market"
And here's how I want to modify the code:
'Print the Commercial Banker-Large Market Worksheets.
DoCmd.OpenReport "Commercial Banker Incentive Worksheet-Large Market",
acViewPreview
MsgBox "Save As ""Alene Worksheet Month 2006""", vbOKOnly, "Alene's
Worksheet"
GoTo Banker_Name "Alene"
DoCmd.PrintOut currentPage only
MsgBox "Save As ""Don Worksheet Month 2006""", vbOKOnly, "Don's Worksheet"
GoTo Banker_Name "Don"
DoCmd.PrintOut currentPage only
MsgBox "Save As ""John's Worksheet Month 2006""", vbOKOnly, "John's
Worksheet"
GoTo Banker_Name "John"
DoCmd.PrintOut currentPage only
DoCmd.Close acReport, "Commercial Banker Incentive Worksheet-Large Market"
Any help you can give would be greatly appreciated.
GwenH