Page 166 - Microsoft Office Excel 2003 Programming Inside Out
P. 166
Part 3: The Excel Object Model
Microsoft Office Excel 2003 Programming Inside Out
Chapter 7
Figure 7-3. You can create procedures that let your users decide whether to hide drawing
objects or leave them visible.
There are three available Excel constants that can be used as values for the DisplayDrawing-
Objects property. They are xlDisplayShapes, which shows all shapes in their full glory; xlHide,
which hides all shapes; and xlPlaceHolders, which causes Excel to print just the objects on
your worksheet.
Managing File Settings
There are two aspects of a workbook’s information you can use when you manipulate the
workbook: the workbook’s path and the workbook’s full name. A path is the complete direc-
tory listing for a file, such as C:\Excel\Data, while a workbook’s full name would include the
workbook’s file name, such as C:\Excel\Data\Q12004.xls. You can refer to these properties of
the workbook that contains your macro code using these two methods:
ThisWorkbook.Path
ThisWorkbook.FullName
When you’re working in the Visual Basic Editor and want to add the full name or path of
the workbook to which you’re adding code, you can click View, Immediate Window to
open the Immediate Window and type MsgBox (ThisWorkbook.FullName) or MsgBox
(ThisWorkbook.Path) to find the directory and file name information for your procedures.
This information isn’t of great importance if you don’t plan to transfer your code outside of
the current workbook, but if you need to refer to this particular workbook from elsewhere,
you will need to use the full name of the file. And, while you could get the same information
140