DocOpen Macro
Syntax
Function DocOpenMacro (StartMode As Long, ReportName As String, CubeName As String, CubePassword As String) As Long End Function
Discussion
Use this macro to add administrative functions, such as document security or statistical logging. If this macro exists in the Macros directory. It runs when the report or cube opens. If the macro returns False, the document is not opened. For example, to record the types of reports that your organization creates in a database, include scripting in the DocOpen.mac file.
Requirements
- The macro, DocOpen.mac, must contain a function called DocOpenMacro, which returns a True or False (-1 or 0 respectively) value. If the macro does not exist, the function name in the macro is incorrect, or the number of parameters are mismatched, the macro does not run and the report or cube opens normally.
An administrator should maintain this macro centrally in the Macros directory specified in the PowerPlay Preferences dialog box.
Parameters |
Description |
---|---|
StartMode |
Required. Specifies how to open the report. 1 = Normal startup 2 = OLE Type: Long |
ReportName |
Required. Specifies the report file name being opened. Type: String |
CubeName |
Required. Specifies the .mdc file name that the report uses. Type: String |
CubePassword |
Optional. Specifies logon information for protected cubes. Type: String |
Return Type
Long
Example
This example logs all reports and cubes that were opened to a text file.
Function DocOpenMacro( StartMode As Long, ReportName
As String, CubeName As String, Unused1 As String, CubePassword As
String, Unused2 As String, Unused3 As String, Unused4 As String)
As Long
Dim strLogFile As String
strLogFile = "c:\log.txt"
Open strLogFile For Append As #1
Print #1, "Report: " & ReportName & " Cube:
" & CubeName
Close #1
DocOpenMacro = 1
End Function
c8 topic - drop for s7