Database Reference
In-Depth Information
reference defaults to the active worksheet in the current workbook. In an effort to keep things simple here,
we will not delete the worksheet name--just remember that it could become an issue. Here is the caveat for
this paragraph and Figure 13.3.10a. This paragraph will never adequately describe what you need to do to
build a graph you would like. So, just turn on the Excel macro recording and make your favorite graph
using an Excel graph wizard and see what you have. There will be extra lines of code because the Excel
macro recording will generate code to set all of the default values. You can throw away a lot of the code.
Just do one line at a time by making the line a comment. Then, check to see if you still have what you want.
Figure_13.3.10b: Excel Property Window for the Class Graph VBA Code Module.
To correct this module name issue, we need to change the name of the macro from Module1 to something
easy to remember, such as Class_Graph. We do that by typing a new name into the Properties window in
the name attribute field. See Figure 13.3.11 below. Once we have renamed the VBA code module, we can
export this Excel VBA code into a macro library for later use. To change the name, we edit the name
property (if it is not already named correctly) on the left side to the Visual Basic for Applications window,
as shown in Figure 13.3.10b. By using the “Export file” option on the File menu, we can place the new
Class_Graph macro into any directory we want to use. The one used here is the Chapter_13 macro
directory created for the example.
Figure 13.3.11: Export Window Showing the Export of File ClassGraph.bas.
Search WWH ::




Custom Search