PDA

View Full Version : Printing certain pages of a report using VBA



Gareth Horton
July 12th, 2002, 01:31 PM
I'm using Ver 5.02A and using MS Object Browser I do not see any reference to setting/getting
page numbers for print.

Here's how you can use MS Object Browser:
1)Open Excel 97 or Higher
2)Create a new workbook
3)Switch to Visual Basic Editor (ALT-F11)
4)Click Tools|References...
5)Click Browse...
6)Navigate to C:Program FilesMonarchProgram (or wherever Monarch is installed)
7)Select Monarch.tlb and Click Open (this will load the Monarch Object Table and set a reference)
8)Click OK
9)Click View|Object Browser (F2)
10)In the top drop down box it should read <All Libraries> click on the arrow and Select MONARCHlib
11)On left box (Classes) click Monarch
12)In the right box you will see all the Properties/Methods of the Monarch Object as listed below:

Sub Test()
Dim ObjMon As New Monarch
ObjMon.CloseAllDocuments
ObjMon.CurrentFilter
ObjMon.CurrentModel
ObjMon.CurrentSort
ObjMon.CurrentSummary
ObjMon.DisplayWindow
ObjMon.Exit
ObjMon.ExportSummary
ObjMon.ExportTable
ObjMon.FilterCount
ObjMon.FindFirstText
ObjMon.GetFilterNameAt
ObjMon.GetSortNameAt
ObjMon.GetSummaryNameAt
ObjMon.IsActive
ObjMon.PRFPublish
ObjMon.PrintReport
ObjMon.PrintSummary
ObjMon.PrintTable
ObjMon.SetDLL
ObjMon.SetFieldVisible
ObjMon.SetFirstView
ObjMon.SetInputCharacterSet
ObjMon.SetLogFile
ObjMon.SetModelFile
ObjMon.SetOutputCharacterSet
ObjMon.SetPRFFile
ObjMon.SetProjectFile
ObjMon.SetReportFile
ObjMon.SetTextAppend
ObjMon.SetView
ObjMon.SortCount
ObjMon.SummaryCount
ObjMon.Version
ObjMon.Visible
ObjMon.WriteToLogFile
End Sub

This best I can tell you is to probably use SendKeys to the Print Dialog box for the page numbers you do know,
the last page will not be so easy.

Hope this helps!!
Nick Osdale-Popa

Mark Huston wrote:
> I'm using version 4.05. Part of a daily process that I'm trying to automate using VBA involves printing certain pages of a report.
>
> According to the Programmer's Guide, "PrintReport sends the contents of the Report view to the printer. If DirectPrintFlag is true, all pages in the report are printed using the default printer settings. If DirectPrintFlag is false, the Print dialog will be invoked, giving the user the opportunity to adjust settings before printing."
>
> 1. On certain reports, I need specific pages to print each time. I don't want the user to have to use the Print dialog. Is there a method supports inclusion within the code of the page numbers to print?
>
> 2. If the user only wants to print the last page, how does the user know which page to specify? Is there a PageCount property that can be read?
>