Database Reference
In-Depth Information
Figure 12.4.9a: Excel Subroutine in Module1 to Trace Activity.
Sub my_graph_1(my_sheet As String)
Msg = "got to subroutine my_graph_1"
Title = "Sheet Name = " + my_sheet
Response = MsgBox(Msg, Style, Title)
End Sub
Figure 12.4.9b shows the output of a message box that is used to track the progress of the executing VBA
program. This is very much like using PRINT statements or PUT statements in your SAS code to track the
progress of the program. The code that produced the message box is in Figure 12.4.9a.
Figure 12.4.9b: Verification the My_graph_1 Subroutine Was Executed.
Figure 12.4.9b shows the message box, in the lower right hand corner, that output the trace message when
the My_graph_1 subroutine was executed. A description of the new “Workbook_Open” VBA Code
Described in Figure 12.4.8. follows to help you understand both the structure and flow of the VBA macro.
The name of this macro is Workbook_Open. It is a private subroutine stored in the VBAProject
area of the workbook called “ PERSONAL.XLS ” (Excel 2003) or “ PERSONAL.XLSB ” (Excel
2007, 2010, 2013). This subroutine has no parameters. Using the keyword “Private” will only
allow this subroutine to execute when Excel starts; the macro will not be available at other times
to execute. Remove the keyword “Private” to use at other times, like for debugging.
Search WWH ::




Custom Search