Book description
Get ready to take your Excel applications to the next level by harnessing the power of the VBA language. This comprehensive resource will help you gain more control over your spreadsheets by using VBA while also showing you how to develop more dynamic Excel applications for other users. From introductory concepts to advanced developer topics, it guides you through every aspect of Excel 2007, including the Ribbon and the XML file formats.
Table of contents
- Copyright
- About the Authors
- Credits
- Acknowledgments
- Introduction
-
1. Primer in Excel VBA
- 1.1. Using the Macro Recorder
- 1.2. User-Defined Functions
- 1.3. The Excel Object Model
-
1.4. The VBA Language
- 1.4.1. Basic Input and Output
- 1.4.2. Calling Functions and Sub Procedures
- 1.4.3. Parentheses and Argument Lists
- 1.4.4. Variable Declaration
- 1.4.5. Scope and Lifetime of Variables
- 1.4.6. Variable Type
- 1.4.7. Object Variables
- 1.4.8. Making Decisions
- 1.4.9. Looping
- 1.4.10. Arrays
- 1.4.11. Run-Time Error-Handling
- 1.5. Summary
- 2. The Application Object
- 3. Workbooks and Worksheets
-
4. Using Ranges
- 4.1. Activate and Select
- 4.2. Range Property
- 4.3. Offset Property
- 4.4. Resize Property
- 4.5. SpecialCells Method
- 4.6. CurrentRegion Property
- 4.7. End Property
- 4.8. Summing a Range
- 4.9. Columns and Rows Properties
- 4.10. Union and Intersect Methods
- 4.11. Empty Cells
- 4.12. Transferring Values between Arrays and Ranges
- 4.13. Summary
- 5. Using Names
- 6. Data Lists
- 7. PivotTables
- 8. Charts
- 9. Event Procedures
- 10. Adding Controls
- 11. Text Files and File Dialog
-
12. Working with XML and the Open XML File Formats
- 12.1. The Basics of Using XML Data in Excel
-
12.2. Using VBA to Program XML Processes
-
12.2.1. Programming XML Maps
- 12.2.1.1. Open an XML Document Directly into a List
- 12.2.1.2. Programmatically Changing XML Map Properties
- 12.2.1.3. Refresh Your XML Data
- 12.2.1.4. Turn Your XML Lists into Hard Data
- 12.2.1.5. Creating Your Own XSD
- 12.2.1.6. Creating a Custom XML List
- 12.2.1.7. Importing Data into an Existing XML Map
- 12.2.1.8. Exporting to an XML File
-
12.2.2. Leveraging DOM and XPath to Manipulate XML Files
- 12.2.2.1. Loading XML into a DOM Document
- 12.2.2.2. Using DOM with ADO to Convert Excel Data to XML
-
12.2.2.3. Traversing and Modifying XML Files with DOM and XPath
- 12.2.2.3.1. Return all Employee IDs
- 12.2.2.3.2. Return all Nodes for Any Employee with an Invoice Amount over $3000
- 12.2.2.3.3. Trap the Node that Contains the FirstName Mike
- 12.2.2.3.4. Find and Edit the Node that Contains the FirstName Mike
- 12.2.2.3.5. Find and Delete all Nodes for the Employee Bullen
-
12.2.1. Programming XML Maps
- 12.3. Using VBA to Program Open XML Files
- 12.4. Summary
- 13. UserForms
-
14. RibbonX
- 14.1. Overview
- 14.2. Prerequisites
- 14.3. Adding the Customizations
- 14.4. XML Structure
- 14.5. RibbonX and VBA
- 14.6. Control Types
- 14.7. Control Attributes
- 14.8. Control Callbacks
- 14.9. Managing Control Images
- 14.10. Other RibbonX Elements, Attributes, and Callbacks
- 14.11. Dynamic Controls
- 14.12. CommandBar Extensions for the Ribbon
- 14.13. RibbonX Limitations
- 14.14. Summary
- 15. Command Bars
- 16. Class Modules
- 17. Add-ins
-
18. Automation Add-Ins and COM Add-Ins
- 18.1. Automation Add-Ins
-
18.2. COM Add-Ins
- 18.2.1. The IDTExtensibility2 Interface (Continued)
- 18.2.2. Registering a COM Add-In with Excel
- 18.2.3. The COM Add-In Designer
- 18.3. Summary
- 19. Interacting with Other Office Applications
-
20. Data Access with ADO
- 20.1. An Introduction to Structured Query Language (SQL)
-
20.2. An Overview of ADO
- 20.2.1. The Connection Object
- 20.2.2. The Recordset Object
- 20.2.3. The Command Object
- 20.2.4. Using ADO in Microsoft Excel Applications
- 20.2.5. Using ADO with Microsoft Access
- 20.2.6. Using ADO with Microsoft SQL Server
- 20.2.7. Using ADO with Non-Standard Data Sources
- 20.3. Summary
-
21. Managing External Data
- 21.1. The External Data User Interface
- 21.2. The QueryTable and ListObject
- 21.3. The WorkbookConnection Object and the Connections Collection
- 21.4. External Data Security Settings
- 21.5. Summary
- 22. The Trust Center and Document Security
- 23. Browsing OLAP Data Sources with Excel
- 24. Excel and the Internet
-
25. International Issues
- 25.1. Changing Windows Regional Settings and the Office 2007 UI Language
-
25.2. Responding to Regional Settings and the Windows Language
- 25.2.1. Identifying the User's Regional Settings and Windows Language
-
25.2.2. VBA Conversion Functions from an International Perspective
- 25.2.2.1. Implicit Conversion
- 25.2.2.2. Date Literals
- 25.2.2.3. The IsNumeric and IsDate Functions
- 25.2.2.4. The CStr Function
- 25.2.2.5. The CDbl, CSng, CLng, CInt, CByte, CCur, and CDec Functions
- 25.2.2.6. The CDate and DateValue Functions
- 25.2.2.7. The CBool
- 25.2.2.8. The Format Function
- 25.2.2.9. The FormatCurrency, FormatDateTime, FormatNumber, and FormatPercent Functions
- 25.2.2.10. The Str Function
- 25.2.2.11. The sNumToUS Function
- 25.2.2.12. The Val Function
- 25.2.2.13. Application.Evaluate
- 25.3. Interacting with Excel
- 25.4. Interacting with Users
- 25.5. Excel 2007's International Options
- 25.6. Features That Don't Play by the Rules
- 25.7. The Range.Value, Range.Formula, and Range.FormulaArray Properties
- 25.8. The Range.AutoFilter Method
- 25.9. The Range.AdvancedFilter Method
- 25.10. The Application.Evaluate, Application.ConvertFormula, and Application.ExecuteExcel4Macro Functions
- 25.11. Responding to Office 2007 Language Settings
- 25.12. Some Helpful Functions
- 25.13. Summary
- 26. Programming the VBE
- 27. Programming with the Windows API
-
A. Excel 2007 Object Model
- A.1. Common Properties with Collections and Associated Objects
-
A.2. Excel Objects and Their Properties, Methods, and Events
- A.2.1. AboveAverage Object
- A.2.2. AboveAverage Properties
- A.2.3. Action Object and the Actions Collection
- A.2.4. Add-In Object and the Addins Collection
- A.2.5. Add-In Common Properties
- A.2.6. Adjustments Object
- A.2.7. AllowEditRange Object and the AllowEditRanges Collection
- A.2.8. Application Object
- A.2.9. Areas Collection
- A.2.10. AutoCorrect Object
- A.2.11. AutoFilter Object
- A.2.12. AutoRecover Object
- A.2.13. Axis Object and the Axes Collection
- A.2.14. AxisTitle Object
- A.2.15. Border Object and the Borders Collection
- A.2.16. CalculatedFields Collection
- A.2.17. CalculatedItems Collection
-
A.2.18. CalculatedMember Object and the CalculatedMembers Collection
- A.2.18.1. CalculatedMembers Common Properties
- A.2.18.2. CalculatedMembers Collection Properties
- A.2.18.3. CalculatedMembers Collection Methods
- A.2.18.4. CalculatedMember Common Properties
- A.2.18.5. CalculatedMember Properties
- A.2.18.6. CalculatedMember Methods
- A.2.18.7. CalculatedMembers Collection and CalculatedMember Object Example
- A.2.19. CalloutFormat Object
- A.2.20. CellFormat Object
- A.2.21. Characters Object
- A.2.22. Chart Object and the Charts Collection
- A.2.23. ChartArea Object
- A.2.24. ChartColorFormat Object
- A.2.25. ChartFillFormat Object
- A.2.26. ChartFormat Object
- A.2.27. ChartGroup Object and the ChartGroups Collection
- A.2.28. ChartObject Object and the ChartObjects Collection
- A.2.29. ChartTitle Object
- A.2.30. ChartView Object
- A.2.31. ColorFormat Object
- A.2.32. ColorScale Object
- A.2.33. ColorScale Properties
- A.2.34. End SubColorScaleCriterion and the ColorScaleCriteria Collection
- A.2.35. ColorScaleCriteria Common Properties
- A.2.36. ColorStop Object and ColorStops Collection
- A.2.37. Comment Object and the Comments Collection
- A.2.38. ConditionValue Object
- A.2.39. ConditionValue Properties
- A.2.40. Connections Object
- A.2.41. ConnectorFormat Object
- A.2.42. ControlFormat Object
- A.2.43. CubeField Object and the CubeFields Collection
- A.2.44. CustomProperty Object and the CustomProperties Collection
- A.2.45. CustomView Object and the CustomViews Collection
- A.2.46. Databar Object
- A.2.47. Databar Properties
- A.2.48. DataLabel Object and the DataLabels Collection
- A.2.49. DataTable Object
- A.2.50. DefaultWebOptions Object
- A.2.51. Dialog Object and the Dialogs Collection
- A.2.52. DisplayUnitLabel Object
- A.2.53. DownBars Object
- A.2.54. DropLines Object
- A.2.55. Error Object and the Errors Collection
- A.2.56. ErrorBars Object
- A.2.57. ErrorCheckingOptions Collection Object
- A.2.58. FillFormat Object
- A.2.59. Filter Object and the Filters Collection
- A.2.60. Floor Object
- A.2.61. Font Object
- A.2.62. FormatColor Object
- A.2.63. FormatCondition Object and the FormatConditions Collection
- A.2.64. FormatCondition Methods
- A.2.65. FreeformBuilder Object
- A.2.66. Graphic Object
- A.2.67. Gridlines Object
- A.2.68. GroupShapes Collection
- A.2.69. HeaderFooter Object
- A.2.70. HiLoLines Object
- A.2.71. HPageBreak Object and the HPageBreaks Collection
- A.2.72. Hyperlink Object and the Hyperlinks Collection
- A.2.73. Icon Object
- A.2.74. IconCriterion and the IconCriteria Collection
- A.2.75. IconCriteria Common Properties
- A.2.76. IconSet and the IconSets Collection
- A.2.77. IconSets Common Properties
- A.2.78. IconSet Properties
- A.2.79. IconSetCondition Object
- A.2.80. IconSetCondition Properties
- A.2.81. Interior Object
- A.2.82. IRtdServer Object
- A.2.83. IRTDUpdateEvent Object
- A.2.84. LeaderLines Object
- A.2.85. Legend Object
- A.2.86. LegendEntry Object and the LegendEntries Collection
- A.2.87. LegendKey Object
- A.2.88. LinearGradient Object
- A.2.89. LineFormat Object
- A.2.90. LinkFormat Object
- A.2.91. ListColumn and ListColumns Collection
- A.2.92. ListColumns Common Properties
- A.2.93. ListDataFormat Object
- A.2.94. ListObject Object and the ListObjects Collection
- A.2.95. ListObjects Common Properties
- A.2.96. ListObject Properties
- A.2.97. ListRow Object and the ListRows Collection
- A.2.98. ListRows Common Properties
- A.2.99. ListRow Properties
- A.2.100. Mailer Object
- A.2.101. MultiThreadedCalculation Object
- A.2.102. Name Object and the Names Collection
- A.2.103. Name Methods
- A.2.104. ODBCConnection Object
- A.2.105. ODBCError Object and the ODBCErrors Collection
- A.2.106. OLEDBConnection Object
- A.2.107. OLEDBError Object and the OLEDBErrors Collection
- A.2.108. OLEFormat Object
- A.2.109. OLEObject Object and the OLEObjects Collection
- A.2.110. Outline Object
- A.2.111. Page Object and the Pages Collection
- A.2.112. PageSetup Object
- A.2.113. Pane Object and the Panes Collection
- A.2.114. Parameter Object and the Parameters Collection
- A.2.115. Phonetic Object and the Phonetics Collection
- A.2.116. PictureFormat Object
- A.2.117. PivotAxis Object
- A.2.118. PivotCache Object and the PivotCaches Collection
- A.2.119. PivotCell Object
- A.2.120. PivotField Object, PivotFields Collection, and the CalculatedFields Collection
- A.2.121. PivotFilter Object and the PivotFilters Collection
- A.2.122. PivotFormula Object and the PivotFormulas Collection
- A.2.123. PivotItem Object, PivotItems Collection, and the CalculatedItems Collection
- A.2.124. PivotItemList Object
- A.2.125. PivotLayout Object
- A.2.126. PivotLine Object, the PivotLines Collection, and the PivotLinesCells Collection
- A.2.127. PivotTable Object and the PivotTables Collection
- A.2.128. PlotArea Object
- A.2.129. Point Object and the Points Collection
- A.2.130. Protection Object
- A.2.131. PublishObject Object and the PublishObjects Collection
- A.2.132. QueryTable Object and the QueryTables Collection
- A.2.133. Range Object and the Ranges Collection Object
- A.2.134. RecentFile Object and the RecentFiles Collection
- A.2.135. RectangularGradient Object
- A.2.136. RoutingSlip Object
- A.2.137. RTD Object
- A.2.138. Scenario Object and the Scenarios Collection
- A.2.139. Series Object and the SeriesCollection Collection
- A.2.140. SeriesLines Object
- A.2.141. ServerViewableItems Collection
- A.2.142. ShadowFormat Object
- A.2.143. Shape Object and the Shapes Collection
- A.2.144. ShapeNode Object and the ShapeNodes Collection
- A.2.145. ShapeRange Collection
- A.2.146. Sheets Collection
- A.2.147. SheetViews Object
- A.2.148. SmartTag Object and the SmartTags Collection Object
- A.2.149. SmartTagAction Object and the SmartTagActions Collection Object
- A.2.150. SmartTagOptions Collection Object
- A.2.151. SmartTagReconizer Object and the SmartTagRecognizers Collection Object
- A.2.152. Sort Object
- A.2.153. SortField Object and the SortFields Collection
- A.2.154. SoundNote Object
- A.2.155. Speech Object
- A.2.156. SpellingOptions Collection Object
- A.2.157. Style Object and the Styles Collection
- A.2.158. Tab Object
- A.2.159. TableStyle Object and the TableStyles Collection Object
- A.2.160. TableStyleElement Object and the TableStyleElements Collection Object
- A.2.161. TextEffectFormat Object
- A.2.162. TextFrame Object
- A.2.163. TextFrame2 Object
- A.2.164. ThreeDFormat Object
- A.2.165. TickLabels Object
- A.2.166. Top10 Object
- A.2.167. Top10 Properties
- A.2.168. TreeviewControl Object
- A.2.169. Trendline Object and the Trendlines Collection
- A.2.170. UniqueValues Object
- A.2.171. UniqueValues Properties
- A.2.172. UpBars Object
- A.2.173. UsedObjects Collection Object
- A.2.174. UserAccess Collection Object
- A.2.175. UserAccessList Collection Object
- A.2.176. Validation Object
- A.2.177. VPageBreak Object and the VPageBreaks Collection
- A.2.178. Walls Object
- A.2.179. Watch Object and the Watches Collection Object
- A.2.180. WebOptions Object
- A.2.181. Window Object and the Windows Collection
- A.2.182. Workbook Object and the Workbooks Collection
- A.2.183. WorkbookConnection Object
- A.2.184. Worksheet Object and the Worksheets Collection
- A.2.185. WorksheetFunction Object
- A.2.186. WorksheetView Object
- A.2.187. XmlDataBinding Object
- A.2.188. XmlMap Object and the XMLMaps Collection
- A.2.189. XmlNameSpace Object and the XMLNameSpacesCollection
- A.2.190. XmlSchema Object and the XmlSchemas Collection
- A.2.191. XPath Object
-
B. VBE Object Model
- B.1. Links between the Excel and VBE Object Models
- B.2. Common Properties and Methods
- B.3. AddIn Object and Add-Ins Collection
- B.4. CodeModule Object
- B.5. CodePane Object and CodePanes Collection
- B.6. CommandBarEvents Object
- B.7. Events Object
- B.8. LinkedWindows Collection
- B.9. Property Object and Properties Collection
- B.10. Reference Object and References Collection
- B.11. End FunctionReferencesEvents Object
- B.12. VBComponent Object and VBComponents Collection
- B.13. VBE Object
- B.14. VBProject Object and VBProjects Collection
- B.15. Window Object and Windows Collection
-
C. Office 2007 Object Model
- C.1. Common Properties with Collections and Associated Objects
-
C.2. Office Objects and Their Properties and Events
- C.2.1. BulletFormat2 Object
- C.2.2. COMAddinObject and the COMAddins Collection Object
- C.2.3. CommandBar Object and the CommandBars Collection Object
- C.2.4. CommandBarButton Object
- C.2.5. CommandBarComboBox Object
- C.2.6. CommandBarControl Object and the CommandBarControls Collection Object
- C.2.7. CommandBarPopup Object
- C.2.8. CustomTaskPane Object
- C.2.9. CustomXMLNode Object and the CustomXMLNodes Collection Object
- C.2.10. CustomXMLPart Object and the CustomXMLParts Collection Object
- C.2.11. CustomXMLPrefixMapping Object and the CustomXMLPrefixMappings Collection Object
- C.2.12. CustomXMLSchema Object and the CustomXMLSchemaCollection Object
- C.2.13. CustomXMLValidationError Object and the CustomXMLValidationErrors CollectionObject
- C.2.14. DocumentInspector Object and the DocumentInspectors CollectionObject
- C.2.15. DocumentLibraryVersion Object and the DocumentLibraryVersions Collection Object
- C.2.16. DocumentProperty Object and the DocumentProperties Collection Object
- C.2.17. EncryptionProvider Object
- C.2.18. FileDialog Object
- C.2.19. FileDialogFilter Object and the FileDialogFilters Collection Object
- C.2.20. FileDialogSelectedItems Collection Object
- C.2.21. FileTypes Object
- C.2.22. Font2 Object
- C.2.23. GlowFormat Object
- C.2.24. GradientStop Object and the GradientStops Collection Object
- C.2.25. IAssistance Object
- C.2.26. IBlogExtensiblity and IBlogPictureExtensibility Objects
- C.2.27. ICTPFactory Object
- C.2.28. ICustomTaskPaneConsumer Object
- C.2.29. IDocumentInspector Object
- C.2.30. IRibbonControl Object
- C.2.31. IRibbonExtensiblity Object
- C.2.32. IRibbonUI Object
- C.2.33. LanguageSettings Object
- C.2.34. MetaProperty Object and the MetaProperties Collection Object
- C.2.35. MsoEnvelope Object
- C.2.36. NewFile Object
- C.2.37. The ODSOColumn Object and the ODSOColumns Collection Object
- C.2.38. The ODSOFilter Object and the ODSOFilters Collection Object
- C.2.39. OfficeDataSourceObject Object
- C.2.40. OfficeTheme Object
- C.2.41. ParagraphFormat2 Object
- C.2.42. Permission Object
- C.2.43. PolicyItem Object and the ServerPolicy Collection Object
- C.2.44. ReflectionFormat Object
- C.2.45. Ruler2 Object
- C.2.46. RulerLevel2 Object and the RulerLevels2 Collection Object
- C.2.47. ScopeFolder Object and the ScopeFolders Collection Object
- C.2.48. SearchFolders Collection Object
- C.2.49. SearchScope Object and the SearchScopes Collection Object
- C.2.50. SharedWorkspace Object
- C.2.51. SharedWorkspaceFile Object and the SharedWorkspaceFiles Collection Object
- C.2.52. SharedWorkspaceFolder Object and the SharedWorkspaceFolders Collection Object
- C.2.53. SharedWorkspaceLink Object and the SharedWorkspaceLinks Collection Object
- C.2.54. SharedWorkspaceMember Object and the SharedWorkspaceMembers Collection Object
- C.2.55. SharedWorkspaceTask Object and the SharedWorkspaceTasks Collection Object
- C.2.56. Signature Object and the SignatureSet Collection Object
- C.2.57. SignatureInfo Object
- C.2.58. SignatureProvider Object
- C.2.59. SignatureSetup Object
- C.2.60. SmartDocument
- C.2.61. SoftEdgeFormat Object
- C.2.62. Sync Object
- C.2.63. TabStop2 Object and the TabStops2 Collection Object
- C.2.64. TextColumn2 Object and the TextColumns2 Collection Object
- C.2.65. TextRange2 Object
- C.2.66. ThemeColor Object
- C.2.67. ThemeColorsScheme Object
- C.2.68. ThemeEffectScheme Object
- C.2.69. ThemeFont Object and the ThemeFonts Collection Object
- C.2.70. ThemeFontScheme Object
- C.2.71. UserPermission
- C.2.72. WebPageFont Object and the WebPageFonts Collection Object
- C.2.73. WorkflowTask Object and the WorkflowTasks Collection Object
- C.2.74. WorkflowTemplate Object and the WorkflowTemplates Collection Object
Product information
- Title: Excel® 2007 VBA Programmer's Reference
- Author(s):
- Release date: March 2007
- Publisher(s): Wrox
- ISBN: 9780470046432
You might also like
book
Excel® 2007 Power Programming with VBA
This book is a single reference that’s indispensable for Excel beginners, intermediate users, power users, and …
book
Access 2007 Programming by Example with VBA, XML, and ASP
Access 2007 Programming by Example with VBA, XML, and ASP shows non-programmers how Access databases can …
book
Beginning Access™ 2007 VBA
This book provides you with the tools and techniques you'll need in order to build more …
book
Excel 2007 VBA Programming with XML and ASP
Excel 2007 Programming by Example with XML and ASP offers a hands-on approach for those looking …