AutoCAD2006VBAAProgrammer’sReferenceJoeSutphin5793fm_final.qxd8/24/0512:01AMPageiAutoCAD2006VBA:AProgrammer’sReferenceCopyright©2005byJoeSutphinAllrightsreserved.Nopartofthisworkmaybereproducedortransmittedinanyformorbyanymeans,electronicormechanical,includingphotocopying,recording,orbyanyinformationstorageorretrievalsystem,withoutthepriorwrittenpermissionofthecopyrightownerandthepublisher.ISBN:1-59059-579-3LibraryofCongressCataloging-in-Publicationdataisavailableuponrequest.PrintedandboundintheUnitedStatesofAmerica987654321Trademarkednamesmayappearinthisbook.Ratherthanuseatrademarksymbolwitheveryoccurrenceofatrademarkedname,weusethenamesonlyinaneditorialfashionandtothebenefitofthetrademarkowner,withnointentionofinfringementofthetrademark.LeadEditor:TonyDavisTechnicalReviewers:PhillipAsh,SteveJohnsonEditorialBoard:SteveAnglin,DanAppleman,EwanBuckingham,GaryCornell,TonyDavis,JasonGilmore,JonathanHassell,ChrisMills,DominicShakeshaft,JimSumserAssociatePublisher:GraceWongProjectManager:KylieJohnstonCopyEditManager:NicoleLeClercCopyEditors:CandaceEnglish,KimWimpsettAssistantProductionDirector:KariBrooks-CoponyProductionEditor:JanetVailCompositor:LindaWeidemann,WolfCreekPressProofreaders:LindaSeifertandSueBoshersIndexer:BroccoliInformationManagementInteriorDesigner:VanWinkleDesignGroupCoverDesigner:KurtKramesManufacturingManager:TomDebolskiDistributedtothebooktradeworldwidebySpringer-VerlagNewYork,Inc.,233SpringStreet,6thFloor,NewYork,NY10013.Phone1-800-SPRINGER,fax201-348-4505,e-mailorders-ny@springer-sbm.com,orvisit@apress.com,orvisit“asis”basis,withoutwarranty.Althougheveryprecautionhasbeentakeninthepreparationofthiswork,neithertheauthor(s)norApressshallhaveanyliabilitytoanypersonorentitywithrespecttoanylossordamagecausedorallegedtobecauseddirectlyorindirectlybytheinformationcontainedinthiswork.Thesourcecodeforthisbookisavailabletoreadersat:01AMPageiiThisbookisdedicatedtomywife,Grace.Withouther,Iwouldnotbeabletoaccomplishthetaskofwritingabook.5793fm_final.qxd8/24/0512:01AMPageiii5793fm_final.qxd8/24/0512:01AMPageivContentsataGlanceAbouttheAuthor.................................................................xxvAbouttheTechnicalReviewers....................................................xxviiAcknowledgments...............................................................xxixIntroduction.....................................................................xxxi■CHAPTER1TheVBAIntegratedDevelopmentEnvironment(VBAIDE).........1■CHAPTER2IntroductiontoVisualBasicProgramming......................23■CHAPTER3ApplicationElements..........................................55■CHAPTER4AutoCADEvents...............................................67■CHAPTER5UserPreferences.............................................75■CHAPTER6ControllingLayersandLinetypes...............................87■CHAPTER7UserInteractionandtheUtilityObject........................111■CHAPTER8DrawingObjects..............................................143■CHAPTER9Creating3-DObjects.........................................173■CHAPTER10EditingObjects...............................................205■CHAPTER11DimensionsandAnnotations.................................231■CHAPTER12SelectionSetsandGroups....................................259■CHAPTER13Blocks,Attributes,andExternalReferences...................285■CHAPTER14ViewsandViewports..........................................321■CHAPTER15LayoutandPlotConfigurations................................337■CHAPTER16ControllingMenusandToolbars...............................355■CHAPTER17DrawingSecurity............................................383■CHAPTER18UsingtheWindowsAPI........................................391■CHAPTER19ConnectingtoExternalApplications..........................403■CHAPTER20CreatingTables..............................................415■CHAPTER21TheSummaryInfoObject......................................427■CHAPTER22AnIllustrativeVBAApplication................................437■APPENDIXAAutoCADObjectSummary....................................447■APPENDIXBAutoCADConstantsReference................................631■APPENDIXCSystemVariables.............................................671■INDEX.......................................................................697v5793fm_final.qxd8/24/0512:01AMPagev5793fm_final.qxd8/24/0512:01AMPageviContentsAbouttheAuthor.................................................................xxvAbouttheTechnicalReviewers....................................................xxviiAcknowledgments...............................................................xxixIntroduction.....................................................................xxxi■CHAPTER1TheVBAIntegratedDevel