Programming excel with VBA and NET

2.3K 66 0
Programming excel with VBA and NET

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Programming Excel with VBA and NET By Steve Saunders, Jeff Webb Publisher: O'Reilly Pub Date: April 2006 Print ISBN-10: 0-596-00766-3 Print ISBN-13: 978-0-59-600766-9 Pages: 1114 Table of Contents | Index Why program Excel? For solving complex calculations and presenting results, Excel is amazingly complete with every imaginable feature already in place But programming Excel isn't about adding new features as much as it's about combining existing features to solve particular problems With a few modifications, you can transform Excel into a task-specific piece of software that will quickly and precisely serve your needs In other words, Excel is an ideal platform for probably millions of small spreadsheet-based software solutions The best part is, you can program Excel with no additional tools A variant of the Visual Basic programming language, VB for Applications (VBA) is built into Excel to facilitate its use as a platform With VBA, you can create macros and templates, manipulate user interface features such as menus and toolbars, and work with custom user forms or dialog boxes VBA is relatively easy to use, but if you've never programmed before, Programming Excel with VBA and NET is a great way to learn a lot very quickly If you're an experienced Excel user or a Visual Basic programmer, you'll pick up a lot of valuable new tricks Developers looking forward to NET development will also find discussion of how the Excel object model works with NET tools, including Visual Studio Tools for Office (VSTO) This book teaches you how to use Excel VBA by explaining concepts clearly and concisely in plain English, and provides plenty of downloadable samples so you can learn by doing You'll be exposed to a wide range of tasks most commonly performed with Excel, arranged into chapters according to subject, with those subjects corresponding to one or more Excel objects With both the samples and important reference information for each object included right in the chapters, instead of tucked away in separate sections, Programming Excel with VBA and NET covers the entire Excel object library For those just starting out, it also lays down the basic rules common to all programming languages With this single-source reference and how-to guide, you'll learn to use the complete range of Excel programming tasks to solve problems, no matter what you're experience level This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Programming Excel with VBA and NET By Steve Saunders, Jeff Webb Publisher: O'Reilly Pub Date: April 2006 Print ISBN-10: 0-596-00766-3 Print ISBN-13: 978-0-59-600766-9 Pages: 1114 Table of Contents | Index Programming Excel with VBA and NET Preface Part I: Learning VBA Chapter Becoming an Excel Programmer Section 1.1 Why Program? Section 1.2 Record and Read Code Section 1.3 Change Recorded Code Section 1.4 Fix Misteakes Section 1.5 Start and Stop Section 1.6 View Results Section 1.7 Where's My Code? Section 1.8 Macros and Security Section 1.9 Write Bug-Free Code Section 1.10 Navigate Samples and Help Section 1.11 What You've Learned Chapter Knowing the Basics Section 2.1 Parts of a Program Section 2.2 Classes and Modules Section 2.3 Procedures Section 2.4 Variables Section 2.5 Conditional Statements Section 2.6 Loops Section 2.7 Expressions Section 2.8 Exceptions Section 2.9 What You've Learned Chapter Tasks in Visual Basic Section 3.1 Types of Tasks Section 3.2 Interact with Users Section 3.3 Do Math Section 3.4 Work with Text Section 3.5 Get Dates and Times Section 3.6 Read and Write Files Section 3.7 Check Results Section 3.8 Find Truth Section 3.9 Compare Bits Section 3.10 Run Other Applications Section 3.11 Control the Compiler Section 3.12 Not Covered Here Section 3.13 What You've Learned Chapter Using Excel Objects This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 4.1 Objects and Their Members Section 4.2 Get Excel Objects Section 4.3 Get Objects from Collections Section 4.4 About Me and the Active Object Section 4.5 Find the Right Object Section 4.6 Common Members Section 4.7 Respond to Events in Excel Section 4.8 The Global Object Section 4.9 The WorksheetFunction Object Section 4.10 What You've Learned Chapter Creating Your Own Objects Section 5.1 Modules Versus Classes Section 5.2 Add Methods Section 5.3 Create Properties Section 5.4 Define Enumerations Section 5.5 Raise Events Section 5.6 Collect Objects Section 5.7 Expose Objects Section 5.8 Destroy Objects Section 5.9 Things You Can't Do Section 5.10 What You've Learned Chapter Writing Code for Use by Others Section 6.1 Types of Applications Section 6.2 The Development Process Section 6.3 Determine Requirements Section 6.4 Design Section 6.5 Implement and Test Section 6.6 Integrate Section 6.7 Test Platforms Section 6.8 Document Section 6.9 Deploy Section 6.10 What You've Learned Section 6.11 Resources Part II: Excel Objects Chapter Controlling Excel Section 7.1 Perform Tasks Section 7.2 Control Excel Options Section 7.3 Get References Section 7.4 Application Members Section 7.5 AutoCorrect Members Section 7.6 AutoRecover Members Section 7.7 ErrorChecking Members Section 7.8 SpellingOptions Members Section 7.9 Window and Windows Members Section 7.10 Pane and Panes Members Chapter Opening, Saving, and Sharing Workbooks Section 8.1 Add, Open, Save, and Close Section 8.2 Share Workbooks Section 8.3 Program with Shared Workbooks Section 8.4 Program with Shared Workspaces Section 8.5 Respond to Actions Section 8.6 Workbook and Workbooks Members Section 8.7 RecentFile and RecentFiles Members This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 8.7 RecentFile and RecentFiles Members Chapter Working with Worksheets and Ranges Section 9.1 Work with Worksheet Objects Section 9.2 Worksheets and Worksheet Members Section 9.3 Sheets Members Section 9.4 Work with Outlines Section 9.5 Outline Members Section 9.6 Work with Ranges Section 9.7 Range Members Section 9.8 Work with Scenario Objects Section 9.9 Scenario and Scenarios Members Section 9.10 Resources Chapter 10 Linking and Embedding Section 10.1 Add Comments Section 10.2 Use Hyperlinks Section 10.3 Link and Embed Objects Section 10.4 Speak Section 10.5 Comment and Comments Members Section 10.6 Hyperlink and Hyperlinks Members Section 10.7 OleObject and OleObjects Members Section 10.8 OLEFormat Members Section 10.9 Speech Members Section 10.10 UsedObjects Members Chapter 11 Printing and Publishing Section 11.1 Print and Preview Section 11.2 Control Paging Section 11.3 Change Printer Settings Section 11.4 Filter Ranges Section 11.5 Save and Display Views Section 11.6 Publish to the Web Section 11.7 AutoFilter Members Section 11.8 Filter and Filters Members Section 11.9 CustomView and CustomViews Members Section 11.10 HPageBreak, HPageBreaks, VPageBreak, VPageBreaks Members Section 11.11 PageSetup Members Section 11.12 Graphic Members Section 11.13 PublishObject and PublishObjects Members Section 11.14 WebOptions and DefaultWebOptions Members Chapter 12 Loading and Manipulating Data Section 12.1 Working with QueryTable Objects Section 12.2 QueryTable and QueryTables Members Section 12.3 Working with Parameter Objects Section 12.4 Parameter Members Section 12.5 Working with ADO and DAO Section 12.6 ADO Objects and Members Section 12.7 DAO Objects and Members Section 12.8 DAO.Database and DAO.Databases Members Section 12.9 DAO.Document and DAO.Documents Members Section 12.10 DAO.QueryDef and DAO.QueryDefs Members Section 12.11 DAO.Recordset and DAO.Recordsets Members Chapter 13 Analyzing Data with Pivot Tables Section 13.1 Quick Guide to Pivot Tables Section 13.2 Program Pivot Tables This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 13.3 PivotTable and PivotTables Members Section 13.4 PivotCache and PivotCaches Members Section 13.5 PivotField and PivotFields Members Section 13.6 CalculatedFields Members Section 13.7 CalculatedItems Members Section 13.8 PivotCell Members Section 13.9 PivotFormula and PivotFormulas Members Section 13.10 PivotItem and PivotItems Members Section 13.11 PivotItemList Members Section 13.12 PivotLayout Members Section 13.13 CubeField and CubeFields Members Section 13.14 CalculatedMember and CalculatedMembers Members Chapter 14 Sharing Data Using Lists Section 14.1 Use Lists Section 14.2 ListObject and ListObjects Members Section 14.3 ListRow and ListRows Members Section 14.4 ListColumn and ListColumns Members Section 14.5 ListDataFormat Members Section 14.6 Use the Lists Web Service Section 14.7 Lists Web Service Members Section 14.8 Resources Chapter 15 Working with XML Section 15.1 Understand XML Section 15.2 Save Workbooks as XML Section 15.3 Use XML Maps Section 15.4 Program with XML Maps Section 15.5 XmlMap and XmlMaps Members Section 15.6 XmlDataBinding Members Section 15.7 XmlNamespace and XmlNamespaces Members Section 15.8 XmlSchema and XmlSchemas Members Section 15.9 Get an XML Map from a List or Range Section 15.10 XPath Members Section 15.11 Resources Chapter 16 Charting Section 16.1 Navigate Chart Objects Section 16.2 Create Charts Quickly Section 16.3 Embed Charts Section 16.4 Create More Complex Charts Section 16.5 Choose Chart Type Section 16.6 Create Combo Charts Section 16.7 Add Titles and Labels Section 16.8 Plot a Series Section 16.9 Respond to Chart Events Section 16.10 Chart and Charts Members Section 16.11 ChartObject and ChartObjects Members Section 16.12 ChartGroup and ChartGroups Members Section 16.13 SeriesLines Members Section 16.14 Axes and Axis Members Section 16.15 DataTable Members Section 16.16 Series and SeriesCollection Members Section 16.17 Point and Points Members Chapter 17 Formatting Charts Section 17.1 Format Titles and Labels This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 17.1 Format Titles and Labels Section 17.2 Change Backgrounds and Fonts Section 17.3 Add Trendlines Section 17.4 Add Series Lines and Bars Section 17.5 ChartTitle, AxisTitle, and DisplayUnitLabel Members Section 17.6 DataLabel and DataLabels Members Section 17.7 LeaderLines Members Section 17.8 ChartArea Members Section 17.9 ChartFillFormat Members Section 17.10 ChartColorFormat Members Section 17.11 DropLines and HiLoLines Members Section 17.12 DownBars and UpBars Members Section 17.13 ErrorBars Members Section 17.14 Legend Members Section 17.15 LegendEntry and LegendEntries Members Section 17.16 LegendKey Members Section 17.17 Gridlines Members Section 17.18 TickLabels Members Section 17.19 Trendline and Trendlines Members Section 17.20 PlotArea Members Section 17.21 Floor Members Section 17.22 Walls Members Section 17.23 Corners Members Chapter 18 Drawing Graphics Section 18.1 Draw in Excel Section 18.2 Create Diagrams Section 18.3 Program with Drawing Objects Section 18.4 Program Diagrams Section 18.5 Shape, ShapeRange, and Shapes Members Section 18.6 Adjustments Members Section 18.7 CalloutFormat Members Section 18.8 ColorFormat Members Section 18.9 ConnectorFormat Members Section 18.10 ControlFormat Members Section 18.11 FillFormat Members Section 18.12 FreeFormBuilder Section 18.13 GroupShapes Members Section 18.14 LineFormat Members Section 18.15 LinkFormat Members Section 18.16 PictureFormat Members Section 18.17 ShadowFormat Section 18.18 ShapeNode and ShapeNodes Members Section 18.19 TextFrame Section 18.20 TextEffectFormat Section 18.21 ThreeDFormat Chapter 19 Adding Menus and Toolbars Section 19.1 About Excel Menus Section 19.2 Build a Top-Level Menu Section 19.3 Create a Menu in Code Section 19.4 Build Context Menus Section 19.5 Build a Toolbar Section 19.6 Create Toolbars in Code Section 19.7 CommandBar and CommandBars Members This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 19.8 CommandBarControl and CommandBarControls Members Section 19.9 CommandBarButton Members Section 19.10 CommandBarComboBox Members Section 19.11 CommandBarPopup Members Chapter 20 Building Dialog Boxes Section 20.1 Types of Dialogs Section 20.2 Create Data-Entry Forms Section 20.3 Design Your Own Forms Section 20.4 Use Controls on Worksheets Section 20.5 UserForm and Frame Members Section 20.6 Control and Controls Members Section 20.7 Font Members Section 20.8 CheckBox, OptionButton, ToggleButton Members Section 20.9 ComboBox Members Section 20.10 CommandButton Members Section 20.11 Image Members Section 20.12 Label Members Section 20.13 ListBox Members Section 20.14 MultiPage Members Section 20.15 Page Members Section 20.16 ScrollBar and SpinButton Members Section 20.17 TabStrip Members Section 20.18 TextBox and RefEdit Members Chapter 21 Sending and Receiving Workbooks Section 21.1 Send Mail Section 21.2 Work with Mail Items Section 21.3 Collect Review Comments Section 21.4 Route Workbooks Section 21.5 Read Mail Section 21.6 MsoEnvelope Members Section 21.7 MailItem Members Section 21.8 RoutingSlip Members Part III: Extending Excel Chapter 22 Building Add-ins Section 22.1 Types of Add-ins Section 22.2 Code-Only Add-ins Section 22.3 Visual Add-ins Section 22.4 Set Add-in Properties Section 22.5 Sign the Add-in Section 22.6 Distribute the Add-in Section 22.7 Work with Add-ins in Code Section 22.8 AddIn and AddIns Members Chapter 23 Integrating DLLs and COM Section 23.1 Use DLLs Section 23.2 Use COM Applications Chapter 24 Getting Data from the Web Section 24.1 Perform Web Queries Section 24.2 QueryTable and QueryTables Web Query Members Section 24.3 Use Web Services Section 24.4 Resources Chapter 25 Programming Excel with NET Section 25.1 Approaches to Working with NET Section 25.2 Create NET Components for Excel This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 25.2 Create NET Components for Excel Section 25.3 Use NET Components in Excel Section 25.4 Use Excel as a Component in NET Section 25.5 Create Excel Applications in NET Section 25.6 Resources Chapter 26 Exploring Security in Depth Section 26.1 Security Layers Section 26.2 Understand Windows Security Section 26.3 Password-Protect and Encrypt Workbooks Section 26.4 Program with Passwords and Encryption Section 26.5 Workbook Password and Encryption Members Section 26.6 Excel Password Security Section 26.7 Protect Items in a Workbook Section 26.8 Program with Protection Section 26.9 Workbook Protection Members Section 26.10 Worksheet Protection Members Section 26.11 Chart Protection Members Section 26.12 Protection Members Section 26.13 AllowEditRange and AllowEditRanges Members Section 26.14 UserAccess and UserAccessList Members Section 26.15 Set Workbook Permissions Section 26.16 Program with Permissions Section 26.17 Permission and UserPermission Members Section 26.18 Add Digital Signatures Section 26.19 Set Macro Security Section 26.20 Set ActiveX Control Security Section 26.21 Distribute Security Settings Section 26.22 Using the Anti-Virus API Section 26.23 Common Tasks Section 26.24 Resources Part IV: Appendixes Appendix A Reference Tables Section A.1 Dialogs Collection Constants Section A.2 Common Programmatic IDs Appendix B Version Compatibility Section B.1 Summary of Version Changes Section B.2 Macintosh Compatibility About the Author Colophon Index This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Programming Excel with VBA and NET by Jeff Webb and Steve Saunders Copyright © 2006 O'Reilly Media, Inc All rights reserved Printed in the United States of America Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O'Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (safari.oreilly.com) For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com Editor: Simon St.Laurent, John Osborn Production Editor: Sanders Kleinfeld Copyeditor: Norma Emory Indexer: Ellen Troutman-Zaig Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrators: Robert Romano, Jessamyn Read, and Lesley Borash Printing History: April 2006: First Edition Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly Media, Inc Programming Excel with VBA and NET, the image of a shoveler duck, and related trade dress are trademarks of O'Reilly Media, Inc Microsoft, the NET logo, Visual Basic NET, Visual Studio NET, ADO.NET, Excel, Windows, and Windows 2000 are registered trademarks of Microsoft Corporation Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O'Reilly Media, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN: 0-596-00766-3 [M] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Preface I was lucky enough to be at Microsoft when Visual Basic was added to Excel I had just wrapped up working on OLE Automationthe technology used to make Excel objects programmableand I remember that meetings with the Excel group were, at times, difficult Why should a premier Microsoft product like Excel put so much effort into adding a lowprofit item like Visual Basic when it already had a macro language? "Because BillG said so" takes you only so far, even at Microsoft The facts are that programmability doesn't sell products the way some other whizbang feature might, it adds risk to delivering the product bug-free and on time, and (we found out) it poses a security hazard What programmability does is make your product a platform for others Today, Excel is the foundation for probably millions of small spreadsheet-based software solutions and is used by certainly thousands of very large and sophisticated applications That sells products It also makes the skill of programming Excel extremely valuable The community of Excel programmers is large, knowledgeable, and (I hope) well paid Learn by Doing There are always new Excel programmers joining our ranks If you are new to Excel or new to programming, I welcome you This book isn't a beginner series, but if you read the early chapters and are motivated, I think you'll find this book a great way to learn a lot very quickly If you are an experienced Excel user or a Visual Basic programmer, howdy! I've got a lot to show you Don't Force It If you get stuck, there are a number of ways to resume your progress: Try turning on macro recording (Tools Macros Record a New Macro), performing the task in Excel, and then turning off recording and examining the code that Excel generates Search MSDN (http://www.microsoft.com/msdn) to see if Microsoft has addressed your problem Search newsgroups (http://groups.google.com/groups) to see if someone else has solved your problem And of course, you can always check http://excelworkshop.com to see if I've solved the problem! If something still seems too difficult, examine your approach I generally go fishing in that situation and come back to the problem later If you don't live somewhere with good fishing, I guess you're just stuck Excel Versions This book was developed with Excel 2003 Professional Edition and is designed to be compatible with Excel 2000 and later If a feature is not available in Excel 2000, I make an effort to note that, but if you are developing for a specific version of Excel, please check Appendix B for specific version compatibility and read Chapter for information on developing design requirements and testing for compatibility If you are developing with NET, I strongly recommend that you target Excel 2003 or later The code shown in this book is written in the Visual Basic Applications Edition, but parallel NET samples are provided online (see the next section) Get the Samples The samples for this book are available at http://excelworkshop.com You'll need them, so go get them now The examples come in a Windows compressed folder (.zip) that you'll need to expand on your computer The samples are organized by chapter, and each chapter has parallel samples written as Visual Studio NET projects Each chapter uses one main workbook (ch01.xls, ch02.xls, etc.) as a starting point to provide instructions and navigation What's in This Book This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] UCase function UnderlyingValue (Field) Undo item, Edit menu Undo method (Application) UndoAction method (UserForm) Ungroup method (Shape) Union method (Application) unit testing conventions when writing tests procedures unit tests Unlink method (ListObject) 2nd Unlist method (ListObject) 2nd UnMerge method (Range) Unprotect method AllowEditRange object Chart object Workbook object Worksheet object Unprotect method (Worksheet) UnprotectSharing method (Workbook) Until statement, using in Do Loop UpBars method (ChartGroup) UpBars object Update method OLEObject object PivotTable object UpdateChanges method (ListObject) 2nd UpdateFromFile (Workbook) UpdateLink method (Workbook) UpdateLinks method (Workbook) UpdateLinksOnSave (DefaultWebOptions) UpdateList method (Lists Web Service) UpdateListItems method (Lists Web Service) UpdateRemoteReferences (Workbook) updating web queries periodically upper bound of an array Uri property (XmlNamespace) URL for help file UsableWidth method (Application) UsedObjects collection displaying all objects loaded in Excel members UsedObjects method (Application) UsedRange method (Worksheet) 2nd UsedRange property 2nd returning Range object UseLocalConnection (PivotCache) UseLongFileNames (WebOptions) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com UseLongFileNames (WebOptions) UsePicture method (ChartFillFormat) user actions, locking out user interaction, Visual Basic user-defined functions (UDFs) help files displayed for help on marking for recalculation user-defined types UserAccess object UserAccessList collection UserControl property (Application) UserForm object Controls property UserId property (UserPermission) UserLibraryPath method (Application) UserName method (Application) UserPermission object users access control in Windows organization name for viewing in Windows XP Users property (AllowEditRange) UserStatus property (Workbook) 2nd UserTextured method (ChartFillFormat) UseSheets method UseStandardHeight (Range) UseStandardWidth (Range) UseSystemSeparators (Application) UseWorksheets method This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] VacatedStyle (PivotTable) Val function 2nd validation advanced, for data form rules, adding to data forms sample settings for data form Value method Parameter object Range object Value property Field object objects having Parameter object PivotTable object XmlNamespaces object XPath object value types Values method (Scenario) Values property (Series) variable-length strings variables arrays conversions declarations data types declaring all to avoid bugs declaring, benefits of in Visual Basic programs misspelled names multiple, referring to single-instance class names naming objects recorded code and replacing literal references with scope and lifetime size of user-defined types Variant type arrays length of Variants, ParamArray arguments VarType function VaryByCategories (ChartGroup) VBA code, converting to NET VBA help files VBASigned (Workbook) vbBinaryCompare function VBE (Visual Basic Editor) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com VBE (Visual Basic Editor) VBE method (Application) VbMsgBoxResult enumeration VbMsgBoxStyle settings VBProject method (Workbook) VBScript installer for add-ins installing add-in installing template removing add-in web site for further information Vector Markup Language (VML) Verb method (OLEObject) Verio, hosting provider for SharePoint Services Verisign timestamp service 2nd Version method Application object PivotTable object Version property (Connection) versions, Excel, xvi 2nd Excel objects listed by version Macintosh compatibility summary of version changes vertical scrollbar, displaying VerticalAlignment method (Range) VerticalAlignment property (TextFrame) VerticalAlignment property (title) VerticalFlip property (Shape) VerticalScrollBarSide (UserForm) Vertices property (Shape) View method (Window) ViewCalculatedMembers (PivotTable) ViewFields element, online information viewing results from Excel code views custom views of a workbook CustomView and CustomViews members personal view, workbooks saving and displaying viruses Anti-Virus API Office Anti Virus API Visible property Application object setting for class VisibleFields method (PivotTable) VisibleItems method (PivotField) VisibleRange method (Window) visual add-ins 2nd adding menu item for adding toolbar responding to application events Visual Basic classes and modules code, storage in Excel conditional statements constants and enumerations DLL functions converted to errors, fixing This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com errors, fixing exceptions expressions fixing compile-time errors fixing runtime errors fixing syntax errors help file, specifying in project properties loops names, rules for parts of a program procedures arguments and results events named arguments optional arguments properties scope for procedures Standard and Professional Editions tasks Boolean tests checking results comparing bits controlling the compiler getting dates and times interacting with users managing files math obsolete or obscure functions overview reading and writing files running other applications working with text transforming XML from variables arrays conversions declaring objects scope and lifetime user-defined types watches Visual Basic Editor add-in, selecting from Available Refrences creating object from a class testing a form Visual Basic Editor (VBE) 2nd Visual Basic for Applications (VBA), printing and publishing objects from Visual Basic Help for Excel VisualTotals (PivotTable) VML (Vector Markup Language) void functions Volatile method (Application) VPageBreak object Delete method members VPageBreaks collection members This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] Wait method (Application) Walls method (Chart) Walls object WallsAndGridlines2D (Chart) watch points (Visual Basic) watches (Visual Basic) Watches method (Application) web address for help file web address, workbook opened from web pages, workbooks saved as web queries limitations of performing cleaning up unneeded query tables destination for imported data formatting options modifying a query periodic updates trapping QueryTable events QueryTable and QueryTables members Web Service Description Language (WSDL) web services 2nd calling asynchronously locating on the Internet reformatting XML results for Excel using through XML Web Services Toolkit Web Services Toolkit 2nd 3rd online information using WebConsecutiveDelimitersAsOne (QueryTable) WebDisableDateRecognition (QueryTable) WebDisableRedirections (QueryTable) WebFormatting property (QueryTable) WebOptions method (Workbook) WebOptions object, members WebPreFormattedTextToColumns (QueryTable) WebSelectionType (QueryTable) WebSelectionType property WebSingleBlockTextImport (QueryTable) WebTables property WebTables property (QueryTable) Weekday function While statement, using in Do Loop While Wend statement whitespace, removing from strings width default column width setting for columns in range This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com setting for columns in range usable area of Excel Width # function Width method (Application) Width property Win32 API WIN32API.TXT file Window object Activate methods 2nd Close method closing and maximizing child windows members 2nd PrintOut and PrintPreview methods windows panes setting procedure to run upon activation Windows API functions using handles with Windows collection Arrange method CompareSideBySideWith method members SyncScrollingSideBySide property Windows Common Object Model (COM) Windows method Application object Workbook object Windows NT and earlier, install locations for applications Windows Server 2003 Windows task bar Windows Task Manager WindowsForPens (Application) WindowState method (Application) WindowState method (Window) WindowState property (Application) WinExec function WinZip self-extractor URL for downloads WinZip tool URL for downloads With keyword WithEvents (Workbook variable) WithEvents keyword declaring NET object with 2nd Word automation from Visual Basic Diagram object exceptions, anticipating from Excel integrating with Excel object library, referencing from Excel programming from Excel running from Excel Word 2003, opening XML spreadsheet Word document embedded on the active worksheet getting object from embedded document WordArt embedded shapes 2nd 3rd text WordWrap property (TextBox, RefEdit) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com WordWrap property (TextBox, RefEdit) workbook (.xls) file Visual Basic code in Workbook object Activate method BeforePrint event CanCheckOut property Charts property CustomViews property events 2nd declaring in any class SheetSelectionChange FollowHyperlink method getting PublishObjects collection from members (key), reference summary members, listed object and event lists password and encryption members PivotCache collection PrintOut and PrintPreview methods protection members returning for file containing current procedure RoutingSlip property Save method SaveAs method SharedWorkspace property SheetActivate event XmlNamespaces method workbooks accessing and responding to events advantages/disadvantages of applications applications, writing bringing data into closing creating hardcopy and online output from creating test workbook for add-in installing loading, predefined folders for objects opening text files as opening XML files opening, saving, and controlling files adding workbook with templates opening as read-only or with passwords opening text files recalculating before saving saving before quitting security encryption password protection and encryption protecting items sending and receiving workbooks (continued) sending as email attachment mail items routing SendForReview method setting permissions shared, programming with changing sharing options This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com changing sharing options determining if shared removing sharing resolving conflicts restricting user access sharing creating shared workbook creating shared workspace shared workspaces Workbooks collection Add method 2nd Application object getting from Application object, Workbooks property members, listed Open method OpenDatabase method OpenText method OpenXML method Workbooks method (Application) worksheet menu bar adding top-level menu Worksheet method (Range) Worksheet object 2nd Activate event Activate method AutoFilter member AutoFilter property Cells, Range, UsedRange, Columns, or Rows method ChartObjects property Comments collection CreatePivotTableWizard method events Hyperlinks method MailEnvelope property members (key), reference summary members, listed object and event lists OLEObjects method Outline property 2nd PageSettings property PageSetup property PrintOut and PrintPreview methods protection members QuertyTables property Scenarios method SelectionChange event ShowAllData method WorksheetFunction method (Application) WorksheetFunction object members worksheets adding comments, hyperlinks and OLE objects to changes on, listing controls on worksheets versus controls on forms creating graphics, objects used for embedding a control events number automatically included in new workbooks print settings repeating formatting and charting in recorded code This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com repeating formatting and charting in recorded code security security protections sending as email using MsoEnvelope using controls on working with, objects for 2nd Worksheets collection 2nd 3rd Add method Application object members, listed PrintOut and PrintPreview methods UseWorksheets method Worksheets method objects returned by Workbook object 2nd workspace files (.xlw) saving current settings shared workspaces versus workspaces shared 2nd creating linking workbook to opening workbooks from removing sharing from workbooks WrapText property (Range) Write # function write-once properties 2nd write-only properties creating WritePassword (Workbook) WriteReserved (Workbook) WriteReservedBy (Workbook) WScript.Shell URL for WSDL (Web Service Description Language) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] XLL, loading and registering XLSTART directory, path to XML custom schemas, support of exporting workbook to XML datafile importing/exporting, objects for language standards lists stored as loading file into workbook objects for importing/exporting online resources opening files in Excel overview reformatting for Excel responding to XML events saving workbooks as data omitted by Excel spreadsheet format transforming from command line transforming in code transforming with processing instructions transforming XML files into spreadsheets transforming XML spreadsheets XSLT, creating for XML spreadsheets Source task pane, displaying support by Excel 2003 supporting standards for using web services through XML maps approaches to using avoiding denormalized data creating XML schema including all nodes in exports XML schema elements not supported exporting data items omitted by Excel getting from list or range limitations of programming with adding or deleting XML maps exporting/importing XML refresh, change, or clear data binding viewing the schema using schemas XML method (XmlSchema) xml-stylesheet processing instruction XmlDataBinding object LoadSettings method This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com LoadSettings method Refresh method RootElementNamespace method XmlImport method (Workbook) XmlImportXml method (Workbook) XmlMap object Delete method Export method Import method IsExportable property members Schemas method tasks performed in code XMLMap property (ListObject) XmlMaps collection Add method members XMLMaps method (Workbook) XMLNamespace object XmlNamespaces collection XmlNamespaces method (Workbook) 2nd XMLNodeList arguments XmlSchema object, members XmlSchemas collection, members XOR operator XPath XPath method (ListColumn) XPath object members XSD (XML Schema Definition) online tutorial XSL online resources xsl:processing-instruction element XSLT creating for XML spreadsheet online tutorial XSLT (continued) replacing mso-application instruction with xml-stylesheet instruction transformations performed by XValues property (Series) XYGroups method (Chart) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] Year function This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] zero values, displaying in cells Zoom property PageSetup object UserForm object Window object ZOrder property Control object OLEObject object ... queries and how to execute web services to perform tasks remotely across a network Chapter 25, Programming Excel with NET, teaches how to use NET code from within Excel, use Excel code from NET, ... Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly Media, Inc Programming Excel with VBA and NET, the image of a shoveler duck, and related... Table of Contents | Index Programming Excel with VBA and NET Preface Part I: Learning VBA Chapter Becoming an Excel Programmer Section 1.1 Why Program? Section 1.2 Record and Read Code Section 1.3

Ngày đăng: 26/03/2019, 10:02

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan