Microsoft Visio Developer ReferenceMicrosoft Visio products include a type library that defines the...

1267
Microsoft Visio Developer Reference Welcome to the Microsoft Visio Developer Reference documentation. This documentation includes the following: What's new in Microsoft Visio 2002 for developers Automation Reference The topics in this section provide an overview of the Automation Reference, including information about the Visio object model, the Visio type library, extending the functionality of Visio with macros, add-ons, and COM (Component Object Model) add-ins, and a sample Microsoft Visual Basic for Applications (VBA) macro. Look here for details on Visio objects, properties, methods, and events. This reference also includes information about common Automation tasks, such as starting the Visual Basic Editor; viewing Visio object, property, method, and event descriptions in the Object Browser; and running macros and add-ons. Go to the Automation Reference ShapeSheet Reference The topics in this section provide an overview of the ShapeSheet Reference, including information about working with formulas, strings, date and time values, units of measure, and information about common ShapeSheet tasks, such as adding and deleting ShapeSheet sections, and referencing cells from formulas. Look here for details on each section, row, and cell in a ShapeSheet spreadsheet and details on functions you can use in formulas. Go to the ShapeSheet Reference See also

Transcript of Microsoft Visio Developer ReferenceMicrosoft Visio products include a type library that defines the...

MicrosoftVisioDeveloperReference

WelcometotheMicrosoftVisioDeveloperReferencedocumentation.Thisdocumentationincludesthefollowing:

What'snewinMicrosoftVisio2002fordevelopers

AutomationReference

ThetopicsinthissectionprovideanoverviewoftheAutomationReference,includinginformationabouttheVisioobjectmodel,theVisiotypelibrary,extendingthefunctionalityofVisiowithmacros,add-ons,andCOM(ComponentObjectModel)add-ins,andasampleMicrosoftVisualBasicforApplications(VBA)macro.

LookherefordetailsonVisioobjects,properties,methods,andevents.ThisreferencealsoincludesinformationaboutcommonAutomationtasks,suchasstartingtheVisualBasicEditor;viewingVisioobject,property,method,andeventdescriptionsintheObjectBrowser;andrunningmacrosandadd-ons.

GototheAutomationReference

ShapeSheetReference

ThetopicsinthissectionprovideanoverviewoftheShapeSheetReference,includinginformationaboutworkingwithformulas,strings,dateandtimevalues,unitsofmeasure,andinformationaboutcommonShapeSheettasks,suchasaddinganddeletingShapeSheetsections,andreferencingcellsfromformulas.

Lookherefordetailsoneachsection,row,andcellinaShapeSheetspreadsheetanddetailsonfunctionsyoucanuseinformulas.

GototheShapeSheetReference

Seealso

What'snewinMicrosoftVisio2002fordevelopers

MicrosoftVisio2002providesapowerfulsingleplatformforyourcustomdrawingsolutions.NewShapeSheetcellsandAutomationobjects,properties,methods,andeventsgiveyoumoreoptionsfordefiningthebehavioroftheelementsinyoursolutions.

NewfeaturesinVisio2002

ThefollowingtopicsprovidelistsofShapeSheetandAutomationelementsthatarenewinVisio2002.

Newcells(alphabeticlist)

Newcells(bysection)

Newobjects

Newproperties(alphabeticlist)

Newproperties(byobject)

Newmethods(alphabeticlist)

Newmethods(byobject)

Newevents

Seealso

AboutAutomation

YoucanwriteprogramstocontrolMicrosoftVisioinMicrosoftVisualBasicforApplications(VBA),MicrosoftVisualBasic,C++,oranyprogramminglanguagethatsupportsAutomation.

AprogramcanuseAutomationtoincorporateVisiodrawinganddiagrammingcapabilitiesortoautomatesimplerepetitivetasksinVisio.Forexample,aprogrammightgenerateanorganizationchartfromalistofnamesandpositionsorprintallofthemastersonastencil.

HowaprogramusingAutomationcontrolsVisio

TheVBAprogrammingenvironmentinVisio

AboutextendingthefunctionalityofMicrosoftVisio

YoucanextendthefunctionalityofMicrosoftVisiointhefollowingways:

CreateVisio-specificmacrosandadd-ons.

CreateCOM(ComponentObjectModel)add-ins.

Macrosandadd-ons

COMadd-ins

AboutXMLinMicrosoftVisio

BeginninginMicrosoftVisio2002,theExtensibleMarkupLanguage(XML)issupportedasanativefileformat,makingitpossibletoshareyourVisiodrawingsacrossmultipleplatforms.

Additionally,theVisio2002objectmodelprovidesnewpropertiesandmethodsthatmakeitpossibleforsolutiondeveloperstostorewell-formed,solution-specificXMLdatawithinaVisiodocument.

FordetailsaboutworkingwithXMLinVisio2002,seetheMicrosoftDeveloperNetwork(MSDN)Website.

AbouttheVisiotypelibrary

MicrosoftVisioproductsincludeatypelibrarythatdefinestheobjects,properties,methods,events,andconstantsthatVisioexposestoAutomationclients.TousetheVisiotypelibrary,adevelopmentenvironmentmustreferenceit.TheMicrosoftVisualBasicforApplications(VBA)projectofaVisiodocumentautomaticallyreferencestheVisiotypelibrary.Inotherdevelopmentenvironmentsyoumusttakeappropriatestepstoreferencethelibrary.

ThenamesofthelibrariesyourVBAprojectreferencesaredisplayedintheProject/LibrarylistintheObjectBrowserintheVisualBasicEditor.

Benefitsofusingatypelibrary

Resolvingobjectnameambiguities

SampleMicrosoftVBAmacro

ForeachdrawingfilethatisopenintheMicrosoftVisioinstance,thesampleMicrosoftVisualBasicforApplications(VBA)macroshownbelowdoesthefollowing:

LogsthenameandpathofthedrawingfileintheImmediatewindow

LogsthenameofeachpageintheImmediatewindow

Hereisalookatthecodeintheprogramandwhatitdoes.

PublicSubShowNames()'DeclareobjectvariablesasVisioobjecttypesDimpagObjAsVisio.PageDimdocObjAsVisio.DocumentDimdocsObjAsVisio.DocumentsDimpagsObjAsVisio.Pages'IteratethroughallopendocumentsSetdocsObj=Application.DocumentsForEachdocObjIndocsObj'PrintthedrawingnameintheVisualBasicEditor'ImmediateWindowDebug.PrintdocObj.FullName

'IteratethroughallpagesinadrawingSetpagsObj=docObj.PagesForEachpagObjInpagsObj'PrintsthepagenameintheVisualBasicEditor'ImmediateWindowDebug.PrintTab(5);pagObj.NameNextNextEndSubHereisanexampleoftheprogram'soutput,assumingOffice.vsdandRecycle.vsdareopenandhavebeensavedinthespecifiedlocations.

Sampleoutput Description

c:\visio\solutions\Office.vsd Thenameofthefirstdrawing

Background-1 Thenameofpage1

Background-2 Thenameofpage2

c:\visio\solutions\Recycle.vsdThenameoftheseconddrawing

Page-1 Thenameofpage1

Page-2 Thenameofpage2

Page-3 Thenameofpage3

YoucanfindmoreinformationaboutwritingaprogramusingtheVBAenvironmentandabouttheVisualBasicEditorintheMicrosoftVisualBasicHelp(intheVisualBasicEditorwindow,clickMicrosoftVisualBasicHelpontheHelpmenu).

YoucanfinddetailsaboutusingaspecificVisioobject,property,method,oreventintheAutomationReferenceincludedinthisDeveloperReference(ontheVisioHelpmenu,clickDeveloperReference).

NoteIfyoudidnotinstalltheDeveloperReferenceatthetimeyouinstalledVisio,clickingtheDeveloperReferencecommandontheHelpmenuwillautomaticallystartitsinstallation.

Addamacrooradd-ontoashape'sshortcutmenu

Selecttheshape.

OntheWindowmenu,clickShowShapeSheet.

ClickinanActioncellinanActionssection.

Ifyoudon'tseeanActionssection,insertonebyclickingSectionontheInsertmenu,andthenselectingtheActionscheckboxintheInsertSectiondialogbox.

OntheEditmenu,clickAction.

IntheActiondialogbox,underProperties,enterthemenuandpromptproperties.

ClickRunmacro,andthenselecttheprogramyouwanttorunfromtheRunmacrolist.ClickOK.

Onthedrawingpage,right-clicktheshape,andthenclickthecustommenucommandontheshortcutmenutoruntheprogram.

NoteYoualsocanassociateamacrooradd-onwithashapebyenteringaformulathatusestheRUNADDONfunctioninanyShapeSheetcell.

Associateamacrooradd-onwiththedouble-clickbehaviorofashape

Selecttheshapewithwhichyouwanttoassociatethemacrooradd-on.

OntheFormatmenu,clickBehavior.

IntheBehaviordialogbox,clicktheDouble-Clicktab,andthenclickRunmacro.

FromtheRunmacrolist,selectthemacrooradd-onyouwanttorun.

ClickOK.

Double-clicktheshapetorunthemacrooradd-on.

ChangethedevelopersettingsforMicrosoftVisio

OntheToolsmenu,clickOptions.

IntheOptionsdialogbox,clicktheAdvancedtab.

UnderDevelopersettings,selectthecheckboxesforthesettingsyouwant,andthenclickOK.

Runamacrooradd-onfromtheMacrosdialogbox

IntheMicrosoftVisiowindow,clickMacrosontheToolsmenu,andthenclickMacros.

Choosethemacrooradd-onyouwanttorun,andthenclickRun.

NoteIfyouhavemorethanoneMicrosoftVisiodrawingopenandthemacroyouwanttorundoesnotappearintheMacrosdialogbox,makesureyouhavechosentheVisiodocumentinwhichthemacroisstoredfromtheMacrosinlist.

StarttheVisualBasicEditor

OntheToolsmenu,clickMacros,andthenclickVisualBasicEditor.OrpressALT+F11.

TipForquickeraccesstotheVisualBasicEditorandotherdevelopercommands,youcanshowtheDevelopertoolbarinMicrosoftVisio.Todothis,right-clickanywhereintheVisiotoolbar,andthenclickDeveloperontheshortcutmenu.

ViewVisioobject,property,method,event,andconstantdescriptions

IntheVisualBasicEditor,clickObjectBrowserontheViewmenu.

TheObjectBrowserinitiallydisplaysitemsdeclaredbyalllibrariesreferencedbyyourproject.

IntheProject/Librarylist,selectVisio.

NoteYoualsocanviewadditionalinformationaboutanitembyselectingtheitemandpressingF1forHelp.

Eventcodes

WhenyouareworkingwiththeAddorAddAdvisemethod,usethefollowingtabletofindtheeventcodefortheeventyouwanttocreate.ThistablelistseachMicrosoftVisioeventanditscorrespondingeventcodeandnumericcode.

NoteIfyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),youdon'tneedtocreateyourownevents.Seetheeventtopicinthisreferencethatcorrespondstotheeventyouwanttouse.

Tableofeventsandcorrespondingeventandnumericcodes

Seealso

AfterModalevent

OccursaftertheMicrosoftVisioinstanceleavesamodalstate.

Versionadded

4.1

Syntax

PrivateSubobject_AfterModal(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

Visiobecomesmodalwhenitdisplaysadialogbox.AmodalinstanceofVisiodoesnothandleAutomationcalls.TheBeforeModaleventindicatesthattheinstanceisabouttobecomemodal,andtheAfterModaleventindicatesthattheinstanceisnolongermodal.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

Example

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

AfterResumeevent

Occurswhentheoperatingsystemresumesnormaloperationafterhavingbeensuspended.

Versionadded

2000SR-1

Syntax

PrivateSubobject_AfterResume(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

YoucanusetheAfterResumeeventtoreopenanynetworkfilesthatyoumayhaveclosedinresponsetotheBeforeSuspendevent.

IfyoursolutionrunsoutsideoftheVisioprocessyoucannotbeassuredofreceivingthisevent.Forthisreason,youshouldmonitorwindowmessagesinyourprogram.

Example

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

AppActivatedevent

OccursafteraMicrosoftVisioinstancebecomesactive.

Versionadded

4.1

Syntax

PrivateSubobject_AppActivated(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheAppActivatedeventindicatesthataninstanceofVisiohasbecometheactiveapplicationontheMicrosoftWindowsdesktop.TheAppActivatedeventisdifferentfromtheAppObjectActivatedevent,whichoccursafteraninstanceofVisiobecomesactive—theinstanceofVisiothatisretrievedbytheGetObjectfunctioninaMicrosoftVisualBasicprogram.

Ifyou'reusingVisualBasicorVisualBasicforApplications,thesyntaxinthis

Example

topicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

AppDeactivatedevent

OccursafteraMicrosoftVisioinstancebecomesinactive.

Versionadded

4.1

Syntax

PrivateSubobject_AppDeactivated(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheAppDeactivatedeventindicatesthataninstanceofVisioisnolongertheactiveapplicationontheMicrosoftWindowsdesktop.TheAppDeactivatedeventisdifferentfromtheAppObjectDeactivatedevent,whichoccursafteraninstanceofVisioceasestobetheactiveinstance—theinstanceofVisiothatisretrievedbytheGetObjectfunctioninaMicrosoftVisualBasicprogram.

Ifyou'reusingVisualBasicorVisualBasicforApplications,thesyntaxinthis

Example

topicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

AppObjActivatedevent

OccursafteraMicrosoftVisioinstancebecomesactive.

Versionadded

4.1

Syntax

PrivateSubobject_AppObjActivated(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheAppObjActivatedeventindicatesthataninstanceofVisiohasbecomeactive—theinstanceofVisiothatisretrievedbytheGetObjectfunctioninaMicrosoftVisualBasicprogram.TheAppObjActivatedeventisdifferentfromtheAppActivatedevent,whichoccursafteraninstanceofVisiobecomestheactiveapplicationontheMicrosoftWindowsdesktop.

Ifyou'reusingVisualBasicorVisualBasicforApplications,thesyntaxinthis

Example

topicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

AppObjDeactivatedevent

OccursafteraMicrosoftVisioinstancebecomesinactive.

Versionadded

4.1

Syntax

PrivateSubobject_AppObjDeactivated(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheAppObjDeactivatedeventindicatesthattheinstanceofVisioisnolongertheactiveinstance—theinstanceofVisiothatisretrievedbytheGetObjectfunctioninaMicrosoftVisualBasicprogram.TheAppObjDeactivatedeventisdifferentfromtheAppDeactivatedevent,whichoccursafteraninstanceofVisiobecomesinactive.

Ifyou'reusingVisualBasicorVisualBasicforApplications,thesyntaxinthis

Example

topicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

BeforeDocumentCloseevent

Occursbeforeadocumentisclosed.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeDocumentClose(ByValdocAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeDocumentSaveevent

Occursjustbeforeadocumentissaved.

Versionadded

5.0

Syntax

PrivateSubobject_BeforeDocumentSave(ByValdocAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeDocumentSaveAsevent

OccursjustbeforeadocumentissavedusingtheSaveAscommand.

Versionadded

5.0

Syntax

PrivateSubobject_BeforeDocumentSaveAs(ByValdocobject TheWithEventsobjectthatreceivestheevent.

Remarks

TheBeforeDocumentSaveAseventfireswhensavingtoeitheranativeformat(forexample,VSDorVDX)oranon-nativeformat(forexample,HTMorBMP).ItdoesnotfirewhensavingtoDWG,DXF,andDGNformats.

TheBeforeDocumentSaveAseventisoneofagroupofeventsforwhichtheEventInfopropertyoftheApplicationobjectcontainsextrainformation.

Example

IftheBeforeDocumentSaveAseventisfiredbecauseasavewasinitiatedbyauseroraprogram,theEventInfopropertyreturnsthefollowingstring:

"/saveasfile=<filename>"

IfitfiresbecauseVisioissavingacopyofanopenfile(forautorecoveryortoincludeasamailattachment),theEventInfopropertywillreturnoneofthefollowingstrings:

Iftheeventisfiredforautorecoverypurposes,thenameofarecoveryfileinthisformat:"/autosavefile=C:\TEMP\~$2VSO2FD.vsd"

Iftheeventisfiredbecauseadocumentcopyisbeingmadetosendasamailattachment,thenameofanattachmentfileinthisformat:"/mailfile=C:\TEMP\~$2VSO2FD.vsd"

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

IfyouarehandlingthiseventfromaprogramthatreceivesanotificationoveraconnectionusingtheAddAdvisemethod,thevMoreInfoargumenttoVisEventProcdesignatesthedocumentindex:"/doc=1".

BeforeMasterDeleteevent

Occursbeforeamasterisdeletedfromadocument.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeMasterDelete(ByValMasterAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeModalevent

OccursbeforeaMicrosoftVisioinstanceentersamodalstate.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeModal(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

Visiobecomesmodalwhenitdisplaysadialogbox.AmodalinstanceofVisiodoesnothandleAutomationcalls.TheBeforeModaleventindicatesthataninstanceisabouttobecomemodal,andtheAfterModaleventindicatesthattheinstanceisnolongermodal.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

Example

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

BeforePageDeleteevent

Occursbeforeapageisdeleted.

Versionadded

4.1

Syntax

PrivateSubobject_BeforePageDelete(ByValPageAsIVPage)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeQuitevent

OccursbeforeaMicrosoftVisioinstanceterminates.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeQuit(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

WhenprogrammingwithMicrosoftVisualBasicforApplications(VBA),usetheBeforeDocumentCloseeventinsteadoftheBeforeQuitevent.ThecodeinaVBAprojectofaVisiodocumentneverhasthechancetorespondtotheBeforeQuiteventbecausetheprojectisapropertyofadocument,andalldocumentsareclosedbeforetheBeforeQuiteventnotificationissent.

Ifyou'reusingMicrosoftVisualBasicorVBA,thesyntaxinthistopicdescribes

Example

acommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

BeforeSelectionDeleteevent

Occursbeforeselectedobjectsaredeleted.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeSelectionDelete(ByValSelectionobject TheWithEventsobjectthatreceivestheevent.

Remarks

AShapeobjectcanserveasthesourceobjectfortheBeforeSelectionDeleteeventiftheshape'sTypepropertyisvisTypeGroup(2)orvisTypePage(1).

TheBeforeSelectionDeleteeventindicatesthatselectedshapesareabouttobedeleted.Thisnotificationissentwhetherornotanyoftheshapesarelocked;however,lockedshapesaren'tdeleted.Tofindoutifashapeislockedagainstdeletion,checkthevalueofitsLockDeletecell.

Example

TheBeforeSelectionDeleteandBeforeShapeDeleteeventsaresimilarinthattheybothfirebeforeshape(s)aredeleted.Theydifferinhowtheybehavewhenasingleoperationdeletesseveralshapes.SupposeaCutoperationdeletesthreeshapes.TheBeforeShapeDeleteeventfiresthreetimesandactsoneachofthethreeobjects.TheBeforeSelectionDeleteeventfiresonceanditactsonaSelectionobjectinwhichthethreeshapesthatyouwanttodeleteareselected.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

BeforeShapeDeleteevent

Occursbeforeashapeisdeleted.

Versionadded

4.5

Syntax

PrivateSubobject_BeforeShapeDelete(ByValShapeAs

object TheWithEventsobjectthatreceivestheevent.

Remarks

AShapeobjectcanserveasthesourceobjectfortheBeforeShapeDeleteeventiftheshape'sTypepropertyisvisTypeGroup(2)orvisTypePage(1).

TheBeforeSelectionDeleteandBeforeShapeDeleteeventsaresimilarinthattheybothfirebeforeshape(s)aredeleted.Theydifferinhowtheybehavewhen

Example

asingleoperationdeletesseveralshapes.SupposeaCutoperationdeletesthreeshapes.TheBeforeShapeDeleteeventfiresthreetimesandactsoneachofthethreeobjects.TheBeforeSelectionDeleteeventfiresonceanditactsonaSelectionobjectinwhichthethreeshapesthatyouwanttodeleteareselected.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

NoteTheBeforeShapeDeleteeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheBeforeShapeDeleteevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheBeforeShapeDeleteevent.TosinktheBeforeShapeDeleteeventfromaDocumentobject(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

BeforeShapeTextEditevent

Occursbeforeashapeisopenedfortexteditingintheuserinterface.

Versionadded

2000

Syntax

PrivateSubobject_BeforeShapeTextEdit(ByValShapeobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeStyleDeleteevent

Occursbeforeastyleisdeleted.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeStyleDelete(ByValStyleAsIVStyle)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeSuspendevent

Occursbeforetheoperatingsystementersasuspendedstate.

Versionadded

2000SR-1

Syntax

PrivateSubobject_BeforeSuspend(ByValappAsIVapplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

Clientprogramsshouldcloseanyopennetworkfileswhenthiseventisfired.

IfyoursolutionrunsoutsideoftheVisioprocessyoucannotbeassuredofreceivingthisevent.Forthisreason,youshouldmonitorwindowmessagesinyourprogram.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,the

Example

syntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

BeforeWindowClosedevent

Occursbeforeawindowisclosed.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeWindowClosed(ByValWindowobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeWindowPageTurnevent

Occursbeforeawindowisabouttoshowadifferentpage.

Versionadded

4.5

Syntax

PrivateSubobject_BeforeWindowPageTurn(ByValWindowobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

BeforeWindowSelDeleteevent

Occursbeforetheshapesintheselectionofawindowaredeleted.

Versionadded

4.1

Syntax

PrivateSubobject_BeforeWindowSelDelete(ByValWindowobject TheWithEventsobjectthatreceivestheevent.

Remarks

TheBeforeWindowSelDeleteeventfiresifuserinteractionscauseshapesinawindowtobedeleted.Itdoesn'tfireifaprogramdeletesshapesinawindowusingtheCutmethod,forexample.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

Example

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

CellChangedevent

Occursafterthevaluechangesinacellinadocument.

Versionadded

4.1

Syntax

PrivateSubobject_CellChanged(ByValCellAsIVCell)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethod.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

NoteTheCellChangedeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheCellChangedevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheCellChangedevent.TosinktheCellChangedeventfromaDocumentobject(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

Example

ThisclassmoduledemonstratesdefiningasinkclasscalledShapeSinkthatdeclarestheobjectvariablem_shpObjusingtheWithEventskeyword.Itcontainsaprocedure,InitWith,thatassignsaparticularShapeobject,aShape,tom_shpObj.TheclassmodulealsocontainsaneventhandlerfortheCellChangedevent,whichcanbefiredbyaShapeobject—inthiscase,theShapeobjectrepresentedbyaShape.

DimWithEventsm_shpObjAsVisio.Shape

PublicSubInitWith(ByValaShapeAsVisio.Shape)Setm_shpObj=aShapeEndSub

PrivateSubm_shpObj_CellChanged(ByValCellAsVisio.IVCell)Debug.PrintCell.Shape.Name&""&Cell.Name&"changedto="&Cell.FormulaEndSub

ConnectionsAddedevent

Occursafterconnectionshavebeenestablishedbetweenshapes.

Versionadded

5.0

Syntax

PrivateSubobject_ConnectionsAdded(ByValConnects

object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasit

Example

appliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

NoteTheConnectionsAddedeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheConnectionsAddedevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheConnectionsAddedevent.TosinktheConnectionsAddedeventfromaDocumentobject(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

ConnectionsDeletedevent

Occursafterconnectionsbetweenshapeshavebeenremoved.

Versionadded

5.0

Syntax

PrivateSubobject_ConnectionsDeleted(ByValConnectsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

NoteTheConnectionsDeletedeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheConnectionsDeletedevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheConnectionsDeletedevent.TosinktheConnectionsDeletedeventfromaDocumentobject(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

ConvertToGroupCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelConvertToGroupevent.

Versionadded

2000

Syntax

PrivateSubobject_ConvertToGroupCanceled(ByValSelectionobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

DesignModeEnteredevent

Occursbeforeadocumententersdesignmode.

Versionadded

5.0

Syntax

PrivateSubobject_DesignModeEntered(ByValdocAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

DocumentAddedevent

Occursafteradocumentisopenedorcreated.

Versionadded

4.1

Syntax

YoucanonlyhandletheDocumentAddedeventbycreatinganEventobjectusingtheAddorAddAdvisemethod.Seethosemethodtopicsfordetailsaboutthecorrectsyntax.

Remarks

YoucanaddDocumentAddedeventstotheEventListpropertyofApplication,Documents,orDocumentobjects.Thefirsttwoarestraightforward—ifadocumentisopenedorcreatedinthescopeoftheApplicationobjectoritsDocumentscollection,theDocumentAddedeventoccurs.

However,addingaDocumentAddedeventtotheEventListpropertyofaDocumentobjectmakessenseonlyiftheevent'sactionis

Example

visActCodeRunAddon.Inthiscase,theeventispersistable—itcanbestoredwiththedocument.Ifthedocumentthatcontainsthepersistenteventisopened,itsactionistriggered.Ifanewdocumentisbasedonorcopiedfromthedocumentthatcontainsthepersistentevent,theDocumentAddedeventiscopiedtothenewdocumentanditsactionistriggered.However,iftheevent'sactionisvisActCodeAdvise,thateventisnotpersistableandthereforeisnotstoredwiththedocument;hence,itisnevertriggered.

YoucanpreventcodefromrunninginresponsetotheDocumentCreated,DocumentOpened,orDocumentAddedeventandalleventsfromfiringbysettingthevalueoftheEventsEnabledpropertyofanApplicationobjecttoFalse,orbyaddingtheentry,EventsEnabled=0,totheVisioApplicationsectionintheregistry.

DocumentChangedevent

Occursaftercertainpropertiesofadocumentarechanged.

Versionadded

4.1

Syntax

PrivateSubobject_DocumentChanged(ByValdocAsIVDocument)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheDocumentChangedeventindicatesthatoneofadocument'sproperties,suchasAuthororDescription,haschanged.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvise

Example

method.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

DocumentCloseCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelDocumentCloseevent.

Versionadded

2000

Syntax

PrivateSubobject_DocumentCloseCanceled(ByValdocobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

DocumentCreatedevent

Occursafteradocumentiscreated.

Versionadded

4.1

Syntax

PrivateSubobject_DocumentCreated(ByValdocAsIVDocument)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheDocumentCreatedeventisoftenaddedtotheEventListcollectionofaVisiotemplatefile(.vst).Theevent'sactionistriggeredwheneveranewdocumentiscreatedbasedonthattemplate.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

YoucanaddDocumentCreatedeventstotheEventListcollectionofanApplicationobject,Documentscollection,orDocumentobject.Thefirsttwoarestraightforward—ifadocumentisopenedorcreatedinthescopeoftheApplicationobjectoritsDocumentscollection,theDocumentCreatedeventoccurs.

However,addingaDocumentCreatedeventtotheEventListcollectionofaDocumentobjectmakessenseonlyiftheevent'sactionisvisActCodeRunAddon.Inthiscase,theeventispersistable—itcanbestoredwiththedocument.Ifthedocumentthatcontainsthepersistenteventisopened,itsactionistriggered.Ifanewdocumentisbasedonorcopiedfromthedocumentthatcontainsthepersistentevent,theDocumentCreatedeventiscopiedtothenewdocumentanditsactionistriggered.However,iftheevent'sactionisvisActCodeAdvise,thateventisnotpersistableandthereforeisnotstoredwiththedocument;henceitisnevertriggered.

YoucanpreventcodefromrunninginresponsetotheDocumentCreated,DocumentOpened,orDocumentAddedeventandalleventsfromfiringbysettingthevalueoftheEventsEnabledpropertyofanApplicationobjecttoFalse,orbyaddingtheentry,EventsEnabled=0totheVisioApplicationsectionintheregistry.

DocumentOpenedevent

Occursafteradocumentisopened.

Versionadded

4.1

Syntax

PrivateSubobject_DocumentOpened(ByValdocAsIVDocument)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheDocumentOpenedeventisoftenaddedtotheEventListcollectionofaVisiotemplatefile(.vst).Theevent'sactionistriggeredwheneveranexistingdocumentisopened.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

Example

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

YoucanaddDocumentOpenedeventstotheEventListcollectionofanApplicationobject,Documentscollection,orDocumentobject.Thefirsttwoarestraightforward—ifadocumentisopenedorcreatedinthescopeoftheApplicationobjectoritsDocumentscollection,theDocumentOpenedeventoccurs.

However,addingaDocumentOpenedeventtotheEventListcollectionofaDocumentobjectmakessenseonlyiftheevent'sactionisvisActCodeRunAddon.Inthiscase,theeventispersistable—itcanbestoredwiththedocument.Ifthedocumentthatcontainsthepersistenteventisopened,itsactionistriggered.Ifanewdocumentisbasedonorcopiedfromthedocumentthatcontainsthepersistentevent,theDocumentOpenedeventiscopiedtothenewdocumentanditsactionistriggered.However,iftheevent'sactionisvisActCodeAdvise,thateventisnotpersistableandthereforeisnotstoredwiththedocument;henceitisnevertriggered.

YoucanpreventcodefromrunninginresponsetotheDocumentCreated,DocumentOpenedorDocumentAddedeventandalleventsfromfiringbysettingthevalueoftheEventsEnabledpropertyofanApplicationobjecttoFalse,orbyaddingtheentry,EventsEnabled=0,totheVisioApplicationsectionintheregistry.

DocumentSavedevent

Occursafteradocumentissaved.

Versionadded

4.1

Syntax

PrivateSubobject_DocumentSaved(ByValdocAsIVDocument)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

wanttocreate,seeEventcodes.

DocumentSavedAsevent

OccursafteradocumentissavedusingtheSaveAscommand.

Versionadded

4.1

Syntax

PrivateSubobject_DocumentSavedAs(ByValdocAsIVDocument)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheDocumentSavedAseventisoneofagroupofeventsforwhichtheEventInfopropertyoftheApplicationobjectcontainsextrainformation.

IftheDocumentSavedAseventisfiredbecauseasavewasinitiatedbyauseroraprogram,theEventInfopropertyreturnsthefollowingstring:

"/saveasfile=<filename>"

Example

IfitfiresbecauseVisioissavingacopyofanopenfile(forautorecoveryortoincludeasamailattachment),theEventInfopropertyreturnsoneofthefollowingstrings:

Iftheeventisfiredforautorecoverypurposes,thenameofarecoveryfileinthisformat:"/autosavefile=C:\TEMP\~$2VSO2FD.vsd"

Iftheeventisfiredbecauseadocumentcopyisbeingmadetosendasamailattachment,thenameofanattachmentfileinthisformat:"/mailfile=C:\TEMP\~$2VSO2FD.vsd"

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

IfyouarehandlingthiseventfromaprogramthatreceivesanotificationoveraconnectioncreatedwiththeAddAdvisemethod,thevMoreInfoargumenttoVisEventProcdesignatesthedocumentindex:"/doc=1".

EnterScopeevent

Queuedwhenaninternalcommandbegins,orwhenanAutomationclientopensascopeusingtheBeginUndoScopemethod.

Versionadded

2000

Syntax

PrivateSubApplication_EnterScope(ByValApplicationnScopeID Alanguageindependentnumberthatdescribestheoperationthatjustended,orthescopeIDreturnedbythebstrDescription Atextualdescriptionoftheoperationthatchangesindifferentlanguageversions.ContainstheuserinterfacedescriptionofaVisiooperation,orthe

descriptionpassedtotheBeginUndoScope

Remarks

ThenScopeIDvaluereturnedinthecaseofaVisiooperationistheequivalentofthecommandrelatedconstantsthatbeginwithvisCmd*.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,the

syntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

IfyouarehandlingthiseventfromaprogramthatreceivesanotificationoveraconnectioncreatedwiththeAddAdvisemethod,theEnterScopeeventisoneofagroupofselectedeventsthatrecordextrainformationintheEventInfopropertyoftheApplicationobject.

TheEventInfopropertyreturnsbstrDescription,asdescribedabove.Inaddition,thevMoreInfoargumenttoVisEventProcwillcontainastringformattedasfollows:[<nScopeID>;<bErrOrCancelled>;<bstrDescription>]

ForEnterScope,bErrOrCancelledwillalwaysequalzero.

ExitScopeevent

Queuedwhenaninternalcommandends,orwhenanAutomationclientexitsascopeusingtheEndUndoScopemethod.

Versionadded

2000

Syntax

PrivateSubApplication_ExitScope(ByValApplicationnScopeID Alanguageindependentnumberthatdescribestheoperationthatjustended,orthescopeIDreturnedbythebstrDescription Atextualdescriptionoftheoperationthatchangesindifferentlanguageversions.ContainstheUIdescriptionofaVisiooperation,orthedescriptionpassedtothebErrOrCancelled Trueiftherewasanerrorduringthescopeorifthescopewascanceled;

Remarks

ThenScopeIDvaluereturnedinthecaseofaVisiooperationistheequivalentofthecommandrelatedconstantsthatbeginwithvisCmd*.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,the

syntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

IfyouarehandlingthiseventfromaprogramthatreceivesanotificationoveraconnectioncreatedusingtheAddAdvisemethod,theExitScopeeventisoneofagroupofselectedeventsthatrecordextrainformationintheEventInfopropertyoftheApplicationobject.

TheEventInfopropertyreturnsbstrDescription,asdescribedabove.Inaddition,thevMoreInfoargumenttoVisEventProcwillcontainastringformattedasfollows:[<nScopeID>;<bErrOrCancelled>;<bstrDescription>]

ForExitScope,bErrOrCancelledwillbenon-zeroiftheoperationfailedorwascanceled.

FormulaChangedevent

Occursafteraformulachangesinacellinadocument.

Versionadded

5.0

Syntax

PrivateSubobject_FormulaChanged(ByValCellAsIVCell)

object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasit

Example

appliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

NoteTheFormulaChangedeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheFormulaChangedevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheFormulaChangedevent.TosinktheFormulaChangedeventfromaDocumentobject(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

MarkerEventevent

CausedbyinvokingtheQueueMarkerEventmethod.

Versionadded

5.0

Syntax

PrivateSubobject_MarkerEvent(ByValappAsIVApplication,object TheWithEventsobjectthatreceivestheevent.SequenceNum Theordinalpositionofthiseventwithrespecttopastevents.ContextString ContextstringpassedbytheQueueMarkerEventmethod.

Remarks

UnlikeothereventsthatVisiofires,aclientprogramcausestheMarkerEventeventtofire.AclientprogramreceivestheMarkerEventeventonlyiftheclientprograminvokedtheQueueMarkerEventmethod.

ByusingtheMarkerEventeventinconjunctionwiththeQueueMarkerEvent

method,aclientprogramcanqueueaneventtoitself.TheclientprogramreceivestheMarkerEventeventafterVisiofiresalltheeventspresentinitseventqueueatthetimeoftheQueueMarkerEventcall.

TheMarkerEventeventpassesboththecontextstringthatwaspassedbytheQueueMarkerEventmethodandthesequencenumberoftheMarkerEventeventtotheMarkerEventeventhandler.EitherofthesevaluescanbeusedtocorrelateQueueMarkerEventcallswithMarkerEventevents.Inthisway,aclientprogramcandistinguisheventsitcausedfromthoseitdidnotcause.

Forexample,aclientprogramthatchangesthevaluesofVisiocellsmayonlywanttorespondtotheCellChangedeventsthatitdidnotcause.TheclientprogramcanfirstcalltheQueueMarkerEventmethodandpassacontextstringforlaterusetobracketthescopeofitsprocessing:

visObj.QueueMarkerEvent"ScopeStart"<Myprogramchangescellshere>visObj.QueueMarkerEvent"ScopeEnd"

Then,intheMarkerEventeventhandler,theclientprogramcouldusethecontextstringpassedtotheQueueMarkerEventmethodtoidentifytheCellChangedeventsthatitcaused:

DimICausedCellChangesasBoolean

PrivateSubvisObj_MarkerEvent(ByValAppAsVisio.IVApplication,_ByValSequenceNumAsLong,ByValContextStringAsIfContextString="ScopeStart"ThenICausedCellChanges=TrueElseIfContextString="ScopeEnd"ThenICausedCellChanges="False"EndIfEndSub

PrivateSubvisObj_CellChanged(ByValCellAsVisio.IVCell)'Respondonlyifthisclientdidn'tcausecellchangeIfICausedCellChanges=FalseThen<respondtothecellchanges>EndIfEndSub

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

Ifyouarehandlingthiseventfromaprogramthatreceivesanotification,theMarkerEventeventisoneofoneofagroupofeventsthatrecordextrainformationintheEventInfopropertyoftheApplicationobject.

TheEventInfopropertyreturnscontextstringasdescribedabove.ThevMoreInfoargumenttoVisEventProcwillbeempty.

MasterAddedevent

Occursafteranewmasterisaddedtoadocument.

Versionadded

4.1

Syntax

PrivateSubobject_MasterAdded(ByValMasterAsIVMaster)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

MasterChangedevent

Occursafterpropertiesofamasterarechangedandpropagatedtoitsinstances.

Versionadded

4.1

Syntax

PrivateSubobject_MasterChanged(ByValMasterAsIVMaster)

object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasit

Example

appliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

MasterDeleteCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelMasterDeleteevent.

Versionadded

2000

Syntax

PrivateSubobject_MasterDeleteCanceled(ByValMasterobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorMicrosoftVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasit

Example

appliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

MustFlushScopeBeginningevent

OccursbeforetheMicrosoftVisioinstanceisforcedtoflushitseventqueue.

Versionadded

5.0

Syntax

PrivateSubobject_MustFlushScopeBeginning(ByValapp

object TheWithEventsobjectthatreceivestheevent.

Remarks

Thisevent,alongwiththeMustFlushScopeEndedevent,canbeusedtoidentifywhetherornotaneventisbeingfiredbecauseVisioisforcedtoflushitseventqueue.

Visiomaintainsaqueueofpendingeventsthatitattemptstofireatdiscrete

Example

momentswhenitisabletoprocessarbitraryrequests(callbacks)fromeventhandlers.

Occasionally,Visioisforcedtoflushitseventqueuewhenitisnotpreparedtohandlearbitraryrequests.Whenthisoccurs,VisiofirstfiresaMustFlushScopeBeginningevent,thenitfirestheeventsthatarepresentlyinitseventqueue.Afterfiringallpendingevents,VisiofirestheMustFlushScopeEndedevent.

AfterVisiohasfiredtheMustFlushScopeBeginningevent,clientprogramsshouldnotinvokeVisiomethodsthathavesideeffectsuntiltheMustFlushScopeEndedeventisreceived.AclientcanperformarbitraryqueriesofVisioobjectswhenVisioisbetweentheMustFlushScopeBeginningeventandMustFlushScopeEndedevent,butoperationsthatcausesideeffectsmayfail.

VisioperformsaforcedflushofitseventqueueimmediatelypriortofiringabeforeeventsuchasBeforeDocumentCloseorBeforeShapeDeletebecausequeuedeventsmayapplytoobjectsthatareabouttocloseorbedeleted.UsingtheBeforeDocumentCloseeventasanexample,therecanbequeuedeventsthatapplytoashapeobjectinthedocumentthatisbeingclosed.So,beforethedocumentcloses,Visiofiresalltheeventsinitseventqueue.

Eventsarefiredinthefollowingsequencewhenashapeisdeleted:

MustFlushScopeBeginningeventClientshouldnotinvokemethodswithsideeffects.

Therearezero(0)ormoreeventsintheeventqueue.

BeforeShapeDeleteeventShapeviable,butVisioisgoingtodeleteit.

MustFlushScopeEndedeventClientcanresumeinvokingmethodswithsideeffects.

ShapesDeletedeventShapehasbeendeleted.

NoEventsPendingevent

Noeventsremaintobefired.

Aneventisfiredbothbefore(BeforeShapeDeletedevent)andafter(ShapesDeletedevent)theshapeisdeleted.Ifaprogrammonitoringtheseeventsrequiresthatadditionalshapesbedeletedinresponsetotheinitialshapedelete,itshoulddosointheShapesDeletedeventhandler,nottheBeforeShapeDeletedeventhandler.TheBeforeShapeDeletedeventisinsidethescopeoftheMustFlushScopeBeginningeventandtheMustFlushScopeEndedevent,whiletheShapesDeletedeventisnot.

NoteThesequencenumberofaMustFlushScopeBeginningeventmaybehigherthanthesequencenumberofeventstheclientseesafterithasreceivedtheMustFlushScopeBeginningeventbecauseVisioassignssequencenumberstoeventsastheyoccur.AnyeventsthatwerequeuedwhentheforcedflushbeganhavealowersequencenumberthantheMustFlushScopeBeginningevent,eventhoughtheMustFlushScopeBeginningeventfiresfirst.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

MustFlushScopeEndedevent

OccursaftertheMicrosoftVisioinstanceforcesaflushofitseventqueue.

Versionadded

5.0

Syntax

PrivateSubobject_MustFlushScopeEnded(ByValappAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Thisevent,alongwiththeMustFlushScopeBeginningevent,canbeusedtoidentifywhetherornotaneventisbeingfiredbecauseVisioisforcedtoflushitseventqueue.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

Example

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

NoEventsPendingevent

OccursaftertheMicrosoftVisioinstanceflushesitseventqueue.

Versionadded

5.0

Syntax

PrivateSubobject_NoEventsPending(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

Visiomaintainsaqueueofeventsandfiresthematdiscretemoments.ImmediatelyafterVisiofiresthelasteventinitseventqueue,itfiresaNoEventsPendingevent.

AclientprogramcanusetheNoEventsPendingeventasasignalthatVisiohascompletedaburstofactivity.Forexample,aclientprogrammaywanttoreacttochangesinashape'sgeometry.Asingleuseractionperformedontheshapecan

Example

generateseveralCellChangedevents.TheclientprogramcouldrecordselectedinformationforeachCellChangedeventandperformitsprocessingafteritreceivestheNoEventsPendingevent.

VisiofirestheNoEventsPendingeventonlyifatleastoneoftheeventsinthequeueisbeinglistenedto.Ifnoprogramislisteningforanyofthequeuedevents,theNoEventsPendingeventdoesnotfire.IfyourprogramisonlylisteningtotheNoEventsPendingevent,itdoesnotfireunlessanotherprogramislisteningforsomeofthequeuedevents.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

OnKeystrokeMessageForAddonevent

OccurswhenMicrosoftVisioreceivesakeystrokemessagefromMicrosoftWindowsthatistargetedatanadd-onwindoworchildofanadd-onwindow.

Versionadded

2002

Syntax

PrivateSubobject_OnKeystrokeMessageForAddon(ByValobject TheWithEventsobjectthatreceivestheevent.returnvalue Truetoindicatethatthemessagewashandledbytheadd-on.otherwise,

Remarks

TheOnKeystrokeMessageForAddoneventenablesadd-onstointerceptandprocessacceleratorandkeystrokemessagesdirectedattheirownadd-onwindowsandchildwindowsoftheiradd-onwindows.Onlyadd-onwindows

Example

createdusingtheAddmethodwillsourcethisevent.

Forthiseventtofire,theadd-onwindoworoneofitschildwindowsmusthavekeystrokefocusandtheVisiomessageloopmustreceivethekeystrokemessage.Itdoesnotfireifthemessageloopassociatedwithanadd-onishandlingmessagesinsteadofVisio.

VisiofirestheOnKeystrokeMessageForAddoneventwhenitreceivesmessagesinthefollowingrange:

WM_KEYDOWN 0x0100WM_KEYUP 0x0101WM_CHAR 0x0102WM_DEADCHAR 0x0103WM_SYSKEYDOWN 0x0104WM_SYSKEYUP 0x0105WM_SYSCHAR 0x0106WM_SYSDEADCHAR 0x0107

TheMSGWrapobject,passedtotheeventhandlerwhentheOnKeystrokeMessageForAddoneventfires,wrapstheWindowsMSGstructure,whichcontainsmessagedata.SeetheMSGWrapobjectformoreinformation,orrefertoyourWindowsdocumentation.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

PageAddedevent

Occursafteranewpageisaddedtoadocument.

Versionadded

4.1

Syntax

PrivateSubobject_PageAdded(ByValPageAsIVPage)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

wanttocreate,seeEventcodes.

PageChangedevent

Occursafterthenameofapage,thebackgroundpageassociatedwithapage,orthepagetype(foregroundorbackground)changes.

Versionadded

4.1

Syntax

PrivateSubobject_PageChanged(ByValPageAsIVPage)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

PageDeleteCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelPageDeleteevent.

Versionadded

2000

Syntax

PrivateSubobject_PageDeleteCanceled(ByValPageAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorMicrosoftVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasit

Example

appliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelConvertToGroupevent

Occursbeforetheapplicationconvertsaselectionofshapestoagroupinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelConvertToGroupobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelConvertToGroupaftertheuserhasdirectedtheinstancetoconvertoneormoreshapesintogroups.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfire

Example

ConvertToGroupCanceledandnotconverttheshapes.

IfallhandlersreturnFalse(don'tcancel),theconversionwillbeperformed.

Insomecases,suchaswhenashapewithaForeignTypepropertyofvisTypeMetafileisconvertedtoagroup,theinitialshapewillbedeletedandreplacedwithnewshapes.InsuchcasestheVisioinstancewillsubsequentlyfireBeforeSelectionDeleteandBeforeShapeDeleteeventsbeforeconvertingtheshapes.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelDocumentCloseevent

Occursbeforetheapplicationclosesadocumentinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelDocumentClose(ByValobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelDocumentCloseaftertheuserhasdirectedtheinstancetocloseadocument.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfireDocumentCloseCanceledandnotclosethedocument.

Example

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireBeforeDocumentCloseandthenclosethedocument.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelMasterDeleteevent

Occursbeforetheapplicationdeletesamasterinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelMasterDelete(ByValobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelMasterDeleteaftertheuserhasdirectedtheinstancetodeleteamaster.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfireMasterDeleteCanceledandnotdeletethemaster.

Example

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireBeforeMasterDeleteandthendeletethemaster.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelPageDeleteevent

Occursbeforetheapplicationdeletesapageinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelPageDelete(ByValobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelPageDeleteaftertheuserhasdirectedtheinstancetodeleteapage.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfirePageDeleteCanceledandnotdeletethepage.

Example

IfallhandlersreturnFalse(don'tcancel)theinstancewillfireBeforePageDelete,andthendeletethepage.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelQuitevent

Occursbeforetheapplicationterminatesinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelQuit(ByValappAsobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelQuitaftertheuserhasdirectedtheinstancetoterminate.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfireQuitCanceledandnotterminate.

Example

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireBeforeQuitandthenterminate.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelSelectionDeleteevent

Occursbeforetheapplicationdeletesaselectionofshapesinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelSelectionDelete(ByValobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelSelectionDeleteaftertheuserhasdirectedtheinstancetodeleteoneormoreshapes.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfire

Example

SelectionDeleteCanceledandnotdeletetheshapes.

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireBeforeSelectionDeleteandBeforeShapeDelete,andthendeletetheshapes.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelStyleDeleteevent

Occursbeforetheapplicationdeletesastyleinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelStyleDelete(ByValobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelStyleDeleteaftertheuserhasdirectedtheinstancetodeleteastyle.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfireStyleDeleteCanceledandnotdeletethestyle.

Example

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireBeforeStyleDeleteandthendeletethestyle.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelSuspendevent

Occursbeforetheoperatingsystementersasuspendedstate.IfanyeventhandlerreturnsTrue,theMicrosoftVisioinstancewilldenytheoperatingsystem'srequest.

Versionadded

2000SR-1

Syntax

PrivateFunctionobject_QueryCancelSuspend(ByValappobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

YouwilltypicallyrespondFalseandallowtheoperatingsystemtoenterasuspendedstate.IfyouhaveopennetworkfilesyoucanclosethemwhenyoureceivetheBeforeSuspendevent.IfyouhaveopennetworkfilesthatyoucannotcloseyoucanreturnTrueandVisiowilldenytheoperatingsystem's

request.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfireSuspendCanceledandnotenterasuspendedstate.

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireBeforeSuspendandthenenterasuspendedstate.

IfyoursolutionrunsoutsideoftheVisioprocessyoucannotbeassuredofreceivingthisevent.Forthisreason,youshouldmonitorwindowmessagesinyourprogram.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelUngroupevent

Occursbeforetheapplicationungroupsaselectionofshapesinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelUngroup(ByValSelectionobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelUngroupaftertheuserhasdirectedtheinstancetoungrouponeormoreshapes.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfire

Example

UngroupCanceledandnotungrouptheshapes.

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireShapeParentChanged,BeforeSelectionDelete,andBeforeShapeDelete,andthenungrouptheshapes.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QueryCancelWindowCloseevent

Occursbeforetheapplicationclosesawindowinresponsetoauseractionintheinterface.IfanyeventhandlerreturnsTrue,theoperationiscanceled.

Versionadded

2000

Syntax

PrivateFunctionobject_QueryCancelWindowClose(ByValobject TheWithEventsobjectthatreceivestheevent.returnvalue Falsetoallowtheoperation;Truetocanceltheoperation.

Remarks

AVisioinstancefiresQueryCancelWindowCloseaftertheuserhasdirectedtheinstancetocloseawindow.

IfanyeventhandlerreturnsTrue(cancel),theinstancewillfireWindowCloseCanceledandnotclosethewindow.

Example

IfallhandlersreturnFalse(don'tcancel),theinstancewillfireBeforeWindowClosedthenclosethewindow.

WhileaVisioinstanceisfiringaqueryorcanceleventitwillrespondtoinquiriesfromclientcodebutitwillrefusetoperformoperations.Clientcodecanshowformsormessageboxeswhilerespondingtoaqueryorcancelevent.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

QuitCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelQuitevent.

Versionadded

2000

Syntax

PrivateSubobject_QuitCanceled(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

RunModeEnteredevent

Occursafteradocumententersrunmode.

Versionadded

5.0

Syntax

PrivateSubobject_RunModeEntered(ByValdocAsIVDocument)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

SelectionAddedevent

Occursafteroneormoreshapesareaddedtoadocument.

Versionadded

4.5

Syntax

PrivateSubobject_SelectionAdded(ByValSelectionAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

AShapeobjectcanserveasthesourceobjectfortheSelectionAddedeventiftheshape'sTypepropertyisvisTypeGroup(2)orvisTypePage(1).

TheSelectionAddedandShapeAddedeventsaresimilarinthattheybothfireaftershape(s)arecreated.Theydifferinhowtheybehavewhenasingleoperationaddsseveralshapes.SupposeaPasteoperationcreatesthreenewshapes.TheShapeAddedeventfiresthreetimesandactsoneachofthethree

Example

objects.TheSelectionAddedeventfiresonceanditactsonaSelectionobjectinwhichthethreenewshapesareselected.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

NoteTheSelectionAddedeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheSelectionAddedevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheSelectionAddedevent.TosinktheSelectionAddedeventfromaDocumentobject(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

SelectionChangedevent

Occursafterasetofshapesselectedinawindowchanges.

Versionadded

4.5

Syntax

PrivateSubobject_SelectionChanged(ByValWindowAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

SelectionDeleteCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelSelectionDeleteevent.

Versionadded

2000

Syntax

PrivateSubobject_SelectionDeleteCanceled(ByValSelectionobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

ShapeAddedevent

Occursafteroneormoreshapesareaddedtoadocument.

Versionadded

4.1

Syntax

PrivateSubobject_ShapeAdded(ByValShapeAsIVShape)object TheWithEventsobjectthatreceivestheevent.

Remarks

AShapeobjectcanserveasthesourceobjectfortheShapeAddedeventiftheshape'sTypepropertyisvisTypeGroup(2)orvisTypePage(1).

TheSelectionAddedandShapeAddedeventsaresimilarinthattheybothfireaftershape(s)arecreated.Theydifferinhowtheybehavewhenasingleoperationaddsseveralshapes.SupposeaPasteoperationcreatesthreenewshapes.TheShapeAddedeventfiresthreetimesandactsoneachofthethree

objects.TheSelectionAddedeventfiresonceanditactsonaSelectionobjectinwhichthethreenewshapesareselected.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

ShapeChangedevent

Occursafterapropertyofashapethatisnotstoredinacellischangedinadocument.

Versionadded

4.5

Syntax

PrivateSubobject_ShapeChanged(ByValShapeAsIVShape)object TheWithEventsobjectthatreceivestheevent.

Remarks

TodeterminewhichpropertieshavechangedwhenShapeChangedfires,usetheEventInfoproperty.ThestringreturnedbytheEventInfopropertycontainsalistofsubstringsthatidentifythepropertiesthatchanged.

ChangestothefollowingshapepropertiescausetheShapeChangedeventtofire:

Example

Shapename(theEventInfopropertycontains"/name")

Data1(theEventInfopropertycontains"/data1")

Data2(theEventInfopropertycontains"/data2")

Data3(theEventInfopropertycontains"/data3")

UniqueID(theEventInfopropertycontains"/uniqueid")

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

IfyouarehandlingthiseventfromaprogramthatreceivesanotificationoveraconnectionthatwascreatedusingAddAdvise,thevMoreInfoargumenttoVisEventProccontainsthestring:"/doc=1/page=1/shape=Sheet.3"

NoteTheShapeChangedeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheShapeChangedevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheShapeChangedevent.TosinktheShapeChangedeventfromaDocument(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

ShapeExitedTextEditevent

Occursafterashapeisnolongeropenforinteractivetextediting.

Versionadded

2000

Syntax

PrivateSubobject_ShapeExitedTextEdit(ByValShapeobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

ShapeParentChangedevent

Occursaftershapesaregroupedoragroupisungrouped.

Versionadded

2000

Syntax

PrivateSubobject_ShapeParentChanged(ByValShapeobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

ShapesDeletedevent

Occursafteroneormoreshapesaredeletedfromadocument.

Versionadded

4.1

Syntax

YoucanonlyhandletheShapesDeletedeventbycreatinganEventobjectusingtheAddorAddAdvisemethod.Seethosetopicsfordetailsaboutthecorrectsyntax.

Remarks

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheShapesDeletedevent.TosinktheShapesDeletedeventfromaDocument(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

BecausetheShapesDeletedeventisanafterevent,thedeletedshapesaregonewhenthenotificationisreceived.Toreceivenotificationjustbeforeshapesaredeleted,usetheBeforeShapeDelete,BeforeSelectionDelete,orBeforeWindowSelDeleteeventinstead.

HowyoudeterminewhichpageormastercontainedthedeletedshapesdependsontheActionpropertyoftheEventobjectwhosetargethasbeentriggered.

Appliesto

Iftheevent'sActionpropertyvalueisvisActCodeRunAddon,thentheindexofthedocumentandpage,ordocumentandmastercontainingtheshapesispassedinthecommandstring.

IftheActionpropertyvalueisvisActCodeAdvise,thenthepSubjectObjargumentpassedtovisEventProcisaSelectionobjectwhoseContainingShapepropertyistheparentshapeoftheshapesthatgotdeleted,andthevMoreInfoargumenttoVisEventProcdesignatesthepageormasterthatcontainedthedeletedshapes.

TheEventInfopropertyoftheApplicationobjectreturnsastringthatcontainsadditionalinformationaboutthenamesofthedeletedshapes:

Ifoneshapeisdeleted,thestringhasthefollowingform:/shapes=shapenamewhereshapenameistheshape'suniqueIDifithasone;otherwiseitistheshape'snameID(sheet.n).

Ifmorethanoneshapeisdeleted,thestringisinthefollowingform,unlessthetotalnumberofcharactersinthestringexceeds8,096characters:

/shapes=shapename1;shapename2;shapename3;...Ifagroupisdeleted,onlythegroupisincludedinthestring.Thegroup'smembersarenotincluded.

Ifthetotalnumberofcharactersinthestringexceeds8,096characters,ithasthefollowingform:

/shapes=many

StyleAddedevent

Occursafteranewstyleisaddedtoadocument.

Versionadded

4.1

Syntax

PrivateSubobject_StyleAdded(ByValStyleAsIVStyle)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

StyleChangedevent

Occursafterthenameofastyleischangedorachangetothestylepropagatestoobjectstowhichthestyleisapplied.

Versionadded

4.1

Syntax

PrivateSubobject_StyleChanged(ByValStyleAsIVStyle)object TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

StyleDeleteCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelStyleDeleteevent.

Versionadded

2000

Syntax

PrivateSubobject_StyleDeleteCanceled(ByValStyleAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

SuspendCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelSuspendevent.

Versionadded

2000SR-1

Syntax

PrivateSubobject_SuspendCanceled(ByValappAsIVapplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

IfyoursolutionrunsoutsideoftheVisioprocessyoucannotbeassuredofreceivingthisevent.Forthisreason,youshouldmonitorwindowmessagesinyourprogram.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

Example

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

TextChangedevent

Occursafterthetextofashapeischangedinadocument.

Versionadded

4.1

Syntax

PrivateSubobject_TextChanged(ByValShapeAsIVShape)object TheWithEventsobjectthatreceivestheevent.

Remarks

TheTextChangedeventisfiredwhentherawtextofashapechanges,suchaswhenthecharactersVisiostoresfortheshapechange.Ifashape'scharacterschangebecauseauseristyping,theTextChangedeventdoesnotfireuntilthetexteditingsessionterminates.

Whenafieldisaddedtoorremovedfromashape'stext,itsrawtextchanges;hence,aTextChangedeventfires.However,noTextChangedeventfireswhen

Example

thetextinafieldchanges.Forexample,ashapehasatextfieldshowingitswidth.ATextChangedeventdoesnotfirewhentheshape'swidthchangesbecausetherawtextstoredfortheshapehasn'tchanged,eventhoughtheapparent(expanded)textoftheshapedoeschange.UsetheCellChangedeventforoneofthecellsintheTextFieldssectiontodetectwhenthetextinatextfieldchanges.

Toaccessashape'srawtext,usetheTextproperty.Toaccessthetextofashapeinwhichtextfieldshavebeenexpanded,usetheCharacters.Textproperty.Youcandeterminethelocationandpropertiesoftextfieldsinashape'stextusingtheShape.Charactersobject.

InVisio5.0andearlierversions,therawcharactersreportedbytheTextpropertyforafieldincludedfourcharacters,thefirstbeingtheEscapecharacter.StartingwithVisio2000,onlyasingleEscapecharacterispresentintherawtextstream.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications(VBA),thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

NoteTheTextChangedeventisincludedintheeventsetofalltheobjectsintheAppliestolist.ForthoseobjectsyoucanuseVBADimWithEventsvariablestosinktheTextChangedevent.

Forperformanceconsiderations,theDocumentobject'seventsetdoesnotincludetheTextChangedevent.TosinktheTextChangedeventfromaDocumentobject(andtheThisDocumentobjectinaVBAproject),youmustusetheAddAdvisemethod.

UngroupCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelUngroupevent.

Versionadded

2000

Syntax

PrivateSubobject_UngroupCanceled(ByValSelectionAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

ViewChangedevent

Occurswhenthezoomlevelorscrollpositionofadrawingwindowchanges.

Versionadded

2000

Syntax

PrivateSubobject_ViewChanged(ByValWindowAsIVWindow)object TheWithEventsobjectthatreceivestheevent.

Remarks

ThiseventfireswheneverthezoomlevelorscrollpositionofaWindowobjectofthetypevisDrawingchanges.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvise

Example

method.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

VisioIsIdleevent

Occursaftertheapplicationemptiesitsmessagequeue.

Versionadded

5.0

Syntax

PrivateSubobject_VisioIsIdle(ByValappAsIVApplication)object TheWithEventsobjectthatreceivestheevent.

Remarks

Visiocontinuallyprocessesmessagesinitsmessagequeue.Whenitsmessagequeueisempty:

Visioperformsitsownidletimeprocessing.

VisiotellsMicrosoftVisualBasicforApplicationstoperformitsidletimeprocessing.

Example

Ifthemessagequeueisstillempty,VisiofirestheVisioIsIdleevent.

Ifthemessagequeueisstillempty,VisiocallsWaitMessage,whichisacalltoMicrosoftWindowsthatdoesn'treturnuntilanewmessagegetsaddedtotheVisiomessagequeue.

AclientprogramcanusetheVisioIsIdleeventasasignaltoperformitsownbackgroundprocessing.

TheVisioIsIdleeventisnottheequivalentofastandardtimerevent.ClientprogramsthatneedtobecalledonaperiodicbasisshouldusestandardtimertechniquesbecausethedurationinwhichVisioisidle(callsWaitMessage)isunpredictable.ForclientprogramsthatareonlymonitoringVisioactivity,however,theVisioIsIdleeventcanbesufficientbecauseuntilWaitMessagereturnstoVisio,therecannothavebeenanyVisioactivitysincetheVisioIsIdleeventwaslastfired.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

WindowActivatedevent

OccursaftertheactivewindowchangesinaMicrosoftVisioinstance.

Versionadded

4.1

Syntax

PrivateSubobject_WindowActivated(ByValWindowAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

TheWindowActivatedeventindicatesthattheactivewindowhaschangedinaVisioinstance.ThiseventimpliesthattheActiveDocumentandActivePagepropertiesoftheApplicationobjectmayalsohavechanged;incontrast,anytimetheActiveDocumentorActivePagepropertychanges,aWindowActivatedeventisalwaysgenerated.

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,the

Example

syntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

WindowChangedevent

Occurswhenthesizeorpositionofawindowchanges.

Versionadded

2000

Syntax

PrivateSubobject_WindowChanged(ByValWindowAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

WindowCloseCanceledevent

OccursafteraneventhandlerhasreturnedTrue(cancel)toaQueryCancelWindowCloseevent.

Versionadded

2000

Syntax

PrivateSubobject_WindowCloseCanceled(ByValWindowobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceives

Example

notification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

WindowOpenedevent

Occursafterawindowisopened.

Versionadded

4.1

Syntax

PrivateSubobject_WindowOpened(ByValWindowAsobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

WindowTurnedToPageevent

Occursafterawindowshowsadifferentpage.

Versionadded

4.5

Syntax

PrivateSubobject_WindowTurnedToPage(ByValWindowobject TheWithEventsobjectthatreceivestheevent.

Remarks

Ifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications,thesyntaxinthistopicdescribesacommon,efficientwaytohandleevents.

IfyouwanttocreateyourownEventobjects,usetheAddorAddAdvisemethod.TocreateanEventobjectthatrunsanadd-on,usetheAddmethodasitappliestotheEventListcollection.TocreateanEventobjectthatreceivesnotification,usetheAddAdvisemethod.Tofindaneventcodefortheeventyou

Example

wanttocreate,seeEventcodes.

Activatemethod

Activatesawindow.

Versionadded

2.0

Syntax

object.Activateobject Required.AnexpressionthatreturnsaWindowobject.

Remarks

Visiocanhavemorethanonewindowopenatatime;however,onlyonewindowisactive.ActivatingawindowcanchangetheobjectsreturnedbytheActiveWindow,ActivePage,andActiveDocumentproperties.

Addmethod

Addsanewobjecttoacollection.

Versionadded

2.0

Syntax

objRet=object.AddobjRet Thenewobjectaddedtothecollection.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

Allpropertiesofthenewobjectareinitializedtozero,soyouneedtosetonlythepropertiesthatyouwanttochange.

Addmethod(Addonscollection)

AddsanewAddonobjecttoanAddonscollection.

Versionadded

2.0

Syntax

addonObj=object.Add(fileName)addonObj ThenewAddonobjectaddedtotheAddonscollection.object Required.AnexpressionthatreturnsanAddonscollection.fileName RequiredString.Thenameoftheadd-on.

Remarks

TheAddmethodaddsanEXEorVSLfiletothecollectionandreturnsanAddonobjectifthestringexpressionspecifiesanEXEfile,orNothingifthestringexpressionspecifiesaVSLfile.

Seealso

Addmethod(Documentscollection)

AddsanewDocumentobjecttotheDocumentscollection.

Versionadded

2.0

Syntax

docObj=object.Add(fileName)docObj ThenewDocumentobjectaddedtotheDocumentscollection.object Required.AnexpressionthatreturnsaDocumentscollection.fileName RequiredString.Thetypeorfilenameofobjecttoadd;ifyou

don'tincludeapath,VisiosearchesfoldersdesignatedintheApplicationobject'sTemplatePathsproperty.

Remarks

Tocreateanewdrawingbasedonnotemplate,passazero-lengthstring("")totheAddmethod.

Tocreateanewdrawingbasedonatemplate,pass"templatename.vst"totheAddmethod.Visioopensstencilsthatarepartofthetemplate'sworkspaceandcopiesstylesandothersettingsassociatedwiththetemplatetothenewdocument.Ifthetemplatefilenameisinvalid,nodocumentisreturnedandanerrorisgenerated.

Tocreateanewstencilbasedonnostencil,pass("vss").

Toopenacopyofastencil,pass("stencilname.vss").

Toopenacopyofadrawing,pass("drawingname.vsd").

NoteOpeningacopyofastencilordrawingisequivalenttoselectingCopyintheOpenlistboxoftheOpendialogboxorusingtheOpenExmethodwiththevisOpenCopyflag.

Addmethod(EventListcollection)

AddsanEventobjectthatrunsanadd-onwhenaneventoccurs.TheEventobjectisaddedtotheEventListcollectionofthesourceobjectwhoseeventsyouwanttoreceive.

Versionadded

4.1

Syntax

eventObj=object.Add(eventCode,visActCodeRunAddoneventObj ThenewEventobjectaddedtotheEventListcollection.object Required.AnexpressionthatreturnsanEventListcollection.eventCode RequiredInteger.Theevent(s)tocapture.target RequiredString.Thenameofyouradd-on.targetArgs RequiredString.Thestringthatispassedtoyouradd-on.

Remarks

Example

ThesourceobjectwhoseEventListcollectioncontainstheEventobjectestablishesthescopeinwhichtheeventsarereported.Eventsarereportedforthesourceobjectandobjectslowerintheobjectmodelhierarchy.Forexample,torunanadd-onwhenaparticulardocumentisopened,addanEventobjectfortheDocumentOpenedeventtotheEventListcollectionofthatdocument.Torunanadd-onwhenanydocumentisopenedinaninstanceoftheapplication,addtheEventobjecttotheEventListcollectionoftheApplicationobject.

CreatingEventobjectsisacommonwaytohandleeventsfromC++orothernon–MicrosoftVisualBasicsolutions.UnlikeeventshandledusingtheVisualBasicWithEventskeyword(alltheeventsinasourceobject'seventsetfire),yourprogramwillonlybenotifiedoftheeventsyouselect.Dependingonyoursolution,thismayresultinimprovedperformance.

Eventobjectsthatrunadd-onscanbepersistent,thatis,theycanbestoredwithaVisiodocument.Tobepersistent,anEventobject'sPersistentandPersistablepropertiesmustbothbeTrue.

TheargumentspassedtotheAddmethodsettheinitialvaluesoftheEventobject'sEvent,Action(visCodeRunAddon),Target,andTargetArgsproperties.

EventcodesaredeclaredbytheVisiotypelibraryandhavetheprefixvisEvt.Eventcodesareoftenacombinationofconstants.Forexample,visEvtAdd+visEvtDocistheeventcodefortheDocumentAddedevent.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

TocreateanEventobjectthatadvisesthecaller'ssinkobjectaboutanevent,seetheAddAdvisemethod.

Addmethod(Layerobject)

Assignsashapetoalayer.

Versionadded

2.0

Syntax

object.Add(shapeObj,fPreserveMembers)object Required.AnexpressionthatreturnsaLayerobject.shapeObj Required.ThenewShapeobjectaddedtotheLayerobject.fPreserveMembers RequiredInteger.Zerotoremovesubshapesfromany

previouslayerassignments;non-zerotopreservelayerassignments.

Remarks

IftheshapeisagroupandfPreserveMembersisnon-zero,thecomponentshapesofthegroupretaintheircurrentlayerassignmentsandarealsoaddedtothislayer.IffPreserveMembersiszero,thecomponentshapesarereassignedtothis

layerandlosetheircurrentlayerassignments.

Addmethod(Layerscollection)

AddsanewLayerobjecttoaLayerscollection.

Versionadded

2.0

Syntax

layerObj=object.Add(layerName)layerObj ThenewLayerobjectaddedtotheLayerscollection.object Required.AnexpressionthatreturnsaLayerscollection.layerName RequiredString.Thenameofthenewlayer.

Seealso

Addmethod(Stylescollection)

AddsanewStyleobjecttoaStylescollection.

Versionadded

2.0

Syntax

styleObj=object.Add(newStyleName,basedOnName,fIncludesTextstyleObj ThenewStyleobjectaddedtotheStylescollection.object Required.AnexpressionthatreturnsaStylescollection.newStyleName RequiredString.Thenewstylename.basedOnName RequiredString.Thenameofthestyleonwhichtobasethenewstyle.fIncludesText RequiredInteger.Zerotodisabletextattributes,ornon-zerotoenablethem.fIncludesLine RequiredInteger.Zerotodisablelineattributes,ornon-zerotoenablethem.fIncludesFill RequiredInteger.Zerotodisablefillattributes,ornon-zerotoenablethem.

Remarks

Passazero-lengthstring("")forthebasedOnNameargumenttobasethenewstyleonnostyle.

Addmethod(Windowscollection)

AddsanewWindowobjecttotheWindowscollection.

Versionadded

2000

Syntax

objRet=object.Add([varCaption][,varFlags][,varType][,varLeft][,varTop][,varWidth][,varHeight][,bstrMergeID][,bstrMergeClass][,nMergePostition])objRet ThenewWindowobjectaddedtothecollection.object Required.AnexpressionthatreturnsaWindowscollection.varCaption OptionalVariant.Thetitleofwindow;defaultis"Untitled".varFlags OptionalVariant.Initialwindowstate.Cancontainany

combinationofvisWindowStatesconstantsdeclaredintheVisiotypelibrary;defaultvariesbasedonthevarType.

Example

varType OptionalVariant.Typeofnewwindow.DefaultstovisStencilAddonforApplication.Windows;defaultstovisAnchorBarAddonforWindow.Windows.

varLeft OptionalVariant.Positionoftheleftsideofthewindow.varTop OptionalVariant.Positionofthetopofthewindow.varWidth OptionalVariant.Widthoftheclientareaofthewindow.varHeight OptionalVariant.Heightoftheclientareaofthewindow.bstrMergeID OptionalVariant.MergeIDofthewindow.bstrMergeClass OptionalVariant.Mergeclassofthewindow.nMergePostition OptionalVariant.Mergepositionofthewindow.

Remarks

UsethismethodtogetanemptyparentframewindowwithintheVisiowindowspacethatyoucanpopulatewithchildwindows.YoumustbeintheVisioprocessspace(forexample,inaDLL/VSLbasedadd-on)tousetheWindowobjectreturnedbythismethodasaparenttoyourwindows.

UsethevaluereturnedbytheWindowHandle32propertyasanHWNDforuseasaparenttoyourownwindows.

AddAdvisemethod

AddsanEventobjecttotheEventListcollectionofthesourceobjectwhoseeventsyouwanttoreceive.Whenselectedeventsoccur,thesourceobjectwillnotifyyoursinkobject.

Versionadded

4.1

Syntax

evtObj=object.AddAdvise(eventCode,eventSink,IIDSinkevtObj ThenewEventobject.object Required.AnexpressionthatreturnsanEventListcollection.eventCode RequiredInteger.Theevent(s)thatgeneratenotifications.eventSink RequiredObject.AreferencetoanOLEinterfaceontheobjectthatisto

receiveeventnotifications.IIDSink RequiredString.Reservedforfutureuse.Mustbe"".targetArgs RequiredString.Thestringthatispassedtoyoursinkobject.

Remarks

EventobjectscreatedwiththeAddAdvisemethodhaveanActionpropertyofvisActCodeAdvise.Theyarenotpersistent,thatis,theycannotbestoredwithaVisiodocumentandmustbere-createdatruntime.

ThesourceobjectwhoseEventListcollectioncontainstheEventobjectestablishesthescopeinwhichtheeventsarereported.Eventsarereportedforthesourceobjectandobjectslowerintheobjectmodelhierarchy.Forexample,toreceivenotificationwhenaparticulardocumentissaved,addanEventobjectfortheDocumentSavedeventtotheEventListcollectionofthatdocument.Toreceivenotificationwhenanydocumentisopenedinaninstanceoftheapplication,addtheEventobjecttotheEventListcollectionoftheApplicationobject.

CreatingEventobjectsisacommonwaytohandleeventsfromC++orothernon–MicrosoftVisualBasicsolutions.UnlikeeventshandledusingtheVisualBasicWithEventskeyword(alltheeventsinasourceobject'seventsetfire),yourprogramwillonlybenotifiedoftheeventsyouselect.Dependingonyoursolution,thismayresultinimprovedperformance.

TheeventCodeargumentisoftenacombinationofconstants.Forexample,visEvtMod+visEvtCellistheeventcodefortheCellChangedevent.EventconstantsaredeclaredbytheVisiotypelibraryandareprefixedwithvisEvt.Tofindaneventcodefortheeventyouwanttocreate,seeEventcodes.

TheargumentspassedtotheAddAdvisemethodsettheinitialvaluesoftheEventobject'sEvent,Action(visCodeRunAddAdvise),andTargetArgsproperties.

BeginningwithMicrosoftVisio2002,youcanuseeventfilterstorefinetheeventsthatyoureceiveinyourprogram.Youcanfiltereventsbyobject,cell,rangesofcells,orcommandID.Fordetailsaboutusingeventfilters,seethemethodtopicsprefixedwithSetFilterandGetFilter.

EnablingyourprogramtohandleeventnotificationsfromMicrosoftVisualBasicorVisualBasicforApplications

AddAtmethod

Createsanewobjectataspecifiedindexinacollection.

Versionadded

4.0

Syntax

objRet=object.AddAt(index)objRet Thenewobjectaddedtothecollection.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.index RequiredLong.Theindexatwhichtoaddtheobject.

Remarks

Iftheindexiszero(0),theobjectisaddedatthebeginningofthecollection.

ThebeginningofaMenuscollectionistheleftmostmenuwhenthemenusarearrangedhorizontally.Forexample,theFilemenuisthefirstmenuintheMenus

collectionforthedrawingwindowcontext.

ThebeginningofaMenuItemscollectionisthetopmostmenuitem.Forexample,theNewWindowmenuitemisthefirstmenuitemintheMenuItemscollectionfortheWindowMenuobject.

ThebeginningofaToolbarItemscollectionistheleftmostiteminatoolbarthatisarrangedhorizontally.

AddAtIDmethod

CreatesanewobjectwithaspecifiedIDinacollection.

Versionadded

4.0

Syntax

objRet=object.AddAtID(id)objRet Thenewobjectaddedtothecollection.object Required.AnexpressionthatreturnsanAccelTables,

MenuSets,orToolbarSetscollection.id RequiredLong.Thewindowcontextforthenewobject.

Remarks

TheIDcorrespondstoawindoworcontextmenu.IfthecollectionalreadycontainsanobjectatthespecifiedID,theAddAtIDmethodreturnsanerror.

ValidIDsaredeclaredbytheVisiotypelibraryandbeginwithvisUIObjSet.

Example

NotallcollectionsincludeanobjectforeverypossibleID.Foralistofvalidcontextsforaparticularcollection,seetheSetIDproperty.

AddCustomField[U]method

ReplacesthetextrepresentedbyaCharactersobjectwithacustomformulafield.

Versionadded

3.0

Syntax

object.AddCustomFieldstrFormula,intFormatobject Required.AnexpressionthatreturnsaCharactersobject.strFormula RequiredString.Theformulaofthenewfield.intFormat RequiredInteger.Theformatofthenewfield.

Remarks

UsingtheAddCustomFieldmethodissimilartoclickingFieldontheInsertmenuandinsertingacustomformulafieldintext.Toaddanyothertypeoffield(notcustom),usetheAddFieldmethod.

Example

Foralistofvalidfieldformatconstants,seetheFieldFormatproperty.ValidfieldformatconstantsarealsodefinedintheVisiotypelibraryinVisFieldFormats.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheAddCustomFieldmethodtosetacustomfieldusinglocalsyntax.UsetheAddCustomFieldUmethodtosetacustomfieldusinguniversalsyntax.

AddFieldmethod

ReplacesthetextrepresentedbyaCharactersobjectwithanewfieldofthecategory,code,andformatyouspecify.

Versionadded

3.0

Syntax

object.AddFieldintCategory,intCode,intFormatobject Required.AnexpressionthatreturnsaCharactersobject.intCategory RequiredInteger.Thecategoryforthenewfield.intCode RequiredInteger.Thecodeforthenewfield.intFormat RequiredInteger.Theformatforthenewfield.

Remarks

UsingtheAddFieldmethodissimilartoclickingFieldontheInsertmenu,andinsertinganyofthefollowingcategoriesoffieldsinthetext:

Example

Date/Time

DocumentInfo

Geometry

ObjectInfo

PageInfo

Toaddacustomformulafield,usetheAddCustomFieldmethod.

ForintCategory,intCode,andintFormatconstantvalues,seetheFieldCategory,FieldCode,andFieldFormatpropertytopics.TheseconstantsarealsodeclaredbytheVisiotypelibraryinVisFieldCategories,VisFieldCodes,andVisFieldFormats.

AddGuidemethod

Addsaguidetoadrawingpage.

Versionadded

2.0

Syntax

objRet=object.AddGuide(guideType,x,y)objRet AShapeobjectthatrepresentsthenewguide.object Required.AnexpressionthatreturnsaPageobject.guideType RequiredInteger.Thetypeofguidetoadd.x RequiredDouble.Thex-coordinateofapointontheguide.y RequiredDouble.They-coordinateofapointontheguide.

Remarks

ThefollowingconstantsdeclaredbytheVisiotypelibraryarevalidvaluesforguides.

Constant Value DescriptionvisPoint 1 GuidepointvisHorz 2 HorizontalguidevisVert 3 Verticalguide

AddHyperlinkmethod

AddsaHyperlinkobjecttoaMicrosoftVisioshape.

Versionadded

5.0

Syntax

objRet=object.AddHyperlinkobjRet TheHyperlinkobjectthatisreturned.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

UsingtheAddHyperlinkmethodisequivalenttoaddingahyperlinktoashapebyclickingHyperlinksontheInsertmenu.

IfaHyperlinkobjectalreadyexistsfortheshape,thenareferencetotheexistingHyperlinkobjectisreturned.

AddNamedRowmethod

AddsarowwiththespecifiednametothespecifiedShapeSheetsection.

Versionadded

4.0

Syntax

retVal=object.AddNamedRow(section,rowName,rowTagretVal Integer.Therownumberofthenewrow.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thesectioninwhichtherowistobeadded.rowName RequiredString.Thenameofthenewrow.rowTag RequiredInteger.Thetypeofrowtobeadded.

Remarks

YoucanaddnamedrowstotheCustomProperties(visSectionProp),User-definedCells(visSectionUser),andConnectionPoints

Example

(visSectionConnectionPts)ShapeSheetsections.YoucanaccesscellsinthenewrowsbypassingtherownumberreturnedbytheAddNamedRowmethodtotheCellsSRCproperty.Alternatively,youcanaccesscellsinthenewrowsusingtherow'snamewiththeCellsproperty.Fordetailsaboutcellreferencesandcellsinnamedrows,seetheUser.Row,Prop.Name,orConnections.Rowrowtopics.

Anemptyrownamestring("")createsarowwithadefaultname.

Avalueofzero(0)intherowTagargumentgeneratesthedefaultrowtypeforthesection.ExplicittagsareusefulwhenaddingrowstotheConnectionPointssection.SeetheRowTypepropertyfordescriptionsofvalidrowtypesforeachsection.Passinganinvalidrowtypegeneratesanerror.

AddinganamedrowtoaConnectionPointssectionautomaticallyconvertsanyexistingunnamedrowsinthesectionintonamedrows,usingtheirdefaultnames(Row_1,Row_2,andsoon).

AddRowmethod

AddsarowtoaShapeSheetsectionataspecifiedposition.

Versionadded

2.0

Syntax

retVal=object.AddRow(section,row,tag)retVal Integer.Therownumberoftherowthatwasadded.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thesectioninwhichtoaddtherow.row RequiredInteger.Thepositionatwhichtoaddtherow.tag RequiredInteger.Thetypeofrowtoadd.

Remarks

IftheShapeSheetsectiondoesnotalreadyexist,itiscreatedwithablankrow.Newcellsinnewrowsareinitializedwithdefaultformulas,ifapplicable.

Otherwise,aprogrammustincludestatementstosettheformulasforthenewcells.Anerrorisgeneratedifthenewrowcannotbeadded.

TherowconstantsdeclaredbytheVisiotypelibraryserveasbasepositionsatwhichasection'srowsbegin.Addoffsetstotheseconstantstospecifythefirstrowandbeyond,forexample,visRowFirst+0,visRowFirst+1,andsoon.Toaddrowsattheendofasection,passtheconstantvisRowLastfortherowargument.Thevaluereturnedistheactualrowindex.

Thetagargumentspecifiesthetypeofrowtoadd.Passzero(0)asthetagargumenttogenerateasection'sdefaultrowtype.ExplicittagsareusefulwhenaddingrowstoGeometry,ConnectionPoints,andControlssections.SeetheRowTypepropertyfordescriptionsofvalidrowtypesforthesesections.Passinganinvalidrowtypegeneratesanerror.

IfyoutrytoaddarowtoaCharacter,Tabs,orParagraphsection,anerroroccurs.

TheAddRowmethodcannotaddnamedrows;anerroroccursifthesectioncontainsnamedrowsorcanholdonlynamedrows.Toaddnamedrows,usetheAddNamedRowmethod.

TheVisiotypelibrarydeclaresrowconstantsprefixedwithvisRowinVisRowIndices.ThesearealsolistedintheAddRowsmethodtopic.

ConstantsforrowsintheGeometry,ConnectionPointsandControlssectionsareprefixedwithvisTaganddeclaredbythetypelibraryinVisRowTags.Toseealistoftheseconstants,seetheRowTypeproperty.

AddRowsmethod

AddsthespecifiednumberofrowstoaShapeSheetsectionataspecifiedposition.

Versionadded

4.0

Syntax

retVal=object.AddRows(section,row,tag,count)retVal Integer.Therownumberofthelastrowthatwasadded.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thesectioninwhichtoaddtherows.row RequiredInteger.Thepositionatwhichtoaddtherows.tag RequiredInteger.Thetypeofrowstoadd.count RequiredInteger.Thenumberofrowstoadd.

Remarks

Example

IftheShapeSheetsectiondoesnotexist,theAddRowsmethodcreatesasectionwithblankrows.Newcellsinnewrowsareinitializedwithdefaultformulas,ifapplicable.Otherwise,aprogrammustincludestatementstosettheformulasforthenewcells.Anerroroccursiftherowcannotbeadded.

TherowconstantsdeclaredbytheVisiotypelibraryserveasbasepositionsatwhichasection'srowsbegin.Addoffsetstotheseconstantstospecifythefirstrowandbeyond,forexample,visRowFirst+0,visRowFirst+1,andsoon.Toaddrowsattheendofasection,passtheconstantvisRowLastfortherowargument.Thevaluereturnedistheactualrowindex.

Thetagargumentspecifiesthetypeofrowstoadd.Passzero(0)asthetagargumenttogenerateasection'sdefaultrowtype.ExplicittagsareusefulwhenaddingrowstoGeometry,ConnectionPoints,andControlssections.SeetheRowTypepropertyfordescriptionsofvalidrowtypesforthesesections.Passinganinvalidrowtypegeneratesanerror.

IfyoutrytoaddrowstoaCharacter,Tabs,orParagraphsection,anerroroccurs.

TheAddRowsmethodcannotaddnamedrows;anerroroccursifthesectioncontainsnamedrowsorcanholdonlynamedrows.Toaddnamedrows,usetheAddNamedRowmethod.

TheVisiotypelibrarydeclarestheconstantsfortaginVisRowIndices.

Validconstantsfortag

AddSectionmethod

AddsanewsectiontoaShapeSheetspreadsheet.

Versionadded

2.0

Syntax

intRet=object.AddSection(section)intRet Integer.Theindexofthesectionthatwasadded.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thetypeofsectiontoadd.

Remarks

TheAddSectionmethodisfrequentlyusedtoaddoneormoreGeometrysectionstoashape.YoucanalsouseAddSectiontoaddothersectionstoashapesuchasScratch,Controls,ConnectionPoints,Actions,User-DefinedCellsandCustomProperties.TheAddSectionmethodreturnsthelogicalindexoftheaddedsection.

ThesectionsthatyoucanaddtoashapecorrespondtothechoicesshownbytheInsertSectiondialogboxwhentheshapeisdisplayedinaShapeSheetwindow.

Ifyoutrytoaddanon-Geometrysectiontoashapethatalreadyhasthatsection,theAddSectionmethodraisesanexception.UsetheSectionExistspropertytodetermineifashapealreadyhasasectionwithagivenlogicalindex.

Anewsectionhasnorows.UsetheAddRowmethodtoaddrowstothenewsection.

TheGeometryCountpropertyreturnsthenumberofGeometrysectionsincludedinashape.UsethefollowingcodetoaddaGeometrysectiontoashape:

Shape.AddSection(visSectionFirstComponent+i)

where0<=i<visSectionLastComponent-visSectionFirstComponent.Thenewsectionprecedesthepresenti'thGeometrysectionfor0<=i<Shape.GeometryCount.ItisthelastsectionforShape.GeometryCount<=i<visSectionLastComponent-visSectionFirstComponent.

TheVisiotypelibrarydeclarestheconstantsforsectionsinVisSectionIndices.

Validsectionconstants

AddToFavoritesmethod

AddsashortcutforahyperlinkaddressinthepresentlyregisteredFavoritesfolder.

Versionadded

5.0

Syntax

object.AddToFavorites[favoritesTitle]object Required.AnexpressionthatreturnsaHyperlinkobject.favoritesTitle OptionalString.Thetitletoassigntothenewshortcut.

Remarks

Ifastringisnotsupplied,theAddToFavoritesmethodusesthehyperlink'sDescriptionpropertyasthenewfavorite'stitle.IftheDescriptionpropertyisempty,theshortcutisgivenagenerictitle,suchasFavorite1.

TheoptionalfavoritesTitleargumentcanspecifythefullpathforthefavorites

file,forexample,"C:\TEMP\MyFavorite.URL",orapathrelativetothefavoritesfolder.

FromMicrosoftVisualBasicorVisualBasicforApplications,acalltotheAddToFavoritesmethodcantakeeitherofthesetwoforms:

object.AddToFavorites"SomeString"object.AddToFavorites

FromC/C++,ifastringissupplied,passaVariantoftypeVT_BSTR.Theapplicationassignsthestringasthetitleoftheshortcut.Ifastringisnotsupplied,passaVariantoftypeVT_EMPTY,oroftypeVT_ERRORandHRESULTDISP_E_PARAMNOTFOUND.

AddToGroupmethod

Addstheselectedshapestotheselectedgroup.

Versionadded

2.0

Syntax

object.AddToGroupobject Required.AnexpressionthatreturnsaSelectionobject.

Remarks

Thecurrentselectionmustcontainboththeshapestoaddandthegrouptowhichyouwanttoaddthem.Thegroupmustbetheprimaryselectionortheonlygroupintheselection.

AddUndoUnitmethod

AddsanobjectthatsupportstheIOleUndoUnitorIVBUndoUnitinterfacetotheMicrosoftVisioundoqueue.

Versionadded

2000

Syntax

object.AddUndoUnit(object)object Required.AnexpressionthatreturnsanApplicationobject.object Required.AnobjectthatsupportstheIOleUndoUnitor

IVBUndoUnitinterface.

Remarks

ForinformationaboutimplementingtheIOleUndoUnitinterfaceonyourobject,seetheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.ForinformationaboutimplementingtheIVBUndoUnitinterface,seeDevelopingVisioSolutionsontheMSDNWebsite.

Arrangemethod

ArrangesthewindowsinaWindowscollection.

Versionadded

2.0

Syntax

object.Arrange(nArrangeFlags)object Required.AnexpressionthatreturnsaWindowscollection.nArrangeFlags OptionalVariant.Aflagthatspecifieshowtoarrangethe

windows;bydefault,thewindowsarearrangedvertically.

Remarks

UsingtheArrangemethodisequivalenttoclickingTileontheWindowmenu.Theactivewindowremainsactive.

Visioconsiderswindowstoptobottom,thenlefttoright.Youcaninfluencewhichwindowswillenduptopmostwhentilinghorizontally(orleftmostwhen

tilingvertically)byprearrangingwindows.

ThefollowingconstantsdeclaredbytheVisiotypelibraryarevalidvaluesfornArrangeFlags.TheseconstantsarealsodeclaredbytheVisiotypelibraryinVisWindowArrange.

Constant ValueVisArrangeTileVertical 1VisArrangeTileHorizontal 2VisArrangeCascade 3

Example

ThefollowingmacrousestheSetWindowRectmethodtoprearrangewindows.ThiscreatesthedesiredresultswhentheArrangemethodiscalledtotilethewindows.Inthisexample,window(i)endsupabovewindow(i+1).

PublicSubp()Fori=1ToWindows.CountWindows(i).SetWindowRecti+100,i+100,100,100NextiWindows.ArrangevisArrangeTileHorizontalEndSub

BeginUndoScopemethod

StartsatransactionwithauniquescopeIDforaninstanceofMicrosoftVisio.

Versionadded

2000

Syntax

nScopeID=object.BeginUndoScope(stringDescription)nScopeID Long.TheIDofthenewscopewithintheVisioinstance.object Required.AnexpressionthatreturnsanApplicationobject.stringDescription RequiredString.Thenameofthescope;couldappearinthe

Visiouserinterface.

Remarks

Ifyouneedtoknowwhethereventsyoureceivearetheresultofaparticularoperationthatyouinitiated,usetheBeginUndoScopeandEndUndoScopemethodstowrapyouroperation.Inyoureventhandlers,usetheIsInScopepropertytotestwhetherthescopeIDreturnedbytheBeginUndoScopemethod

ispartofthecurrentcontext.MakesureyouclearthescopeIDyoustoredfromtheBeginUndoScopepropertywhenyoureceivetheExitScopeeventwiththatID.

YoumustbalancecallstotheBeginUndoScopemethodwithcallstotheEndUndoScopemethod.IfyoucalltheBeginUndoScopemethod,youshouldcalltheEndUndoScopemethodassoonasyouarefinishedwiththeactionsthatconstituteyourscope.Also,whileactionstomultipledocumentsshouldberobustwithinasinglescope,closingadocumentmayhavethesideeffectofpurgingtheundoinformationforthecurrentlyopenscopeaswellaspurgingtheundoandredostacks.Ifthathappens,passingbCommit=FalsetoEndUndoScopedoesnotrestoretheundoinformation.

YoucanalsousetheBeginUndoScopeandEndUndoScopemethodstoaddanactiondefinedbyanadd-ontotheVisioundostream.Thisisusefulwhenyouareoperatingfrommodelessscenarioswheretheinitiatingagentispartofanadd-on'suserinterfaceoramodelessprogrammaticaction.

NoteMostVisioactionsarealreadywrappedininternalundoscopes,soadd-onsrunningwithintheapplicationdonotneedtocallthismethod.

BoundingBoxmethod

Returnsarectanglethattightlyenclosesashape,ortheshapesofapage,master,orselection.

Versionadded

4.5

Syntax

object.BoundingBoxflags,left,bottom,right,topobject Required.AnexpressionthatreturnsthePage,Master,Shape

orSelectionobjectwhoseboundingboxistoberetrieved.flags RequiredInteger.Flagsthatinfluencetheboundingbox

calculatedforeachshapethatcontributestotheresultingboundingbox.

left RequiredDouble.Returnsx-coordinateofleftedgeofboundingbox.

bottom RequiredDouble.Returnsy-coordinateofbottomedgeofboundingbox.

right RequiredDouble.Returnsx-coordinateofrightedgeofboundingbox.

top RequiredDouble.Returnsy-coordinateoftopedgeofboundingbox.

Remarks

ForaShapeobject,theBoundingBoxmethodreturnsarectanglethattightlyenclosestheshapeanditssub-shapes.

ForaPage,Master,orSelectionobject,theBoundingBoxmethodreturnsarectanglethattightlyenclosesthepage's,master's,orselection'sshapesandtheirsub-shapes.

IftheBoundingBoxmethodreturnsanerror,orifitisaskedtoreturntherectangleenclosingzeroshapes,therectanglereturnedis{left:0,bottom:0,right:-1,top:-1};otherwise,therectanglereturnedhasleftlessthanorequalto(<=)rightandbottomlessthanorequalto(<=)top.Thenumbersreturnedareininternalunits(inches).

TheboundingrectanglereturnedforanindividualshapedependsonitsTypeproperty.

Constant DescriptionvisTypePage EquivalenttoPage.BoundingBoxor

Master.BoundingBox.visTypeGroup Rectanglethattightlyenclosesthe

groupanditssub-shapes.visTypeShape Determinedrectangledependsonflags.

Seebelow.visTypeForeignObject Determinedrectangledependsonflags.

Seebelow.visTypeGuide Determinedrectangledependsonflags.

Seebelow.

ThemethodwillraiseanexceptionforobjecttypevisTypeDoc.

Theflagsargumenthasseveralbitsthatcontroltheboundingboxretrievedfor

eachshape.Ifmorethanoneofthebitsdescribedbelowisset,therectangledeterminedfortheshapecoversallrectanglesimpliedbythebits.

Flag Value DescriptionvisBBoxUprightWH &H1 Returnarectanglethatisthesmallest

rectangleparalleltothelocalcoordinatesystemoftheshape'sparentthatenclosestheshape'swidth-heightbox.Iftheshapeisnotrotated,itsuprightwidth-heightboxanditswidth-heightboxarethesame.Pathsintheshape'sgeometryneedn'tandoftendon'tlieentirelywithintheshape'swidth-heightbox.

visBBoxUprightText &H2 Returnarectanglethatisthesmallestrectangleparalleltothelocalcoordinatesystemoftheshape'sparentthatenclosestheshape'stext.

visBBoxExtents &H4 Returnarectanglethatisthesmallestrectangleparalleltothelocalcoordinatesystemoftheshape'sparentthatenclosesthepathsstrokedbytheshape'sgeometry.Thismaybelargerorsmallerthantheshape'suprightwidth-heightbox.TheextentsboxdeterminedforashapeoftypevisTypeForeignObjectequalsthatshape'suprightwidth-heightbox.

visBBoxIncludeHidden &H10 Includehiddengeometry.visBBoxIgnoreVisible &H20 Ignorevisiblegeometry.VisBBoxIncludeGuides &H1000 Includeextentsforshapesoftype

visTypeguide.Bydefault,theextentsofshapesoftypevisTypeGuideareignored.Ifyourequestguideextents,thenonlythexpositionsofverticalguidesandtheypositionsofhorizontalguidescontributetotherectanglethatis

returned.Ifanyverticalguidesarereportedon,aninfiniteyextentisreturned.Ifanyhorizontalguidesarereportedon,aninfinitexextentisreturned.Ifanyrotatedguidesarereportedon,infinitexandyextentsarereturned.

visBBoxDrawingCoords &H2000 Returnnumbersinthedrawingcoordinatesystemofthepageormasterwhoseshapesarebeingconsidered.Bydefault,thereturnednumbersaredrawingunitsinthelocalcoordinatesystemoftheparentoftheconsideredshapes.

visBBoxNoNonPrint &H4000 Ignoretheextentsofshapesthatarenon-printing.Ashapeisnon-printingifthevalueofitsNonPrintingcellisnon-zerooritbelongsonlytonon-printinglayers.

Theextentsrectangleisdeterminedusingthecenteroftheshape'sstrokes;itdoesnottakeintoaccountthewidthofthestrokes.Nordoestherectangleincludeanyareacoveredbyshadowsorlineendmarkers.Visiodoesn'texposeameanstodetermineashape's"blackbits"box,thatis,theextentsboxadjustedtoaccountforstrokewidths,shadows,andlineends.

Ashapemayhavecontrolpointsorconnectionpointsthatlieoutsideanyoftheboundingrectanglesreportedbytheshape.Youcandeterminethepositionofcontrolpointsandconnectionpointsbyqueryingresultsoftheshape'scells.

BringForwardmethod

Bringstheshapeorselectedshapesforwardonepositioninthez-order.

Versionadded

2.0

Syntax

object.BringForwardobject Required.AnexpressionthatreturnstheShapeorSelection

objecttobringforward.

BringToFrontmethod

Bringstheshapeorselectedshapestothefrontofthez-order.

Versionadded

2.0

Syntax

object.BringToFrontobject Required.AnexpressionthatreturnstheShapeorSelection

objecttobringtothefront.

CenterDrawingmethod

Centersapage's,master's,orgroup'sshapeswithrespecttotheextentofthepage,master,orgroup.

Versionadded

4.0

Syntax

object.CenterDrawingobject Required.AnexpressionthatreturnsaPage,Master,orShape

objectthatcontainstheshapestocenter.

Remarks

Centeringshapesdoesnotchangetheirpositionrelativetoeachother.

Seealso Example

ClearCustomMenusmethod

Restoresthebuilt-inMicrosoftVisiomenus.

Versionadded

4.0

Syntax

object.ClearCustomMenusobject Required.AnexpressionthatreturnsanApplicationor

Documentobjectthatisusingthecustommenus.

Remarks

CallingtheClearCustomMenusmethodonanobjectwithoutcustommenushasnoeffect.

Seealso

ClearCustomToolbarsmethod

Restoresthebuilt-inMicrosoftVisiotoolbars.

Versionadded

4.0

Syntax

object.ClearCustomToolbarsobject Required.AnexpressionthatreturnsanApplicationor

Documentobjectthatisusingthecustomtoolbars.

Remarks

CallingtheClearCustomToolbarsmethodonanobjectwithoutcustomtoolbarshasnoeffect.

Seealso

ClearGestureFormatSheetmethod

Clearslocalformattinginadocument'sGestureFormatsheet.

Versionadded

2000

Syntax

object.ClearGestureFormatSheetobject Required.AnexpressionthatreturnsaDocumentobject.

Remarks

AnyshapesdrawnaftertheGestureFormatsheetisclearedinherittheirline,fill,andtextformattingfromthedocument'sdefaultstyles.

Adocument'sGestureFormatsheetalsogetsclearedautomaticallywhenthedocumentisopened.

FordetailsabouttheGestureFormatsheet,seetheGestureFormatSheet

Example

property.

Closemethod

Closesawindow,document,ormaster.

Versionadded

2.0

Syntax

object.Closeobject Required.AnexpressionthatreturnstheWindow,Document,

orMasterobjecttoclose.

Remarks

Iftheindicatedwindowistheonlywindowopenforadocumentandthedocumentcontainsunsavedchanges,analertappearsaskingifyouwanttosavethedocument.YoucanusetheAlertResponsepropertytopreventthealertfromappearing.

Ifyoucloseadockedstencilwindow,onlythatwindowisclosed.However,if

youcloseadrawingwindowthatcontainsdockedstencils,thedockedstencilwindowisalsoclosed.

UsetheClosemethodforaMasterobjectafteropeningamasterforeditingusingtheOpenmethod.TheClosemethodpushesanychangesmadetothemasterwhileitwasopentoinstancesofthemaster.

Combinemethod

Createsanewshapebycombiningselectedshapes.

Versionadded

2.0

Syntax

object.Combineobject Required.AnexpressionthatreturnstheSelectionobjectthat

containstheshapestocombine.

Remarks

TheCombinemethodisequivalenttoclickingtheCombinecommandontheOperationssubmenuontheShapemenuinVisio.Theproducedshapewillbethetopmostshapeinitscontainingshapeandwillinheritthetextandformattingofthefirstselectedshape.Theoriginalshapesaredeletedandnoshapesareselectedwhentheoperationiscomplete.

Example

TheCombinemethodissimilartotheJoinmethodbutdiffersinthefollowingways:

TheCombinemethodproducesashapewithoneGeometrysectionforeachoriginalshape.Theresultingshapewillhaveholesinregionswheretheoriginalshapesoverlapped.

TheJoinmethoddiffersfromCombineinthatitwillcoalesceabuttinglineandcurvesegmentsintheoriginalshapesintoasingleGeometrysectionintheresultingshape.

ConvertResultmethod

Convertsastringornumberintoanequivalentnumberindifferentmeasurementunits.

Versionadded

4.5

Syntax

retVal=object.ConvertResult(StringOrNumber,unitsIn,retVal Double.Theresultoftheconversion.object Required.AnexpressionthatreturnsanApplicationobject.StringOrNumber RequiredVariant.Stringornumbertobeconverted;canbeastring,

floatingpointnumber,orinteger.unitsIn RequiredVariant.MeasurementunitstoattributetoStringOrNumberunitsOut RequiredVariant.Measurementunitstoexpresstheresultin.

Remarks

Ifpassedasastring,StringOrNumbermightbetheformulaorprospectiveformulaofacellortheresultorprospectiveresultofacellexpressedasastring.TheConvertResultmethodevaluatesthestringandconvertstheresultintotheunitsdesignatedbyunitsOut.TheConvertResultmethodreturnsanerrorifthestringcontainsanycellreferences.

PossiblevaluesforStringOrNumberinclude:

1.7

3

"2.5"

"4.1cm"

"12ft-17in+(12cm/SQRT(7))"

TheunitsInandunitsOutargumentscanbestringssuchas"inches","inch","in.",or"i".StringsmaybeusedforallsupportedVisiounitssuchascentimeters,meters,miles,andsoon.YoucanalsouseanyoftheunitsconstantsdeclaredbytheVisiotypelibraryinVisUnitCodes.AlistofvalidunitsisalsolistedinAboutunitsofmeasure.

IfStringOrNumberisafloatingpointnumberorinteger,unitsIndeclareswhatunitofmeasuretheConvertResultmethodshouldconstruethenumbertobe.Pass""toindicateinternalVisiounits.

IfStringOrNumberisastring,unitsInspecifieshowtointerprettheevaluatedresultandisonlyusediftheresultisascalar.Forexample,theexpression"4*5cm"evaluatesto20cm,whichisnotascalarsounitsInisignored.Theexpression"4*5"evaluatesto20whichisascalarandisinterpretedusingthespecifiedunitsIn.

TheunitsOutargumentspecifiesinwhatunitsthereturnednumbershouldbeexpressed.Ifyouwanttheresultsexpressedinthesameunitsastheevaluatedexpression,pass"NOCAST"orvisNoCast.

Exampleswherestringisspecified:

Debug.Printapplication.ConvertResult("0.5*2","ft","ft")>>>1.0Debug.Printapplication.ConvertResult("0.5*2","ft","in")>>>12.0Debug.Printapplication.ConvertResult("1cm","ft","in")>>>0.39Debug.Printapplication.ConvertResult("1cm","ft","NOCAST")>>>1.0Debug.Printapplication.ConvertResult("1cm","ft","")>>>0.39Debug.Printapplication.ConvertResult("1cm","ft","bozo")>>>exception:Badmeasurementunit.

Exampleswherenumberisspecified:

Debug.Printapplication.ConvertResult(1,"ft","ft")>>>1Debug.Printapplication.ConvertResult(1,"ft","in")>>>12Debug.Printapplication.ConvertResult(1.0,"in","ft")>>>8.33333333333333E-02Debug.Printapplication.ConvertResult(1.0,visFeet,"")>>>12Debug.Printapplication.ConvertResult(1,"bozo","in")>>>exception:Badmeasurementunit.

ConvertToGroupmethod

Convertsaselectionoranobjectfromanotherapplication(alinkedorembeddedobject)toagroup.

Versionadded

2.0

Syntax

object.ConvertToGroupobject Required.AnexpressionthatreturnstheShapeorSelection

objecttoconvert.

Remarks

Iftheobjecttoconvertisametafileitwillbeconvertedintobasicshapes.

Example

Copymethod

CopiesatextrangeorhyperlinktotheClipboard.

Versionadded

2.0

Syntax

object.Copyobject Required.AnexpressionthatreturnsaCharactersor

Hyperlinkobject.

Remarks

TomakeacopywithoutusingtheClipboard,usetheDuplicatemethod.

Copymethod(Selectionobject)

CopiesaselectiontotheClipboard.

Versionadded

2002

Syntax

object.Copy[flags]object Required.AnexpressionthatreturnsaSelectionobject.flags OptionalVariant.Determineshowshapesaretranslatedduring

thecopyoperation.

Remarks

PossiblevaluesforflagsaredeclaredbytheVisiotypelibraryinVisCutCopyPasteCodes,andaredescribedinthefollowingtable.

Flag Value DescriptionvisCopyPasteNormal &H0 Default.Shapesarecopiedtothe

Example

centerofthedocument.visCopyPasteNoTranslate &H1 Shapesarecopiedtotheiroriginal

coordinatelocations.

SettingflagtovisCopyPasteNormalistheequivalentofthebehaviorintheuserinterface.YoushouldusethevisCopyPasteNormalandvisCopyPasteNoTranslateflagsconsistently.Forexample,ifyoucopyusingvisCopyPasteNoTranslate,youshouldalsopasteusingthatvalueasitistheonlywaytoensurethatshapesarepastedtotheiroriginalcoordinatelocation.

TomakeacopywithoutusingtheClipboard,usetheDuplicatemethod.

Copymethod(Shapeobject)

CopiesashapetotheClipboard.

Versionadded

2002

Syntax

object.Copy[flags]object Required.AnexpressionthatreturnsaShapeobject.flags OptionalVariant.Determineshowshapesaretranslatedduring

thecopyoperation.

Remarks

PossiblevaluesforflagsaredeclaredbytheVisiotypelibraryinVisCutCopyPasteCodes,andaredescribedinthefollowingtable.

Flag Value DescriptionvisCopyPasteNormal &H0 Default.Shapesarecopiedtothe

Example

centerofthedocument.visCopyPasteNoTranslate &H1 Shapesarecopiedtotheiroriginal

coordinatelocations.

SettingflagtovisCopyPasteNormalistheequivalentofthebehaviorintheuserinterface.YoushouldusethevisCopyPasteNormalandvisCopyPasteNoTranslateflagsconsistently.Forexample,ifyoucopyusingvisCopyPasteNoTranslate,youshouldalsopasteusingthatvalueasitistheonlywaytoensurethatshapesarepastedtotheiroriginalcoordinatelocation.

TomakeacopywithoutusingtheClipboard,usetheDuplicatemethod.

CopyPreviewPicturemethod

Copiesthepreviewpicturefromanotherdocumentintothecurrentdocument.

Versionadded

2002

Syntax

object.CopyPreviewPicturepSourceDocobject Required.AnexpressionthatreturnsaDocumentobject.pSourceDoc Required.TheDocumentobjectwhosepreviewpictureyou

wanttocopyintothisdocument.

Example

CreateShortcutmethod

Createsashortcutforamaster.

Versionadded

2000

Syntax

objRet=object.CreateobjRet ThenewMasterShortcutobject.object Required.AnexpressionthatreturnsaMasterobject.

Remarks

Thenewmastershortcutiscreatedinthesamedocumentasthetargetmasterandisaddedtothedocument'sMasterShortcutscollection.Thedocumentmustthereforebeeditableforthismethodtosucceed.

Thenewshortcut'snameis"ShortcuttoX",where"X"isthenameofthetargetmaster.Theshortcut'sTargetDocumentNameandTargetMasterName

Example

propertiesidentifythetargetmaster.Soonceashortcuthasbeencreated,itcanbemovedorcopiedintootherdocuments.

Youcannotcreateashortcuttoamasterinanunsavedstencil.Ifyoutrytodoso,theCreateShortcutmethodreturnsanerror.

CreateURLmethod

Returnsafullyqualifiedandoptionallycanonicalizedrepresentationofthehyperlink'sabsoluteaddress.

Versionadded

5.0

Syntax

strRet=object.CreateURL(intExpression)strRet String.AfullyqualifiedURLrepresentationofahyperlink.object Required.AnexpressionthatreturnsaHyperlinkobject.intExpression RequiredInteger.True(non-zero)ifcanonicalform;

otherwise,False(0).

Remarks

TheCreateURLmethodoftheHyperlinkobjectcanbeusedtoresolverelativeURLsagainstahyperlink'sbaseaddress.

Whenyouusethecanonicalform,theCreateURLmethodappliesURLcanonicalizationrulestothehyperlink.OnlyspacesareURLencodedduringcanonicalization.Port80isassumedforHTTPURLsandisremovedduringcanonicalization.TheURL"http://www.microsoft.com:80/"isreturnedas"http://www.microsoft.com/",whereashttp://www.microsoft.com:1000/"isunchanged.

Example

HerearesomeexamplesofresultsoftheCreateURLmethod:

Address="http://www.microsoft.com/"CreateURL(False)returns"http://www.microsoft.com/"Address="C:\MyDocuments\Spreadsheet.XLS"CreateURL(False)returns"file://C:\MyDocuments\Spreadsheet.XLS"CreateURL(True)returns"file://C:\My%20Documents\Spreadsheet.XLS"

Relativepathexample:

Assume:Document.HyperlinkBase="http://www.microsoft.com/bar/"Address="../file.htm"CreateURL(False)returns"http://www.microsoft.com/file.htm"

Cutmethod

DeletesanobjectorselectionandplacesitontheClipboard.

Versionadded

2002

Syntax

object.Cut[flags]object Required.AnexpressionthatreturnsaSelectionorShape

object.flags OptionalVariant.Determineshowshapesaretranslatedduring

thecutoperation.

Remarks

PossiblevaluesforflagsaredeclaredbytheVisiotypelibraryinVisCutCopyPasteCodes,andaredescribedinthefollowingtable.

Flag Value Description

visCopyPasteNormal &H0 Default.Shapesarecopiedtothecenterofthedocument.

visCopyPasteNoTranslate &H1 Shapesarecopiedtotheiroriginalcoordinatelocations.

SettingflagstovisCopyPasteNormalistheequivalentofthebehaviorintheuserinterface.YoushouldusethevisCopyPasteNormalandvisCopyPasteNoTranslateflagsconsistently.Forexample,ifyoucopyusingvisCopyPasteNoTranslate,youshouldalsopasteusingthatvalueasitistheonlywaytoensurethatshapesarepastedtotheiroriginalcoordinatelocation.

Cutmethod(Charactersobject)

DeletesatextrangeandplacesitontheClipboard.

Versionadded

2.0

Syntax

object.Cutobject Required.AnexpressionthatreturnsaCharactersobject.

Remarks

WhenusedwithaCharactersobject,theCutmethodplacesthetextrangerepresentedbythatobjectontotheClipboard.

Example

Deletemethod

Deletesanobjectorselection.

Versionadded

2.0

Syntax

object.Deleteobject Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Deletemethod(Layerobject)

DeletesaLayerobject.Canalsodeleteshapesassignedtothedeletedlayer.

Versionadded

2.0

Syntax

object.DeletefDeleteShapesobject Required.AnexpressionthatreturnstheLayerobjecttodelete.fDeleteShapes RequiredInteger.1(True)todeleteshapesassignedtothe

layer;otherwise,0(False).

Remarks

WhenfDeleteShapesisnon-zero,shapesassignedonlytothedeletedlayeraredeleted.Otherwise,theshapesaresimplynolongerassignedtothatlayer.

Seealso Example

Deletemethod(Pageobject)

DeletesaPageobject.Canalsorenumberremainingpages.

Versionadded

2.0

Syntax

object.DeletefRenumberPagesobject Required.AnexpressionthatreturnsthePageobjecttodelete.fRenumberPages RequiredInteger.1(True)torenumberremainingpages;

otherwise,0(False).

Remarks

WhenfRenumberPagesisnon-zero,theremainingpages'defaultpagenamesarerenumberedafterthepageisdeleted,otherwise,thepagesretaintheirnames.

Seealso Example

DeleteRowmethod

DeletesarowfromasectioninaShapeSheetspreadsheet.

Versionadded

2.0

Syntax

object.DeleteRowsection,rowobject Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Theindexofthesectionthatcontainsthe

row.row RequiredInteger.Theindexoftherowtodelete.

Remarks

ToremoveonerowatatimefromaShapeSheetsection,usetheDeleteRowmethod.Ifthesectionhasindexedrows,therowsfollowingthedeletedrowshiftposition.Iftherowdoesnotexist,nothingisdeleted.

Youshouldnotdeleterowsthatdefinefundamentalcharacteristicsofashape,suchasthe1-DEndpointsrow(visRowXForm1D)orthecomponentrow(visRowComponent)ortheMoveTorow(visRowVertex+0)inaGeometrysection.YoucannotdeleterowsfromsectionsrepresentedbyvisSectionCharacter,visSectionParagraph,andvisSectionTab.

DeleteSectionmethod

DeletesaShapeSheetsection.

Versionadded

2.0

Syntax

object.DeleteSectionsectionobject Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Theindexofthesectiontodelete.

Remarks

WhenyoudeleteaShapeSheetsection,allrowsinthesectionareautomaticallydeleted.Ifthespecifiedsectiondoesnotexist,nothingisdeletedandnoerrorisgenerated.

IfaGeometrysectionisdeleted,anysubsequentGeometrysectionsshiftupbecausetheyareindexedandnogapscanexistinanindexedrange.

YoucandeleteanysectionexceptthesectionrepresentedbyvisSectionObject(althoughyoucandeleterowswithinthatsection).

Foralistofsectionindexvalues,seetheAddSectionmethodorviewtheVisiotypelibraryforthemembersofvisSectionIndices.

DeleteSolutionXMLElementmethod

DeletesthenamedSolutionXMLelement.

Versionadded

2002

Syntax

object.DeleteSolutionXMLElementelementNameobject Required.AnexpressionthatreturnsaDocumentobject.elementName RequiredString.NameoftheSolutionXMLelementtodelete.

Remarks

TheelementNameargumentiscase-sensitiveandshouldmatchthenamepassedasanargumenttotheSolutionXMLElementproperty.

IfMicrosoftVisio2002filesaresavedinVisio5.0format,SolutionXMLelementsaredeleted.Ifversion2002filesaresavedinVisio2000format,SolutionXMLelementsaresavedbutthedataisinaccessible.

Example

DeselectAllmethod

Deselectsallshapesinawindoworselection.

Versionadded

2.0

Syntax

object.DeselectAllobject Required.AnexpressionthatreturnsaWindoworSelection

object.

Example

DockedStencilsmethod

ReturnsthenamesofallstencilsdockedinaMicrosoftVisiodrawingwindow.

Versionadded

4.5

Syntax

object.DockedStencilsnameArrayobject Required.AnexpressionthatreturnsaWindowobject.nameArray RequiredString.Arraythatreceivesthenamesofstencils

dockedinawindow.

Remarks

TheDockedStencilsmethodreturnsanarrayofstrings—thenamesofthestencilsshowninthedockedstencilpanesofawindow.Whenthewindowisadrawingwindow,thenumberofdockedstencilpanes(n)isequaltoorgreaterthanzero,andniszerowhenthewindowisn'tadrawingwindow.

IftheDockedStencilsmethodsucceeds,nameArrayreturnsaone-dimensionalarrayofnstringsindexedfromzero(0)ton-1.ThenameArrayargumentisanoutargumentthatisallocatedbytheDockedStencilsmethod,ownershipofwhichispassedbacktothecaller.ThecallershouldeventuallyperformtheSafeArrayDestroyprocedureonthereturnedarray.NotethattheSafeArrayDestroyprocedurehasthesideeffectoffreeingthestringsreferencedbythearray'sentries.TheDockedStencilsmethodfailsifnameArrayisnull.(MicrosoftVisualBasicandVisualBasicforApplicationstakecareofdestroyingthearrayforyou.)

IfsiisthestringreturnedbynameArray(i),thenDocuments.Item(si)succeedsandreturnsaDocumentobjectrepresentingthestencil.

DoCmdmethod

PerformsthecommandwiththeindicatedcommandID.

Versionadded

4.0

Syntax

object.DoCmd(intExpression)object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.Thecommandtoperform.

Remarks

ConstantsforVisiocommandIDsaredeclaredbytheVisiotypelibraryinVisUICmdsandareprefixedwithvisCmd.

TheDoCmdmethodworksbestwithcommandsthatdisplaydialogboxes.

Seealso

DrawBeziermethod

CreatesanewshapewhosepathisdefinedbythesuppliedsequenceofBeziercontrolpoints.

Versionadded

4.1

Syntax

objRet=object.DrawBezier(xyArray,degree,flags)objRet ThenewShapeobject.object Required.Thepage,master,orgroupinwhichtodrawthe

shape.xyArray RequiredDouble.Anarrayofalternatingxandyvaluesthat

definetheBeziercontrolpointsforthenewshape.degree RequiredInteger.ThedegreeoftheBeziercurve.flags RequiredInteger.Flagsthatinfluencehowtheshapeisdrawn.

Remarks

ThexyArrayanddegreeparametersmustmeetthefollowingconditions:

1<=degree<=9

Thenumberofpointsmustbek*degree+1,wherekisapositiveinteger.Ifthefirstpointiscalledp0,thenforanyintegermbetween1andk,p(m*degree)isassumedtobethelastcontrolpointofaBeziersegment,aswellasthefirstcontrolpointofthenext.

TheresultisacompositecurvethatconsistsofkBeziersegments.TheinputpointsfromxyArraydefinethecurve'scontrolpoints.Ifyouwantasmoothcurve,makesurethepointsp(n-1),pnandp(n+1)areco-linearwhenevern=m*degreewithanintegerm.ThecompositeBeziercurveisrepresentedintheapplicationasaB-splinewithintegerknotsofmultiplicity=degree.

Thecontrolpointsshouldbeininternaldrawingunits(inches)withrespecttothecoordinatespaceofthepage,master,orgroupwheretheshapeisbeingdropped.ThepassedarrayshouldbeatypeSAFEARRAYof8-bytefloatingpointvaluespassedbyreference(VT_R8|VT_ARRAY|VT_BYREF).ThisishowMicrosoftVisualBasicpassesarraystoAutomationobjects.

Theflagsargumentisabitmaskthatspecifiesoptionsfordrawingthenewshape.Itsvalueshouldbezero(0)orvisSpline1D(8).

IfflagsisvisSpline1DandthefirstandlastpointsinxyArraydon'tcoincide,theDrawBeziermethodproducesashapewithone-dimensional(1-D)behavior;otherwise,itproducesashapewithtwo-dimensional(2-D)behavior.

IfthefirstandlastpointsinxyArraydocoincide,theDrawBeziermethodproducesafilledshape.

DrawLinemethod

AddsalinetotheShapescollectionofapage,master,orgroup.

Versionadded

2.0

Syntax

objRet=object.DrawLine(x1,y1,x2,y2)objRet AShapeobjectthatrepresentsthenewline.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectonwhichtodrawtheline.x1 RequiredDouble.Thex-coordinateoftheline'sbeginpoint.y1 RequiredDouble.They-coordinateoftheline'sbeginpoint.x2 RequiredDouble.Thex-coordinateoftheline'sendpoint.y2 RequiredDouble.They-coordinateoftheline'sendpoint.

Remarks

UsingtheDrawLinemethodisequivalenttousingtheLinetoolinVisio.Theargumentsareininternaldrawingunitswithrespecttothecoordinatespaceofthepage,master,orgroupwherethelineisbeingplaced.

DrawNURBSMethod

CreatesanewshapewhosepathconsistsofasingleNURBS(nonuniformrationalB-spline)segment.

Versionadded

2000

Syntax

objRet=object.DrawNURBS(degree,xyArray,knots,flagsobjRet AnobjectthatrepresentsthenewNURBScurve.object Required.AnexpressionthatreturnsaPage,Master,orShape

whichtodrawtheshape.degree RequiredInteger.Thespline'sdegree;anintegerbetween1and25.xyArray RequiredDouble.Anarrayofalternatingxandyvaluesthatdefinethe

controlpointscoordinates;useinternaldrawingunits(inches).knots RequiredDouble.Anarrayofknots.flags RequiredInteger.Flagsthatinfluencehowtheshapeisdrawn.weights OptionalVariant.Anarrayofweights.

Example

Remarks

TheDrawNURBSmethodcreatesanewshapewhosepathconsistsofasingleNURBSsegmentasspecifiedbythearguments.

Thecontrolpointsshouldbeininternaldrawingunits(inches)withrespecttothecoordinatespaceofthepage,master,orgroupwheretheshapeisbeingdropped.ThexyArray,knots,andweightsarraysshouldbeoftypeSAFEARRAYof8-bytefloatingpointvaluespassedbyreference(VT_R8|VT_ARRAY|VT_BYREF).ThisishowMicrosoftVisualBasicpassesarraystoAutomationobjects.

Theknotsargumentisunit-less.Thesequenceofknotsshouldbenon-decreasing.Inotherwords,knots(i+1)<knots(i)isnotacceptable.knots(i+1)=knots(i)ispermitted,andthenthevalueisrepeated,butthefollowingrestrictionsapply:

Thefirstknotmaynotberepeatedmorethandegree+1times.

Thelastknotmaynotberepeated.

Anyknotbetweenthefirstandlastmaynotberepeatedmorethandegreetimes.

Ifthefirstknotisrepeatedlessthandegree+1times,thesplineisperiodic.

Thelistofweightsisoptional.Itsabsencesignalsthatthesplineisnon-rational.Weightsareunit-less.

Thefollowingrulesapplytothesizesofthelists.Forasplinewithncontrolpoints:

Ifthesplineisperiodic,thenn>2.Otherwise,n>degree.

ThesizeofxyArrayis2n.

Thesizeoftheweightsarrayisn(ifpresent).

Thesizeoftheknotsarrayisn+1.

Theconventionalnon-periodicsplinerequiresn+degree+1knots,buttheapplicationimpliestherepeatedknotsattheend.Forexample,thedegree2knotlist(0,0,0,2,5,8)isinterpretedintheapplicationastheconventionalknot

sequence(0,0,0,2,5,8,8,8).

Theflagsparameterisabitmaskthatspecifiesoptionsfordrawingthenewshape.Itsvalueshouldbeeitherzero(0)orvisSpline1D(8).IfflagsisvisSpline1DandifthefirstandlastpointsinxyArraydon'tcoincide,theDrawNURBSmethodproducesashapewithone-dimensional(1-D)behavior;otherwise,itproducesashapewithtwo-dimensional(2-D)behavior.

IfthefirstandlastpointsinxyArraydocoincide,theDrawNURBSmethodproducesafilledshape.

DrawOvalmethod

AddsanellipsetotheShapescollectionofapage,master,orgroup.

Versionadded

2.0

Syntax

retVal=object.DrawOval(x1,y1,x2,y2)retVal AShapeobjectthatrepresentsthenewellipse.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectonwhichtodrawtheellipse.x1 RequiredDouble.Theleftsideoftheellipse'swidth-height

box.y1 RequiredDouble.Thetopoftheellipse'swidth-heightbox.x2 RequiredDouble.Therightsideoftheellipse'swidth-height

box.y2 RequiredDouble.Thebottomoftheellipse'swidth-heightbox.

Remarks

UsingtheDrawOvalmethodisequivalenttousingtheEllipsetoolintheapplication.Theargumentsareininternaldrawingunitswithrespecttothecoordinatespaceofthepage,master,orgroupwheretheellipseisbeingplaced.

DrawPolylinemethod

Createsanewshapewhosepathisapolylinealongagivensetofpoints.

Versionadded

2000

Syntax

objRet=object.DrawPolyline(xyArray,flags)objRet AShapeobjectthatrepresentsthenewpolyline.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectinwhichtodrawtheshape.xyArray RequiredDouble.Anarrayofalternatingxandyvaluesthat

definespointsinthenewshape'spath.flags RequiredInteger.Flagsthatinfluencehowtheshapeisdrawn.

Remarks

TheDrawPolylinemethodcreatesanewshapewhosepathconsistsofa

sequenceoflinesegmentsandwhoseendpointsmatchthepointsspecifiedinxyArray.CallingtheDrawPolylinemethodisequivalenttocallingtheDrawSplinemethodwithatoleranceofzero(0)andaflagofvisSplineAbrupt.

Thecontrolpointsshouldbeininternaldrawingunits(inches)withrespecttothecoordinatespaceofthepage,master,orgroupwheretheshapeisbeingdropped.ThepassedarrayshouldbeatypeSAFEARRAYof8-bytefloatingpointvaluespassedbyreference(VT_R8|VT_ARRAY|VT_BYREF).ThisishowMicrosoftVisualBasicpassesarraystoAutomationobjects.

Theflagsargumentisabitmaskthatspecifiesoptionsfordrawingthenewshape.ItsvaluecanincludevisPolyline1D(8)orvisPolyarcs(256).Ifflagsincludes

visPolyline1DandifthefirstandlastpointsinxyArraydon'tcoincide,theDrawPolylinemethodproducesashapewithone-dimensional(1-D)behavior;otherwise,itproducesashapewithtwo-dimensional(2-D)behavior.

visPolyarcs,thenVisiowillproduceasequenceofarcsratherthanasequenceoflinesegments;xyArrayshouldspecifytheinitialx,ypointofthesequencefollowedbyx,ybowtriples.VisiowillproduceashapewithEllipticalArcTorowswherethebowofthearcmatchesthespecifiedvalue.

IfthefirstandlastpointsinxyArraycoincide,theDrawPolylinemethodproducesafilledshape.

DrawRectanglemethod

AddsarectangletotheShapescollectionofapage,master,orgroup.

Versionadded

2.0

Syntax

objRet=object.DrawRectangle(x1,y1,x2,y2)objRet AShapeobjectthatrepresentsthenewrectangle.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectonwhichtodrawtherectangle.x1 RequiredDouble.Theleftsideoftherectangle'swidth-height

box.y1 RequiredDouble.Thetopoftherectangle'swidth-heightbox.x2 RequiredDouble.Therightsideoftherectangle'swidth-height

box.y2 RequiredDouble.Thebottomoftherectangle'swidth-height

box.

Remarks

UsingtheDrawRectanglemethodisequivalenttousingtheRectangletoolintheapplication.Theargumentsareininternaldrawingunitswithrespecttothecoordinatespaceofthepage,master,orgroupwheretherectangleisbeingplaced.

DrawRegionmethod

Drawsanewshapethatrepresentstheregioncontainingagivenpoint.

Versionadded

2000

Syntax

objRet=object.DrawRegion(tolerance,flags,[x],[y],[ResultsMasterobjRet AShapeobject.object Required.AnexpressionthatreturnsaSelectionobject.tolerance RequiredDouble.Errortolerancewhendeterminingthecoincidenceofpoints.

Adistanceexpressedininternalunitsinthecoordinatespaceoftheobject'scontainingshape;themaximumgapbetweenpathsthatistoleratedwhenconstructingtheboundariesofaregion.

flags RequiredInteger.Aconstantorintegerthatspecifieshowtodrawtheregion.x OptionalVariant.X-coordinateininternalunitsinthecoordinatespaceofthe

Selectionobject.y OptionalVariant.Y-coordinateininternalunitsinthecoordinatespaceofthe

Selectionobject.ResultsMaster OptionalVariant.TheMasterobjectwhichthenewShapeobjectshouldbean

instanceof.

Remarks

Seealso Example

TheDrawRegionmethodcreatesanewShapeobjectfrompiecesofthepathsintheSelectionobject.

Ifbothxandyarespecified,theresultingshapeisthesmallestregionthatcontainsthepoint(x,y).

Intheabsenceofeitherxory,orifthepoint(x,y)isnotcontainedinanyregionenclosedbythepathsoftheselectedshapes,theresultistheunionofalltheshapesthatwouldhavebeencreatedusingtheFragmentoperation.

Ifnoclosedregionisdefinedbytheselectedshapes,thentheDrawRegionmethodreturnsNothingandraisesnoexception.

TheflagsargumentcanbeoneoracombinationofthefollowingconstantsdeclaredbytheVisiotypelibraryinVisDrawRegionFlags.

Name Value DescriptionvisDrawRegionDeleteInput &H4 Deleteitemsinselection.visDrawRegionIncludeHidden &H10 Includehiddengeometry.visDrawRegionIgnoreVisible &H20 Excludevisiblegeometry.

IftheDrawRegionmethodispassedaResultsMasteroftypeVT_EMPTYorVT_ERROR(whichishowVBApassesanunspecifiedoptionalargument),thenewshapeisnotaninstanceofamasterandthefill,line,andtextstylesofthenewregionaresettothedocument'sdefaultstyles.

IftheDrawRegionmethodispassedareferencetoaMasterobjectinResultsMaster(typeVT_UNKNOWNorVT_DISPATCH),thentheDrawRegionmethodinstancesthatMasterobjectandaddsgeometrycomputedgiventheSelectionobject.

ThenewShapeobjecthasnotextotherthantextalreadyinResultsMaster.

DrawSplinemethod

Createsanewshapewhosepathfollowsagivensequenceofpoints.

Versionadded

4.1

Syntax

objRet=object.DrawSpline(xyArray,tolerance,flags)objRet AShapeobjectthatrepresentsthenewspline.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectinwhichtodrawthenewshape.xyArray RequiredDouble.Anarrayofalternatingxandyvaluesthat

definepointsinthenewshape'spath.tolerance RequiredDouble.Howcloselythepathofthenewshapemust

approximatethegivenpoints.flags RequiredInteger.Flagsthatinfluencehowtheshapeisdrawn.

Remarks

TheDrawSplinemethodcreatesanewshapewhosepathfallswithinthegiventoleranceofthegivenarrayofpoints.Tofitthegivenpointsexactly,specifyatoleranceofzero(0).Typically,theDrawSplinemethodfitssplinesegmentsthroughthepoints,butitsometimesproduceslineorcirculararcsegmentsinthenewshape.

Thecontrolpointsandtoleranceareininternaldrawingunits(inches)withrespecttothecoordinatespaceofthepage,master,orgroupwheretheshapeisbeingdropped.ThepassedarrayshouldbeatypeSAFEARRAYof8-bytefloatingpointvaluespassedbyreference(VT_R8|VT_ARRAY|VT_BYREF).ThisishowMicrosoftVisualBasicpassesarraystoAutomationobjects.

Theerrorfromthepointstothepathoftheresultingshapeisroughlywithintolerance.Whenthenumberofpointsislarge,theactualerrormaysometimesexceedtheprescribedtolerance.

Theflagsargumentisabitmaskthatspecifiesoptionsfordrawingthenewshape.Itsvalueshouldbeacombinationofzeroormoreofthefollowingvalues.

Constant ValuevisSplinePeriodic 1(&H1)visSplineDoCircles 2(&H2)visSplineAbrupt 4(&H4)visSpline1D 8(&H8)

IfflagsincludesvisSplinePeriodicandthefollowingconditionsaremet,theapplicationattemptstodrawaperiodicspline.Otherwise,Visiodrawsanon-periodicspline:

Thelastpointmustbearepetitionofthefirstone.

IftheflagvisSplineAbruptisincludedaswell,theentireclosedpathoutlinedbythepointsmustbefreeofabruptchangesofdirectionandcurvature.

IfflagsincludesvisSplineDoCircles,Visiorecognizescircularsegmentsinthegivenarrayofpointsandgeneratescirculararcsinsteadofsplinerowsforthosesegments.

IfflagsincludesvisSplineAbrupt,Visiobreaksthesplinewheneveritdetectsan

abruptchangeofdirectionorcurvatureinthepoint'strail.AnabruptchangeofdirectionisdefinedbythreeconsecutivepointsA,B,Cinthelist,forwhichthedistancebetweenBandthelinesegmentACismorethantwicethetolerance.TheapplicationalsoconsiderspointBtobeanabruptchangeifoneofthesegmentsABorBCismorethantwiceaslongastheother.Atapointwhereanabruptchangeisdetected,theapplicationendsthecurrentpiece(line,arc,orspline)andstartsafreshone.

IfflagsincludesvisSpline1DandthefirstandlastpointsinxyArraydon'tcoincide,theDrawSplinemethodproducesashapewithone-dimensional(1-D)behavior,otherwise,itproducesashapewithtwo-dimensional(2-D)behavior.

IfthefirstandlastpointsinxyArraydocoincide,theDrawSplinemethodproducesafilledshape.

Dropmethod

CreatesanewShapeorMasterobjectbydroppinganobjectontoareceivingobjectsuchasastencil,drawingpage,orgroup.

Versionadded

2.0

Syntax

objRet=object.Drop(dropObject,x,y)objRet TheMasterorShapeobjectcreatedbydroppingdropObject.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.TheobjecttoreceivedropObject.dropObject Required.Theobjecttodrop.WhilethisistypicallyaVisio

objectsuchasaMaster,Shape,orSelectionobject;itcanbeanyOLEobjectthatprovidesanIDataObjectinterface.

x RequiredInteger.Thex-coordinateatwhichtoplacethecenteroftheshape'swidthorPinX.

y RequiredInteger.They-coordinateatwhichtoplacethecenter

oftheshape'sheightorPinY.

Remarks

UsingtheDropmethodissimilartodragginganddroppingashapewiththemouse.Theobjectdropped(dropObject)canbeamasterorashapeonthedrawingpage.

Toaddashapetoagrouporonadrawingpage,applytheDropmethodtoaShapeorPageobject,respectively.Thecenteroftheshape'swidth-heightboxispositionedatthespecifiedcoordinates,andaShapeobjectthatrepresentstheshapethatiscreatedisreturned.WhenapplyingthismethodtoaShapeobject,makesurethattheShapeobjectrepresentsagroup.

IfdropObjectisaMaster,thepinofthemasterisdroppedatthespecifiedcoordinates.Amaster'spinisoften,butnotnecessarily,atitscenterofrotation.

Tocreateanewmasterinastencil,applytheDropmethodtoaDocumentobjectthatrepresentsastencil(thestencilmustbeopenedasanoriginaloracopyratherthanread-only).Inthiscase,thexandyargumentsareignored,andthenewmasterthatiscreatedisreturned.

DropMany[U]method

CreatesoneormorenewShapeobjectsonapage,inamaster,orinagroup.ItreturnsanarrayoftheIDsoftheShapeobjectsitproduces.

Versionadded

4.5

Syntax

intRet=object.DropMany(ObjectsToInstance,xyArray,IDArrayintRet Integer.NumberofentriesinxyArraythatprocessedsuccessfully.object Required.AnexpressionthatreturnsaPage,Master,orShape

whichtocreatenewshapes.ObjectsToInstance RequiredVariant.Identifiesmastersorotherobjectsfromwhichtomake

shapes.xyArray RequiredDouble.Anarrayofalternatingxandyvaluesspecifyingthe

positionsforthenewshapes.IDArray RequiredInteger.AnarraythatreturnstheIDsofthecreatedshapes.

Remarks

UsingtheDropManymethodislikeusingthePage,Master,orShapeobject'sDropmethod,exceptyoucanusetheDropManymethodtocreatemanynewShapeobjectsatonce,ratherthanonepermethodcall.TheDropManymethodcreatesnewShapeobjectsonthepage,inthemaster,orinthegroupshapetowhichitisapplied(thisshapeiscalledthe"targetobject"inthefollowingdiscussion).

ObjectsToInstanceshouldbeaone-dimensionalarrayofn>=1variants.ItsentriesidentifyobjectsfromwhichyouwanttomakenewShapeobjects.AnentryoftenreferstoaVisioapplicationMasterobject.ItmightalsorefertoaVisioapplicationShapeobject,Selectionobject,orevenanobjectfromanotherapplication.Theapplicationdoesn'tcarewhatthelowerandupperarrayboundsoftheObjectsToInstanceentriesare.Callthesevlbandvub,respectively.

IfObjectsToInstance(i)isanunknownordispatch(inMicrosoftVisualBasicforApplications,areferencetoaselection,shape,master,guide,orOLEobject),thentheobjectitisreferencingisinstanced.ThisisessentiallyequivalenttocallingDrop(ObjectsToInstance(i),x,y).

IfObjectsToInstance(i)istheintegerj,thenaninstanceoftheMasterobjectinthedocumentstencilofthetargetobject'sdocumentwhose1-basedindexisjismade.TheEventDropcellintheEventssectionofthenewshapeisnottriggered.UsetheDropmethodinsteadifyouwanttheEventDropcelltotrigger.

IfObjectsToInstance(i)isthestrings(orareferencetothestrings),thenaninstanceoftheMasterobjectwithnamesinthedocumentstencilofthetargetobject'sdocumentismade;scanequaleithertheMasterobject'sUniqueIDorNameproperty.TheEventDropcellintheEventssectionofthenewshapeisnottriggered.UsetheDropmethodinsteadifyouwanttheEventDropcelltotrigger.

Forvlb<i<=vub,ifObjectsToInstance(i)isempty(NothingoruninitializedinMicrosoftVisualBasic),thenentryiwillcauseObjectsToInstance(j)tobeinstancedagain,wherejisthelargestvalue<isuchthatObjectsToInstance(j)isn'tempty.Ifyouwanttomakeninstancesofthesamething,onlyObjectsToInstance(vlb)needstobeprovided.

ThexyArrayargumentshouldbeaone-dimensionalarrayof2mdoubleswithlowerboundxylbandupperboundxyub,wherem>=n.ThevaluesinthearraytelltheDropManymethodwheretopositiontheShapeobjectsitproduces.ObjectsToInstance(vlb+(i-1))isdroppedat(xy[(i-1)2+xylb],xy[(i-1)2+xylb+1])for1<=i<=n.

Notethatm>nisallowed.Forn<i<=m,thei'ththinginstancedisthesamethingasthen'ththinginstanced.Thustomakem>=1instancesofthesamething,youcanpassanObjectsToInstancearraywithoneentryandanmentryxyArrayarray.

Iftheentitybeinginstancedisamaster,thepinofthenewShapeobjectispositionedatthegivenxy.Otherwise,thecenteroftheShapeobjectsispositionedatthegivenxy.

ThevalueintRetreturnedbytheDropManymethodisthenumberofxyentriesinxyArraythattheDropManymethodsuccessfullyprocessed.Ifallentriesprocessedsuccessfully,thenmisreturned.Ifsomeentriesaresuccessfullyprocessedpriortoanerroroccurring,thentheproducedShapeobjectsarenotdeletedandthisraisesanexceptionyetstillreturnsapositiveintRet.

Presumingallmxyentriesprocesscorrectly,thenumberofnewShapeobjectsproducedbytheDropManymethodisusuallyequaltom.Inrarecases(forexample,ifaSelectionobjectgetsinstanced),morethanmShapeobjectsmaybeproduced.ThecallercandeterminethenumberofproducedShapeobjectsbycomparingthenumberofshapesinthetargetobjectbeforeandaftertheDropManymethodexecutes.ThecallercanassertthenewShapeobjectsarethosewiththehighestindicesinthetargetobject'sShapescollection.

IftheDropManymethodreturnszero(0),IDArrayreturnsNull(Nothing).Otherwise,itreturnsaone-dimensionalarrayofmintegersindexedfrom0tom-1.IDArrayisanoutargumentthatisallocatedbytheDropManymethodandownershipispassedtotheprogramthatcalledtheDropManymethod.ThecallershouldeventuallyperformtheSafeArrayDestroyprocedureonthereturnedarray.(VisualBasicandVisualBasicforApplicationstakecareofthisforyou.)

IfIDArrayreturnsnon-Null(notNothing),thenIDArray(i-1),1<=i<=intRet,returnstheIDoftheShapeobjectproducedbythei'thxyArrayentry,provided

thei'thxyArrayentryproducedexactlyoneShapeobject.Ifthei'thxyArrayentryproducedmultipleShapeobjects,then-1isreturnedintheentry.Allentriesi,intRet<=i<m,return-1.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheDropManymethodtodropmorethanoneshapewhenusinglocalnamestoidentifytheshapes.UsetheDropManyUmethodtodropmorethanoneshapewhenusinguniversalnamestoidentifytheshapes.

Duplicatemethod

Duplicatesanobjectorselection.

Versionadded

2.0

Syntax

object.Duplicateobject Required.AnexpressionthatreturnsaSelectionorShape

object.

Remarks

TheDuplicatemethodduplicatesthespecifiedobjectorselectionandaddsacopytothesamepageastheoriginal.UsingtheDuplicatemethodisequivalenttoclickingDuplicateontheEditmenu.

WhenusedwithaShapeobject,theDuplicatemethodduplicatestheshape.

WhenusedwithaSelectionobject,theDuplicatemethodduplicatestheselection.

EndUndoScopemethod

Endsorcancelsatransactionwithauniquescope.

Versionadded

2000

Syntax

object.EndUndoScope(nScopeID,bCommit)object Required.AnexpressionthatreturnsanApplicationobject.nScopeID RequiredLong.TheIDofthescopetoclose.bCommit RequiredBoolean.Aflagindicatingthatthechangesmade

duringthescopeshouldbeaccepted(True)orcanceled(False).

Remarks

Ifyouneedtoknowwhethereventsyoureceivearetheresultofaparticularoperationthatyouinitiated,usetheBeginUndoScopeandEndUndoScopemethodstowrapyouroperation.Inyoureventhandlers,usetheIsInScopepropertytotestwhetherthescopeIDreturnedbytheBeginUndoScopemethod

ispartofthecurrentcontext.MakesureyouclearthescopeIDyoustoredfromtheBeginUndoScopepropertywhenyoureceivetheExitScopeeventwiththatID.

YoumustbalancecallstotheBeginUndoScopemethodwithcallstotheEndUndoScopemethod.IfyoucalltheBeginUndoScopemethod,youshouldcalltheEndUndoScopemethodassoonasyouaredonewiththeactionsthatconstituteyourscope.Also,whileactionstomultipledocumentsshouldberobustwithinasinglescope,closingadocumentmayhavethesideeffectofpurgingtheundoinformationforthecurrentlyopenscopeaswellaspurgingtheundoandredostacks.Ifthathappens,passingbCommit=FalsetoEndUndoScopedoesnotrestoretheundoinformation.

YoucanalsousetheBeginUndoScopeandEndUndoScopemethodstoaddanactiondefinedbyanadd-ontotheVisioundostream.Thisisusefulwhenyouareoperatingfrommodelessscenarioswheretheinitiatingagentispartofanadd-on'suserinterfaceoramodelessprogrammaticaction.

NoteMostVisioactionsarealreadywrappedininternalundoscopes,soadd-onsrunningwithintheapplicationdonotneedtocallthismethod.

EnumDirectoriesmethod

ReturnsanarraynamingthefoldersMicrosoftVisiowouldsearchgivenalistofpaths.

Versionadded

4.5

Syntax

object.EnumDirectoriespathList,nameArrayobject Required.AnexpressionthatreturnsanApplicationobject.pathList RequiredString.Astringoffullorpartialpathsseparatedby

semicolons.nameArray String.Arraythatreceivestheenumeratedfoldernames.

Remarks

SeveralVisiopropertiessuchasAddonPathsandTemplatePathsacceptandreceiveastringinterpretedtobealistofpath(folder)namesseparatedbysemicolons.Non-fullyqualifiednamesinthelistareappendedtothefolderthat

containstheVisioprogramfiles(appObj.Path).Whentheapplicationlooksforitemsinthenamedpaths,itlooksinthefoldersandalltheirsubfolders.

Supposed:\Add-onsisapaththatexistsande:\Add-onsisapaththatdoesn'texist.IftheVisioexecutablefileisinstalledinc:\Visio,andAddonPathsis"Add-ons;d:\Add-ons",theapplicationlooksforadd-onsinc:\Visio\Add-ons,d:\Add-ons,andanyoftheirsubfolders.

ThepurposeoftheEnumDirectoriesmethodistoacceptastringsuchasonethattheAddonPathspropertymightproduceandreturnalistofthefoldersthattheapplicationenumerateswhenprocessingsuchastring.

IftheEnumDirectoriespropertysucceeds,nameArrayreturnsaone-dimensionalarrayofnstringsindexedfrom0ton-1.Eachstringisthefullyqualifiednameofafolderthatexists.Thelistnamesthosefoldersdesignatedinthepathlistthatexistandalltheirsubfolders.

ThenameArrayargumentisanoutargumentthatisallocatedbytheEnumDirectoriesmethodandownershipispassedbacktothecaller.ThecallershouldeventuallyperformtheSafeArrayDestroyprocedureonthereturnedarray.(VisualBasicandVisualBasicforApplicationsautomaticallyfreethestringsreferencedbythearray'sentries.)

ExecuteLinemethod

ExecutesalineofMicrosoftVisualBasiccode.

Versionadded

4.5

Syntax

object.ExecuteLinestringExpressionobject Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.AstringthatwillbeinterpretedasMicrosoft

VisualBasicforApplications(VBA)code.

Remarks

TheVBAprojectoftheDocumentobjectistoldtoexecutethesuppliedstring.VBAtreatsthestringasitwouldtreatthesamestringtypedintoitsImmediatewindow.

TheExecuteLinemethodcreatesaVBAprojectinthedocumentifonedoesnot

Example

exist.

Herearesomepossibilities:

ThisDocument.ExecuteLine("SomeMacro")'Executesthemacro(argumentlessprocedure)namedSomeMacro'thatisinsomemoduleoftheVBAprojectofThisDocument.ThisDocument.ExecuteLine("SomeProc1,2,3")'ExecutestheprocedurenamedSomeProcandpassesit3arguments.ThisDocument.ExecuteLine("Module1.SomeProc1,2,3")'Sameaspreviousexample,butprocedurenamequalified'withmodulename.ThisDocument.ExecuteLine("UserForm1.Show")'ShowstheformUserForm1.ThisDocument.ExecuteLine("Debug.Print""somestring""")'Prints"somestring"toVBA'sImmediatewindow.ThisDocument.ExecuteLine("Debug.PrintDocuments.Count")'PrintsnumberofopendocumentstoImmediatewindow.ThisDocument.ExecuteLine("ThisDocument.Save")'TellsThisDocumenttosaveitself.

Exportmethod

ExportsanobjectfromMicrosoftVisiotoafileformatsuchas.pcx,.eps,or.htm.

Versionadded

3.0

Syntax

object.ExportfileNameobject Required.AnexpressionthatreturnsaPage,Master,

Selection,orShapeobjecttoexport.fileName RequiredString.Thefullyqualifiedpathandnameofthefile

toreceivetheexportedobject.

Remarks

Thefileextensionindicateswhichexportfiltertouse.Ifthefilterisnotinstalled,theExportmethodreturnsanerror.TheExportmethodusesthedefaultpreferencesettingsforthespecifiedfilteranddoesnotprompttheuserfornon-

Example

defaultarguments.

TheExportmethodofaPageobjectsupportssavingtoHTMLfileformatusingtheextension.htmor.html.PagesareexportedusingthesettingsthatwerelastselectedintheSaveAsdialogbox.

Ifthespecifiedfilealreadyexists,itisreplacedwithoutpromptingtheuser.

ExportIconmethod

ExportstheiconforaMasterobjecttoanamedfileortheClipboard.

Versionadded

4.5

Syntax

object.ExportIconfileName,flags,[TransparentRGB]object Required.AnexpressionthatreturnsaMasterobject.fileName RequiredString.Thefiletowhichtoexporttheicon.flags RequiredInteger.Theformatinwhichtowritetheexported

file.TransparentRGBOptionalVariant.Thecolortosubstituteforanytransparent

areasoftheexportediconimage.

Remarks

IffileNameisempty,themaster'siconiscopiedtotheClipboard.

Example

IfthevalueofflagsisvisIconFormatVisio(0),theiconisexportedintheapplicationinternaliconformat.TheImportIconmethodacceptsfileswritteninthisformat.

IfthevalueofflagsisvisIconFormatBMP(2),theiconisexportedinbitmap(.bmp)fileformat.

StartingwithVisio2000,youcanusetheTransparentRGBargumentwiththeExportIconmethod.IfTransparentRGBisomitted,thecolordefaultstoblack,whichsimulatesVisio5.0behavior.

FitCurvemethod

Reducesthenumberofgeometrysegmentsinashapeorshapesbyreplacingthemwithsimilarspline,arc,andlinesegmentsthatapproximatethepathsoftheinitialsegments.Typically,thisreducesthenumberofsegmentsintheshape.

Versionadded

4.1

Syntax

object.FitCurvetolerance,flagsobject Required.AnexpressionthatreturnsaShapeorSelection

objectwhosepathistobereplaced.tolerance RequiredDouble.Howcloselytheresultingpathsmustmatch

theshape'soriginalpaths.flags RequiredInteger.Flagsthatinfluencehowtheshapeisdrawn.

Remarks

TheFitCurvemethodofaSelectionobjectoptimizeseachoftheshapesinthe

Example

selection.Itdoesnotcombinetheselectedshapesintoasingleshape.

ThepathsresultingfromtheFitCurvemethodfallwithinthegiventoleranceoftheinitialpaths.Toleranceshouldbeininternaldrawingunits(inches).Tomatchtheinitialpathsexactly,specifyatoleranceofzero(0).

Theflagsargumentisabitmaskthatspecifiesoptionsforoptimizingthepaths.Itsvalueshouldbeacombinationofzeroormoreofthefollowingvalues.

Constant Value DescriptionvisSplinePeriodic &H1 Produceperiodicsplinesifappropriate.visSplineDoCircles &H2 Recognizecircularsegmentsinthe

shape(s)andgeneratecirculararcsinsteadofsplinerowsforthosesegments.

visSplineAbrupt &H4 Breaktheresultingsplineswheneveranabruptchangeofdirectionorcurvatureinapathisdetected.

FlipHorizontalmethod

Flipsanobjecthorizontally.

Versionadded

2.0

Syntax

object.FlipHorizontalobject Required.AnexpressionthatreturnsaShapeorSelection

objecttoflip.

Example

FlipVerticalmethod

Flipsanobjectvertically.

Versionadded

2.0

Syntax

object.FlipVerticalobject Required.AnexpressionthatreturnsaShapeorSelection

objecttoflip.

Example

Followmethod

CausesMicrosoftVisiotonavigatetoahyperlink.

Versionadded

5.0

Syntax

object.Followobject Required.AnexpressionthatreturnsaHyperlinkobject.

FollowHyperlinkmethod

Navigatestoanarbitrarydocument-basedhyperlink.

Versionadded

5.0

Syntax

object.FollowHyperlink(Address,SubAddress,[ExtraInfoobject Required.AnexpressionthatreturnsaDocumentobject.Address RequiredString.Theaddresstowhichyouwanttonavigate.SubAddress RequiredString.Thesubaddresstowhichyouwanttonavigate;ifyoudon'tneedthisinformation,passanempty

string.ExtraInfo OptionalVariant.ExtraURLrequestinformationtouseinresolvingtheURL.Frame OptionalVariant.TheHTMLframetowhichtonavigate.NewWindow OptionalVariant.Specifiesifanewwindowistobeopened.res1 Optional.Unused.res2 Optional.Unused.

Example

res3 Optional.Unused.

Remarks

FromMicrosoftVisualBasicorVisualBasicforApplications,donotpassavalueforoptionalarguments.FromC/C++,passanemptyvariantforoptionalarguments.

Visio4.5providedanundocumentedHyperlinkmethodforaDocumentobjectwiththefollowingsignature:

HRESULTFollowHyperlink[in]BSTRTarget,[in]BSTRLocation);

Visio5.0andlaterstillsupportthismethodbutithasbeenrenamedtoFollowHyperlink45:

HRESULTFollowHyperlink45[in]BSTRTarget,[in]BSTRLocation);

FormatResultmethod

Formatsastringornumberintoastringaccordingtoaformatpicture,usingspecifiedunitsforscalingandformatting.

Versionadded

4.5

Syntax

stringRet=object.FormatResult(stringOrNumber,unitsInstringRet String.Theevaluatedresultformattedaccordingtoformatandobject Required.AnexpressionthatreturnsanApplicationobject.stringOrNumber RequiredVariant.Stringornumbertobeformatted;canbepassedasastring,

floatingpointnumber,orinteger.unitsIn RequiredVariant.MeasurementunitstoattributetostringOrNumber.unitsOut RequiredVariant.Measurementunitstoexpresstheresultin.format RequiredString.Pictureofwhattheresultstringshouldlooklike.

Remarks

Ifpassedasastring,stringOrNumbermightbetheformulaorprospectiveformulaofacell,ortheresultorprospectiveresultofacellexpressedasastring.TheFormatResultmethodevaluatesthestringandformatstheresult.Becausethestringisbeingevaluatedoutsidethecontextofbeingtheformulaofaparticularcell,theFormatResultmethodreturnsanerrorifthestringcontainsanycellreferences.

PossiblevaluesforstringOrNumberinclude:

1.7

3

"2.5"

"4.1cm"

"12ft-17in+(12cm/SQRT(7))"

TheunitsInandunitsOutargumentscanbestringssuchas"inches","inch","in.",or"i".StringsmaybeusedforallsupportedVisiounitssuchascentimeters,meters,miles,andsoon.YoucanalsouseanyoftheunitconstantsdeclaredbytheVisiotypelibraryinVisUnitCodes.AlistofvalidunitsisalsoincludedinAboutunitsofmeasure.

IfstringOrNumberisastring,unitsInspecifieshowtointerprettheevaluatedresultandisonlyusediftheresultisascalar.Forexample,theexpression"4*5cm"evaluatesto20cm,whichisnotascalarsounitsInisignored.Theexpression"4*5"evaluatesto20whichisascalarandisinterpretedusingthespecifiedunitsIn.

TheunitsOutargumentspecifiestheunitsinwhichthereturnedstringshouldbeexpressed.Ifyouwanttheresultsexpressedinthesameunitsastheevaluatedexpression,pass"NOCAST"orvisNoCast.

formatisastringthatspecifiesatemplateorpictureofthestringproducedbytheFormatResultmethod.Fordetails,seetheFORMATfunction.Afewofthepossibilitiesare:

#:Ouputasingledigit,butnotifit'saleadingortrailing0.

0:Outputasingledigit,evenifitisaleadingortrailing0.

.:Decimalplaceholder.

,:Thousandsseparator.

"text"or'text':Outputenclosedtextasis.

\c:Outputthecharacterc.

Examples

Whereastringisspecified

Whereanumberisspecified

Fragmentmethod

Breaksselectedshapesintosmallershapes.

Versionadded

2.0

Syntax

object.Fragmentobject Required.AnexpressionthatreturnsaSelectionobjectthat

containstheshapestofragment.

Remarks

UsingtheFragmentmethodisequivalenttoclickingFragmentontheOperationssubmenuoftheShapemenu.Theproducedshapesarethetopmostshapesinthecontainingshapeoftheselectedshapes.Theyinherittheformattingofthefirstselectedshapeandhavenotext.

Theoriginalshapesaredeletedandtherearen'tanyshapesselectedwhenthe

Example

operationiscomplete.

GetFilterCommandsmethod

ReturnsanarrayofcommandrangesandaTrueorFalsevalueindicatinghowtofiltereventsforthatcommandrange.

Versionadded

2002

Syntax

retVal=object.GetFilterCommands()object Required.AnexpressionthatreturnsanEventobject.retVal Long.AnarrayofcommandrangesandaTrueorFalsevalue

specifyinghowtofiltereventsforthatcommandrange.

Remarks

TheeventfiltersdescribedinthearrayreturnedbytheGetFilterCommandsmethodprovidedevelopersawayofignoringspecifiedeventsbasedoncommandID.ThearrayreturnedisthatpassedtotheSetFilterCommandsmethodforthisEventobject.

Example

ThearraythatisreturnedbytheGetFilterCommandsmethodcanbeinterpretedinthefollowingmanner:

Thenumberofelementsinthearrayisamultipleof3,asfollows:

ThefirstelementcontainsthebeginningcommandIDoftherange(anymemberofVisUICmds).

ThesecondelementcontainstheendcommandIDoftherange(anymemberofVisUICmds).

ThethirdelementcontainsaTrueorFalsevalue,whichindicateswhetheryouarelisteningtoeventsforthatcommandrange(Truetolistentoevents;Falsetoexcludeevents).

Foraneventtosuccessfullypassthroughacommandfilter,itmustsatisfythefollowingcriteria:

ItmusthaveavalidcommandID.

IfallfiltersareTrue,theeventmustmatchatleastonefilter.

IfallfiltersareFalse,theeventmustnotmatchanyfilter.

IfthefiltersareamixtureofTrueandFalse,theeventmustmatchatleastoneTruefilterandnotmatchanyFalsefilters.

IftherearenoTruerangesdefinedinthearray,eventsareconsideredTrue.

FordetailsaboutdefiningeventfiltersusingcommandIDs,seetheSetFilterCommandsmethod.

GetFilterObjectsmethod

ReturnsanarrayofobjecttypesandaTrueorFalsevalueindicatinghowtofiltereventsforthatobject.

Versionadded

2002

Syntax

retVal=object.GetFilterObjects()object Required.AnexpressionthatreturnsanEventobject.retVal Long.AnarrayofobjectstypesandaTrueorFalsevalue

specifyinghowtofiltereventsforthatobject.

Remarks

TheeventfiltersdescribedinthearrayreturnedbytheGetFilterObjectsmethodprovidedevelopersawayofignoringspecifiedeventsbasedonobjecttype.ThearrayreturnedisthatpassedtotheSetFilterObjectsmethodforthisEventobject.

Example

ThearraythatisreturnedbytheGetFilterObjectsmethodcanbeinterpretedinthefollowingmanner.

Thenumberofelementsinthearrayisamultipleof2:

Thefirstelementcontainsanobjecttype(oneofvisTypePage,visTypeGroup,visTypeShape,visTypeForeignObject,visTypeGuide,orvisTypeDoc).

ThesecondelementcontainsaTrueorFalsevalueindicatingwhetheryouarelisteningtoeventsforthatobject(Truetolistentoanobject'sevents;Falsetoexcludeanobject'sevents).

Foraneventtosuccessfullypassthroughanobjecteventfilter,itmustsatisfythefollowingcriteria:

Itmustbeavalidobjecttype.

IfallfiltersareTrue,theeventmustmatchatleastonefilter.

IfallfiltersareFalse,theeventmustnotmatchanyfilter.

IfthefiltersareamixtureofTrueandFalse,theeventmustmatchatleastoneTruefilterandnotmatchanyFalsefilters.

IftherearenoTruerangesdefinedinthearray,eventsareconsideredTrue.

FordetailsaboutdefiningeventfiltersusingcommandIDs,seetheSetFilterObjectsmethod.

GetFilterSRCmethod

ReturnsanarrayofcellrangesandaTrueorFalsevalueindicatingwhetheryouarefilteringeventsforthatrange.

Versionadded

2002

Syntax

retVal=object.GetFilterSRC()object Required.AnexpressionthatreturnsanEventobject.retVal Integer.AnarrayofcellrangesandaTrueorFalsevalue

specifyinghowtofiltereventsforthatrange.

Remarks

TheeventfiltersdescribedinthearrayreturnedbytheGetFilterSRCmethodprovidedevelopersawayofignoringspecifiedeventsbasedonobjecttype.ThearrayreturnedisthatpassedtotheSetFilterSRCmethodforthisEventobject.

Example

ThearraythatisreturnedbytheGetFilterSRCmethodcanbeinterpretedinthefollowingmanner.

Thenumberofelementsinthearrayisamultipleof7.Thesesevenelementscontainthefollowingvalues:

Thefirstthreeelementsdescribethesection,row,andcellofthebeginningcelloftherange.

Thenextthreeelementsdescribethesection,row,andcelloftheendcelloftherange.

ThelastelementcontainsaTrueorFalsevalueindicatingwhetheryouwanttoreceiveeventsforthespecifiedrangeofcells(Truetolistentoeventsforarangeofcells;Falsetoexcludeeventsfortherangeofcells).

Foraneventtosuccessfullypassthroughacellrangefilter,itmustsatisfythefollowingcriteria:

Itmustbeavalidsection,row,cellreference.

IfallfiltersareTrue,theeventmustmatchatleastonefilter.

IfallfiltersareFalse,theeventmustnotmatchanyfilter.

IfthefiltersareamixtureofTrueandFalse,theeventmustmatchatleastoneTruefilterandnotmatchanyFalsefilters.

IftherearenoTruerangesdefinedinthearray,eventsareconsideredTrue.

FordetailsaboutdefiningeventfiltersusingcommandIDs,seetheSetFilterSRCmethod.

GetFormulas[U]method

Returnstheformulasofmanycells.

Versionadded

4.5

Syntax

object.GetFormulasSID_SRCStream,formulasobject Required.AnexpressionthatreturnsaPage,Master,Shape,

orStyleobject.SID_SRCStream RequiredInteger.Streamidentifyingcellstobequeried.formulas RequiredVariant.Arraythatreceivesformulasofqueried

cells.

Remarks

TheGetFormulasmethodisliketheFormulamethodofaCellobject,exceptyoucanuseittoobtaintheformulasofmanycellsatonce,ratherthanonecellatatime.TheGetFormulasmethodisaspecializationoftheGetResultsmethod,

whichcanbeusedtoobtaincellformulasorresults.SettingupacalltotheGetFormulasmethodinvolvesslightlylessworkthansettinguptheGetResultsmethod.

ForShapeorStyleobjectsyoucanusetheGetFormulasmethodtogetformulasofanysetofcells.

ForaPageorMasterobjectyoucanusetheGetFormulasmethodtogetformulasofanysetofcellsinanysetofshapesofthepageormaster.

SID_SRCStreamisanarrayof2-byteintegers:

ForShapeorStyleobjects,SID_SRCStreamshouldbeaone-dimensionalarrayof3n2-byteintegersforsomen>=1.GetFormulasinterpretsthestreamas:

{sectionIdx,rowIdx,cellIdx}n

wheresectionIdxisthesectionindexofthedesiredcell,rowIdxisitsrowindexandcellIdxisitscellindex.

ForPageorMasterobjects,SID_SRCStreamshouldbeaone-dimensionalarrayof4n2-byteintegersforn>=1.TheGetFormulasmethodinterpretsSID_SRCStreamas:

{sheetID,sectionIdx,rowIdx,cellIdx}n

wheresheetIDistheIDpropertyoftheShapeobjectonthepageormasterwhosecellformulaisdesired.

NoteIfthesheetIDinanentryisvisInvalShapeID(-1)orifthebottombyteofsectionIdxisvisSectionInval(255),thentheentrywillbeignoredandanemptyvariantwillbereturnedinthecorrespondingresultsarrayentry.ThemotivationforthisisthatthesameSID_SRCStreamarraycanbeusedonseveralcallstoGetFormulas,SetFormulas,andsimilarmethodswiththecalleronlyneedingtomakeminorchangestothestreambetweencalls.

IftheGetFormulasmethodsucceeds,formulasreturnsaone-dimensionalarrayofnvariantsindexedfrom0ton-1.Eachvariantreturnsaformulaasastring.FormulasisanoutargumentthatisallocatedbytheGetFormulasmethod,whichpassesownershipbacktothecaller.Thecallershouldeventuallyperform

theSafeArrayDestroyprocedureonthereturnedarray.NotethattheSafeArrayDestroyprocedurehasthesideeffectofclearingthevariantsreferencedbythearray'sentries,hencedeallocatinganystringstheGetFormulasmethodreturns.(MicrosoftVisualBasicandVisualBasicforApplicationstakecareofthisforyou.)TheGetFormulasmethodfailsifformulasisNull.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheGetFormulasmethodtogetmorethanoneformulausinglocalsyntax.UsetheGetFormulasUmethodtogetmorethanoneformulausinguniversalsyntax.

GetNames[U]method

ReturnsthenamesofallitemsinaDocuments,Pages,Masters,Styles,orAddonscollection.

Versionadded

4.5

Syntax

object.GetNamesnameArrayobject Required.Anexpressionthatreturnsacollectionfromthe

Appliestolist.nameArray RequiredString.Arraythatreceivesnamesofmembersofthe

indicatedobject.

Remarks

IftheGetNamesmethodsucceeds,nameArrayreturnsaone-dimensionalarrayofnstringsindexedfrom0ton-1,wherenequalstheCountpropertyoftheobject.nameArrayisanoutargumentthatisallocatedbytheGetNames

Seealso

method,whichpassesownershipbacktothecaller.ThecallershouldeventuallyperformtheSafeArrayDestroyprocedureonthereturnedarray.NotethattheSafeArrayDestroyprocedurehasthesideeffectoffreeingthestringsreferencedbythearray'sentries.TheGetNamesmethodfailsifcalledwith!nameArrayornameArray.(MicrosoftVisualBasicandVisualBasicforApplicationstakecareofthisforyou.)

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheGetNamesmethodtogetmorethanoneobject'slocalname.UsetheGetNamesUmethodtogetmorethanoneobject'suniversalname.

GetPolylineDatamethod

Returnsthepointsrecordedinapolylinerow.

Versionadded

2000

Syntax

object.GetPolylineDataflags,xyArrayobject Required.AnexpressionthatreturnsaRowobject.flags RequiredInteger.Flagsthatinfluencethepointsreturned.xyArray RequiredDouble.Returnsanarrayofalternatingxandyvalues

specifyingthepointsrecordedintherow.

Remarks

Iftherow'stypeisnotvisTagPolylineTo,anexceptionisraised.

IftheGetPolylineDatamethodsucceeds,xyArrayreturnsaone-dimensionalarrayofndoubles(VT_R8)indexedfrom0ton-1.TheargumentxyArrayisan

Example

outargumentthatisallocatedbytheGetPolylineDatamethod,whichpassesownershipbacktothecaller.ThecallershouldeventuallyperformSafeArrayDestroyonthereturnedarray.(MicrosoftVisualBasicandVisualBasicforApplicationsmanagethisforyou.)

Theflagsargumentisabitmaskthatspecifiesoptionsforreturningpoints.Itsvalueshouldbeacombinationofzeroormoreofthefollowingvalues.

Constant Value DescriptionvisGeomExcludeLastPoint &H1 Thelastpointofthepolyline(theXand

Ycellsintherow)willnotbeincludedinxyArray.

visGeomWHPct &H10 ThevaluesreturnedinxyArraywillbepercentagesofwidth/height.

visGeomXYLocal &H20 ThevaluesreturnedinxyArraywillbelocal,internalunitsinthedrawing.

GetResultsmethod

Getstheresultsorformulasofmanycells.

Versionadded

4.5

Syntax

object.GetResultsSID_SRCStream,flags,units,resultsobject Required.AnexpressionthatreturnsaPage,Master,Shape,

orStyleobject.SID_SRCStream RequiredInteger.Arrayidentifyingcellstobequeried.flags RequiredInteger.Flagsthatinfluencethetypeofentries

returnedinresults.units RequiredVariant.Arrayofmeasurementunitsthatresultsare

tobereturnedin.results RequiredVariant.Arraythatreceivesresultsorformulasof

queriedcells.

Remarks

TheGetResultsmethodisliketheResultmethodfortheCellobject,exceptthatitcanbeusedtogettheresults(values)ofmanycellsatonce,ratherthanonecellatatime.

ForShapeorStyleobjects,youcanusetheGetResultsmethodtogetresultsofanysetofcells.

ForaPageorMasterobject,youcanusetheGetResultsmethodtogetresultsofanysetofcellsinanysetofshapesofthepageormaster.

SID_SRCStreamisanarrayof2-byteintegers:

ForShapeorStyleobjects,SID_SRCStreamshouldbeaone-dimensionalarrayof3n2-byteintegersforn>=1.TheGetResultsmethodinterpretsSID_SRCStreamas:

{sectionIdx,rowIdx,cellIdx}n

wheresectionIdxisthesectionindexofthedesiredcell,rowIdxisitsrowindexandcellIdxisitscellindex.

ForPageorMasterobjects,SID_SRCStreamshouldbeaone-dimensionalarrayof4n2-byteintegersforn>=1.TheGetResultsmethodinterpretsSID_SRCStreamas:

{sheetID,sectionIdx,rowIdx,cellIdx}n

wheresheetIDistheIDpropertyoftheShapeobjectonthepageormasterwhosecellresultisdesired.

NoteIfthesheetIDinanentryisvisInvalShapeID(-1)orifthebottombyteofsectionIdxisvisSectionInval(255),thentheentrywillbeignoredandanemptyvariantwillbereturnedinthecorrespondingresultsarrayentry.ThemotivationforthisisthatthesameSID_SRCStreamarraycanbeusedonseveralcallstoGetResults,SetResults,andsimilarmethodswiththecalleronlyneedingtomakeminorchangestothestreambetweencalls.

Theflagsargumentindicateswhatdatatypethereturnedresultsshouldbe

expressedin.Itsvalueshouldbeoneofthefollowing.

Constant Value DescriptionvisGetFloats 0 Resultsreturnedasdoubles

(VT_R8).visGetTruncatedInts 1 Resultsreturnedas

truncatedlongintegers(VT_I4).

visGetRoundedInts 2 Resultsreturnedasroundedlongintegers(VT_I4).

visGetStrings 3 Resultsreturnedasstrings(VT_BSTR).

visGetFormulas 4 Formulasreturnedasstrings(VT_BSTR).

visGetFormulasU 5 Formulasreturnedinuniversalsyntax(VT_BSTR).

Theunitsargumentisanarraythatcontrolswhatmeasurementunitsindividualresultsarereturnedin.Eachentryinthearraycanbeastringsuchas"inches","inch","in.",or"i".StringsmaybeusedforallsupportedVisiounitssuchascentimeters,meters,miles,andsoon.Youcanalsoindicatedesiredunitswithintegerconstants(visCentimeters,visInches,etc.)declaredbytheVisiotypelibrary.NotethatthevaluesspecifiedintheunitsarrayhavenoeffectifflagsisvisGetFormulas.

Ifnotnull,theapplicationexpectsunitstobeaone-dimensionalarrayof1<=uVariants.Eachentrycanbeastringorintegercode,orempty(nothing).Ifthei'thentryisempty,thenthei'threturnedresultisreturnedintheunitsdesignatedbyunits(j),wherejistheindexofthemostrecentpriornon-emptyentry.Thusifyouwantallreturnedvaluestobeinthesameunits,youneedonlypassaunitsarraywithoneentry.Ifthereisnopriornon-emptyentry,orifnounitsarrayissupplied,thenvisNumber(0x20)isused.Thiscausesinternalunits(liketheResultIUpropertyofaCellobject)tobereturned.

IftheGetResultsmethodsucceeds,resultsreturnsaone-dimensionalarrayofnvariantsindexedfromzero(0)ton-1.Thetypeofthereturnedvariantsisafunctionofflags.ResultsisanoutargumentthatisallocatedbytheGetResults

method,whichpassesownershipbacktothecaller.ThecallershouldeventuallyperformSafeArrayDestroyonthereturnedarray.NotethatSafeArrayDestroyhasthesideeffectofclearingthevariantsreferencedbythearray'sentries,hencedeallocatinganystringstheGetResultsmethodreturns.(MicrosoftVisualBasicandVisualBasicforApplicationstakecareofthisforyou.)

GetViewRectmethod

Returnsthepagecoordinatesofawindow'sborders.

Versionadded

2000

Syntax

object.GetViewRect(doubleLeft,doubleTop,doubleWidthobject Required.AnexpressionthatreturnsaWindowobject.doubleLeft RequiredDouble.Thecoordinateinpageunitsoftheleftsideofthewindow.doubleTop RequiredDouble.Thecoordinateinpageunitsofthetopofthewindow.doubleWidth RequiredDouble.Thedistanceinpageunitsfromtheleftsidetotherightsideof

thewindow.doubleHeight RequiredDouble.Thedistanceinpageunitsfromthetoptothebottomofthe

window.

Remarks

Example

IftheWindowobjectisnotavisDrawingtype,thentheGetViewRectmethodraisesanexception.

GetWindowRectmethod

Getsthesizeandpositionoftheclientareaofawindow.

Versionadded

2000

Syntax

object.GetWindowRectpnLeft,pnTop,pnWidth,pnHeightobject Required.AnexpressionthatreturnsaWindowobject.pnLeft RequiredLong.Thecoordinateoftheleftsideofthewindow.pnTop RequiredLong.Thecoordinateofthetopofthewindow.pnWidth RequiredLong.Thedistanceinpixelsfromtheleftsidetothe

rightsideofthewindow.pnHeight RequiredLong.Thedistanceinpixelsfromthetoptothebottom

ofthewindow.

Remarks

Example

TheGetWindowRectmethodgetsthesizeandpositionoftheclientareaofthewindowwithrespecttothewindowthatownstheWindowscollectiontowhichitbelongs.FortheWindowscollectionofanApplicationobject,the"withrespectto"windowistheMDICLIENTwindowoftheVisiomainwindow.FortheWindowscollectionofaWindowobject,the"withrespectto"windowistheclientareaofthedrawingwindow.

Fromtheedge(acellintheAlignmentsection)ofa2-Dshapeto…

Fromanoutwardorinward/outwardconnectionpointcellofa1-Dshapeto…

Fromanoutwardorinward/outwardconnectionpointcellofa2-Dshapeto…

Fromacontrolpointcellto…

Fordetailsaboutconnectionpointtypeanddirection,seetheConnectionPointssection.

GlueToPosmethod

Gluesoneshapetoanotherfromacellinthefirstshapetoanx,ypositioninthesecondshape.

Versionadded

2.0

Syntax

object.GlueToPosshpObject,x,yobject Required.AnexpressionthatreturnsaCellobject.shpObject Requiredobject.AnexpressionthatreturnstheShapeobjectto

begluedto.x RequiredDouble.Thex-coordinateofthepositiontoglueto.y RequiredDouble.They-coordinateofthepositiontoglueto.

Remarks

TheGlueToPosmethodcreatesanewconnectionpointatthelocation

determinedbyxandy,whichrepresentdecimalfractionsofthespecifiedshape'swidthandheight,respectively,ratherthancoordinates.Forexample,thefollowingcreatesaconnectionpointatthecenterofshpObjectandgluesthepartoftheshapethatcelObjrepresentstothatpoint:

celObj.GlueToPosshpObject,0.5,0.5

GluingtheXcellofaControlssectionroworaBeginXorEndXcellautomaticallygluestheYcelloftheControlssectionrowortheBeginYorEndYcell,respectively.(Thereverseisalsotrue.)

Groupmethod

Groupstheobjectsthatareselectedinaselection,oritconvertsashapeintoagroup.

Versionadded

2.0

Syntax

shpObj=object.GroupshpObj Object.TheresultingShapeobject.object Required.AnexpressionthatreturnsaShapeorSelection

object.

IconFileNamemethod

Setsacustomiconfileforamenuortoolbaritem.

Versionadded

4.0

Syntax

object.IconFileName("fileString[,N]")object Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemthatloadstheiconfile.fileString RequiredString.ThepathandnameoftheICO,EXE,DLL,or

VSLfiletoload.N OptionalInteger.Theiconresourcelocation.Ifyouareusing

anEXE,DLL,orVSLfile,Nspecifiesthelocationoftheiconinthefile,beginningwithzero(0).

Remarks

TheIconFileNamemethodloadsthefilethatcontainstheicon,savesthebits,

anddiscardsthefilename.

Iftheiconcontainsmultipleimages,Visioalwaysusesthe16x16(16-color)image.

UnlessfileStringisafullyqualifiedpath,theapplicationsearchesfortheICO,EXE,DLL,orVSLfileinthefoldersindicatedbytheApplicationobject'sAddonPathsproperty(assumingthattheUIObjectobjectisintheVisioprocess).

Importmethod

Importsafileintotheapplication.

Versionadded

3.0

Syntax

objRet=object.Import(fileName)objRet AShapeobjectthatrepresentsthenewshapeimportedfrom

thefile.object Required.AnexpressionthatreturnsthePage,Master,or

Shapeobjecttoreceivethenewshape.fileName RequiredString.Thenameofthefiletoimport;mustbeafully

qualifiedpath.

Remarks

TheImportmethodimportsthefilespecifiedbyfileNameontoapage,orintoamasterorgroup.

Example

Thefileextensionindicateswhichimportfiltertouse.Ifthefilterisnotinstalled,theImportmethodreturnsanerror.TheImportmethodusesthedefaultpreferencesettingsforthespecifiedfilteranddoesnotprompttheuserfornon-defaultarguments.

ImportIconmethod

ImportstheiconforaMasterobjectfromanamedfile.

Versionadded

4.5

Syntax

object.ImportIconfileNameobject Required.AnexpressionthatreturnstheMasteror

MasterShortcutobjecttoreceivethenewicon.fileName RequiredString.Thenameofthefiletoimport.

Remarks

TheImportIconmethodcanonlyimportfilesthatwereproducedbyexportingamastericonintheapplication'sinternaliconformat(visIconFormatVisio)—itdoesnotaccepticonsinotherfileformats.

Example

InsertFromFilemethod

Addsalinkedorembeddedobjecttoapage,master,orgroup.

Versionadded

4.1

Syntax

objRet=object.InsertFromFile(filename,flags)objRet AShapeobjectrepresentingthenewlylinkedorembedded

object.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectinwhichtoembedorlinktheobject.filename RequiredString.Thenameofthefilethatcontainstheobject

tolinkorembed.flags RequiredInteger.Flagsthatinfluencehowtheobjectis

inserted.

Remarks

Example

TheInsertFromFilemethodcreatesanewshapethatrepresentsalinkedorembeddedOLEobject.

Theflagsargumentisabitmaskthatshouldbeacombinationofthefollowingvalues.

Constant Value DescriptionvisInsertLink &H8 Ifset,thenewshaperepresentsanOLE

linktothenamedfile.Otherwise,theInsertFromFilemethodproducesanOLEobjectfromthecontentsofthenamedfileandembedsitinthedocumentthatcontainsthepage,master,orgroup.

visInsertIcon &H10 Displaythenewshapeasanicon.

InsertObjectmethod

AddsanewembeddedobjectorActiveXcontroltoapage,master,orgroup.

Versionadded

4.1

Syntax

objRet=object.InsertObject(ClassOrProgID,flags)objRet AShapeobjectthatrepresentsthenewlycreatedobjector

control.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectinwhichtocreatetheobjectorcontrol.ClassOrProgIDRequiredString.Identifiesthetypeofobjectorcontrolto

create.flags RequiredInteger.Flagsthatinfluencetheoperation.

Remarks

Example

ClassOrProgIDisastringthatidentifiesthekindofobjectorcontroltocreate.Itcanbeeithertheobjectorcontrol'sclassID(GUID)instringformortheobjectorcontrol'sprogramIDofthehandlerfortheclass.

IfClassOrProgIDisastringrepresentingaclassID,itlookslike"{D3E34B21-9D75-101A-8C3D-00AA001A1652}."

IfClassOrProgIDisastringrepresentingaprogramID,itlookslike"paint.picture"or"forms.combobox.1".

Seevendor-specificdocumentationorbrowsetheregistrytodeterminewhichclassIDsandprogramIDsareassociatedwithobjectsandcontrolsprovidedbyotherapplications.

Theflagsargumentisabitmaskthatcanincludeoneofthefollowingvalues.

Constant Value DescriptionvisInsertIcon &H10 Displaythenewshapeasanicon.visInsertDontShow &H1000 Don'texecutethenewobject'sshowverb.

IfbothvisInsertIconandvisInsertDontShowarespecified,theInsertObjectmethodfails.Ifyouwanttoinsertanobjectthatisdisplayedasanicon,youmustallowtheapplicationtoexecutetheobject'sshowverb.

Theflagsargumentcanalsoincludeoneofthefollowingvalues.

Constant ValuevisInsertAsControl &H2000visInsertAsEmbed &H4000

ValuesinvisInsertAsControlandvisInsertAsEmbedonlyhaveaneffectiftheclassidentifiedbyClassOrProgIDisidentifiedintheregistryasacontrolthatcanbeinserted.IfneithervisInsertAsControlnorvisInsertAsEmbedisspecifiedandtheobjectcanbeeitheracontroloranembeddedobject,theapplicationinsertsitasacontrol.

Inrarecases,Visio5.0orlaterversionsmayinsertacontrolwhereasearlierversionsofVisiowouldhaverespondedtothesamecallbyinsertinganembeddedobject.Ifacontrolisinserted,thismethodplacesthedocumentin

designmode,causinganycodeexecutinginthedocumenttohaltuntilthedocumentisreturnedtorunmode.

Intersectmethod

Createsoneclosedshapefromtheareainwhichselectedshapesoverlaporintersect.

Versionadded

4.0

Syntax

object.Intersectobject Required.AnexpressionthatreturnsaSelectionobjectthat

containstheshapestointersect.

Remarks

TheIntersectmethodisequivalenttoclickingIntersectontheOperationssubmenuontheShapemenuinVisio.Theproducedshapewillbethetopmostshapeinitscontainingshapeandwillinheritthetextandformattingofthefirstselectedshape.

Example

Theoriginalshapesaredeletedandnoshapesareselectedwhentheoperationiscomplete.

InvokeHelpmethod

PerformsHelpoperationsusingtheMicrosoftVisioHelpsystem.

Versionadded

2002

Syntax

object.InvokeHelpbstrHelpFileName,command,dataobject Required.AnexpressionthatreturnsanApplicationobject.bstrHelpFileName RequiredString.SpecifiesanHTMLfile,aURL,a

compiledHTMLfile,oranoptionalwindowdefinition(precededwitha">"character).IfthecommandbeinguseddoesnotrequireafileorURL,thisvaluemaybe"".

command RequiredLong.Theactiontoperform.data RequiredLong.Anydatathatisrequiredbasedonthevalue

ofthecommandargument.

Remarks

UsingtheInvokeHelpmethod,youcancreateacustomHelpsystemthatisintegratedwiththeVisioHelpsystem.ToenableyourcustomHelptoappearinthesametiledMSOHelpwindowasVisioHelp,donotspecifyawindowdefinitioninthebstrHelpFileNameargument.

TheargumentspassedtotheInvokeHelpmethodcorrespondtothosedescribed

Seealso Example

intheHTMLHelpAPI.Foralistofcommandvalues,seetheHTMLHelpAPIReferenceontheMicrosoftDeveloperNetwork(MSDN)Website.MicrosoftVisualBasicprogrammerscanusethenumericequivalentoftheC++constantsdefinedintheHTMLHelpAPIheaderfiles.

Forexample,usethefollowingcodetoshowthedefaultVisioHelpwindow:

Application.InvokeHelp"Visio.chm",15,0OrusethefollowingcodetohidetheVisioHelpwindow:

Application.InvokeHelp"",18,0FormoreinformationabouttheHTMLHelpAPI,searchfor"HTMLHelpAPIoverview"ontheMSDNWebsite.

Joinmethod

Createsanewshapebyjoiningselectedshapes.

Versionadded

4.1

Syntax

object.Joinobject Required.AnexpressionthatreturnsaSelectionobject

containingtheshapestojoin.

Remarks

TheJoinmethodisequivalenttoclickingJoinontheOperationsubmenuontheShapemenuinVisio.Thenewshapeinheritsthetextandformattingofthefirstselectedshapeandisthetopmostshapeinitscontainer—thenthshapeintheShapescollectionofitscontainingshape,wheren=Count.

Theoriginalshapesaredeletedandnoshapesareselectedwhentheoperationis

Example

complete.

TheJoinmethodandtheCombinemethodaresimilarbutdifferinthefollowingways:

JoincoalescesabuttinglineandcurvesegmentsintheoriginalshapesintoasingleGeometrysectionintheresultingshape.

CombineproducesashapethathasoneGeometrysectionforeachoriginalshape.Theresultingshapehasholesinregionswheretheoriginalshapesoverlapped.

Youmightwanttojoinshapesafterimportinganon-Visiodrawinginwhichapparentpolylinesarerepresentedbymanyindependentshapes,eachpossessingasinglelineorcurvesegment.Byjoiningtheshapesthatconstituteapolylineinsuchadrawing,youcanreplacemanysingle-segmentshapeswithonemultiple-segmentshape.

Layoutmethod

Laysouttheshapesand/orreroutestheconnectorsforthepage,master,group,orselection.

Versionadded

4.5

Syntax

object.Layoutobject Required.AnexpressionthatreturnsaPage,Master,Shapeor

Selectionobjectwhoseshapesaretoberepositioned.

Remarks

UsingtheLayoutmethodisequivalenttoclickingLayOutShapesontheShapemenu.

BehavioroftheLayoutmethodcanbeinfluencedbysettingtheformulasorresultsofcellsinthePageLayoutandShapeLayoutsectionsofthepage,master,orgrouptobelaidout.YoucaninferhowthesecellsinfluencethebehavioroftheLayoutmethodbyexaminingtheeffectofvariousLayOutShapesdialogboxoptionsonthevaluesofthesecells.

Tolayoutasubsetoftheshapesofapage,master,orgroup,establishaSelectionobjectinwhichtheshapestobelaidoutareselected,theninvoketheLayoutmethod.IftheLayoutmethodisperformedonaSelectionobjectand

Seealso Example

theobjecthasnoshapesselected,allshapesinthepage,master,orgroupoftheselectionarelaidout.

LoadFromFilemethod

LoadsaMicrosoftVisioapplicationUIObjectobjectfromafile.

Versionadded

4.0

Syntax

object.LoadFromFilefileNameobject Required.AnexpressionthatreturnsaUIObjectobjectto

receivedatafromthefile.fileName RequiredString.Thenameofthefiletoload.

Remarks

YoumustusetheSaveToFilemethodtosaveaUIObjectobjectinafilethatcanbeloadedwiththeLoadToFilemethod.

Openmethod(Documentscollection)

Opensanexistingfilesoitcanbeedited.

Versionadded

2.0

Syntax

docObjRet=docsObj.Open(fileName)docObjRet ADocumentobjectthatrepresentsthefilethatwasopened.docsObj Required.AnexpressionthatreturnstheDocumentscollection

toreceivetheopenedfile.fileName RequiredString.Thenameofafiletoopen.

Remarks

WhenyouusetheOpenmethodtoopenaDocumentobject,itopensaVisiofileasanoriginal.Dependingonthefileextension,theOpenmethodopensadrawing(.vsd),astencil(.vss),atemplate(.vst),aworkspace(.vsw),anXMLdrawing(.vdx),anXMLstencil(.vsx),oranXMLtemplate(.vtx).Youcanalso

openandconvertnon–VisiofilestoVisiofilesusingthismethod.Ifthefiledoesnotexistorthefilenameisinvalid,noDocumentobjectisreturnedandanerrorisgenerated.

Ifavalidstencil(.vss)filenameispassed,theoriginalstencilfileisopened,whichmeansyoucanedititsmasters.Unlessyouwanttocreateoreditthemasters,openastencilasread-onlythroughanassociatedtemplateorbyusingtheOpenExmethod.

Openmethod(Masterobject)

Opensanexistingmastersoitcanbeedited.

Versionadded

4.1

Syntax

masterObjCopy=masterObj.OpenmasterObjCopy AtemporarycopyofmasterObj.masterObj Required.AnexpressionthatreturnsaMasterobjecttobe

edited.

Remarks

YoucanusetheOpenmethodforaMasterobjectinconjunctionwiththeClosemethodtoreliablyedittheshapesandcellsofamaster.InpreviousversionsofVisio,youcouldeditaMasterobject'sshapesandcells,butthechangesweren'tpushedtoinstancesofthemaster,andalignmentboxinformationdisplayedwheninstancingtheeditedmasterwasn'tcorrect.

Example

ToedittheshapesandcellsofaMasterobjectfromaprogram,followthesesteps:

OpentheMasterobjectforeditingusingmasterObjCopy=masterObj.Open.ThiscodefailsifthereisadrawingwindowopenintomasterObjorifotherprogramsalreadyhavemasterObjopen.IftheOpenmethodsucceeds,masterObjCopyisacopyofmasterObj.

ChangeanyshapesandcellsinmasterObjCopy,notmasterObj.

ClosetheMasterobjectusingmasterObjCopy.Close.TheClosemethodfailsifmasterObjCopyisn'taMasterobjectthatresultedfromapriormasterObj.Opencall.Otherwise,theClosemethodmergesthechangesmadeinstep2frommasterObjCopybackintomasterObj.ItalsoupdatesallinstancesofmasterObjtoreflectthechangesandupdateinformationcachedinmasterObj.IfmasterObj.IconUpdateisn'tvisManual(0),theClosemethodupdatestheiconshowninthestencilwindowformasterObjtodepictanimageofmasterObjCopy.

Ifyouchangetheshapesandcellsofamasterdirectly,asopposedtoopeningandclosingthemasterasdescribedintheprocedureabove,theeffectslistedinstep3don'toccur.

AprogramthatcreatesacopyofamasterObjforeditingshouldbothcloseandreleasethecopy.MicrosoftVisualBasictypicallyreleasesitautomatically.However,withC/C++,youmustexplicitlyreleasethecopy,justasyouwouldforanyotherobject.

OpenDrawWindowmethod

Opensanewdrawingwindowthatdisplaysapage,master,orgroup.

Versionadded

4.1

Syntax

objRet=object.OpenDrawWindowobjRet AWindowobjectthatrepresentstheopenedwindow.object Required.AnexpressionthatreturnsaPage,Master,orShape

objecttodisplayinthedrawingwindow.

Remarks

TheOpenDrawWindowmethodopensanewdrawingwindow,evenifthepage,master,orgroupisalreadydisplayedinadrawingwindow.

Example

OpenExmethod

OpensanexistingMicrosoftVisiofileusingextrainformationpassedinanargument.

Versionadded

4.0

Syntax

objRet=object.OpenEx(fileName,openFlags)objRet ADocumentobjectthatrepresentsthefilethatwasopened.object Required.AnexpressionthatreturnsaDocumentscollection.fileName RequiredString.Thenameofthefile.openFlags RequiredInteger.Flagsthatindicatehowtoopenthefile.

Remarks

TheOpenExmethodisidenticaltotheOpenmethod,exceptthatitprovidesanextraargumentinwhichthecallercanspecifyhowthedocumentopens.

TheopenFlagsargumentshouldbeacombinationofzeroormoreofthefollowingvalues.

Constant ValuevisOpenCopy &H1visOpenRO &H2visOpenDocked &H4visOpenDontList &H8visOpenMinimized &H10visOpenRW &H20visOpenMacrosDisabled &H80

IfvisOpenDockedisspecified,thefileappearsinadockedratherthananMDIwindow,providedthatthefileisastencilfileandthereisanactivedrawingwindowinwhichtoputthedockedstencilwindow.

IfvisOpenDontListisspecified,thenameoftheopenedfiledoesn'tappearinthelistofrecentlyopeneddocumentsontheFilemenu.

IfvisOpenMinimizedisspecified,thefileopensminimized—itisnotactive.ThisflagisnotsupportedinversionsofVisioearlierthan5.0b.

IfvisOpenMacrosDisabledisspecified,thefileopenswithVBAmacrosdisabled.ThisflagisnotsupportedinversionsearlierthanMicrosoftVisio2002.

OpenIconWindowmethod

Opensaniconwindowthatshowsamaster'sicon.

Versionadded

4.1

Syntax

objRet=object.OpenIconWindowobjRet AWindowobjectthatrepresentstheopenedwindow.object Required.AnexpressionthatreturnsaMasterobject.

Remarks

Ifthemaster'siconisalreadydisplayedinaniconwindow,theOpenIconWindowmethodactivatesthatwindowratherthanopeninganotherwindow.

OpenSheetWindowmethod

OpensaShapeSheetwindowforaShapeobject.

Versionadded

4.1

Syntax

objRet=object.OpenSheetWindowobjRet AWindowobjectthatrepresentstheopenedwindow.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

TheOpenSheetWindowmethodopensanewShapeSheetwindowfortheshapeeveniftheinformationisalreadydisplayedinanotherwindow.

OpenStencilWindowmethod

Opensastencilwindowthatshowsthemastersinthedocument.

Versionadded

4.1

Syntax

objRet=object.OpenStencilWindowobjRet AWindowobjectthatrepresentstheopenedwindow.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Ifthedocument'sstencilisalreadydisplayedinastencilwindow,theOpenStencilWindowmethodactivatesthatwindowratherthanopeninganotherwindow.

ParseLinemethod

ParsesalineofMicrosoftVisualBasiccode.

Versionadded

4.5

Syntax

object.ParseLinelineobject Required.AnexpressionthatreturnsaDocumentobject.line RequiredString.AstringinterpretedasVisualBasicfor

Applications(VBA)code.

Remarks

TheParseLinemethodtellstheVBAprojectoftheDocumentobjecttoparsethestring.VBAtreatsthestringlikeitwouldtreatthesamestringtypedintoitsImmediatewindow.

TheParseLinemethodcreatesaVisualBasicprojectinthedocumentifone

Example

doesnotexist.TheParseLinemethodraisesanexceptionifthestringfailstoparse.Youcandeterminewhetherthestringhassuccessfullyparsedusingthefollowingtechnique.

PublicSubparse(strAsString)OnErrorResumeNextThisDocument.ParseLinestrIfErr=0ThenMsgBox"Stringparsedsuccessfully"ElseMsgBox"Parsenotsuccessful"EndIfEndSub

Pastemethod

PastesthecontentsoftheClipboardintoanobject.

Versionadded

2002

Syntax

object.Paste[flags]object Required.AnexpressionthatreturnsthePage,Shape,or

Masterobjecttopaste.flags OptionalVariant.Determineshowshapesaretranslatedduring

thepasteoperation.

Remarks

ThePastemethodworksonlywithShapeobjectsthataregroupshapes.UsetheTypepropertyofashapetodeterminewhetheritisagroup.

PossiblevaluesforflagsaredeclaredbytheVisiotypelibraryin

VisCutCopyPasteCodes,andaredescribedinthefollowingtable.

Flag Value DescriptionvisCopyPasteNormal &H0 Default.Shapesarepastedtothe

centeroftheactivewindow.visCopyPasteNoTranslate &H1 Shapesarepastedtotheiroriginal

coordinatelocations.

SettingflagtovisCopyPasteNormalistheequivalentofthebehaviorintheuserinterface.YoushouldusethevisCopyPasteNormalandvisCopyPasteNoTranslateflagsconsistently.Forexample,ifyoucopyusingvisCopyPasteNoTranslate,youshouldalsopasteusingthatvalueasitistheonlywaytoensurethatshapesarepastedtotheiroriginalcoordinatelocation.

Ifyouneedtocontroltheformatofthepastedinformationand(optionally)establishalinktoasourcefile(forexample,aMicrosoftWorddocument),usethePasteSpecialmethod.

Pastemethod(Charactersobject)

PastesthetextrangeontheClipboardintoanobject.

Versionadded

2.0

Syntax

object.Pasteobject Required.AnexpressionthatreturnstheCharactersobjectto

paste.

Seealso Example

PasteSpecialmethod

InsertsthecontentsoftheClipboard,allowingyoutocontroltheformatofthepastedinformationand(optionally)establishalinktothesourcefile(forexample,aMicrosoftWorddocument).

Versionadded

2002

Syntax

object.PasteSpecial(format[,link][,displayAsIcon])object Required.AnexpressionthatreturnsaMaster,Page,orShape

object.format RequiredLong.TheinternalClipboardformat.link OptionalVariant.Truetoestablishalinktothesourceofthe

pasteddata;otherwise,False(thedefault).Ignoredifthesourcedataisnotsuitablefor,ordoesn'tsupport,linking.

displayAsIcon OptionalVariant.Truetodisplaythepasteddataasanicon;otherwise,False(thedefault).

Remarks

TosimplypastethecontentsoftheClipboardintoanobject,usethePastemethod.

ThePasteSpecialmethodofaShapeobjectworksonlywithShapeobjectsthat

Seealso Example

aregroupshapes.UsetheTypepropertyofashapetodeterminewhetheritisagroup.

Thevalueoftheformatargumentcanbeanyofthefollowing:

AvaluefromVisPasteSpecialFormat(seethefollowingtable).

AnyofthestandardClipboardformats,forexample,CF_TEXT.Fordetails,seetheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

AnyvaluereturnedfromacalltotheRegisterClipboardFormatfunction.Fordetails,seetheMicrosoftPlatformSDKontheMSDNWebsite.

PossiblevaluesforformatdeclaredbytheVisiotypelibraryinVisPasteSpecialFormataredescribedinthefollowingtable.

Flag ValuevisPasteText 1visPasteBitmap 2visPasteMetafilePicture 3visPasteOEMText 7visPasteDeviceIndependentBitmap 8visPasteEnhancedMetafile 14visPasteOleObject 65536visPasteRTF 65537visPasteHyperlink 65538visPasteURL 65539

Pointmethod

Returnsapointatapositionalongacurve.

Versionadded

5.0

Syntax

object.Point(t,x,y)object Required.AnexpressionthatreturnsaCurveobject.t RequiredDouble.Thevalueinthecurve'sparameterdomainto

evaluate.x RequiredDouble.Returnsxvalueofcurveatt.y RequiredDouble.Returnsyvalueofcurveatt.

Remarks

ACurveobjectdescribesitselfintermsofitsparameterdomain,whichistherange[Start(),End()].ThePointmethodofaCurveobjectreturnsthex,y

coordinatesatpositiont,whichisanypositionalongthecurve'spath.ThePointmethodcanbeusedtoextrapolatethecurve'spathoutsideof[Start(),End()].

PointAndDerivativesmethod

Returnsapointandderivativesatapositionalongacurve'spath.

Versionadded

5.0

Syntax

object.PointAndDerivatives(t,n,x,y,dx,dy,ddx,ddy)object Required.AnexpressionthatreturnsaCurveobject.t RequiredDouble.Thevalueinthecurve'sparameterdomainto

evaluate.n RequiredInteger.0:getpoint;1:pointand1stderivative;2:

pointplusfirstandsecondderivative.x RequiredDouble.Returnsxvalueofcurveatt.y RequiredDouble.Returnsyvalueofcurveatt.dx RequiredDouble.Returnsfirstderivative(dx/dt)attifn>0.dy RequiredDouble.Returnsfirstderivative(dx/dt)attifn>0.ddx RequiredDouble.Returnssecondderivative(ddx/dt)attifn>

1.ddy RequiredDouble.Returnssecondderivative(ddy/dt)attifn>

1.

Remarks

UsethePointAndDerivativesmethodoftheCurveobjecttoobtainthecoordinatesofapointwithinthecurve'sparameterdomainanditsfirstandsecondderivatives.

ACurveobjectdescribesitselfintermsofitsparameterdomainwhichistherange[Start(),End()].ThePointAndDerivativesmethodcanbeusedtoextrapolatethecurve'spathoutside[Start(),End()].

Printmethod

Printsthecontentsofanobjecttothedefaultprinter.

Versionadded

2.0

Syntax

object.Printobject Required.AnexpressionthatreturnsaPageorDocument

objecttoprint.

Remarks

ForaDocumentobject,thismethodprintsallofthedocument'spages.Backgroundpagesareprintedonthesamesheetofpaperastheforegroundpagestowhichtheyareassigned.

ForaPageobject,thismethodprintsthepageanditsbackgroundpage(ifany)onthesamesheetofpaper.

Ifyou'reusingMicrosoftVisualBasicforApplicationsorVisualBasic,youmustassignthemethodresulttoadummyvariableandyoumustapplythemethodtoavariableoftypeObject,nottypeVisio.DocumentorVisio.Page.Forexample,toprintadocument:

Seealso Example

DimdocObjAsVisio.DocumentDimdocObjTempasObjectDimdummyAsStringSetdocObj=ThisDocumentSetdocObjTemp=docObjdummy=docObjTemp.Print

PrintTilemethod

Printsasingletileofadrawingpage.

Versionadded

2002

Syntax

object.PrintTilenTileobject Required.AnexpressionthatreturnsaPageobjecttoprint.nTile RequiredLong.Thenumberoftiles.

Remarks

UsethePrintTilemethodtoprintasingletileofadrawingthatspansmultiplephysicalprinterpages.

ThismethodistheequivalentofclickingthePrinttoolbarbuttonwhenyouarepreviewingasingletileinPrintPreviewmode.

Example

PurgeUndomethod

EmptiestheMicrosoftVisioqueueofundoactions.

Versionadded

5.0

Syntax

object.PurgeUndoobject Required.AnexpressionthatreturnsanApplicationobject.

Remarks

AftercallingthePurgeUndomethod,nooperationperformedbeforethecallcanbereversed.

QueueMarkerEventmethod

Queuesamarkereventthatfiresafterallotherqueuedevents.

Versionadded

5.0

Syntax

intRet=object.QueueMarkerEvent(contextString)intRet Long.Thesequencenumberoftheeventthatfiresafterall

otherqueuedevents.object Required.AnexpressionthatreturnsanApplicationobject.contextString RequiredString.Anarbitrarystringthatispassedwiththe

eventthatfires.

Remarks

TheQueueMarkerEventmethodworksinconjunctionwiththeMarkerEventeventtoallowanAutomationclienttoqueueaneventtoitself.TheQueueMarkerEventmethodcausestheapplicationtofireaMarkerEvent

eventafterithasfiredalloftheeventsinitseventqueue.

TheQueueMarkerEventmethodreturnsthesequencenumberoftheMarkerEventeventtofire,andthestringpassedtotheQueueMarkerEventmethod(legallyempty)ispassedtotheMarkerEventeventhandler.

AclientprogramcanuseeitherthesequencenumberorthestringtocorrelateQueueMarkerEventcallswithMarkerEventevents.Inthisway,theclientisabletodistinguisheventsitcausedandeventsitdidnotcause.

Quitmethod

ClosestheindicatedinstanceofMicrosoftVisio.

Versionadded

2.0

Syntax

object.Quitobject Required.AnexpressionthatreturnsanApplicationobject.

Remarks

IftheQuitmethodisinvokedwhenadocumentwithunsavedchangesisopen,adialogboxappearsaskingifyouwanttosavethedocument.Toquittheapplicationwithoutsavingandseeingthedialogbox,settheSavedpropertyoftheDocumentobjectrepresentingthedocumenttoTrueimmediatelybeforequitting.SettheSavedpropertytoTrueonlyifyouaresureyouwanttoclosethedocumentwithoutsavingchanges.

Example

Redomethod

Reversesthemostrecentundounit.

Versionadded

2.0

Syntax

object.Redoobject Required.AnexpressionthatreturnsanApplicationobject.

Remarks

ToreversetheeffectoftheUndomethod,usetheRedomethod.Forexample,ifyouclearanitemandrestoreitwiththeUndomethod,usetheRedomethodtocleartheitemagain.

YoucannotinvoketheRedomethodfromcodethatisexecutinginsidethescopeofanopenundounit.Codeisinthescopeofanopenundounitifitisoneofthefollowing:

Amacrooradd-oninvokedbytheVisiouserinterface.

InaneventhandlerrespondingtoaVisioeventotherthantheVisioIsIdleevent.

Inauser-createdundoscope.IfyoucalltheRedomethodfromcodeinsidethescopeofanopenundounit,itwillraiseanexception.

TheRedomethodalsoraisesanexceptioniftheVisioinstanceispresentlyperforminganundoorredo.TodeterminewhethertheVisioinstanceisundoingorredoingusetheIsUndoingOrRedoingproperty.

YoucancalltheRedomethodfromtheVisioIsIdleeventhandlerbecausetheVisioIsIdleeventcanonlyfirewhentheIsUndoingOrRedoingpropertyisFalse.YoucanalsocalltheRedomethodfromcodenotinvokedbytheVisioinstance,forexample,codeinvokedfromtheVisualBasicEditororfromanexternalprogram.

Removemethod

Removesashapefromalayer.

Versionadded

4.0

Syntax

object.RemoveshapeObj,fPreserveMembersobject Required.AnexpressionthatreturnsaLayerobject.shapeObj Required.AnexpressionthatreturnstheShapeobjectto

remove.fPreserveMembers RequiredInteger.Flagthatindicateswhethertoremove

membersofagroup.

Remarks

IftheshapeisagroupandfPreserveMembersisnon-zero,membershapesofthegroupareunaffected.IffPreserveMembersiszero(0),thegroup'smembershapesarealsoremovedfromthelayer.

Removingashapefromalayerdoesnotdeletetheshape.

Seealso Example

RemoveFromGroupmethod

Removesselectedshapesfromagroup.

Versionadded

2.0

Syntax

object.RemoveFromGroupobject Required.AnexpressionthatreturnsaSelectionobject.

Example

RenameCurrentScopemethod

Renamesthetop-levelopenundoscope.

Versionadded

2002

Syntax

object.RenameCurrentScopebstrScopeNameobject Required.AnexpressionthatreturnsanApplicationobjectthat

containstheundoscope.bstrScopeName RequiredString.Thenewnameoftheundoscope.

Remarks

ThenewnameassignedtotheundoscopeappearsontheUndomenuastheitemname.Ifthereisnoopenundoscope,theRenameCurrentScopemethodraisesanexception.

Example

ResizeToFitContentsmethod

Resizesthepage,orthemaster'spage,tofittightlyaroundtheshapesormasterthatareonit.

Versionadded

2002

Syntax

object.ResizeToFitContentsobject Required.AnexpressionthatreturnsaMasterorPageobject.

Remarks

Afterthepageisresized,thepageheightandwidth,andthePinXandPinYvaluesoftheshapesormasteraretypicallychanged.

TheResizeToFitContentsmethodistheequivalentofclickingSizetofitdrawingcontentsonthePageSizetabinthePageSetupdialogbox(ontheFilemenu,clickPageSetup).

Seealso Example

ReverseEndsmethod

Reversesanobjectbyflippingitbothhorizontallyandvertically.

Versionadded

2.0

Syntax

object.ReverseEndsobject Required.AnexpressionthatreturnstheShapeorSelection

objecttoreverse.

Example

Rotate90method

Rotatesanobject90degreescounterclockwise.

Versionadded

2.0

Syntax

object.Rotate90object Required.AnexpressionthatreturnstheShapeorSelection

objecttorotate.

Example

Runmethod

Runstheadd-onrepresentedbyanAddonobject.

Versionadded

4.0

Syntax

object.RunargStringobject Required.AnexpressionthatreturnsanAddonobject.argString RequiredString.Theargumentstringtopasstotheadd-on.

Remarks

Iftheadd-onisimplementedbyanEXEfile,theargumentsarepassedinthecommandlinestring.Iftheadd-onisimplementedbyaVSLfile,theargumentsarepassedinafieldoftheargumentstructurethataccompaniestherunmessagesenttotheVSL'sVisioLibMainprocedure.

Seealso Example

Savemethod

Savesadocument.

Versionadded

2.0

Syntax

object.Saveobject Required.AnexpressionthatreturnsaDocumentobject.

Remarks

UsetheSaveAsmethodtosaveandnameanewdocument.Untiladocumenthasbeensaved,theSavemethodgeneratesanerror.

Example

SaveAsmethod

Savesadocumentwithafilename.

Versionadded

2.0

Syntax

object.SaveAsfileNameobject Required.AnexpressionthatreturnsaDocumentobject.fileName RequiredString.Thefilenameforthedocument.

Remarks

TheSaveAsmethodcanacceptdrivenamesusingtheuniversalnamingconvention(UNC),forexample,\\corporation\marketing.

BeginningwithVisio2002,youcansaveyourdrawingasanXMLdrawing(.vdx),anXMLstencil(.vsx),oranXMLtemplate(.vtx).

SaveAsExmethod

Savesadocumentwithafilenameusingextrainformationpassedinanargument.

Versionadded

4.0

Syntax

object.SaveAsExfileName,saveFlagsobject Required.AnexpressionthatreturnsaDocumentobject.fileName RequiredString.Thefilenameforthedocument.saveFlags RequiredInteger.Howtosavethefile.

Remarks

TheSaveAsExmethodisidenticaltotheSaveAsmethod,exceptthatitprovidesanextraargumentinwhichthecallercanspecifyhowthedocumentistobesaved.

ThesaveFlagsargumentshouldbeacombinationofthefollowingvalues.

Constant Value DescriptionvisSaveAsRO &H1 Thedocumentissavedasread-only.visSaveAsWS &H2 Thecurrentworkspaceissavedwith

thefile.visSaveAsListInMRU &H4 Thedocumentisincludedinthe

MostRecentlyUsed(MRU)list.Bydefault,SaveandSaveAsdonotplacethedocumentintotheMRUlist.

SaveToFilemethod

SavestheuserinterfacerepresentedbyaUIObjectobjectinafile.

Versionadded

4.0

Syntax

object.SaveToFilefileNameobject Required.AnexpressionthatreturnstheUIObjectobjectto

savetothefile.fileName RequiredString.Thenameofthefileinwhichtosavethe

UIObjectobject.

Remarks

ThefilecanbeloadedintotheapplicationbyusingtheLoadFromFilemethodofaUIObjectobject.

NoteBeginningwithVisio2000,youcancustomizetheuserinterfacebyright-

clickingthetoolbar,andthenclickingCustomizeontheshortcutmenu.Changesyoumaketotheinterfacepersistwhenyouclosetheapplication—theyarestoredwiththeApplicationobjectandinafilenamedCustom.vsu,whichisstoredasApplicationDatainthecurrentuser'sUserProfile.

SaveWorkspaceAsmethod

BeginningwithMicrosoftVisio2002,thismethodisobsolete.

Remarks

Inversionsearlierthan2002,SaveWorkSpaceAssavedtheworkspaceintoaVSWfile.

Seealso Example Appliesto

Scrollmethod

Scrollsthecontentsofawindowvertically,horizontally,orboth.

Versionadded

2000

Syntax

object.Scroll(longFlagsX,longFlagsY)object Required.AnexpressionthatreturnsaWindowobject.longFlagsX RequiredLong.Indicateshowtoscrollhorizontally.longFlagsY RequiredLong.Indicateshowtoscrollvertically.

Remarks

ConstantsrepresentingwaystoscrollaredeclaredbytheVisiotypelibraryinVisWindowScrollXandVisWindowScrollY.

ValuesoflongFlagsX

Example

ValuesoflongFlagsY

IftheWindowobjectisnotabuilt-inMDIorbuilt-indockedstenciltype,thentheScrollmethodraisesanexception.

ScrollViewTomethod

Scrollsawindowtoaparticularpagecoordinate.

Versionadded

2000

Syntax

object.ScrollViewTo(doubleX,doubleY)object Required.AnexpressionthatreturnsaWindowobject.doubleX RequiredDouble.Thex-coordinatetowhichtoscroll.doubleY RequiredDouble.They-coordinatetowhichtoscroll.

Remarks

TheScrollViewTomethodscrollstothedoubleXanddoubleYcoordinates.

IfthevalueoftheWindowobject'sTypepropertyisnotvisDrawing,thenthemethodraisesanexception.

Example

Selectmethod

Selectsordeselectsanobject.

Versionadded

2.0

Syntax

object.SelectaddObj,selectTypeobject Required.AnexpressionthatreturnsaWindoworSelection

objectthatcontainstheshapes.addObj Required.AnexpressionthatreturnsaShapeobjecttoselector

deselect.selectType RequiredInteger.Thetypeofselectiontomake.

Remarks

WhenusedwiththeWindowobject,theSelectmethodwillaffecttheselectionintheVisiowindow.TheSelectionobject,however,isindependentoftheselectioninthewindow.Therefore,usingtheSelectmethodwithaSelection

objectonlyaffectsthestateoftheobjectinmemory—theVisiowindowisunaffected.

ThefollowingconstantsdeclaredbytheVisiotypelibraryshowvalidvaluesforselectiontypes.

Constant ValuevisDeselect 1visSelect 2visSubSelect 3visSelectAll 4visDeselectAll 256

YoucancombinevisDeselectAllwithvisSelectandvisSubSelecttodeselectallshapespriortoselectingorsubselectingothershapes.

IftheobjectbeingoperatedonisaSelectionobject,andtheSelectmethodselectsaShapeobjectwhoseContainingShapepropertyisdifferentthantheContainingShapepropertyoftheSelectionobject,thentheSelectmethoddeselectseverything,eveniftheselectiontypevaluedoesn'tspecifydeselection.

SelectAllmethod

Selectsallpossibleshapesinawindoworselection.

Versionadded

2.0

Syntax

object.SelectAllobject Required.AnexpressionthatreturnsaWindoworSelection

objectthatcontainstheshapes.

Remarks

Allshapesthatcanbeselectedareimmediatechildrenoftheselection'scontainingshape.

SendBackwardmethod

Movesashapeorselectedshapesbackonepositioninthez-order.

Versionadded

2.0

Syntax

object.SendBackwardobject Required.AnexpressionthatreturnsaShapeorSelection

objecttosendbackward.

SendToBackmethod

Movestheshapeorselectedshapestothebackofthez-order.

Versionadded

2.0

Syntax

object.SendToBackobject Required.AnexpressionthatreturnsaShapeorSelection

objecttosendtotheback.

SetBeginmethod

Movesthebeginpointofaone-dimensional(1-D)shapetothecoordinatesrepresentedbyxandy.

Versionadded

2.0

Syntax

object.SetBeginx,yobject Required.AnexpressionthatreturnsaShapeobject.x RequiredDouble.Thenewx-coordinateofthebeginpoint.y RequiredDouble.Thenewy-coordinateofthebeginpoint.

Remarks

TheSetBeginmethodonlyappliesto1-Dshapes.Iftheindicatedshapeisa2-Dshape,anerrorisgenerated.

Thecoordinatesrepresentedbythexandyargumentsareparentcoordinates,

Example

measuredfromtheoriginoftheshape'sparent(thepageorgroupthatcontainstheshape).

SetCentermethod

Movesashapesothatitspinispositionedatthecoordinatesrepresentedbyxandy.

Versionadded

2.0

Syntax

object.SetCenterx,yobject Required.AnexpressionthatreturnsaShapeobject.x RequiredDouble.Thenewx-coordinateofthecenterof

rotation(PinX).y RequiredDouble.Thenewy-coordinateofthecenterof

rotation(PinY).

Remarks

Thecoordinatesrepresentedbythexandyargumentsareparentcoordinates,measuredfromtheoriginoftheshape'sparent(thepageorgroupthatcontains

Example

theshape).

TheSetCentermethodonlymovesthepoint,inparentcoordinates,aboutwhichtheshaperotates.Itdoesnotchangethepoint,inlocalcoordinates,aboutwhichtheshaperotates.

SetCustomMenusmethod

Replacesthecurrentbuilt-inorcustommenusofanapplicationordocument.

Versionadded

4.0

Syntax

object.SetCustomMenusUIObjectobject Required.AnexpressionthatreturnsanApplicationor

Documentobjecttoreceivethecustommenus.UIObject Required.AnexpressionthatreturnsaUIObjectobjectthat

representsthenewcustommenus.

Remarks

IftheUIObjectobjectwascreatedinaseparateprocessbyusingtheCreateObjectprocedureinsteadofgettingtheappropriatepropertyofanApplicationorDocumentobject,theSetCustomMenusmethodreturnsanerror.

SetCustomToolbarsmethod

Replacesthecurrentbuilt-inorcustomtoolbarsofanapplicationordocument.

Versionadded

4.0

Syntax

object.SetCustomToolbarsUIObjectobject Required.AnexpressionthatreturnsanApplicationor

Documentobjecttoreceivethecustomtoolbars.UIObject Required.AnexpressionthatreturnsaUIObjectobjectthat

representsthenewcustomtoolbars.

Remarks

IftheUIObjectobjectwascreatedinaseparateprocessbyusingtheCreateObjectprocedureinsteadofgettingtheappropriatepropertyofanApplicationorDocumentobject,theSetCustomToolbarsmethodreturnsanerror.

SetEndmethod

Movestheendpointofaone-dimensional(1-D)shapetothecoordinatesrepresentedbyxandy.

Versionadded

2.0

Syntax

object.SetEndx,yobject Required.AnexpressionthatreturnsaShapeobject.x RequiredDouble.Thenewx-coordinateoftheendpoint.y RequiredDouble.Thenewy-coordinateoftheendpoint.

Remarks

TheSetEndmethodappliesonlyto1-Dshapes.Iftheindicatedshapeisa2-Dshape,anerrorisreturned.

Thecoordinatesrepresentedbythexandyargumentsareparentcoordinates,

Example

measuredfromtheoriginoftheshape'sparent(thepageorgroupthatcontainstheshape).

SetFilterCommandsmethod

SpecifiesanarrayofcommandrangesandaTrueorFalsevalueindicatinghowtofiltereventsforeachcommandrange.

Versionadded

2002

Syntax

object.SetFilterCommandscommandsobject Required.AnexpressionthatreturnsanEventobject.commands RequiredLong.AnarrayofcommandrangesandaTrueor

Falsevaluespecifyinghowtofiltereventsforeachcommandrange.

Remarks

WhenanEventobjectcreatedwiththeAddAdvisemethodisaddedtotheEventListcollectionofasourceobject,thedefaultbehavioristhatalloccurrencesofthateventarepassedtotheeventsink.TheSetFilterCommands

Example

methodprovidesawayofignoringselectedeventsbasedoncommandID.

ThecommandsargumentpassedtoSetFilterCommandsisanarraydefinedinthefollowingway.

Thenumberofelementsincommandsisamultipleof3:

ThefirstelementcontainsthebeginningcommandIDoftherange(anymemberofVisUICmds).

ThesecondelementcontainstheendcommandIDoftherange(anymemberofVisUICmds).

ThethirdelementcontainsaTrueorFalsevalue,whichindicateswhetheryouarelisteningtoeventsforthatcommandrange(Truetolistentoevents;Falsetoexcludeevents).

Foraneventtosuccessfullypassthroughacommandfilter,itmustsatisfythefollowingcriteria:

ItmusthaveavalidcommandID.

IfallfiltersareTrue,theeventmustmatchatleastonefilter.

IfallfiltersareFalse,theeventmustnotmatchanyfilter.

IfthefiltersareamixtureofTrueandFalse,theeventmustmatchatleastoneTruefilterandnotmatchanyFalsefilters.

IftherearenoTruerangesinthearray,eventsareconsideredTrue.

Forexample,tosetupanarraythatblocksoutasinglecommand,usethefollowing:

DimcmdArray(1*3)AsLong'IgnorethelayoutcommandcmdArray(1)=visCmdLayoutDynamiccmdArray(2)=visCmdLayoutDynamiccmdArray(3)=False

Or,tosetupanarraythatlistensonlytotheSendtoBackcommand:

DimcmdArray(3*3)AsLong'PayattentiontotheSendToBackcommandcmdArray(1)=visCmdObjectSendToBackcmdArray(2)=visCmdObjectSendToBackcmdArray(3)=True'IgnoreanycommandIDsbeforetheSendToBackcommandcommands(4)=visCmdCMDFIRSTcommands(5)=visCmdObjectSendToBack-1cmdArray(6)=False'IgnoreanycommandIDsaftertheSendToBackcommandcommands(4)=visCmdObjectSendToBack+1commands(5)=visCmdCMDLASTcommands(6)=False

SetFilterObjectsmethod

SpecifiesanarrayofobjecttypesandaTrueorFalsevalueindicatinghowtofiltereventsforeachobject.

Versionadded

2002

Syntax

object.SetFilterObjectsobjectsobject Required.AnexpressionthatreturnsanEventobject.objects RequiredLong.AnarrayofobjectstypesandaTrueorFalse

valuespecifyinghowtofiltereventsforeachobjecttype.

Remarks

WhenanEventobjectcreatedwiththeAddAdvisemethodisaddedtotheEventListcollectionofasourceobject,thedefaultbehavioristhatalloccurrencesofthateventarepassedtotheeventsink.TheSetFilterObjectsmethodprovidesawaytoignoreselectedeventsbasedonobjecttype.

Example

TheobjectsargumentpassedtoSetFilterObjectsisanarraydefinedinthefollowingmanner.

Thenumberofelementsinthearrayisamultipleof2:

Thefirstelementcontainsanobjecttype(oneofvisTypePage,visTypeGroup,visTypeShape,visTypeForeignObject,visTypeGuide,orvisTypeDoc).

ThesecondelementcontainsaTrueorFalsevalueindicatingwhetheryouarelisteningtoeventsforthatobject(Truetolistentoanobject'sevents;Falsetoexcludeanobject'sevents).

Foraneventtosuccessfullypassthroughanobjecteventfilter,itmustsatisfythefollowingcriteria:

Itmustbeavalidobjecttype.

IfallfiltersareTrue,theeventmustmatchatleastonefilter.

IfallfiltersareFalse,theeventmustnotmatchanyfilter.

IfthefiltersareamixtureofTrueandFalse,theeventmustmatchatleastoneTruefilterandnotmatchanyFalsefilters.

IftherearenoTruerangesdefinedinthearray,eventsareconsideredTrue.

Forexample,ifyouwanttolistenonlytoeventssourcedbyashapeorguide,youcanpassanarraylikethefollowing:

DimobjArray(2*2)AsLongobjArray(1)=visTypeShapeobjArray(2)=TrueobjArray(3)=visTypeGuideobjArray(4)=True

SetFilterSRCmethod

SpecifiesanarrayofcellrangesandaTrueorFalsevalueindicatinghowtofiltereventsforeachcellrange.

Versionadded

2002

Syntax

object.SetFilterSRCSRCStreamobject Required.AnexpressionthatreturnsanEventobject.SRCStream RequiredInteger.AnarrayofcellrangesandaTrueorFalse

valuespecifyinghowtofiltereventsforeachrange.

Remarks

WhenanEventobjectcreatedwiththeAddAdvisemethodisaddedtotheEventListcollectionofasourceobject,thedefaultbehavioristhatalloccurrencesofthateventarepassedtotheeventsink.TheSetFilterSRCmethodprovidesawaytoignoreselectedeventsbasedonarangeofcells.

Example

TheSRCStreamargumentpassedtoSetFilterCommandsisanarraydefinedinthefollowingmanner:

Thenumberofelementsinthearrayisamultipleof7:

Thefirstthreeelementsdescribethesection,row,andcellofthebeginningcelloftherange.

Thenextthreeelementsdescribethesection,row,andcelloftheendcelloftherange.

ThelastelementcontainsaTrueorFalsevalueindicatinghowtofiltereventsforthecellrange(Truetolistentoeventsforarangeofcells;Falsetoexcludeeventsforarangeofcells).

Foraneventtosuccessfullypassthroughacellrangefilter,itmustsatisfythefollowingcriteria:

Itmustbeavalidsection,row,cellreference.

IfallfiltersareTrue,theeventmustmatchatleastonefilter.

IfallfiltersareFalse,theeventmustnotmatchanyfilter.

IfthefiltersareamixtureofTrueandFalse,theeventmustmatchatleastoneTruefilterandnotmatchanyFalsefilters.

IftherearenoTruerangesdefinedinthearray,eventsareconsideredTrue.

Forexample,ifyouwanttolistenforanychangesintheValuecellofthesecondrowintheCustomPropertysection,usethefollowing:

DimsrcArray(1*7)AsLongsrcArray(1)=visSectionPropsrcArray(2)=visRowProp+1srcArray(3)=visCustPropsValuesrcArray(4)=visSectionPropsrcArray(5)=visRowProp+1

srcArray(6)=visCustPropsValuesrcArray(7)=True

SetFormulasmethod

Setstheformulasofoneormorecells.

Versionadded

4.5

Syntax

intRetobject.SetFormulasSID_SRCStream,formulas,flagsintRet Integer.NumberofSID_SRCStreamentrieswhichprocessed

successfully.object Required.AnexpressionthatreturnsaPage,Master,Shape,or

Styleobjectwhosecellsaretobemodified.SID_SRCStream RequiredInteger.Streamidentifyingcellstobemodified.formulas RequiredVariant.Formulastobeassignedtoidentifiedcells.flags RequiredInteger.Flagsthatinfluencethebehaviorof

SetFormulas.

Remarks

TheSetFormulasmethodbehavesliketheFormulaproperty,exceptyoucanuseittosettheformulasofmanycellsatonce,ratherthanonecellatatime.

ForShapeorStyleobjects,youcanusetheSetFormulasmethodtosetresultsofanysetofcells.

ForPageorMasterobjects,youcanusetheSetFormulasmethodtosetresultsofanysetofcellsinanysetofshapesofthepageormaster.

Inbothofthesecases,youtelltheSetFormulasmethodwhichcellsyouwanttosetbypassinganarrayofintegersinSID_SRCStream.SID_SRCStreamisaone-dimensionalarrayof2-byteintegers.

ForShapeandStyleobjects,SID_SRCStreamshouldbeaone-dimensionalarrayof3n2-byteintegersforn>=1.TheSetFormulasmethodinterpretsthestreamas:

{sectionIdx,rowIdx,cellIdx}n

wheresectionIdxisthesectionindexofthedesiredcell,rowIdxisitsrowindex,andcellIdxisitscellindex.

ForPageandMasterobjectsSID_SRCStreamshouldbeaone-dimensionalarrayof4n2-byteintegersforn>=1.TheSetFormulasmethodinterpretsthestreamas:

{sheetID,sectionIdx,rowIdx,cellIdx}n

wheresheetIDistheIDpropertyoftheShapeobjectonthepageormasterwhosecellresultistobemodified.

IfthesheetIDinanentryisvisInvalShapeID(-1)orifthebottombyteofsectionIdxisvisSectionInval(255),thentheentryisignoredbytheSetResultsmethod.ThemotivationforthisisthatthesameSID_SRCStreamarraycanbeusedonseveralcallstoSetFormulas,GetFormulas,andsimilarmethodswiththecalleronlyneedingtomakeminorchangestothestreambetweencalls.

Theformulasargumentshouldbeaone-dimensionalarrayof1<=mvariants.EachVariantshouldbeaString,areferencetoaString,orEmpty.If

formulas(i)isempty,thenthei'thcellwillbesettotheformulainformulas(j),wherejistheindexofthemostrecentpriorentrywhichisnotempty.Ifthereisnopriorentrythatisnotempty,thecorrespondingcellisnotaltered.Iffewerformulasthancellsarespecified(m<n),thenthei'thcell,i>m,willbesettothesameformulaaswaschosentosetthem'thcellto.Thustosetmanycellstothesameformula,youneedonlypassonecopyoftheformula.

Theflagsargumentshouldbeabitmaskofthefollowingvalues.

Constant Value DescriptionvisSetBlastGuards &H2 Overridepresentcellvalues

evenifthey'reguarded.visSetTestCircular &H4 Testforestablishmentof

circularcellreferences.visSetUniversalSyntax &H8 Formulasareinuniversal

syntax.

ThevaluereturnedbytheSetFormulasmethodisthenumberofentriesinSID_SRCStreamthatweresuccessfullyprocessed.Ifi<nentriesprocesscorrectly,butanerroroccursonthei+1stentry,thentheSetFormulasmethodraisesanexceptionandreturnsi.Otherwise,nisreturned.

SetResultsmethod

Setstheresultsorformulasofoneormorecells.

Versionadded

4.5

Syntax

intRetobject.SetResultsSID_SRCStream,units,results,flagsintRet Integer.NumberofSID_SRCStreamentrieswhichprocessed

successfully.object Required.AnexpressionthatreturnsaPage,Master,Shape,or

Stylewhosecellsaretobemodified.SID_SRCStream RequiredInteger.Anarrayidentifyingcellstobemodified.units RequiredVariant.Measurementunitstobeattributedtoentriesin

resultsarray.results RequiredVariant.Resultsorformulastobeassignedtoidentified

cells.flags RequiredInteger.FlagsthatinfluencethebehaviorofSetResults

Remarks

TheSetResultsmethodisliketheResultmethodofaCellobject,exceptthatitcanbeusedtosettheresults(values)ofmanycellsatonce,ratherthanonecellatatime.

ForShapeorStyleobjects,youcanusetheSetResultsmethodtosetresultsofanysetofcells.

ForPageorMasterobjects,youcanusetheSetResultsmethodtosetresultsofanysetofcellsinanysetofshapesofthepageormaster.

Inbothofthesecases,youtelltheSetResultsmethodwhichcellsyouwanttosetbypassinganarrayofintegersinSID_SRCStream.SID_SRCStreamisaone-dimensionalarrayof2-byteintegers.

ForShapeandStyleobjectsSID_SRCStreamshouldbeaone-dimensionalarrayof3n2-byteintegersforn>=1.TheSetResultsmethodinterpretsthestreamas:

{sectionIdx,rowIdx,cellIdx}n

wheresectionIdxisthesectionindexofthedesiredcell,rowIdxisitsrowindex,andcellIdxisitscellindex.

ForPageandMasterobjectsSID_SRCStreamshouldbeaone-dimensionalarrayof4n2-byteintegersforn>=1.TheSetResultsmethodinterpretsthestreamas:

{sheetID,sectionIdx,rowIdx,cellIdx}n

wheresheetIDistheIDpropertyoftheShapeobjectonthepageormasterwhosecellresultistobemodified.

IfthesheetIDinanentryisvisInvalShapeID(-1)orifthebottombyteofsectionIdxisvisSectionInval(255),thentheentryisignoredbytheSetResultsmethod.ThemotivationforthisisthatthesameSID_SRCStreamarraycanbeusedonseveralcallstoSetResults,GetResults,andsimilarmethodswiththecalleronlyneedingtomakeminorchangestothestreambetweencalls.

Theunitsarraycontrolswhatmeasurementunitsindividualentriesinresultsarein.Eachentryinthearraycanbeastringsuchas"inches","inch","in.",or"i".StringsmaybeusedforallsupportedVisiounitssuchascentimeters,meters,miles,andsoon.Youcanalsoindicatedesiredunitswithintegerconstants(visCentimeters,visInches,etc.)declaredbytheVisiotypelibraryinVisUnitCodes.Foralistofconstantsusedforunitsofmeasure,seeAboutunitsofmeasure.NotethatthevaluesspecifiedintheunitsarrayhavenoeffectifvisSetFormulasissetinflags.

Ifnotempty,weexpectunitstobeaone-dimensionalarrayof1<=uvariants.Eachentrycanbeastringorintegercode,orempty(nothing).Ifthei'thentryisempty,thenthei'thentryinresultsisintheunitsdesignatedbyunits(j),wherejisthemostrecentpriorentrythatisnotempty.Thusifyouwantallentriesinresultstobeinterpretedinthesameunits,thenyouneedonlypassaunitsarraywithoneentry.Ifthereisnopriorentrythatisnotempty,orifnounitsarrayissupplied,thenvisNumber(0x20)willbeused.Thiscausestheapplicationtodefaulttointernalunits(liketheResultIUpropertyofaCellobject).

Theresultsargumentshouldbeaone-dimensionalarrayof1<=mvariants.AresultcanbepassedasDouble,Integer,String,orareferencetoaString.StringsareacceptedonlyifvisSetFormulasissetinflags,inwhichcasestringsareinterpretedasformulas.Ifresults(i)isempty,thenthei'thcellwillbesettothevalueinresults(j),wherejistheindexofthemostrecentpriorentrywhichisnotempty.Ifthereisnopriorentrythatisnotempty,thecorrespondingcellisnotaltered.Iffewerresultsthancellsarespecified(m<n),thenthei'thcell,i<m,willbesettothesamevalueaswaschosentosetthem'thcellto.Thustosetmanycellstothesamevalue,youneedonlypassonecopyofthevalue.

Theflagsargumentshouldbeabitmaskofthefollowingvalues.

Constant Value DescriptionvisSetFormulas &H1 Treatstringsinresultsas

formulas.visSetBlastGuards &H2 Overridepresentcellvalues

evenifthey'reguarded.visSetTestCircular &H4 Testforestablishmentof

circularcellreferences.visSetUniversalSyntax &H8 Formulasareinuniversal

syntax

ThevaluereturnedbytheSetResultsmethodisthenumberofentriesinSID_SRCStreamthatweresuccessfullyprocessed.Ifi<nentriesprocesscorrectly,butanerroroccursonthei+1stentry,thentheSetResultsmethodraisesanexceptionandreturnsi.Otherwise,nisreturned.

SetViewRectmethod

Setsthepagecoordinatesofawindow'sbordersbyadjustingthezoomlevelandcenterscrollposition.

Versionadded

2000

Syntax

object.SetViewRectdLeft,dTop,dWidth,dHeightobject Required.AnexpressionthatreturnsaWindowobject.dLeft RequiredDouble.Thepagecoordinateoftheleftsideofthe

window.dTop RequiredDouble.Thepagecoordinateofthetopofthe

window.dWidth RequiredDouble.Thedistanceinpageunitsfromtheleftside

totherightsideofthewindow.dHeight RequiredDouble.Thedistanceinpageunitsfromthetoptothe

bottomofthewindow.

Example

Remarks

IftheWindowobjectisnotavisDrawingtype,thentheSetViewRectmethodraisesanexception.

SetWindowRectmethod

Setsthesizeandpositionoftheclientareaofawindow.

Versionadded

2000

Syntax

object.SetWindowRectnLeft,nTop,nWidth,nHeightobject Required.AnexpressionthatreturnsaWindowobject.nLeft RequiredLong.Thecoordinateoftheleftsideofthewindow.nTop RequiredLong.Thecoordinateofthetopofthewindow.nWidth RequiredLong.Thedistanceinpixelsfromtheleftsidetothe

rightsideofthewindow.nHeight RequiredLong.Thedistanceinpixelsfromthetoptothe

bottomofthewindow.

Remarks

Example

TheSetWindowRectmethodsetsthesizeandpositionoftheclientareaofthewindowwithrespecttothewindowthatownstheWindowscollectiontowhichitbelongs.FortheWindowscollectionofanApplicationobject,the"withrespectto"windowistheMDICLIENTwindowoftheVisiomainwindow.FortheWindowscollectionofaWindowobject,the"withrespectto"windowistheclientareaofthedrawingwindow.

Subtractmethod

Subtractstheareasthatoverlaptheselectedshape.

Versionadded

4.0

Syntax

object.Subtractobject Required.AnexpressionthatreturnsaSelectionobjectthat

containstheshapestosubtract.

Remarks

TheSubtractmethodisequivalenttoclickingSubtractontheOperationssubmenuontheShapemenuinVisio.Thefirstselectedshapeistheonethatwillhavetheotherselectedshapessubtractedfromit.Theothershapeswillbedeletedandnoshapesareselectedwhentheoperationiscomplete.

Example

SwapEndsmethod

Swapsthebeginandendpointsofaone-dimensional(1-D)shape.

Versionadded

2002

Syntax

object.SwapEndsobject Required.AnexpressionthatreturnsaSelectionorShape

object.

Remarks

Thetypeofglueassociatedwiththeendpointsisalsoswapped.Forexample,ifthebeginpointofa1-DshapeisgluedtoobjectAandtheendpointofthe1-Dshapeisnotglued,then,afterinvokingtheSwapEndsmethod,theendpointwillbegluedtoobjectAandthebeginpointwillnotbeglued.

Seealso Example

TransformXYFrommethod

TransformsapointexpressedinthelocalcoordinatesystemofoneShapeobjectfromanequivalentpointexpressedinthelocalcoordinatesystemofanotherShapeobject.

Versionadded

2000

Syntax

object.TransformXYFromOtherShape,x,y,xprime,yprimeobject Required.AnexpressionthatreturnsaShapeobjectwhoselocal

coordinatesystemyouaretransformingthepointto.OtherShape Required.AnexpressionthatreturnsaShapeobjectwhoselocal

coordinatesystemyouaretransformingthepointfrom.x RequiredDouble;x-coordinatecorrespondingtoxinthe

OtherShapecoordinatesystem.y RequiredDouble;y-coordinatecorrespondingtoyinthe

OtherShapecoordinatesystem.

Example

xprime RequiredDouble;x-coordinateincoordinatesystemofobject.yprime RequiredDouble;y-coordinateincoordinatesystemofobject.

Remarks

Thepointsx,y,xprime,andyprimearealltreatedasinternaldrawingunits.

AnexceptionisraisedifobjectisnotaShapeobjectofaPageorMasterobject,orifOtherShapeisnotinthesamePageorMasterobjectasobject.

TransformXYTomethod

TransformsapointexpressedinthelocalcoordinatesystemofoneShapeobjecttoanequivalentpointexpressedinthelocalcoordinatesystemofanotherShapeobject.

Versionadded

2000

Syntax

object.TransformXYToOtherShape,x,y,xprime,yprimeobject Required.AnexpressionthatreturnsaShapeobjectwhoselocal

coordinatesystemyouaretransformingthepointfrom.OtherShape Required.AnexpressionthatreturnsaShapeobjectwhoselocal

coordinatesystemyouaretransformingthepointto.x RequiredDouble;x-coordinateincoordinatesystemofobject.y RequiredDouble;y-coordinateincoordinatesystemofobject.xprime RequiredDouble;x-coordinatecorrespondingtoxinthe

OtherShapecoordinatesystem.

Example

yprime RequiredDouble;y-coordinatecorrespondingtoyintheOtherShapecoordinatesystem.

Remarks

Thepointsx,y,xprimeandyprimearealltreatedasinternaldrawingunits.

AnexceptionisraisedifobjectisnotaShapeobjectofaPageorMasterobject,orifOtherShapeisnotinthesamePageorMasterobjectasobject.

Triggermethod(Cellobject)

Evaluatestheformulaofacell.

Versionadded

4.0

Syntax

object.Triggerobject Required.AnexpressionthatreturnsaCellobject.

Remarks

Triggeringacellsimplyevaluatestheformulaofthatcell.Iftheformulacontainsotheractionssuchasrunninganadd-on,thoseactionsoccur.

Example

Triggermethod(Eventobject)

Causesanevent'sactiontobeperformed.

Versionadded

4.0

Syntax

object.TriggercontextStringobject Required.AnexpressionthatreturnsanEventobject.contextString Thestringtosendtothetargetoftheevent.

Remarks

Triggeringaneventcausestheactionassociatedwiththeeventtobeperformed.Thespecifiedcontextstringispassedtothetargetoftheaction:

Iftheactionistorunanadd-on(visEvtCodeRunAddon),thestringispassedinthecommandlinestringsenttotheadd-on.

Iftheactionistosendanotificationtothecallingprogram(visEvtCodeAdvise),thestringispassedinthemoreInfoparameterofthenotification.

Seealso Example

Trimmethod

Trimsselectedshapesintosmallershapes.

Versionadded

4.1

Syntax

object.Trimobject Required.AnexpressionthatreturnsaSelectionobjectthat

containstheshapestotrim.

Remarks

TheTrimmethodisequivalenttoclickingTrimontheOperationssubmenuontheShapemenuinVisio.

Thenewshapesinherittheformattingofthefirstselectedshape,havenotext,andarethetopmostshapesintheircontainer—thenthshape,nth–1shape,nth–2shape,andsoforthintheShapescollectionoftheircontainingshape,wheren

Example

=count.Theoriginalshapesaredeletedandnoshapesareselectedwhentheoperationiscomplete.

TheTrimmethodissimilartotheFragmentmethodbutdiffersinthefollowingways:

ShapesproducedbytheTrimmethodcoincidewiththedistinctpathsoftheselectedshapes,alsotakingoverlapintoaccount.

ShapesproducedbytheFragmentmethodcoincidewiththedistinctregionsoftheselectedshapes,takingoverlapintoaccount.

Undomethod

Reversesthemostrecentundounit,iftheundounitcanbereversed.

Versionadded

2.0

Syntax

object.Undoobject Required.AnexpressionthatreturnsanApplicationobject.

Remarks

UsetheUndomethodtoreverseactionsoneundounitatatime.

ThenumberoftimesthatcodecancalltheUndomethoddependsonwhetherornotthecodeisexecutinginthescopeofanopenundounit.Coderunsinthescopeofanopenundounitifitis:

Amacrooradd-oninvokedbytheVisiouserinterface.

InaneventhandlerrespondingtoaVisioeventotherthantheVisioIsIdleevent.

Inauser-createdundoscope.

Ifcodeisnotexecutinginthescopeofanopenundounit,itcancalltheUndomethodforeachundounitpresentlyontheVisioundostack.ThemaximumnumberofunitsontheundostackissetintheOptionsdialogboxontheGeneraltab(20isthedefault).IfthenumberofcallstotheUndomethodexceedsthenumberofundounitsonthestack,noactionistakenandtheUndomethodraisesnoexception.

Ifcodeisexecutinginthescopeofanopenundounit,itcancalltheUndomethodonceforeachoperationintheopenundounit.IfthereareadditionalcallstotheUndomethod,itwillraiseanexceptionandtakenoaction.Forexample,ifcodeinamacroperformstwooperations,itcancalltheUndomethodtwice.IfthemacrocallstheUndomethodathirdtime,theUndomethodwillraiseanexception.

CodethatcallstheUndomethodfromwithinthescopeofanundounitcannotcalltheRedomethodtoreversetheaction.TheRedomethodcanonlybecalledwhentherearenoopenundounits.

TheUndomethodalsoraisesanexceptioniftheVisioinstanceispresentlyperforminganundoorredo.TodeterminewhethertheVisioinstanceisundoingorredoing,usetheIsUndoingOrRedoingproperty.

YoucancalltheUndomethodfromtheVisioIsIdleeventhandlerbecausetheVisioIsIdleeventcanonlyfirewhentheIsUndoingOrRedoingpropertyisFalse.YoucanalsocalltheUndomethodfromcodenotinvokedbytheVisioinstance,forexample,codeinvokedfromtheVisualBasicEditororfromanexternalprogram.

Youcanundomostactions,butnotall.UsetheRedomethodtoreversetheeffectoftheUndomethod.

Ungroupmethod

Ungroupsagroup.

Versionadded

2.0

Syntax

object.Ungroupobject Required.AnexpressionthatreturnsaShapeorSelection

objecttoungroup.

Unionmethod

Createsanewshapefromtheperimeterofselectedshapes.

Versionadded

2.0

Syntax

object.Unionobject Required.AnexpressionthatreturnsaSelectionobjectthat

containstheshapestounite.

Remarks

TheUnionmethodisequivalenttoclickingUnionontheOperationssubmenuontheShapemenuinVisio.Theproducedshapewillbethetopmostshapeinitscontainingshapeandwillinheritthetextandformattingofthefirstselectedshape.

Theoriginalshapesaredeletedandnoshapesareselectedwhentheoperationis

Example

complete.

UpdateAlignmentBoxmethod

Updatesthealignmentboxforashape.

Versionadded

2000

Syntax

objRet=object.UpdateAlignmentBoxobjRet Required.AnexpressionthatreturnsaShapeobjectwithanew

widthandheight.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

TheUpdateAlignmentBoxmethodaltersthewidthandheightofashape,oftenagroup.Forexample,aftermovingashapeinagrouptheshapemaybeoutsidethegroup'salignmentbox.TheUpdateAlignmentBoxmethodupdatesthealignmentboxsoitenclosesalltheshapesinthegroup.

NoteManyshapesaredesignedsothattheiralignmentboxesdon'tcoincidewiththeirgeometricextents.UsingtheUpdateAlignmentBoxmethodonsuchshapesdefeatstheintentionsoftheshapedesigner.

Seealso Example

UpdateUImethod

CausesMicrosoftVisiotodisplaychangestotheuserinterfacerepresentedbyaUIObjectobject.

Versionadded

4.0

Syntax

object.UpdateUIobject Required.AnexpressionthatreturnsaUIObjectobjectthat

representstheuserinterfacethatwaschanged.

Remarks

TheUpdateUImethodupdatestheVisiouserinterfacewithchangesmadetoaUIObjectobjectduringasession.UsetheCustomMenusorCustomToolbarspropertyofanApplicationobjectorDocumentobjecttoobtaintheUIObjectobject.

Example

XYFromPagemethod

TransformsapointexpressedinthelocalcoordinatesystemofitsPageorMasterobjecttoanequivalentpointexpressedinthelocalcoordinatesystemoftheShapeobject.

Versionadded

2000

Syntax

object.XYFromPagex,y,xprime,yprimeobject Required.AnexpressionthatreturnsaShapeobjectwhose

localcoordinatesystemyouaretransformingthepointto.x RequiredDouble;x-coordinatecorrespondingtoxinthePage

orMasterobject'scoordinatesystem.y RequiredDouble;y-coordinatecorrespondingtoyinthePage

orMasterobject'scoordinatesystem.xprime RequiredDouble;x-coordinateincoordinatesystemofobject.yprime RequiredDouble;y-coordinateincoordinatesystemofobject.

Example

Remarks

Thepointsx,y,xprime,andyprimearealltreatedasinternaldrawingunits.

AnexceptionisraisedifobjectisnotaShapeobjectofaPageorMasterobject.

XYToPagemethod

TransformsapointexpressedinthelocalcoordinatesystemofaShapeobjecttoanequivalentpointexpressedinthelocalcoordinatesystemofitsPageorMasterobject.

Versionadded

2000

Syntax

object.XYToPagex,y,xprime,yprimeobject Required.AnexpressionthatreturnsaShapeobjectwhose

localcoordinatesystemyouaretransformingthepointfrom.x RequiredDouble;x-coordinateincoordinatesystemofshpObj.y RequiredDouble;y-coordinateincoordinatesystemofshpObj.xprime RequiredDouble;x-coordinatecorrespondingtoxinthePage

orMasterobject'scoordinatesystem.yprime RequiredDouble;y-coordinatecorrespondingtoyinthePage

orMasterobject'scoordinatesystem.

Example

Remarks

Thepointsx,y,xprime,andyprimearealltreatedasinternaldrawingunits.

AnexceptionisraisedifobjectisnotaShapeobjectofaPageorMasterobject.

<Global>object

">

TheVisioglobalobjectisautomaticallyavailabletoMicrosoftVisualBasicforApplications(VBA)codethatispartoftheVBAprojectofaVisiodocument.TheVisioglobalobjectisnotavailabletocodeinothercontexts.

Versionadded

4.5

Remarks

Membersoftheglobalobjectcanbeaccessedwithoutqualification.Forexample,toaccesstheActivePagememberoftheglobalobject:

SetpageObj=ActivePage

Theprecedingsyntaxisdifferentfromthesyntaxyouwoulduseforaccessingmembersofnon-globalobjects.Forexample:

Seealso Methods Events

SetpageObj=AppObj.ActivePage

NoteTheVBAprojectofeveryVisiodocumentalsohasaclassmodulecalledThisDocument.WhenreferencedfromcodeintheVBAproject,theThisDocumentmodulereturnsareferencetotheproject'sDocumentobject.

ThisDocumentobject

TheMicrosoftVisualBasicforApplications(VBA)projectofeveryMicrosoftVisiodocumenthasaclassmodulecalledThisDocument.Whenreferencedfromcodeintheproject,theThisDocumentobjectreturnsareferencetotheproject'sDocumentobject.

Versionadded

4.5

Remarks

YoucandisplaythenameoftheVBAproject'sdocumentinamessageboxwiththisstatement,forexample:

Seealso

MsgBoxThisDocument.Name

YoucangetthefirstpageoftheVBAproject'sdocumentbyusingthiscode,forexample:

DimpagObjAsVisio.PageSetpagObj=ThisDocument.Pages.Item(1)

IfyouwanttomanipulatethedocumentassociatedwithyourVBAproject,usetheThisDocumentobject.Ifyouwanttomanipulateadocument,butnotnecessarilythedocumentassociatedwithyourVBAproject,getaDocumentobjectfromtheDocumentscollection.

TheActiveDocumentpropertyoften,butnotnecessarily,returnsareferencetothesamedocumentastheThisDocumentobject.TheActiveDocumentandThisDocumentobjectsarethesameifthedocumentshownintheVisioactivewindowisthedocumentcontainingtheThisDocumentobject'sproject.WhetheryourcodeusestheActiveDocumentorThisDocumentobjectdependsonthepurposeofyourprogram.

Youcanextendthesetofpropertiesandmethodsofaproject'sDocumentobjectbyaddingpublicpropertiesandmethodstothatproject'sThisDocumentclassmodule.Thenewmethodsandpropertiesareexposedjustlikethebuilt-inmethodsandpropertiesimplementedbyVisio.Thenewmethodsandpropertiesaren'tavailablewhenyoureferenceotherDocumentobjects.

NoteTheThisDocumentobjectisnotavailabletocodethatisn'tpartoftheVBAprojectofaVisiodocument.

AccelItemobject

RepresentsasingleacceleratorusedbyMicrosoftVisio.

Versionadded

4.0

Remarks

AnAccelItemobjectconsistsofakey,modifierstothekey,andtheVisiocommandoradd-onthattheacceleratorexecuteswhentheuserpressestheaccelerator.AkeyisanyASCIIkeycode,andisnotcase-sensitive.ThemodifiersareALT,CTRL,andSHIFT.CommandidentifiersaredeclaredbytheVisiotypelibraryandprefixedwithvisCmd.

Events

AccelItemscollection

IncludesanAccelItemobjectforeachacceleratorinaMicrosoftVisiowindowcontext.

ToretrieveanAccelItemscollection,usetheAccelItemspropertyofanAccelTableobject.

Versionadded

4.0

Remarks

ThedefaultpropertyforanAccelItemscollectionisItem.

UnlikeotherVisiocollections,theAccelItemscollectionisindexedstartingwithzero(0)ratherthan1.

Events

AccelTableobject

RepresentsaMicrosoftWindowsacceleratortable.

Versionadded

4.0

Remarks

YoucancreateoneAccelTableobjectforeachVisiowindowcontext(drawingwindow,stencilwindow,ShapeSheetwindow,andsoforth).

Events

AccelTablescollection

IncludesanAccelTableobjectforeachMicrosoftVisiowindowcontextthathasaccelerators.

ToretrieveanAccelTablescollection,usetheAccelTablespropertyofaUIObjectobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofAccelTablesisItem.

UnlikeotherVisiocollections,theAccelTablescollectionisindexedstarting

Events

withzero(0)ratherthan1.

AnAccelTableobjectisidentifiedintheAccelTablescollectionbyitsSetIDproperty,whichcorrespondstoaVisiowindowcontext.ForalistofSetIDvaluesthatidentifyAccelTableobjects,seetheSetIDproperty.

Addonobject

object;DAR_Objects_(A-M)_1015.htm">

RepresentsaninstalledMicrosoftVisioadd-on.

ToretrieveanAddonobject,usetheAddonscollectionofanApplicationobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofanAddonobjectisName.

Events

Addonscollection

object;DAR_Objects_(A-M)_1015.htm">

Representsthesetofinstalledadd-onsknowntoanApplicationobject.

ToretrieveanAddonscollection,usetheAddonspropertyofanApplicationobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofanAddonscollectionisItem.

Installedadd-onsarethoseVisiofindsinitsAddonsorStartUppaths,orthosethatotheradd-onshavedynamicallyinstalledusingtheAddmethodoftheAddonscollection.

Events

Application(InvisibleApp)object

RepresentsaninstanceofMicrosoftVisio.AnexternalprogramtypicallycreatesorretrievesanApplicationobjectbeforeitcanretrieveotherVisioobjectsfromthatinstance.UsetheMicrosoftVisualBasicCreateObjectfunctionortheNewkeywordtorunanewinstance,orusetheGetObjectfunctiontoretrieveaninstancethatisalreadyrunning.YoucanalsousetheCreateObjectfunctionwiththeInvisibleAppobjecttorunanewinstancethatisinvisible.SetthevalueoftheInvisibleAppobject'sVisiblepropertytoTruetoshowit.

Versionadded

4.1

Remarks

Seealso

UsetheDocuments,Windows,andAddonspropertiesofanApplicationobjecttoretrievetheDocument,Window,andAddoncollectionsoftheinstance.

UsetheActiveDocument,ActivePage,orActiveWindowpropertytoretrievethecurrentlyactiveDocument,Page,orWindowobject.TheApplicationobject'smenusandtoolbarscanbeaccessedusingtheBuiltInMenus,BuiltInToolbars,CustomMenus,CustomToolbars,orCommandBarsproperties.

ActiveDocumentisthedefaultpropertyofanApplicationobject.

NoteCodeintheMicrosoftVisualBasicforApplicationsprojectofaVisiodocumentcanusetheVisioglobalobjectinsteadofaVisioApplicationobjecttoretrieveotherobjects.

Cellobject

Holdsaformulathatevaluatestosomevalue.

Versionadded

2.0

Remarks

ThedefaultpropertyofaCellobjectisResultIU.

Youcangetorsetacell'sformulaorvalue.AcellbelongstoaShape,Style,orRowobjectandrepresentsapropertyoftheshape,style,orrow.Forexample,theheightofashapeequalsthevalueoftheshape'sHeightcell.

Seealso

Aprogramcancontrolashape'sappearanceandbehaviorbyworkingwiththeformulasintheshape'scells.Youcanvisuallyinspectmostofashape'scellsbyopeningtheshape'sShapeSheetwindow.UsetheCellsorCellsSRCpropertyofaShapeobjecttoretrieveaCellobject.Toretrieveacellinastyle,usetheCellspropertyofaStyleobject.

Charactersobject

Representsashape'stextwiththetextfieldsexpandedtothenumberofcharacterstheydisplayinadrawingwindow.

ToretrieveaCharactersobject,usetheCharacterspropertyofaShapeobject.

Versionadded

3.0

Remarks

ThedefaultpropertyofaCharactersobjectisText.

TheBeginandEndpropertiesofaCharactersobjectdeterminetherangeoftheshape'stextthatisrepresentedbytheCharactersobject.Initially,therangecontainsalloftheshape'stext;youcansettheBeginandEndpropertiestospecifyasubrangeofthetext.

AfteryouretrieveaCharactersobject,youcanuseitsTextpropertytoretrieveorsettheshape'stext.UsetheCopy,Cut,orPastemethodtocopy,cut,orpastetheCharacterobject'stexttoorfromtheClipboard.UsetheCharPropsorParaPropspropertytochangetheCharacterobject'sformatting.

Colorobject

RepresentsacolorinthecolorpaletteforaMicrosoftVisiodocument.

Versionadded

4.0

Remarks

ThedefaultpropertyofaColorobjectisPaletteEntry.

Methods Events

Colorscollection

IncludesaColorobjectforeachcolorinthepaletteforaMicrosoftVisiodocument.

ToretrieveaColorscollection,usetheColorspropertyofaDocumentobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofColorsisItem.

Methods Events

Connectobject

Representsaconnectionbetweentwoshapesinadrawing,suchasalineandaboxinanorganizationchart.

RetrieveaConnectobjectfromtheConnectscollectionreturnedbytheConnectsandFromConnectspropertiesofaShapeobject,ortheConnectscollectionofaPageorMasterobject.

Versionadded

2.0

Remarks

ThedefaultpropertyofaConnectobjectisFromSheet.

UsetheGlueToorGlueToPosmethodofaCellobjecttoconnectoneshapetoanotherinadrawing.

Methods Events

Connectscollection

IncludesaConnectobjectforeachconnectionbetweentwoshapesinadrawing,suchasalineandaboxinanorganizationchart.

Versionadded

2.0

Remarks

ThedefaultpropertyofaConnectscollectionisItem.

UsetheConnectspropertyofaShapeobjecttoretrieveaConnectscollectionwithaConnectobjectforeveryShapeobjecttowhichtheindicatedShapeobjectisconnected(glued).

UsetheFromConnectspropertyofaShapeobjecttoretrieveaConnectscollectionwithaConnectobjectforeveryShapeobjectthatisconnected(glued)totheindicatedShapeobject.

Methods Events

UsetheConnectspropertyofaPageobjecttoretrieveaConnectscollectionwithanentryforeveryconnectiononthePageobject.

UsetheConnectspropertyofaMasterobjecttoretrieveaConnectscollectionwithanentryforeveryconnectionintheMasterobject.

Curveobject

AniteminaPathobjectthatrepresentsaconsecutivesequenceofrowsintheGeometrysectionofitsPathobject.

Versionadded

5.0

Remarks

ThedefaultpropertyofCurveobjectisPoint.

IfaCurveobjectisinacollectionreturnedbythePathspropertyofaShapeobject,itscoordinatesareexpressedintheshape'sparentcoordinatesystem.IftheCurveobjectisinacollectionreturnedbythePathsLocalpropertyofaShapeobject,itscoordinatesareexpressedintheshape'slocalcoordinatesystem.Inbothcases,thecoordinatesareexpressedininternaldrawingunits

Events

(inches).

ACurveobjectdescribesitselfintermsofitsparameterdomain,whichistherange[Start(),End()].UsetheStartpropertyofaCurveobjecttoobtainthecurve'sstartingpointandtheEndpropertyofaCurveobjecttoobtainthecurve'sendingpoint.

UsethePointmethodofacurveobjecttoextrapolateapointalongthecurve'spath.UsethePointAndDerivativesmethodofaCurveobjecttodetermineapointalongthecurve'spathand,optionally,itsfirstandsecondderivatives.

UsethePointspropertyofaCurveobjecttoobtainastreamofpointsthatapproximatethecurve'spath.

Documentobject

object;DAR_Objects_(A-M)_1015.htm">

Representsadrawingfile(.vsdor.vdx),stencilfile(.vssor.vsx),ortemplatefile(.vstor.vtx)thatisopeninaninstanceofVisio.ADocumentobjectisamemberoftheDocumentscollectionofanApplicationobject.

Versionadded

2.0

Remarks

ThedefaultpropertyofaDocumentobjectisName.

UsetheOpenmethodofaDocumentscollectiontoopenanexistingdocument.

UsetheAddmethodofaDocumentscollectiontocreateanewdocument.

UsetheActiveDocumentpropertyofanApplicationobjecttoretrievetheactivedocumentinaninstance.

UsethePages,Masters,andStylespropertiesofaDocumentobjecttoretrievePage,Master,andStyleobjects,respectively.

UsetheCustomMenusorCustomToolbarspropertiesofaDocumentobjecttoaccessthecustommenusortoolbars.

NoteTheMicrosoftVisualBasicforApplications(VBA)projectofeveryVisiodocumentalsohasaclassmodulecalledThisDocument.WhenyoureferencetheThisDocumentmodulefromcodeinaVBAproject,itreturnsareferencetotheproject'sDocumentobject.Forexample,thecodeinadocument'sprojectcandisplaythenameoftheproject'sdocumentinamessageboxwiththisstatement:

MsgBoxThisDocument.Name

Documentscollection

object;DAR_Objects_(A-M)_1015.htm">

IncludesaDocumentobjectforeachopendocumentinaMicrosoftVisioinstance.

ToretrieveaDocumentscollection,usetheDocumentspropertyofanApplicationobject.

Versionadded

2.0

Remarks

ThedefaultpropertyofaDocumentscollectionisItem.

Eventobject

AmemberoftheEventListcollectionofasourceobjectsuchasaDocument.Aneventencapsulatesaneventcode.

AnEventobjectcantriggertwokindsofactions:itcanrunanadd-on,oritcansendanotificationoftheeventtothecallingprogram.TocreateanEventobject,usetheAddorAddAdvisemethodofanEventListobject.

Versionadded

4.0

Remarks

Events

ThedefaultpropertyofanEventobjectisEvent.

TheEventpropertyoftheEventobjectestablishestheeventthattriggerstheaction,anditsActionpropertyindicatestheactiontobeperformed.

UsethePersistablepropertytofindoutiftheeventcanbestoredwithaVisiodocument,orthePersistentpropertytofindoutiftheeventisstored.UsetheTriggermethodtotriggeranEventobject'sactionwithoutwaitingfortheeventtooccur.UsetheEnabledpropertytotemporarilydisableanevent.

EventListcollection

IncludesanEventobjectforeacheventtowhichanobjectshouldrespond.TheobjectthatpossessestheEventListissometimescalledthesourceobject.

ToretrieveanEventListcollection,usetheEventListpropertyofthesourceobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofEventListisItem.

Events

Ingeneral,thelevelofthesourceobjectintheVisioobjecthierarchydeterminesthescopeofitsresponse.Forexample,ifanEventobjectfortheDocumentOpenedeventisintheEventListofaDocumentobject,thatevent'sactionistriggeredonlywhenthatdocumentisopened.IfthesameEventobjectisintheEventListofanApplicationobject,theevent'sactionistriggeredwheneveranydocumentisopenedinthatinstanceofVisio.

TocreateanEventobjectthatrunsanadd-on,usetheAddmethodofanEventListcollection.

TocreateanEventobjectthatsendsanotification,usetheAddAdvisemethod.

Fontobject

Representsatypefacethatiseitherappliedtotextinadocumentoravailableforuseonthesystem.

Versionadded

4.0

Remarks

ThedefaultpropertyofaFontobjectisName.

AFontobjectmapsitsname(forexample,"Arial")tothefontID(forexample,3)thatVisiostoresinaFontcellinaCharactersectionofashapewhosetextisformattedwiththatfont.FontIDscanchangewhenadocumentisopenedondifferentsystemsorwhenfontsareinstalledorremoved.

Methods Events

Fontscollection

IncludesaFontobjectforeachfontappliedtotextinadocumentoravailableonthesystem.

ToretrieveaFontscollection,usetheFontspropertyofaDocumentobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofaFontscollectionisItem.

ToretrieveaFontobjectbyitsfontID(thevalueshownintheFontcellinashape'sCharactersection),usetheItemFromIDproperty.

Methods Events

Hyperlinkobject

Completelyencapsulatesthepropertiesandbehaviorofahyperlink.Ashapecanhaveoneormorehyperlinksthatnavigatetoanynamedlocation,suchasanotherpage,alocaldocument,oraURL.AHyperlinkobjectenablesyoutoaccessandmanipulatetheshape'sHyperlink.Rowrow.

Versionadded

5.0

Remarks

ThedefaultpropertyofaHyperlinkobjectisDescription.

ToaddaHyperlinkobjecttoashape,usetheAddHyperlinkmethod.

Tonavigatetoanamedhyperlinklocation,usetheFollowmethod.

Events

Hyperlinkscollection

IncludesHyperlinkobjects.AHyperlinkscollectionenablesyoutoaccessandmanipulateashape'sHyperlinkssection.

ToretrieveaHyperlinkscollection,usetheHyperlinkspropertyofaShapeobject.

Versionadded

2000

Remarks

ThedefaultpropertyofaHyperlinkscollectionisItem.

Events

Layerobject

Representsalayerofapageormaster.Youcanassignshapestoorremovethemfromthelayer.

Versionadded

4.0

Remarks

ThedefaultpropertyofaLayerobjectisName.

Toaccesscellswhosevaluesdefinelayerattributes,suchaswhetherthelayerisvisibleorprintable,usetheCellsCproperty.

Events

Alayer'sIndexandRowpropertiestypicallyhavedifferentvalues.TheIndexpropertyindicatesthelayer'sordinalpositioninitsLayerscollection.Thelayer'sRowpropertyindicatestheindexoftherowintheLayerssectionwherethelayer'sattributesaredefined.

Layerscollection

IncludesaLayerobjectforeachlayerdefinedforapageormaster.

ToretrieveaLayerscollection,usetheLayerspropertyofaPageobjectoraMasterobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofLayersisItem.

Events

Masterobject

Representsamasterinastencil.

YouretrieveaparticularMasterobjectfromtheMasterscollectionofaDocumentobjectwhosestencilcontainsthatmaster.

Versionadded

2.0

Remarks

ThedefaultpropertyofaMasterobjectisName.

Tocreateaninstanceofamasterinadrawing,usetheDropmethodofaPageobjectthatrepresentsadrawingpage.

Masterscollection

IncludesaMasterobjectforeachmasterinadocument'sstencil.

ToretrieveaMasterscollection,usetheMasterspropertyofaDocumentobject.

Versionadded

2.0

Remarks

ThedefaultpropertyofaMasterscollectionisItem.

MasterShortcutobject

Representsamastershortcutinastencil.Amastershortcutreferencesamasterinastencil.

Versionadded

2000

Remarks

ThedefaultpropertyofaMasterShortcutobjectisName.

Events

MasterShortcutscollection

IncludesMasterShortcutobjects.

ToretrieveaMasterShortcutscollection,usetheMasterShortcutspropertyofaDocumentobject.

Versionadded

2000

Remarks

ThedefaultpropertyofaMasterShortcutscollectionisItem.

Events

Menuobject

RepresentsasinglemenuonaMicrosoftVisiomenubar,suchastheFilemenuorEditmenu.

Versionadded

4.0

Remarks

TheindexofaMenuobjectwithintheMenuscollectioncorrespondstothemenu'spositionfromlefttorightonthemenubar,startingwithzero(0)forthemenufarthesttotheleftifthemenusarearrangedhorizontally.

Events

MenuItemobject

RepresentsasinglemenuitemonaMicrosoftVisiomenu,suchastheCopymenuitemontheEditmenu.

Versionadded

4.0

Remarks

ThedefaultpropertyofMenuItemisCaption.

AMenuItemobjectcontainsalltheinformationitneedstodisplaythemenuitemandlaunchtheappropriateVisiocommandoradd-on.ItalsocontainstextfortheUndo,Redo,andRepeatmenuitemsanderrormessages.

Events

TheindexofaMenuItemobjectwithintheMenuItemscollectioncorrespondstothemenuitem'spositionfromtoptobottomonthemenuorsubmenu,startingwithzero(0).

Ifthemenuitemdisplaysasubmenu,theMenuItemobjecthasaMenuItemscollectionthatrepresentsitemsonthesubmenu.TheMenuItemobject'sCaptionpropertycontainsthesubmenutitleanditsCmdNumpropertyissettozero(0).MostoftheotherpropertiesoftheMenuItemareignored,becausethisobjectservesmuchthesameroleasaMenuobject.

MenuItemscollection

ContainsaMenuItemobjectforeachcommandonaMicrosoftVisiomenu.

ToretrieveaMenuItemscollection,usetheMenuItemspropertyofaMenuobjectoraMenuItemobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofMenuItemsisItem.

UnlikeotherVisiocollections,theMenuItemscollectionisindexedstartingwithzero(0)ratherthan1.

Events

Menuscollection

IncludesaMenuobjectforeachmenuinaMicrosoftVisiomenuset.

ToretrieveaMenuscollection,usetheMenuspropertyofaMenuSetobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofMenusisItem.

UnlikeotherVisiocollections,theMenuscollectionisindexedstartingwithzero(0)ratherthan1.

Events

MenuSetobject

RepresentsanentiremenusetusedbyaMicrosoftVisiowindowcontext.

Versionadded

4.0

Remarks

Ashortcutmenu(whichappearswhenyoupresstherightmousebutton)isrepresentedbyaMenuSetobjectthathasasingleuntitledMenuobjectinitsMenuscollection,whichcontainsthecontentsoftheshortcutmenuinitsMenuItemscollection.

Events

MenuSetscollection

IncludesaMenuSetobjectforeachMicrosoftVisiowindowcontextthathasmenus.

ToretrieveaMenuSetscollection,usetheMenuSetspropertyofaUIObjectobject.

Versionadded

4.0

Remarks

ThedefaultpropertyofMenuSetsisItem.

UnlikeotherVisiocollections,theMenuSetscollectionisindexedstartingwith

Events

zero(0)ratherthan1.

AMenuSetobjectisidentifiedintheMenuSetscollectionbyitsSetIDproperty,whichcorrespondstoaVisiowindowcontext.ForalistofSetIDvaluesforMenuSetobjects,seetheSetIDproperty.

MSGWrapobject

PassedasanargumentwiththeOnKeystrokeMessageForAddonevent.TheMSGWrapobjectwrapsthedatacontainedinamessagepassedfromMicrosoftWindowstoMicrosoftVisio.

Versionadded

2002

Remarks

ThepropertiesoftheMSGWrapobjectcorrespondtothefieldsintheMSGstructuredefinedaspartoftheWindowsoperatingsystem.

Fordetails,searchfor"MSGstructure"inyourWindowsdocumentationorontheMicrosoftDeveloperNetwork(MSDN)Website.

Methods Events

OLEObjectobject

RepresentsanOLE2.0linkedorembeddedobjectoranActiveXcontrolinaMicrosoftVisiodocument,page,ormaster.

Versionadded

5.0

Remarks

ThedefaultpropertyofOLEObjectisObject.

ToobtaintheIDispatchinterfaceonanActiveXcontrolorembeddedorlinkedOLE2.0objectrepresentedbyashape,usetheObjectpropertyofanOLEObjectobject.

Methods Events

OLEObjectscollection

IncludesanOLEObjectobjectforeachOLE2.0linkedorembeddedobjectorActiveXcontrolcontainedinadocument,page,ormaster.

EachmemberofanOLEObjectscollectionisanOLEObjectobject,whichrepresentsanOLE2.0linkedorembeddedobjectoranActiveXcontrolinaMicrosoftVisiodocument.

ToretrieveanOLEObjectscollection,usetheOLEObjectspropertyofaDocument,Page,orMasterobject.

Versionadded

5.0

Remarks

ThedefaultpropertyofOLEObjectsisItem.

Methods Events

Pageobject

Representsadrawingpage,whichcanbeeitheraforegroundpageorbackgroundpage.

Versionadded

2.0

Remarks

ThedefaultpropertyofaPageobjectisName.

Toretrievetheactivepageinaninstance,usetheActivePagepropertyofanApplicationobject.

ThemembersofaDocumentobject'sPagescollectionrepresentthepagesinthatdocument.Toretrieveapage'sshapes,usetheShapespropertyofaPageobject.

Pagescollection

IncludesaPageobjectforeachdrawingpageinadocument.

ToretrieveaPagescollection,usethePagespropertyofaDocumentobject.

Versionadded

2.0

Remarks

ThedefaultpropertyofaPagescollectionisItem.

TheorderofitemsinaPagescollectionissignificant:Iftherearenforeground

pagesinadocument,thenthefirstnpagesinitsPagescollectionareforegroundpagesandareinorder.Theremainingpagesinthecollectionarethebackgroundpagesofthedocument;theseareinnoparticularorder.

Pathobject

Representsasequenceofoneormoresegmentswhoseendsabut.Apathdescribeswhereapenwouldmoveinordertodrawoneshapecomponent.EachPathobjectcorrespondstoaGeometrysectionofashape.

Versionadded

5.0

Remarks

ThedefaultpropertyofaPathobjectisItem.

ACurveobjectisaniteminaPathobjectthatisanylinearorcurvedsegmentrepresentingaconsecutivesequenceofrowsintheGeometrysectionthatthePathobjectrepresents.ThenumberofCurveobjectsinaPathobjectisnotnecessarilythesameasthenumberofrowsinitsGeometrysection.

ThePathobjectisconceptuallyofzerowidth.Lineweights,patterns,andendsareignored,however,cornerroundingisincluded.APathobjectmayormaynotbeclosed,anditmayintersectitself.Forexample,aPathmaydescribea

Methods Events

figureeight.

IfyouretrieveaPathobjectfromacollectionobtainedbythePathspropertyofashape,itscoordinatesareexpressedintheshape'sparentcoordinatesystem.IfyouretrieveaPathobjectfromacollectionobtainedbythePathsLocalpropertyofashape,itscoordinatesareexpressedintheshape'slocalcoordinatesystem.Inbothcases,coordinatesareexpressedininternaldrawingunits(inches).

Pathscollection

IncludesaPathobjectforeachGeometrysectionforagrouporshape.

ToretrieveaPathscollectionexpressedintheshape'sparentcoordinatesystem,usethePathspropertyoftheshape.Thecoordinatesareexpressedininternaldrawingunits(inches).

Versionadded

5.0

Remarks

ThedefaultpropertyofaPathscollectionisItem.

ToretrieveaPathscollectionexpressedintheshape'slocalcoordinatesystem,usethePathsLocalpropertyoftheshape.Thecoordinatesareexpressedininternaldrawingunits(inches).

IfaShapeobjectisapage,foreignobject,orguide,thenitsPathsandPathsLocalpropertiesdon'tcontainanyitems.

Methods Events

IfaShapeobjectisagroup,thenitsPathsandPathsLocalpropertiesaretheunionofthepathsofitscomponentshapes.

IfaShapeobjectisashape,thenitsPathsandPathsLocalpropertiesincludeoneitemforeachGeometrysectionthatdefinesastrokeofpositivelength.

Rowobject

Enablesyoutoaccessandmanipulatearowinasection.

Versionadded

2000

Remarks

ThedefaultpropertyofaRowobjectisCell.

Seealso

Sectionobject

Enablesyoutoaccessandmanipulateasectionofashape.AsectionofashapecorrespondstoasectionshownintheShapeSheetwindow.Asectioncontainsrowsandcells.

Versionadded

2000

Remarks

ThedefaultpropertyofaSectionobjectisRow.

Seealso Methods

Selectionobject

RepresentsasubsetofShapeobjectsforapageormastertowhichanoperationcanbeapplied.

ToretrieveaSelectionobjectthatcorrespondstothesetofshapesselectedinawindow,usetheSelectionpropertyofaWindowobject.

Versionadded

2.0

Remarks

ThedefaultpropertyofaSelectionobjectisItem.

AfteryouretrieveaSelectionobject,youcanaddorremoveshapesbyusingtheSelectmethod.

Seealso

Events

Bydefault,theitemsreportedbyaSelectionobjectdonotincludesubselectedorsuperselectedShapeobjects.UsetheIterationModepropertytocontrolwhethersubselectedandsuperselectedShapeobjectsarereported.YoucandeterminewhetheranindividualitemissubselectedorsuperselectedusingtheItemStatusproperty.

Shapeobject

Representsanythingyoucanselectinadrawingwindow:abasicshape,agroup,aguide,oranobjectfromanotherapplicationembeddedorlinkedinMicrosoftVisio.

Versionadded

2.0

Remarks

ThedefaultpropertyofaShapeobjectisName.

YoucanretrieveaparticularShapeobjectfromtheShapescollectionofthefollowingobjects:

Pageobject

Masterobject

Shapeobjectthatrepresentsagroup

ToretrieveCellobjectsandConnectobjects,usetheCellsandConnectspropertiesofaShapeobject,respectively.

NoteThePageSheetpropertyofaPageobjectandMasterobjectreturnsaShapeobjectwhoseTypepropertyreturnsvisTypePage.Ithascellsthatspecifypropertiessuchasdrawingsizeanddrawingscale.TheDocumentSheetpropertyofaDocumentobjectalsoreturnsaShapeobjectwhoseTypepropertyreturnsvisTypeDoc.Ithascellsthatspecifypropertiesofthedocument.

Shapescollection

IncludesaShapeobjectforeachbasicshape,group,guide,orobjectfromanotherapplication(linkedorembeddedinMicrosoftVisio)onadrawingpage,master,orgroup.

Versionadded

2.0

Events

Remarks

ToretrieveaShapescollection,usetheShapespropertyofaPage,Master,orShapeobject.

ThedefaultpropertyofaShapescollectionisItem.

TheorderofitemsinaShapescollectioncorrespondstothestacking(drawing)orderoftheshapes.

StatusBarobject

BeginningwithMicrosoftVisio2002,thisobjectisobsolete.

Remarks

Inearlierversions,thisrepresentedastatusbarshownatthebottomofaVisiowindow.

Seealso Properties Methods Events

StatusBarItemobject

BeginningwithMicrosoftVisio2002,thisobjectisobsolete.

Remarks

Inearlierversions,thisrepresentedasingleitem(button,message,andsoforth)onastatusbar.

Seealso Properties Methods Events

StatusBarItemscollection

BeginningwithMicrosoftVisio2002,thiscollectionisobsolete.

Remarks

Inearlierversions,thiscollectionincludedaStatusBarItemobjectforeachVisiowindowcontext.

Seealso Properties Methods Events

StatusBarscollection

BeginningwithMicrosoftVisio2002,thiscollectionisobsolete.

Remarks

Inearlierversions,thisincludedaStatusBarobjectforeachVisiowindowcontextthatcoulddisplayastatusbar.

Seealso Properties Methods Events

Styleobject

Representsastyledefinedinadocument.

YouretrieveaparticularstylefromtheStylescollectionofaDocumentobject.

Versionadded

2.0

Remarks

ThedefaultpropertyofaStyleobjectisName.

AnyShapeobjecttowhichastyleisappliedinheritstheattributesdefinedbythestyle.UsetheLineStyle,FillStyle,TextStyle,orStylepropertyofaShapeobjecttoapplyastyletoashapeortodeterminewhatstyleisappliedtoashape.

LikeaShapeobject,aStyleobjecthascellswhoseformulasdefinethevaluesofthestyle'sattributes.Toretrieveoneofthesecells,usetheCellsorCellsSRCpropertyoftheStyleobject.

Stylescollection

IncludesaStyleobjectforeachstyledefinedinadocument.

Versionadded

2.0

Remarks

ToretrieveaStylescollection,usetheStylespropertyofaDocumentobject.

ThedefaultpropertyofaStylescollectionisItem.

Toolbarobject

RepresentsagroupoftoolbaritemsinaMicrosoftVisiowindow.

Versionadded

4.0

Remarks

ThedefaultpropertyofToolbarisCaption.

TheindexoftheToolbarobjectwithintheToolbarscollectioncorrespondstoitsorderintheVisiowindow,startingwithzero(0)forthetoolbarclosesttothetop.Upto10toolbarscanbedisplayedinaVisiowindowatonetime.

Events

ToolbarItemobject

RepresentsoneiteminaToolbarobject.AToolbarItemobjectcanrepresentabutton,combobox,oranyotheritemontheMicrosoftVisiotoolbars.

Versionadded

4.0

Remarks

TheindexoftheToolbarItemobjectwithintheToolbarItemscollectioncorrespondstoitspositiononthetoolbar,startingwithzero(0)fortheitemfarthesttotheleftifthetoolbarsarearrangedhorizontally.

BeginningwithMicrosoftVisio2002,usetheBeginGrouppropertytocreatespacesonatoolbar.

Events

ToolbarItemscollection

IncludesaToolbarItemobjectforeachitemonatoolbar.

Versionadded

4.0

Remarks

ToretrieveaToolbarItemscollection,usetheToolbarItemspropertyofaToolbarobject.

ThedefaultpropertyofToolbarItemsisItem.

UnlikeotherVisiocollections,theToolbarItemscollectionisindexedstartingwithzero(0)ratherthan1.

Events

Toolbarscollection

IncludesaToolbarobjectforeachtoolbarinawindowcontext.

Versionadded

4.0

Remarks

ToretrieveaToolbarscollection,usetheToolbarspropertyofaToolbarSetobject.

ThedefaultpropertyofToolbarsisItem.

UnlikeotherVisiocollections,theToolbarscollectionisindexedstartingwithzero(0)ratherthan1.

Events

ToolbarSetobject

RepresentsthesetoftoolbarsforaMicrosoftVisiowindowcontext.

Versionadded

4.0

Events

ToolbarSetscollection

IncludesaToolbarSetobjectforeachwindowcontextthatcandisplaytoolbars.

Versionadded

4.0

Remarks

ToretrieveaToolbarSetscollection,usetheToolbarSetspropertyofaUIObjectobject.

ThedefaultpropertyofToolbarSetsisItem.

UnlikeotherVisiocollections,theToolbarSetscollectionisindexedstartingwithzero(0)ratherthan1.

Events

AToolbarSetobjectisidentifiedintheToolbarSetscollectionbyitsSetIDproperty,whichcorrespondstoaVisiowindowcontext.ForalistifSetIDvaluesforToolbarSetobjects,seetheSetIDproperty.

UIObjectobject

RepresentsasetofMicrosoftVisiomenus,toolbars,andaccelerators,fromeitherthebuilt-inVisiouserinterfaceoracustomizedversionofit.

Versionadded

4.0

Remarks

ToretrieveaUIObjectobjectthatcontains

Visiomenusandaccelerators,usetheBuiltInMenuspropertyofanApplicationobjectandthentheMenusetsorAccelTablescollectionsoftheUIObject

Events

objectreturnedfromtheBuiltInMenusproperty.

Visiotoolbars,usetheBuiltInToolbarspropertyofanApplicationobjectandthentheToolbarSetscollectionoftheUIObjectobjectreturnedfromtheBuiltInToolbarsproperty.

IfanApplicationobjectorDocumentobjecthasacustomizeduserinterface,usetheCustomMenusorCustomToolbarspropertiestoretrieveUIObjectobjectsthatrepresentthese.

AUIObjectobjectcanbestoredinafileandloadedintoVisio.UsetheSaveToFilemethodtosavetheobjectandtheLoadFromFilemethodtoloadit,orsettheCustomMenusFileorCustomToolbarsFilepropertyofanApplicationobjectorDocumentobjecttothenameofthestoreduserinterfacefile.

BeginningwithMicrosoftVisio2002,aprogramcanmanipulatemenusandtoolbarsintheVisiouserinterfacebymanipulatingtheCommandBarscollectionreturnedbytheCommandBarsproperty.TheCommandBarscollectionhasaninterfaceidenticaltotheCommandBarscollectionexposedbythesuiteofMicrosoftOfficeapplicationssuchasMicrosoftWordandMicrosoftExcel.Consequently,programscanmanipulatetheVisiomenusandtoolbarsusingeithertheCommandBarscollectionorUIObjectobjects.

Windowobject

object;DAR_Objects_(A-M)_1015.htm">

RepresentsanopenwindowinaMicrosoftVisioinstance.

Versionadded

2.0

Remarks

ThedefaultpropertyofaWindowobjectisApplication.

Toretrieve

theactivewindowinaninstanceofVisio,usetheActiveWindowpropertyofanApplicationobject.

aPageobjectthatrepresentsthepageshowninthewindow,usethePagepropertyofaWindowobject.

aDocumentobjectthatrepresentsthedocumentdisplayedinthatwindow,usetheDocumentproperty.

aSelectionobjectthatrepresentstheshapesselectedinthatwindow,usetheSelectionproperty.

NoteBeginningwithMicrosoftVisio2002,thefollowingmethodsoftheWindowobjectareobsolete:AddToGroup,Cut,Combine,Copy,Delete,Duplicate,Fragment,Group,Intersect,JoinRemoveFromGroup,Subtract,Trim,andUnion.Existingsolutionsthatinvokethesemethodswillcontinuetoworkproperly;however,neworrebuiltsolutionsshouldusethesemethodswiththeSelectionobject.

Inaddition,theWindowobject'sPastemethodisnowobsolete.UsethePasteorPasteSpecialmethodofthePage,Master,orShapeobject.(UsetheShapeobjectinthecaseofgroupshapes.)

Windowscollection

object;DAR_Objects_(A-M)_1015.htm">

IncludesaWindowobjectforawindowthatisopenintheapplication.

Versionadded

2.0

Remarks

ToretrieveaWindowscollection,usetheWindowspropertyofanApplicationobject.

ThedefaultpropertyofaWindowscollectionisItem.

Ifadockedstencilwindowcontainsmorethanonestencil,onlyonewindowiscounted.

AccelItemsproperty

ReturnstheAccelItemscollectionofanAccelTableobject.

Versionadded

4.0

Syntax

objRet=object.AccelItemsobjRet AnAccelItemscollection.object Required.AnexpressionthatreturnsanAccelTableobject.

Seealso

AccelTablesproperty

ReturnstheAccelTablescollectionofaUIObjectobject.

Versionadded

4.0

Syntax

objRet=object.AccelTablesobjRet AnAccelTablescollection.object Required.AnexpressionthatreturnstheUIObjectobjectthat

ownsthecollection.

Remarks

IfaUIObjectobjectrepresentsmenuitemsandaccelerators(forexample,ifyouretrievedtheobjectusingtheBuiltInMenuspropertyofanApplicationobject),thenitsAccelTablescollectionrepresentstablesofacceleratorkeysforthatUIObjectobject.

Toretrieveacceleratorsforaparticularwindowcontext,forexample,thedrawingwindow,usetheItemAtIDpropertyofanAccelTablescollection.Ifawindowcontextdoesnotincludeaccelerators,ithasnoAccelTablescollection.ForalistofvalidwindowcontextIDs,seetheSetIDproperty.

Actionproperty

GetsorsetstheactioncodeofanEventobject.

Versionadded

4.0

Syntax

intRet=object.Actionobject.Action=actionCodeintRet Integer.TheEventobject'sactioncode.object Required.AnexpressionthatreturnsanEventobject.actionCode RequiredInteger.Thenewactioncodetoassign.

Remarks

AnEventobjectconsistsofanevent-actionpair—aneventtriggersanaction.Anactioncodeisthenumericconstantfortheactionthattheeventtriggers.

Example

Visiosupportsthefollowingactioncodes.

Constant ValuevisActCodeRunAddon 1visActCodeAdvise 2

ActionTextproperty

Getsorsetstheactiontextforamenu,menuitem,ortoolbaritem.

Versionadded

4.0

Syntax

object.ActionText=actionStractionStr=object.ActionTextobject Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemobjectthatownstheactiontext.actionStr RequiredString.Astringthatdescribestheaction.

Remarks

ActiontextisastringthatdescribestheactionontheUndo,Redo,andRepeatmenuitemsontheEditmenu.

IftheActionTextpropertyisemptyandtheobject'sCmdNumpropertyissettooneoftheVisiobuilt-incommandIDs,theitemusesthedefaultactiontextfromthebuilt-inVisiouserinterface.

Activeproperty

IndicateswhethertheinstanceofMicrosoftVisiorepresentedbytheApplicationobjectistheactiveapplicationontheMicrosoftWindowsdesktop—theapplicationwiththehighlightedtitlebar.

Versionadded

4.1

Syntax

intRet=object.ActiveintRet Integer.False(0)iftheapplicationisnotactive;True(-1)ifit

isactive.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

TheactiveapplicationontheWindowsdesktopisdistinctfromtheactiveVisioinstance,whichisreturnedbyacalltotheOLEGetActiveObjectfunction(GetObjectfunctioninMicrosoftVisualBasic).TheGetObjectfunction

Seealso

retrievestheinstanceofVisiothatwasmostrecentlyactivated,whichmayormaynotbetheactiveapplicationonthedesktopatthatmoment.OfallinstancesofVisiothatarecurrentlyrunning,onlyoneistheactiveVisioinstance.

Forexample,supposeyoustartoneinstanceofVisioandoneofanotherapplication,suchasMicrosoftExcel.

IftheinstanceofVisioistheactiveapplicationonyourdesktop,GetObject(,"visio.application")retrievesthatinstanceanditsActivepropertyisTrue.

IfyouactivatetheinstanceofMicrosoftExcel,GetObject(,"visio.application")retrievesthesameinstanceofVisio,butitsActivepropertyisFalse.

IfanApplicationobject'sActivepropertyisTrue,youcanassumethatthecorrespondinginstanceofVisioistheactiveinstanceofVisiounlesstheInPlacepropertyisalsoTrue.IfaninstanceofVisioisactivatedforin-placeeditinginacontainerapplication,thatinstancemaynotnecessarilyreportitselfastheactiveinstanceofVisio.

ActiveDocumentproperty

object;DAR_Objects_(A-M)_1015.htm">

ReturnstheactiveDocumentobject,thedocumentshownintheactivewindow.

Versionadded

2.0

Syntax

objRet=object.ActiveDocumentobjRet ADocumentobjectthatrepresentstheactivedocument.object Required.AnexpressionthatreturnstheApplicationobject

thatownsthedocument.

Remarks

Whennodocumentsareopen,thereisnoactivedocumentandtheActiveDocumentpropertyreturnsthevalueNothinganddoesnotraiseanexception.

IfyourcodeisintheMicrosoftVisualBasicforApplications(VBA)projectofaVisiodocument,theActiveDocumentpropertyoften,butnotnecessarily,returnsareferencetotheThisDocumentobject,aclassmoduleintheVBAprojectofeveryVisiodocument.IftheThisDocumentobjectisshownintheactivewindow,thentheActiveDocumentobjectandtheThisDocumentobjectrefertothesamedocument.WhentheThisDocumentobjectisreferencedfrom

codeinaproject,itreturnsareferencetotheproject'sDocumentobject.

WhetheryouusetheActiveDocumentobjectortheThisDocumentobjectdependsonthepurposeofyourcode.

YoucancomparetheresultreturnedbytheActiveDocumentpropertywiththevalueNothingtodetermineifadocumentisactive.IfthevalueoftheApplication.Documents.Countpropertyisgreaterthanzero,thenatleastonedocumentisopenandactive.

ActivePageproperty

object;DAR_Objects_(A-M)_1015.htm">

ReturnstheactivePageobject.

Versionadded

2.0

Syntax

objRet=object.ActivePageobjRet APageobjectthatrepresentstheactivepage.object Required.AnexpressionthatreturnstheApplicationobject

thatownsthepage.

Remarks

TheActivePagepropertyreturnsaPageobjectonlywhentheactivewindowdisplaysadrawingpage;otherwise,itreturnsNothing.Toverifythatapageisactive,usetheIsoperatortocomparetheActivePagepropertywithNothing.

ActivePrinterproperty

SpecifiestheprinterthatallMicrosoftVisiodocumentsprintto.

Versionadded

2002

Syntax

strRet=object.ActivePrinter

object.ActivePrinter=strExpressionstrRet String.Thecurrentactiveprinter.object Required.AnexpressionthatreturnsanApplicationobject.strExpression RequiredString.Thenewactiveprinter.

Remarks

TheActivePrinterpropertyisinitiallysettothedefaultprinter.

Example

ActiveWindowproperty

object;DAR_Objects_(A-M)_1015.htm">

ReturnstheactiveWindowobject.

Versionadded

2.0

Syntax

objRet=object.ActiveWindowobjRet AWindowobjectthatrepresentstheactivewindow.object Required.AnexpressionthatreturnstheApplicationobject

thatownsthewindow.

Remarks

Theactivewindowcanbeoneofthefollowingwindowtypes:Drawing,Stencil,ShapeSheet,EditIcon,oraDrawingorStencilwindowcreatedbyanadd-on.Theapplication'sactivewindowcanonlybeanMDIframewindow—itcannotbeoneofthefloating,docked,oranchoredwindows.Foracompletelistofwindowtypes,seetheTypeproperty.

IfawindowinaninstanceofVisioisnotactive,theActiveWindowpropertyreturnsNothing.

Addinsproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

InearlierversionsofVisio,thispropertyreturnedacollectionofregisteredCOMadd-ins.UsetheCOMAddinspropertytogetareferencetotheCOMAddinscollection.

Seealso Example Appliesto

AddonArgsproperty

Getsorsetstheargumentstringthatyousendtotheadd-onassociatedwithaparticularmenuortoolbar.

Versionadded

4.0

Syntax

object.AddonArgs=argsStrargsStr=object.AddonArgsobject Required.AnexpressionthatreturnsanobjectintheAppliesto

listthatstartstheadd-on.argsStr RequiredString.Theargumentstringtobepassedtotheadd-

on.

Remarks

Anargument'sstringcanbeanythingappropriatefortheadd-on.However,the

argumentsarepackagedtogetherwithotherinformationintoacommandstring,whichcannotexceed127characters.Forbestresults,limitargumentsto50characters.

Anobject'sAddonNamepropertyindicatesthenameoftheadd-ontowhichtheargumentsaresent.

AddonNameproperty

Getsorsetsthenameofanadd-onassociatedwithamenuortoolbar.

Versionadded

4.0

Syntax

object.AddonName=addonStraddonStr=object.AddonNameobject Required.AnexpressionthatreturnsanobjectintheAppliesto

list.addonStr RequiredString.Thenameoftheadd-ontoberunor

MicrosoftVisualBasicforApplications(VBA)codetobeexecuted.

Remarks

WhenanitemwhoseAddonNamepropertyissetisselected,Visioasksthe

VBAprojectoftheactivedocumenttoparsetheAddonNamepropertystring.IfVBAsuccessfullyparsesthestring,VisiotellsVBAtoexecutethestring.Usingthistechnique,youcancauseamenuortoolbaritemtorunaVBAmacroorprocedure,showaVBAform,loginformationtotheImmediatewindow,andsoon.SeetheExecuteLinemethodforexamples.

IfVBAcannotparsethestring,thenVisiorunstheadd-onnamedbytheAddonNameproperty.Ifthereisnosuchadd-on,Visiodoesnothing.

IftheAddonNamepropertyisset,Visioignorestheobject'sCmdNumproperty.

UsetheAddonArgspropertytospecifyargumentstosendtotheadd-onwhenitisrun.

AddonPathsproperty

GetsorsetsthepathswhereMicrosoftVisiolooksforadd-ons.

Versionadded

4.0

Syntax

strRet=object.AddonPathsobject.AddonPaths=strPathsstrRet String.Alistoffolders.object Required.AnexpressionthatreturnsanApplicationobject.strPaths RequiredString.Atextstringcontainingalistoffolders.Use

semicolonstoseparateindividualfoldersinthestring.

Remarks

ToindicatemorethanonefolderinthepathwhereVisiolooksforadd-ons,separateindividualitemsinthepathstringwithsemicolons.

Example

ThestringpassedtoandreceivedfromtheAddonPathspropertyisthesamestringshownontheFilePathstabintheOptionsdialogbox(clickOptionsontheToolsmenu).ThisstringisstoredinHKEY_CURRENT_USER\Software\Microsoft\Visio\application\AddonsPath

WhenVisiolooksforadd-ons,itlooksinallpathsnamedintheAddonPathspropertyandallthesubfoldersofthosepaths.IfyoupasstheAddonPathspropertytotheEnumDirectoriesmethod,itreturnsacompletelistoffullyqualifiedpathsinwhichVisiolooks.

Ifapathisnotfullyqualified,VisiolooksforthefolderinthefolderthatcontainstheVisioprogramfiles(appObj.Path).Forexample,iftheVisioexecutablefileisinstalledinc:\Visio,andtheAddonPathspropertyis"Add-ons;d:\Add-ons",Visiolooksforadd-onsinbothc:\Visio\Add-onsandd:\Add-ons.

Addonsproperty

object;DAR_Objects_(A-M)_1015.htm">

ReturnstheAddonscollectionofanApplicationobject.

Versionadded

4.0

Syntax

objRet=object.AddonsobjRet TheAddonscollectionoftheApplicationobject.object Required.AnexpressionthatreturnstheApplicationobject

thatownsthecollection.

Remarks

TheAddonscollectionincludesanAddonobjectforeachadd-oninthefoldersspecifiedbytheAddonPathspropertyandforeachadd-onthatisaddeddynamicallytothecollectionbyotheradd-ons.

Addressproperty

Getsorsetstheaddressforashape'sHyperlinkobject—theaddresstowhichthehyperlinknavigates.

Versionadded

5.0

Syntax

strRet=object.Addressobject.Address=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaHyperlinkobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

SettingtheAddresspropertyforaHyperlinkobjectisequivalenttoenteringinformationintheAddressboxintheHyperlinksdialogbox(clickHyperlinks

ontheInsertmenu),orsettingtheresultoftheAddresscellintheshape'sHyperlink.RowrowthroughtheShapeSheetwindow.

TheAddresspropertyvaluecanbeaDOS,UNC,orURLpath,forexample,c:\Drawings\MyDrawing.vsd,\\Server\Shared\MyDrawing.vsd,orhttp://www.microsoft.com,respectively.

IftheAddresspropertyisrelative,forexample,"..\Drawing.vsd",thenitiscomposedagainsttheHyperlinkBaseproperty,ifsupplied,orthehyperlink'sdocumentpath.Ifthedocumentisnotsaved,thehyperlinkisundefined.

IftheAddresspropertyisempty,thenyoucanassumetheaddresspointstoapageinthedocumentthatcontainsthepage.Inthiscase,theSubAddresspropertycontainsthenameofthedrawingpagetowhichthehyperlinknavigates.

AlertResponseproperty

DetermineswhetherMicrosoftVisioshowsalertsandmodaldialogboxestotheuser.

Versionadded

4.1

Syntax

intRet=object.AlertResponseobject.AlertResponse=intExpressionintRet Integer.Zero(0)todisplayalertstotheuserandallowtheuser

torespond,orthevalueofthedefaultresponse(seeRemarks).object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.Zero(0)todisplayalertstotheuserand

allowtheusertorespond,orthevalueofthedefaultresponsetosupply(seeRemarks).

Remarks

Example

Certainoperations,suchasclosingadocumentwithunsavedmodifications,causeVisiotodisplayanalertormodaldialogboxrequestingtheusertosupplyaresponsesuchasOK,Yes,No,orCancel.TopreventVisiofromdisplayingalertsormodaldialogboxeswhenaprogramperformssuchactions,settheAlertResponsepropertytoadefaultvaluefortheresponse.Inthiscase,Visiodoesnotdisplaythealertormodaldialogbox;instead,VisiobehavesasiftheuserrespondedtothealertormodaldialogboxwiththevalueoftheAlertResponseproperty.

IftheAlertResponsepropertyis0(itsdefaultvalue),alertsandmodaldialogboxesaredisplayed.

ThevaluesyousupplyfortheAlertResponsepropertycorrespondtothestandardWindowsconstantsIDOK,IDCANCEL,andsoforth.

Constant ValueIDOK 1IDCANCEL 2IDABORT 3IDRETRY 4IDIGNORE 5IDYES 6IDNO 7

AlignNameproperty

Getsorsetsthepositionofamasternameinastencilwindow.

Versionadded

2.0

Syntax

intRet=object.AlignNameobject.AlignName=intNewAlignmentintRet Integer.Returnsthecurrentalignmentofthemaster'sname.object Required.AnexpressionthatreturnsaMasterobject.intNewAlignment RequiredInteger.Thenewalignmentforthemaster'sname.

Remarks

ThefollowingconstantsdeclaredbytheVisiotypelibraryshowthepossiblealignmentvalues.

Constant ValuevisLeft 1visCenter 2visRight 3

Seealso Example

AllowEditingproperty

DetermineswhethertheEditcommandisenabledordisabledinastencilwindow.

Versionadded

2002

Syntax

boolRet=object.AllowEditingobject.AllowEditing=boolValueboolRet Boolean.TrueiftheEditcommandisenabledinastencil

window;Falseifitisdisabled.object Required.AnexpressionthatreturnsaWindowobject.boolValue RequiredBoolean.TruetoenabletheEditcommand;Falseto

disableit.

Remarks

UsetheAllowEditingpropertytopreventunintentionaleditinginthestencil.

Seealso Example

Altproperty

DetermineswhethertheALTkeyisamodifierforanaccelerator.

Versionadded

4.0

Syntax

intRet=object.Altobject.Alt=intExpressionintRet Integer.True(-1)iftheALTkeymodifiesanacceleratorkey

inanAccelItemobject;otherwise,False(0).object Required.AnexpressionthatreturnsanAccelItemobject.intExpression RequiredInteger.True(non-zero)iftheALTkeymodifiesan

acceleratorkeyinanAccelItemobject;otherwise,False(0).

Example

AlternateNamesproperty

Getsorsetsthealternatenamesforadocument.

Versionadded

2000

Syntax

strRet=object.AlternateNamesobject.AlternateNames=strExpressionstrRet String.Oneormorefilenamesdelimitedbysemicolons.object Required.AnexpressionthatreturnsaDocumentobject.strExpression RequiredString.Oneormorefilenamesdelimitedby

semicolons.Forexample,"MyShapes99.vss";"MyShapes98.vss".

Remarks

Theapplicationstoresdocumentnamesinthefollowingsituations:

Seealso

Templatesstorestencilnames.Forexample,theBasicFlowcharttemplatestoresthenamesoftheBasicFlowchartShapes.vssandBackgrounds.vssstencils.ThesestencilsareopenedwiththeBasicFlowcharttemplate.

Mastershortcutsstorestencilnames.Forexample,ashortcutfortheDatashapestoresthenameofthestencilonwhichtheDatashapeisstored—BasicFlowchartShapes.vss.

WhentheapplicationopensadocumentoraccessestheDocumentobject'scollection,itusesthedocumentname.IfVisiocan'tfindthedocumentname,itlooksforalternatenamesforthosestencilsthatareinthecorrectpath(ontheToolsmenu,clickOptions,andthenclicktheFilePathstabtoaddapath).Forexample,supposeyoucreatedthestencilnamed"MyShapes98.vss."Thefollowingyearyourevisedthestencilandrenamedit"MyShapes99.vss."AnytemplatesthatopenedMyShapes98.vssshouldnowopenMyShapes99.vss.Todothis,settheAlternateNamespropertyofMyShapes99.vssto"MyShapes98.vss."ThefollowingVBAcodeshowsonewaytodothis:

Visio.Documents("MyShapes99.vss").AlternateNames="MyShapes98.vss"

TheAlternateNamespropertyisemptyuntilyousetitthroughAutomation.Eachofthealternatenamesinthestringshouldcontainthefilename,withnofolderinformation.Youcanalsoincludecommentsinanglebrackets(<>)astheapplicationignoresanythinginanglebrackets.Forexample,youcouldsettheAlternateNamespropertylikethis:

Visio.Documents("HRShapes.vss").AlternateNames="HumanResourcesShapes.vss";<oldname>;"HRDeptShapes.vss"

Applicationproperty

object;DAR_Objects_(A-M)_1015.htm">

ReturnstheinstanceofMicrosoftVisiothatisassociatedwithanobject.

Versionadded

2.0

Syntax

objRet=object.ApplicationobjRet TheApplicationobjectthatisassociatedwithanobject.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Seealso

AreaIUproperty

Returnstheareaofanobjectininternalunits(squareinches).

Versionadded

4.0

Syntax

retVal=object.AreaIUretVal Double.Theareaoftheobjectininternalunits.object Required.AnexpressionthatreturnsaShapeobject.

Example

Attributesproperty

Returnstheattributesofthefont.

Versionadded

3.0

Syntax

intRet=object.Attributes

intRet Integer.TheattributesofaFontobject.

object Required.AnexpressionthatreturnsaFontobject.

Remarks

WhenusingtheAttributespropertywithaFontobject,oneofthefollowingvaluesisreturned.

Constant ValuevisFontRaster 16visFontDevice 32visFontScalable 64visFont0Alias 128

Afontmarkedasthefont0aliasisusedinsteadoffont0(thedefaultfont).The

Seealso Example

font0aliasisusedinsomelocalizedversionsofVisioandiscontrolledthroughentriesintheregistry.

AutoLayoutproperty

Allowsyoutotemporarilydisabletheactionoftheautomaticlayoutfunctionality,andthenreenableitafteryouarefinishedwithanaction.

Versionadded

2000

Syntax

boolRet=object.AutoLayoutobject.AutoLayout=boolValueboolRet Boolean.Trueifautomaticlayoutisenabled,Falseifitis

disabled.object Required.AnexpressionthatreturnsanApplicationobject.boolValue RequiredBoolean.Truetoenableautomaticlayout;Falseto

disableautomaticlayout.

Remarks

Example

UsingtheAutoLayoutpropertyhelpstoimprovetheperformanceofadd-onsthatexecutemanyoperationsinconnecteddrawingsthatuseVisioautomaticlayoutfunctionality.

AutoRecoverproperty

Determineswhetheranopendocumentwithunsavedchangesiscopiedwhenautomaticrecoveryisenabled.

Versionadded

2000SR-1

Syntax

boolRet=object.AutoRecoverobject.AutoRecover=boolValueboolRet Boolean.Trueifautomaticrecoveryisenabled,Falseifitis

disabled.object Required.AnexpressionthatreturnsaDocumentobject.boolValue RequiredBoolean.Truetoenableautomaticrecovery;Falseto

disableautomaticrecovery.

Remarks

Ifautomaticrecoveryisenabled(theAutoRecoverIntervalpropertyisgreaterthan0),alldocumentsthatareopenandhaveunsavedchangesarecopiedintotemporaryfiles.Ifyoudonotwantadocumenttoberecovered,setitsAutoRecoverpropertytoFalse.TheAutoRecoverpropertyisnotsavedwithadocumentandmustbeseteachtimethedocumentopens.

WhenVisiolaunchesafteranabnormalterminationanddeterminesthatautomaticrecoverywasenabled,itattemptstoopenallfilesthatwereopenattermination.

Ifthereisarecoveryfilethatismorerecentthanthelastsavedcopyofthefile,itopenstherecoveredfileanddisplaysthename"<filename>(Recovered)"inthedocumenttitlebar.

Ifthereisnorecoveryfile,Visioopensthelastsavedcopyofthedocument.

YoumuststillsavechangestorecovereddocumentsbeforeVisiocloses.Ifrecovereddocumentsarenotsaved,changeswillbedeletedasinanyunsaveddocument.

AutoRecoverIntervalproperty

Representsthetimeinterval(inminutes)forhowoftenyouwanttocreatecopiesofopendocumentswithunsavedchangesincaseofapowerfailureoranapplicationerror.

Versionadded

2000SR-1

Syntax

intRet=object.AutoRecoverIntervalobject.AutoRecoverInterval=intExpressionintRet Integer.Anintegervaluefromzero(0)to120representingthe

intervalinminutes.Thedefaultis0.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.Anintegervaluefrom0to120representing

theintervalinminutes.Thedefaultis0.

Remarks

IfthevalueoftheAutoRecoverIntervalpropertyislessthanorequalto0,noautomaticrecoverycopiesarecreated.

IfthevalueoftheAutoRecoverIntervalpropertyisgreaterthan0,automaticrecoveryisenabledforalldocumentsintheVisioinstance.Todisableautomaticrecoveryforaparticulardocument,setitsAutoRecoverpropertytoFalse.

AvailablePrintersproperty

Returnsalistofinstalledprinters.

Versionadded

2002

Syntax

strRet=object.AvailablePrintersstrRet String.Anarrayofprintersinstalledonthecomputer.object Required.AnexpressionthatreturnsanApplicationobject.

Example

Backgroundproperty

Determineswhetherapageisabackgroundpage.

Versionadded

2.0

Syntax

retVal=object.Backgroundobject.Background=intExpressionretVal Integer.Trueifthepageisabackgroundpage;otherwise,

False.object Required.AnexpressionthatreturnsaPageobject.intExpression RequiredInteger.False(0)todeclarethepageasaforeground

page;True(non-zero)todeclareitasabackgroundpage.

BackPageproperty

Getsorsetsthebackgroundpageofapage.

Versionadded

2.0

Syntax

objVariantRet=object.BackPageobject.BackPage=stringVariantobjVariantRet Variant.APageobjectthatrepresentsthebackgroundpage.object Required.AnexpressionthatreturnsaPageobject.stringVariant RequiredVariant.Astringthatnamesthenewbackground

page.

Remarks

Ifapagehasnobackground,itsBackPagepropertyreturnsanemptyVariant.OtherwisethereturnedVariantreferstoaPageobject—thebackgroundpageof

Example

theindicatedpage.

Toassignabackgroundpagetoapage,setthepage'sBackPagepropertytothenameofthebackgroundpageyouwanttoassign.Tocauseapagetohavenobackgroundpage,passanemptystringtotheBackPageproperty.

NoteInearlierversionsofVisio(throughversion4.1),theBackPagepropertyreturnedanobject(asopposedtoaVariantoftypeobject)anditacceptedastring(asopposedtoaVariantoftypestring).ThepropertyhasbeenmodifiedsothatitacceptsandreturnsvariantsduetochangesinAutomationsupporttools.Forbackwardcompatibility,theBackPageAsObjandBackPageFromNamepropertieshavebeenadded.ThesepropertieshavethesamesignaturesandoccupythesamevtableslotsastheearlierversionoftheBackPageproperty.

BackPageAsObjproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertyreturnedthebackgroundpageofapage.

Seealso Example Appliesto

BackPageFromNameproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertysetthebackgroundpageofapage.

Seealso Example Appliesto

BasedOnproperty

GetsorsetsthestyleonwhichaStyleobjectisbased.

Versionadded

4.0

Syntax

strVal=object.BasedOnobject.BasedOn=styleNamestrVal String.Thenameofthecurrentstyle.object Required.AnexpressionthatreturnsaStyleobject.styleName RequiredString.Thenameofthenewstyle.

Remarks

Tobaseastyleonnostyle,settheBasedOnpropertytoazero-lengthstring("").

Example

BaseIDproperty

ReturnsabaseIDforamaster.

Versionadded

2000

Syntax

strRet=object.BaseIDstrRet String.AMasterobject'sbaseID.object Required.AnexpressionthatreturnsaMasterobject.

Remarks

AbaseIDisassignedtoamasterwhenitiscreated.Whenamasteriscopied,thecopiesallhavethesamebaseIDastheoriginalmaster.

AMasterobjectalsohasaUniqueIDpropertythatremainsthesameastheoriginalmasterwhencopied.Ifthecopyofthemastergetschanged,theuniqueIDchangesbutthebaseIDremainsthesame.

Example

Theonlywaytochangeamaster'sbaseIDistousetheNewBaseIDproperty.

Beginproperty

GetsorsetsthebeginningindexofaCharactersobject,whichrepresentsarangeoftextinashape.

Versionadded

3.0

Syntax

intRet=object.Beginobject.Begin=intExpressionintRet Integer.ThecurrentbeginningindexoftheCharactersobject.object Required.AnexpressionthatreturnsaCharactersobject.intExpression RequiredInteger.ThenewbeginningindexoftheCharacters

object.

Remarks

TheBeginpropertydeterminesthebeginningofthetextrangerepresentedbya

Example

Charactersobject.ThevalueoftheBeginpropertyisanindexthatrepresentstheboundarybetweentwocharacters,similartoaninsertionpointintext.Likeselectedtextinadrawingwindow,aCharactersobjectrepresentsthesequenceofcharactersthatareaffectedbysubsequentactions,suchastheCutorCopymethod.WhenyouretrieveaCharactersobject,itscurrenttextrangeincludesalltheshape'stext.YoucanchangethetextrangebysettingtheCharactersobject'sBeginandEndproperties.ChangingthetextrangeofaCharactersobjecthasnoeffectonthetextofthecorrespondingshape.

TheBeginpropertycanhaveavaluefromzero(0)tothevalueoftheCharCountpropertyforthecorrespondingshape.Anindexof0isbeforethefirstcharacterintheshape'stext.AnindexthatisthesameastheCharCountpropertyisafterthelastcharacterintheshape'stext.Ifyouspecifyavaluelessthan0,Visiouses0.Ifyouspecifyavaluethatisinsidetheexpandedcharactersofafield,VisiosetsthevalueoftheBeginpropertytothestartofthefield.

ThevalueoftheBeginpropertymustalwaysbelessthanorequaltothevalueoftheEndproperty.IfyouattempttosetthevalueoftheBeginpropertytoavaluegreaterthantheEndproperty,VisiosetsboththeBeginandEndpropertiestothevaluespecifiedfortheBeginproperty.

BeginGroupproperty

Determineswhetherthemenuitemortoolbaritemappearsatthebeginningofagroupofitemsonthemenuortoolbar.

Versionadded

2002

Syntax

boolRet=object.BeginGroup

object.BeginGroup=boolValboolRet Boolean.Trueifthemenuitemortoolbaritemisatthe

beginningofagroup;otherwise,False.object Required.AnexpressionthatreturnsaMenuItemor

ToolbarItemobject.boolVal RequiredBoolean.Truetoindicatethatthemenuitemor

toolbaritemisthebeginningofagroupofitems;otherwise,False.

Remarks

IfyousettheBeginGrouppropertyofaMenuItemorToolbarItemobjecttoTrue,aseparatorisinsertedintothemenuoraspacerisinsertedintothetoolbarprecedingthisitem.

Seealso Example

NoteInVisio2000,theonlywaytocreateaseparatorinamenuoraspacerinatoolbarwastoaddadummyitemwithaCmdNumpropertyofzero,aCaptionpropertythatcontained"",andanemptyMenuItemsorToolbarItemscollection.ThistechniquecontinuestoworkinMicrosoftVisio2002.

Blueproperty

GetsorsetstheintensityofthebluecomponentofaColorobject.

Versionadded

4.0

Syntax

intRet=object.Blueobject.Blue=intValintRet Integer.Thecurrentvalueofthecolor'sbluecomponent.object Required.AnexpressionthatreturnsaColorobject.intVal RequiredInteger.Thenewvalueofthecolor'sblue

component.

Remarks

TheBluepropertycanbeavaluefrom0to255.

Example

Acolorisrepresentedbyred,green,andbluecomponents.Italsohasaflagthatindicateshowthecoloristobeused.ThesecorrespondtomembersoftheMicrosoftWindowsPALETTEENTRYdatastructure.Fordetails,searchfor"PALETTEENTRY"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

BottomMarginproperty

Specifiesthebottommarginwhenprintingthepagesinadocument.

Versionadded

4.0

Syntax

retVal=object.BottomMargin([unitsNameorCode])object.BottomMargin([unitsNameorCode])=newValueretVal Double.Themarginvalueexpressedinthegivenunits.object Required.AnexpressionthatreturnsaDocumentobject.unitsNameorCode OptionalVariant.Theunitstousewhenretrievingorsetting

themarginvalue.Defaultstointernaldrawingunits.newValue RequiredDouble.Thenewmarginvalue.

Remarks

ThevalueofthispropertycorrespondstothevalueenteredintheBottomboxin

Example

thePrintSetupdialogbox(ontheFilemenu,clickPageSetup,andthenclickSetuponthePrintSetuptab).

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Ifthestringisinvalid,anerrorisgenerated.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

Cell.BottomMargin(visInches)=newValue

Cell.BottomMargin(65)=newValue

Cell.BottomMargin("in")=newValuewhere"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

Buildproperty

Returnsthebuildnumberoftherunninginstance.

Versionadded

2002

Syntax

retVal=object.BuildretVal Long.Thebuildnumber.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

Theformatofthebuildnumberisdescribedinthefollowingtable.

Bits Description0-15 Internalbuildnumber

Thebuildnumberoftherunninginstanceiswrittentothe

Example

BuildNumberCreatedpropertywhenanewdocumentiscreated,andtotheBuildNumberEditedpropertywhenadocumentisedited.

BuildNumberCreatedproperty

Returnsthebuildnumberoftheinstanceusedtocreatethedocument.

Versionadded

2002

Syntax

retVal=object.BuildNumberCreatedretVal Long.Thebuildnumberwhenthedocumentwascreated.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Theformatofthebuildnumberisdescribedinthefollowingtable.

Bits Description0-15 Internalbuildnumber

Example

BuildNumberEditedproperty

Returnsthebuildnumberoftheinstancelastusedtoeditthedocument.

Versionadded

2002

Syntax

retVal=object.BuildNumberEditedretVal Long.Thebuildnumberwhenthedocumentwaslastedited.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Theformatofthebuildnumberisdescribedinthefollowingtable.

Bits Description0-15 Internalbuildnumber

Example

BuiltInproperty

DetermineswhetheranobjectisadefaultMicrosoftVisiouserinterfaceobjectoracustomobject.

Versionadded

2000

Syntax

boolVal=object.BuiltinboolVal Boolean.Trueiftheobjectisbuilt-in;Falseifitisn't.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Seealso Example

BuiltInMenusproperty

ReturnsaUIObjectobjectthatrepresentsacopyofthebuilt-inMicrosoftVisiomenusandaccelerators.

Versionadded

4.0

Syntax

objRet=object.BuiltInMenusobjRet AUIObjectobjectthatrepresentsthebuilt-inVisiomenusand

accelerators.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

YoucanusetheBuiltInMenuspropertytoobtainaUIObjectobjectandmodifyitsmenusandaccelerators.YoucanthenusetheSetCustomMenusmethodofanApplicationorDocumentobjecttosubstituteyourcustomizedmenusandacceleratorsforthebuilt-inVisiomenusandaccelerators.

YoucanalsousetheSaveToFilemethodoftheUIObjectobjecttostoreitsmenusinafileandreloadthemascustommenusbysettingtheCustomMenusFilepropertyofanApplicationorDocumentobject.

BuiltInToolbarsproperty

ReturnsaUIObjectobjectthatrepresentsacopyofthebuilt-inMicrosoftVisiotoolbars.

Versionadded

4.0

Syntax

objRet=object.BuiltInToolbarsobjRet AUIObjectobjectthatrepresentsthebuilt-inVisiotoolbars.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

YoucanusetheBuiltInToolbarspropertytoobtainaUIObjectobjectandmodifyitstoolbars.YoucanthenusetheSetCustomToolbarsmethodofanApplicationorDocumentobjecttosubstituteyourcustomizedtoolbarsforthebuilt-inVisiotoolbars.

YoucanalsousetheSaveToFilemethodoftheUIObjectobjecttostoreitstoolbarsinafileandreloadthemascustomtoolbarsbysettingtheCustomToolbarsFilepropertyofanApplicationorDocumentobject.

PriortoVisio5.0,theargumentforthisproperty(fWhichToolbars)designatedwhichtypeoftoolbartoget(MSOfficeorLotusSS).BeginningwithVisio5.0,theapplicationnolongersupportsdifferenttypesoftoolbarsandthisargumentisignored.

Captionproperty

Getsorsetsthecaptionforanobject.

Versionadded

4.0

Syntax

object.Caption=stringValstringVal=object.Captionobject Required.AnexpressionthatreturnsanobjectintheAppliesto

listthathasorgetsthecaption.stringVal RequiredString.Thecaptionoftheobject.

Use&inthestringtocausethenextcharacterinthestringtobecometheshortcutkeyforthatmenuormenuitem,Forexample,thestring"F&ormat"causesotobecometheshortcutkeyforthatmenuiteminthatonemenu.

Use""inthestringtodisplayadoublequotationmarkonthe

menu.

Use&&inthestringtodisplayanampersandonthemenu.

Remarks

VisiodoesnotusetheCaptionpropertyofaMenuSetorToolbarSetobject.

Categoryproperty

Getsorsetsthevalueofadocument'scategory—oneofthedocumentproperties.

Versionadded

5.0

Syntax

strRet=object.Categoryobject.Category=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueofthefield.

Remarks

SettingtheCategorypropertyisequivalenttoenteringinformationintheCategoryboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

Example

Cell[U]property

Returnsacellusingthenameorindexofthecell.

Versionadded

2000

Syntax

objRet=object.Cell(reference)objRet ACellobject.object Required.AnexpressionthatreturnsaRowobject.reference RequiredVariant.Thenameorindexofthecell.

Remarks

Thefirstcellinarowhasanindexofzero(0).

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheCellpropertytogetaCellobjectusingitslocalname.UsetheCellUpropertytogetaCellobjectusingitsuniversalname.

Seealso Example

CellExists[U]property

DetermineswhetheraparticularShapeSheetcellexistsinthescopeofthesearch.

Versionadded

4.0

Syntax

intRet=object.CellExists(stringExpression,fExistsLocallyintRet Integer.False(0)ifcelldoesn'texist;True(-1)ifitdoes.stringExpression RequiredString.ThenameoftheShapeSheetcellforwhichyou

wanttosearch.fExistsLocally RequiredInteger.Thescopeofthesearch.

Remarks

ThestringExpressionargumentmustspecifyacellname.Tosearchforacellbysection,row,andcolumnindex,usetheCellsSRCExistsproperty.

Example

ThefExistsLocallyargumentspecifiesthescopeofthesearch.

IffExistsLocallyisnon-zero(True),theCellExistspropertyvalueisTrueonlyiftheobjectcontainsthecelllocally;ifthecellisinherited,theCellExistspropertyvalueisFalse.

IffExistsLocallyiszero(False),theCellExistspropertyvalueisTrueiftheobjecteithercontainsorinheritsthecell.

Foralistofcellindexvalues,viewtheVisiotypelibraryforthemembersofclassVisCellIndices.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheCellExistspropertytodetermineifacellexistsusingthecell'slocalname.UsetheCellExistsUpropertytodetermineifacellexistsusingthecell'suniversalname.

Cells[U]property

ReturnsaCellobjectthatrepresentsaShapeSheetcell.

Versionadded

2.0

Syntax

objRet=object.Cells(stringExpression)objRet ACellobjectthatrepresentstherequestedcell.object Required.AnexpressionthatreturnsaShapeorStyleobject

thatownsthecell.stringExpression RequiredString.ThenameofaShapeSheetcell.

Remarks

Cells("somestring")doesnotraiseanexceptionif"somestring"doesnotnameanactualcell.Subsequentmethodsinvokedonthereturnedobjectwillfail.Youcandetermineifacellwiththename"somestring"existsusingtheCellExistsproperty.

Thecellsinashape'sUser-DefinedCellsandCustomPropertiessectionsbelongtorowswhosenameshavebeenassignedbytheuseroraprogram.YoucanaccesscellsinnamedrowsusingtheCellsproperty.

Forexample,if"MyRowsName"isthenameofarowinashape'sUser-DefinedCellssection,youcanaccessthezero'th(value)cellinthisrowusingthisstatement:

cellobj=shpobj.cells("User.MyRowsName")

YoucanaccessthepromptcellinMyRowsNameusingthisstatement:

cellobj=shpobj.cells("User.MyRowsName.Prompt")

Next,assumethatMyRowsNameisintheCustomPropertiessectioninsteadoftheUser-DefinedCellssection.Youcanaccessthezero'th(value)cellusingthisstatement:

cellobj=shpobj.cells("Prop.MyRowsName")

Youcanaccessothercellsintherowusingthisstatement:

cellobj=shpobj.cells("Prop.MyRowsName.xxx")

wherexxxisoneoftheseproperties:Label,Prompt,SortKey,Type,Format,Invisible,orAsk.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheCellspropertytogetaCellobjectusingthecell'slocalname.UsetheCellsUpropertytogetaCellobjectusingthecell'suniversalname.

CellsCproperty

ReturnsaCellobjectthatrepresentsaShapeSheetcellinalayer.

Versionadded

4.0

Syntax

objRet=object.CellsC(column)objRet ACellobjectthatrepresentstherequestedcell.object Required.AnexpressionthatreturnsaLayerobject.column RequiredInteger.Thecellindexofthecelltoget.

Remarks

ThefollowingconstantsforthecellindexaredeclaredbytheVisiotypelibrary.

Constant ValuevisLayerName 0visLayerColor 2visLayerStatus 3visLayerVisible 4visLayerPrint 5visLayerActive 6visLayerLock 7

Seealso Example

visLayerSnap 8visLayerGlue 9visLayerNameUniv 10

CellsRowIndex[U]property

Returnstheindexofarowtowhichacellbelongs.

Versionadded

2000

Syntax

intRet=object.CellsRowIndex(stringExpression)intRet OptionalInteger.Theindexoftherowcontainingthecell

namedinstringEspression.object Required.AnexpressionthatreturnsaShapeobjectthat

containsthecell.stringExpression RequiredString.ThenameofaShapeSheetcell.

Remarks

BeginningwithVisio2000products,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheCellsRowIndexpropertytogetacell'srowindexusingthecell'slocalname.UsetheCellsRowIndexUpropertytogetacell'srowindexusingthecell'suniversalname.

Seealso Example

CellsSRCproperty

ReturnsaCellobjectthatrepresentsaShapeSheetcellidentifiedbysection,row,andcolumnindices.

Versionadded

2.0

Syntax

objRet=object.CellsSRC(section,row,column)objRet ACellobjectthatrepresentstherequestedcell.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thecell'ssectionindex.row RequiredInteger.Thecell'srowindex.column RequiredInteger.Thecell'scolumnindex.

Remarks

Toaccessanyshapeformulabyitssection,row,andcolumnindices,usethe

CellsSRCproperty.Constantsforsection,row,andcolumnindicesaredeclaredbytheVisiotypelibraryasmembersofVisSectionIndices,VisRowIndices,andVisCellIndices,respectively.

TheCellsSRCpropertydoesnotraiseanexceptionifindexvaluesforsection,row,andcolumndonotidentifyanactualcell.Subsequentmethodsinvokedonthereturnedobjectfail.YoucandetermineifacellwithparticularindexvaluesexistsusingtheCellsSRCExistsproperty.

TheCellsSRCpropertyistypicallyusedtoiteratethroughthecellsinasectionorrow.Toretrieveasinglecell,usetheCellspropertyandspecifyacellname.Forexample:

SetcelObj=Cells("PinX")

CellsSRCExistsproperty

DetermineswhetheraShapeSheetcellexistsinthescopeofasearch.

Versionadded

4.0

Syntax

intRet=object.CellsSRCExists(section,row,column,fExistsLocallyintRet Integer.False(0)ifacelldoesn'texist;True(-1)ifitdoes.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thecell'ssectionindex.row RequiredInteger.Thecell'srowindex.column RequiredInteger.Thecell'scolumnindex.fExistsLocally RequiredInteger.Thescopeofthesearch.

Remarks

Constantsforsection,row,andcolumnindicesaredeclaredbytheVisiotype

Example

libraryasmembersofVisSectionIndices,VisRowIndices,andVisCellIndices,respectively.

ThefExistsLocallyargumentspecifiestothescopeofthesearch:

IffExistsLocallyisnon-zero(True),theCellsSRCExistspropertyreturnsTrueonlyiftheobjectcontainsthecelllocally;ifthecellisinherited,theCellsSRCExistspropertyreturnsFalse.

IffExistsLocallyiszero(False),theCellsSRCExistspropertyreturnsTrueiftheobjecteithercontainsorinheritsthecell.

Tosearchforacellbyname,usetheCellExistsproperty.

Charactersproperty

ReturnsaCharactersobjectthatrepresentsthetextofashape.

Versionadded

3.0

Syntax

objRet=object.CharactersobjRet ACharactersobjectthatrepresentstheshape'stext.object Required.AnexpressionthatreturnsaShapeobject.

CharCountproperty

Returnsthenumberofcharactersinanobject.

Versionadded

3.0

Syntax

intRet=object.CharCountintRet Integer.Thenumberofcharactersintheobject'stext.object Required.AnexpressionthatreturnstheCharactersorShape

objectthatcontainsthetext.

Remarks

ForaShapeobject,theCharCountpropertyreturnsthenumberofcharactersintheshape'stext.ForaCharactersobject,theCharCountpropertyreturnsthenumberofcharactersinthetextrangerepresentedbythatobject.

ThevaluereturnedbytheCharCountpropertyincludestheexpandednumber

Example

ofcharactersforanyfieldsintheobject'stext.Forexample,ifthetextcontainsafieldthatdisplaysthefilenameofadrawing,theCharCountpropertyincludesthenumberofcharactersinthefilename,ratherthantheone-characterescapesequenceusedtorepresentafieldintheTextpropertyofaShapeobject.

CharPropsproperty

SetsacharacterpropertyofaCharactersobjecttoanewvalue.

Versionadded

3.0

Syntax

object.CharProps(intWhichProp)=intExpressionobject Required.AnexpressionthatreturnsaCharactersobject.intWhichProp RequiredInteger.Thepropertytoset.intExpression RequiredInteger.Thenewvaluefortheproperty.

Remarks

Dependingontheextentofthetextrangeandtheformat,settingtheCharPropspropertymaycauserowstobeaddedorremovedfromashape'sCharactersection.

TheCharPropspropertyisawrite-onlyproperty.Toretrieveformatting

Example

propertiesofaCharactersobject,usetheCharPropsRowproperty.

ThevaluesoftheintWhichPropargumentcorrespondtocellsviewedintheCharactersectionoftheShapeSheetwindow,andthevaluesofintExpressioncorrespondtothevaluesthatcanbeenteredinthosecellsintheShapeSheetwindow.

ConstantsforintWhichPropandintExpressionaredeclaredbytheVisiotypelibrary.

intWhichProp Value intExpression ValuevisCharacterFont 0 Anintegerthatrepresentsan

indexintothefontscollectioninstalledonasystem.Zerorepresentsthedefaultfont.

N/A

visCharacterColor 1 Anintegerfrom0to23thatcorrespondstoacolorinthecurrentcolorpalette.

N/A

visCharacterStyle 2 visBoldvisItalicvisUnderLinevisSmallCaps

&H1&H2&H4&H8

visCharacterCase 3 visCaseNormalvisCaseAllCapsvisCaseInitialCaps

012

visCharacterPos 4 visPosNormalvisPosSupervisPosSub

012

visCharacterSize 7 Anintegerrepresentingpointsize.

N/A

CharPropsRowproperty

ReturnstheindexoftherowintheCharactersectionofaShapeSheetwindowthatcontainscharacterformattinginformationforaCharactersobject.

Versionadded

3.0

Syntax

intRet=object.CharPropsRow(bias)intRet Integer.TheindexoftherowthatdefinestheCharacters

object'sformat.object Required.AnexpressionthatreturnsaCharactersobject.bias RequiredInteger.Thedirectionofthesearch.

Remarks

IftheformattingoftheCharactersobjectisrepresentedbymorethanonerowintheCharactersectionoftheShapeSheetwindow,theCharPropsRowpropertyreturns-1.IftheCharactersobjectrepresentsaninsertionpointrather

Example

thanasequenceofcharacters(thatis,ifitsBeginandEndpropertiesreturnthesamevalue),usethebiasargumenttodeterminewhichrowindextoreturn.

Constant ValuevisBiasLeft 1visBiasRight 2visBiasLetVisioChoose 0

SpecifyvisBiasLeftfortherowthatcoverscharacterformattingforthecharactertotheleftoftheinsertionpoint,orvisBiasRightfortherowthatcoverscharacterformattingforthecharactertotherightoftheinsertionpoint.

CharSetproperty

ReturnstheMicrosoftWindowscharactersetforaFontobject.

Versionadded

4.0

Syntax

intRet=object.CharSetintRet Integer.Thecharactersetcodefortheobject.object Required.AnexpressionthatreturnsaFontobject.

Remarks

TheWindowscharactersetspecifiescharactermappingforafont.ThepossiblevaluesoftheCharSetpropertycorrespondtothoseofthelfCharSetmemberoftheWindowsLOGFONTdatastructure.Fordetails,searchfor"LOGFONT"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Example

ClassIDproperty

ReturnstheclassIDstringofashaperepresentinganActiveXcontroloranembeddedorlinkedOLEobject.

Versionadded

4.5

Syntax

strRet=object.ClassIDstrRet String.TheclassIDoftheOLEobjectrepresentedbythe

shape.object Required.AnexpressionthatreturnstheShapeobjectto

examine.

Remarks

TheClassIDpropertyraisesanexceptioniftheshapedoesn'trepresentanActiveXcontrolorOLE2.0embeddedorlinkedobject.AshaperepresentsanActiveXcontroloranOLE2.0embeddedorlinkedobjectifthe

visTypeIsOLE2bit(&H8000)issetinthevaluereturnedbyshpObj.ForeignType.

ClassIDreturnsastringoftheform:

{2287DC42-B167-11CE-88E9-002AFDDD917}

Thisidentifiestheapplicationthatservicestheobject.Itmight,forexample,identifyanembeddedobjectonaVisiopageasaMicrosoftExcelobject.

Afterusingashape'sObjectpropertytoobtainanAutomationinterfaceontheobjecttheshaperepresents,youmightwanttoobtaintheshape'sClassIDorProgIDpropertytodeterminethemethodsandpropertiesprovidedbytheinterface.

Cloneproperty

ReturnsacopyoftheUIObjectobject.

Versionadded

2000

Syntax

objRet=object.CloneobjRet AcopyoftheUIObjectobject.object Required.AnexpressionthatreturnsaUIObjectobject.

Seealso

Closedproperty

Determinesiftheobjectisclosed(itsbeginpointcoincideswithitsendpoint).

Versionadded

5.0

Syntax

intRet=object.ClosedintRet Integer.True(-1)ifthePathorCurveobjectisclosed;

otherwise,False(0).object Required.AnexpressionthatreturnsaPathorCurveobjectto

examine.

Remarks

UsetheClosedpropertyofaPathorCurveobjecttotestforequality(Visiouses10E-6asits"fuzz"factor)oftheobject'sbeginandendpoints.AclosedCurveobjectcanbeinaPathobjectthatisopen,andaCurveobjectthatisopencanbeinaclosedPathobject.

TheClosedpropertyofaPathobjectisunrelatedtoaPathobject'sfill.APathobjectisfilledifitsGeometryn.NoFillcelliszero(0).IfVisioistoldtofillanopenPathobject,itpretendsthereisaLineTocellfromthePathobject'sendpointtoitsbeginpoint.WhenfillingaPathobject,VisioconsidersapointtobeinsidethePathobjectifaraydrawnfromthepointinanydirectioncrossesthe

Seealso Example

Pathobjectoranyoftheshape'sotherPathobjectscrossanoddnumberoftimes.

CmdNumproperty

GetsorsetsthecommandIDassociatedwithanaccelerator,menu,menuitem,ortoolbaritem.

Versionadded

4.0

Syntax

object.CmdNum=intValintVal=object.CmdNumobject Required.AnexpressionthatreturnsanAccelItem,Menu,

MenuItem,orToolbarItemobject.intVal RequiredInteger.ThecommandIDoftheobject.

Remarks

WhentheAddOnNamepropertyofaMenuItemorToolbarItemobjectindicatesanadd-ontorun,VisioautomaticallyassignsaCmdNumproperty.

TheCmdNumpropertyforaMenuItemobjectthatrepresentsasubmenushouldbezero(0).TheCmdNumpropertyshouldneverbezeroforanAccelItemobject.

ToinsertaseparatorinamenuprecedingaMenuItemobjectoraspacerinatoolbarprecedingaToolbarItemobject,usetheBeginGroupproperty.

ValidcommandIDsaredeclaredbytheVisiotypelibraryinVisUICmds.TheyhavetheprefixvisCmd.

CntrlIDproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

InearlierversionsofVisio,thispropertycontainedthecontrolIDforamenu,menuitem,ortoolbaritem.

Seealso Example Appliesto

CntrlTypeproperty

Getsorsetsthecontroltypeofamenu,menuitem,ortoolbaritem.

Versionadded

4.0

Syntax

object.CntrlType=intValintVal=object.CntrlTypeobject Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemobject.intVal RequiredInteger.Thecontroltypeoftheobject.

Remarks

Ifyouareaddingacustomtoolbarbutton,settheCntrlTypepropertytovisCtrlTypeBUTTON.ThefollowingtabledescribesthecontroltypesdeclaredbytheVisiotypelibraryinVisUICtrlTypes.

Constant ValuevisCtrlTypeBUTTON 2(&H2)visCtrlTypeSPLITBUTTON 16(&H10)visCtrlTypeSPLITBUTTON_MRU_COLOR 17(&H11)visCtrlTypeSPLITBUTTON_MRU_COMMAND 18(&H12)visCtrlTypeBUTTON_OWNERDRAW 33(&H21)visCtrlTypeEDITBOX 64(&H40)visCtrlTypeCOMBOBOX 128(&H80)visCtrlTypeCOMBOBOX_SORTED 129(&H81)visCtrlTypeDROPDOWN_OWNERDRAW 256(&H100)visCtrlTypeDROPDOWN_SORTED_OWNERDRAW 257(&H101)visCtrlTypeDROPDOWN 272(&H110)visCtrlTypeDROPDOWN_SORTED 273(&H111)visCtrlTypeLABEL 2048(&H800)visCtrlTypeSWATCH 32768(&H8000)visCtrlTypeSWATCH_COLORS 32769(&H8001)

Colorsproperty

ReturnstheColorscollectionofaDocumentobject.

Versionadded

4.0

Syntax

objRet=object.ColorsobjRet TheColorscollectionoftheDocumentobject.object Required.AnexpressionthatreturnsaDocumentobject.

Example

Columnproperty

Returnsthecolumnindexofacell.

Versionadded

4.0

Syntax

intRet=object.ColumnintRet Integer.ThecolumnindexoftheCellobject.object Required.AnexpressionthatreturnsaCellobject.

Example

COMAddInsproperty

ReturnsareferencetotheCOMAddInscollectionthatrepresentsalltheComponentObjectModel(COM)add-inscurrentlyregisteredinMicrosoftVisio.

Versionadded

2002

Syntax

objsRet=object.COMAddInsobjsRet AcollectionofCOMAddInobjectsthatprovideinformation

aboutaCOMadd-inregisteredintheregistry.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

TheCOMadd-insthatarecurrentlyregisteredarelistedintheCOMAdd-Insdialogbox(ontheToolsmenu,pointtoMacros,andthenclickCOMAdd-ins).

Seealso

TogetinformationabouttheobjectreturnedbytheCOMAddInsproperty:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,clickOffice.

IfyoudonotseetheOfficetypelibraryintheProject/Librarylist,ontheToolsmenu,clickReferences,selecttheMicrosoftOffice10.0ObjectLibrarycheckbox,andthenclickOK.

UnderClasses,examinetheclassnamedCOMAddIns.

Example

'ThismacrodemonstratesusingtheCOMAddInsproperty'tolisttheCOMadd-insregisteredwithVisio.PublicSubIterateCOMAddIns()

DimmyCOMAddInsAsCOMAddInsDimmyCOMAddInAsCOMAddIn

'GetthesetofCOMadd-insSetmyCOMAddIns=Application.COMAddIns

'ListeachCOMadd-ininthe'ImmediatewindowForEachmyCOMAddInInmyCOMAddInsDebug.PrintmyCOMAddIn.DescriptionNext

EndSub

CommandBarsproperty

ReturnsareferencetotheCommandBarscollectionthatrepresentsthecommandbarsinthecontainerapplication.

Versionadded

2002

Syntax

objsRet=object.CommandBarsobjsRet ThecollectionofCommandBarobjectsthatrepresent

commandbarsinthecontainerapplication.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

BeginningwithMicrosoftVisio2002,aprogramcanmanipulatemenusandtoolbarsintheVisiouserinterfacebymanipulatingtheCommandBarscollectionreturnedbytheCommandBarsproperty.TheCommandBarscollectionhasaninterfaceidenticaltotheCommandBarscollectionexposedby

thesuiteofMicrosoftOfficeapplicationssuchasMicrosoftWordandMicrosoftExcel.

Alternatively,sinceVisioversion4.0,VisiohasexposedapplicationanddocumentpropertiesthatreturnaUIObjectobjectthatprovidessimilarfunctionalitytoCommandBars.Consequently,programscanmanipulatetheVisiomenusandtoolbarsusingeithertheCommandBarscollectionorUIObjectobjects.

TogetinformationabouttheobjectreturnedbytheCommandBarsproperty:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,clickOffice.

IfyoudonotseetheOfficetypelibraryintheProject/Librarylist,ontheToolsmenu,clickReferences,selecttheMicrosoftOffice10.0ObjectLibrarycheckbox,andthenclickOK.

UnderClasses,examinetheclassnamedCommandBars.

NoteEachCommandBarControlobjectinaCommandBarscollectionhasanOnActionandContextpropertywhosevaluesaredeterminedbythecontainerapplication.InVisio:

TheOnActionpropertyisaStringvaluethatisinterpretedeitherasaCOMadd-in,aVisualBasicforApplications(VBA)macro,VBAcodeorasaVisioadd-onname.

TheContextpropertydeterminesinwhichmenucontextacommandbarappears.ThemenucontextnumberisaStringvalue(forexamplevisUIObjSetDrawingor"2"),whichisfollowedbyanasteriskifthecommandbarisvisiblebydefault(forexample,visUIObjSetShapeSheet&"*"or"4*").ValidmenucontextsarevisUIObjSetDrawing(2),visUIObjSetStencil(3),visUIObjSetShapeSheet(4),visUIObjSetIcon(5),orvisUIObjSetPrintPreview(7).AttemptingtosettheContextpropertytoanyothervaluewillfail.

FormoreinformationaboutusingtheOnActionandContextpropertiesinVisio,seeDevelopingVisioSolutionsontheMicrosoftDeveloperNetwork(MSDN)Website.

Example

'ThismacrodemonstratesusingtheCommandBarsproperty'tolistthecommandbars.

PublicSubIterateCommandBars()

DimmyCommandBarsAsCommandBarsDimmyCommandBarAsCommandBar

'GetthesetofCommandBars'fortheapplicationSetmyCommandBars=Application.CommandBars

'ListeachCommandBarin'theImmediatewindowForEachmyCommandBarInmyCommandBarsDebug.PrintmyCommandBar.NameNext

EndSub

CommandLineproperty

DetermineshowMicrosoftVisiowasstarted.

Versionadded

2000

Syntax

strRet=object.CommandLinestrRet String.Thecommandlinewithwhichtheapplicationwas

started.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

Whenyoudouble-clickadrawing,template,orstencilicontostarttheapplication,thenameofthefileappearsinthestringreturnedbytheCommandLineproperty.WhenyoustarttheapplicationusingaCreateObjectcall,"/Automation"appearsinthestring.Whenyoudouble-clickaVisioembeddedobjectinanOLEcontainerapplication,"/Embedding"appearsinthestring.

Thefollowingtableincludesothercommandlineswitchesyoucanusetostarttheapplication.

Commandlineswitch

Description

Seealso Example

/nonew ChooseDrawingTypedialogboxisnotshownonstartup.

/nologo Splashscreenisnotshownonstartup./pfilename Printdialogboxisshownsoyoucanquicklyprintafile.filename OpensaVisiofile.ThefilehastobeintheDrawingsfile

pathontheFilePathstabintheOptionsdialogbox(ontheToolsmenu,clickOptions),oranabsolutepathmustbenamed.

/1,/2,/3,…/9 Opensoneofthelast-openedfiles./noreg PreventsVisiofromregisteringitself./u UnregistersVisio./r RegistersVisio./s SilentlyregistersVisio./ptfilename,[printername,drivername,portname]

Directsfiletoprintonaparticularprinter.(AddedinVisioversion5.0c.)

::ODMA VisioopensafileusingODMA.

Companyproperty

ReturnsorsetsthevalueoftheCompanyfieldinadocument'sproperties.

Versionadded

5.0

Syntax

strRet=object.Companyobject.Company=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueofthefield.

Remarks

SettingtheCompanypropertyisequivalenttoenteringinformationintheCompanyboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

Example

Connectsproperty

ReturnsaConnectscollectionforashape,page,ormaster.

Versionadded

2.0

Syntax

objRet=object.ConnectsobjRet TheConnectscollectionoftheShape,Page,orMasterobject.object Required.AnexpressionthatreturnsaShape,Page,orMaster

objectthatownsthecollection.

Remarks

TheConnectscollectionofashapecontainseveryConnectobjectforwhichtheshapeisreturnedbytheFromSheetproperty.Thistellsyoualltheshapestowhichtheshapeisconnected.

ToobtainaConnectscollectionthatcontainseveryConnectobjectforwhich

Example

theshapeistheToSheetproperty,usetheshape'sFromConnectsproperty.Thistellsyoualltheshapesthatareconnectedtothisshape.

TheConnectscollectionofapagecontainsaConnectobjectforeveryconnectiononthepage.

TheConnectscollectionofamastercontainsaConnectobjectforeveryconnectioninthemaster.

Containerproperty

ReturnsanIDispatchinterfaceontheActiveXcontainerinwhichthedocumentiscontainedorNothingifthedocumentisnotinacontainer.

Versionadded

2000

Syntax

objRet=object.ContainerobjRet AnIDispatchonthecontainer.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

TheinterfacereturnedistheresultofqueryingtheIOleContainerinterfaceprovidedbythecontainingobjectforIDispatch.

Seealso Example

ContainingMasterproperty

ReturnstheMasterobjectthatcontainsanobject.

Versionadded

4.0

Syntax

objRet=object.ContainingMasterobjRet TheMasterobjectthatcontainstheobjectorcollection.object Required.AnexpressionthatreturnsaSelectionorShape

object,orShapescollectiontoexamine.

Remarks

Iftheobjectisn'tinaMasterobject,theContainingMasterpropertyreturnsNothing.Forexample,ifaShapeobjectbelongstotheShapescollectionofaPageobject,theContainingMasterpropertyreturnsNothing.

Example

ContainingPageproperty

Returnsthepagethatcontainsanobject.

Versionadded

4.0

Syntax

objRet=object.ContainingPageobjRet ThePageobjectthatcontainstheobjectorcollection.object Required.AnexpressionthatreturnsaSelectionorShape

objectoraShapescollectiontoexamine.

Remarks

Iftheobjectisn'tinaPageobject,theContainingPagepropertyreturnsNothing.Forexample,ifaShapeobjectbelongstoaMasterscollection,theContainingPagepropertyreturnsNothing.

Example

ContainingRowproperty

Returnstherowthatcontainsacell.

Versionadded

2000

Syntax

objRet=object.ContainingRowobjRet TheRowobjectthatcontainstheCellobject.object Required.AnexpressionthatreturnsaCellobject.

Seealso Example

ContainingSectionproperty

Returnsthesectioninwhicharowiscontained.

Versionadded

2000

Syntax

objRet=object.ContainingSectionobjRet TheSectionobjectthatcontainstherow.object Required.AnexpressionthatreturnsaRowobject.

Seealso Example

ContainingShapeproperty

ReturnstheShapeobjectthatcontainsanobjectorcollection.

Versionadded

4.0

Syntax

objRet=object.ContainingShapeobjRet TheShapeobjectthatcontainstheobjectorcollection.object Required.AnexpressionthatreturnsaSelectionorShape

objectoraShapescollectiontoexamine.

Remarks

IftheShapeobjectisthememberofagroup,theContainingShapepropertyreturnsthatgroup.

IftheShapeobjectisatop-levelshapeinitsPageorMasterobject(itisnotamemberofagroup),theContainingShapepropertyreturnsthepagesheetofits

Example

pageormaster.

IftheShapeobjectisthepagesheetofapageormaster,theContainingShapepropertyreturnsNothing.

ContainsWorkspaceproperty

Determineswhetherthedocumentwassavedasaworkspace.

Versionadded

2002

Syntax

boolRet=object.ContainsWorkspaceboolRet Boolean.Trueifthedocumentwassavedasaworkspace;

otherwise,False.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Thispropertyisreadonly,butyoucancauseadocumenttobesavedasaworkspacebypassingthevisSaveAsWSflagtotheSaveAsExmethod.

ThisisequivalenttoclickingWorkspaceundertheSavebuttonintheSaveAsdialogbox(ontheFilemenu,clickSaveAs,andthenclickthearrownextto

Example

Save).

Controlproperty

DetermineswhethertheCTRLkeymodifiestheacceleratorkeyinanAccelItemobject.

Versionadded

3.0

Syntax

intRet=object.Controlobject.Control=intExpressionintRet Integer.True(-1)iftheCTRLkeymodifiesthekeyinan

AccelItemobject;otherwise,False(0).object Required.AnexpressionthatreturnsanAccelItemobject.intExpression RequiredInteger.True(non-zero)iftheCTRLkeymodifies

thekeyinanAccelItemobject;otherwise,False(0).

Remarks

Example

SettheControlpropertytoTruetousetheCTRLkeyasamodifierforanaccelerator,forexample,CTRL+BACKSPACE.

Countproperty

Returnsthenumberofobjectsinacollection.

Versionadded

2.0

Syntax

intRet=object.CountintRet Integer.Thenumberofobjectsinthecollection.object Required.Anexpressionthatreturnsanobjectfromthe

Appliestolist.

Seealso

Creatorproperty

Getsorsetsthevalueofadocument'sauthor.

Versionadded

2.0

Syntax

strRet=object.Creatorobject.Creator=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueofthefield.

Remarks

SettingtheCreatorpropertyisequivalenttoenteringinformationintheAuthorboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

CurrentScopeproperty

DeterminestheIDofthescopethatcausesaneventtofire.

Versionadded

2000

Syntax

longRet=object.CurrentScopelongRet Long.ThescopeIDofthemostrecentlyfiredEnterScope

event;visScopeIDInvalid(-1)ifascopeisn'topen.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

ThescopeIDcouldbeaninternalVisioscopeIDthatcorrespondstoaVisiocommandoranexternalscopeIDpassedtoanAutomationclientthroughtheBeginUndoScopemethod.

TherecipientsofaneventconsiderascopeopeniftheEnterScopeeventhas

fired,buttheExitScopeeventhasnotfired.

TodetermineiftheeventqueuefiringisrelatedtoaparticularscopeinternaltotheapplicationoroneopenedandclosedbyanAutomationclient,usetheIsInScopeproperty.

CustomMenusproperty

GetsaUIObjectobjectthatrepresentsthecurrentcustommenusandacceleratorsofanApplicationobjectoraDocumentobject.

Versionadded

4.0

Syntax

objRet=object.CustomMenusobjRet AUIObjectobjectthatrepresentstheobject'scurrentcustom

menus.object Required.AnexpressionthatreturnstheApplicationor

Documentobjecttoexamine.

Remarks

BeginningwithVisio2000,ifyouhaven'tcustomizedtheuserinterface,theobjectreturnedbyCustomMenuspropertycontainsthesamecollectionsastheobjectreturnedbytheBuiltInMenusproperty.

InVisio5.0orearlier,iftheobjectisnotusingcustomtoolbars,theCustomMenuspropertyreturnsNothing.

CustomMenusFileproperty

GetsorsetsthenameofthefilethatdefinescustommenusandacceleratorsforanApplicationobjectoraDocumentobject.

Versionadded

4.0

Syntax

strRet=object.CustomMenusFileobject.CustomMenusFile=fileStrstrRet String.Thenameofthefilethatdefinesthecurrentcustom

menusfortheobject.object Required.AnexpressionthatreturnstheApplicationor

Documentobject.fileStr RequiredString.Thenameofthefilethatdefinesnewcustom

menusfortheobject.

Remarks

Iftheobjectisnotusingcustommenus,theCustomMenusFilepropertyreturnsNothing.

CustomToolbarsproperty

GetsaUIObjectobjectthatrepresentsthecurrentcustomtoolbarsandstatusbarsofanApplicationobjectoraDocumentobject.

Versionadded

4.0

Syntax

objRet=object.CustomToolbarsobjRet AUIObjectobjectthatrepresentstheobject'scurrentcustom

toolbars.object Required.AnexpressionthatreturnsanApplicationor

Documentobject.

Remarks

BeginningwithVisio2000,ifyouhaven'tcustomizedtheuserinterface,theobjectreturnedbyCustomToolbarspropertycontainsthesamecollectionsastheobjectreturnedbytheBuiltInToolbarsproperty.

Example

InVisio5.0orearlier,iftheobjectisnotusingcustomtoolbars,theCustomToolbarspropertyreturnsNothing.

CustomToolbarsFileproperty

ReturnsorsetsthenameofthefilethatdefinescustomtoolbarsandstatusbarsforanApplicationobjectoraDocumentobject.

Versionadded

4.0

Syntax

strRet=object.CustomToolbarsFileobject.CustomToolbarsFile=fileStrstrRet String.Thenameofthefilethatdefinesthecurrentcustom

toolbarsfortheobject.object Required.AnobjectthatreturnsanApplicationorDocument

object.fileStr RequiredString.Thenameofthefilethatdefinesnewcustom

toolbarsfortheobject.

Remarks

Example

Iftheobjectisnotusingcustomtoolbars,theCustomToolbarsFilepropertyreturnsNothing.

Data1property

GetsorsetsthevalueoftheData1fieldforaShapeobject.

Versionadded

2.0

Syntax

strRet=object.Data1object.Data1=strExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaShapeobject.strExpression RequiredString.Thenewvalueforthefield.

Remarks

UsetheData1propertytosupplyadditionalinformationaboutashape.Thepropertycancontainupto64KBofcharacters.Textcontrolsshouldbeusedwithcarewithastringthatisgreaterthan3,000characters.

SettingtheData1propertyisequivalenttoenteringinformationintheData1boxintheSpecialdialogbox(clickSpecialontheFormatmenu).

Data2property

GetsorsetsthevalueoftheData2fieldforaShapeobject.

Versionadded

2.0

Syntax

strRet=object.Data2object.Data2=strExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaShapeobject.strExpression RequiredString.Thenewvalueforthefield.

Remarks

UsetheData2propertytosupplyadditionalinformationaboutashape.Thepropertycancontainupto64KBofcharacters.Textcontrolsshouldbeusedwithcarewithastringthatisgreaterthan3,000characters.

SettingtheData2propertyisequivalenttoenteringinformationintheData2boxintheSpecialdialogbox(clickSpecialontheFormatmenu).

Data3property

GetsorsetsthevalueoftheData3fieldforaShapeobject.

Versionadded

2.0

Syntax

strRet=object.Data3object.Data3=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaShapeobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

UsetheData3propertytosupplyadditionalinformationaboutashape.Thepropertycancontainupto64KBofcharacters.Textcontrolsshouldbeusedwithcarewithastringthatisgreaterthan3,000characters.

SettingtheData3propertyisequivalenttoenteringinformationintheData3boxintheSpecialdialogbox(clickSpecialontheFormatmenu).

DefaultAngleUnitsproperty

Determinesthedefaultunitofmeasureforquantitiesthatrepresentangles.

Versionadded

2002

Syntax

unitsCode=object.DefaultAngleUnitsobject.DefaultAngleUnits=unitsNameOrCodeunitsCode Variant.Thedefaultangleunit.object Required.AnexpressionthatreturnsanApplicationobject.unitsNameOrCodeOptionalVariant.Thenewdefaultangleunit.

Remarks

TheDefaultAngleUnitspropertycorrespondstothevalueshownintheAngleboxontheRegionaltabintheOptionsdialogbox(ontheToolsmenu,clickOptions).

Example

ThereturnvalueunitsCodecontainsoneofthevaluesofVisUnitCodes,whicharedeclaredintheVisiotypelibrary.

YoucanspecifyunitsNameOrCodeasaninteger(amemberofVisUnitCodes)orastringvaluesuchas"degrees".Ifthestringisinvalidortheunitcodeisinappropriate(non-angular),anerrorisgenerated.

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

Cellformulasthatcontainaspecificunitofmeasurearedisplayedinthoseunitsregardlessofthedefaultangleunitssetting.Manycellformulas,however,useimplicitunitsyntaxandaredisplayedindefaultunits.

Aprogramcancreateacellwhoseformulaisdisplayedindefaultunitsbysettingthecell'sFormulapropertytoastringinimplicitunitsyntax.Forexample,iftheformulafortheangleofashapeis"=90[deg,A]",theresultisdisplayedas"90deg."iftheDefaultAngleUnitspropertyisvisDegrees,and"1.5708rad."iftheDefaultAngleUnitspropertyisvisRadians.

Alternatively,aprogramcansetthecell'sresulttodefaultangleunitsusingthefollowingstatement:

cellObj.Result(visAngleUnits)=90Inthiscase,theresultis90degreesiftheDefaultAngleUnitspropertyisvisDegrees,and90radiansiftheDefaultAngleUnitspropertyisvisRadians.

Fordetailsaboutimplicitunitsofmeasure,seeAboutunitsofmeasure.

DefaultDurationUnitsproperty

Determinesthedefaultunitofmeasureforquantitiesthatrepresentdurations.

Versionadded

2002

Syntax

unitsCode=object.DefaultDurationUnitsobject.DefaultDurationUnits=unitsNameOrCodeunitsCode Variant.Thedefaultdurationunitofmeasure.object Required.AnexpressionthatreturnsanApplicationobject.unitsNameOrCodeOptionalVariant.Thenewdefaultdurationunitofmeasure.

Remarks

TheDefaultDurationUnitspropertycorrespondstothevalueshownintheDurationboxontheRegionaltabintheOptionsdialogbox(ontheToolsmenu,clickOptions).

Example

ThereturnvalueunitsCodecontainsoneofthevaluesofVisUnitCodes,whicharedeclaredintheVisiotypelibrary.

YoucanspecifyunitsNameOrCodeasaninteger(amemberofVisUnitCodes)orastringvaluesuchas"minutes".Ifthestringisinvalidortheunitcodeisinappropriate(non-duration),anerrorisgenerated.

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

Cellformulasthatcontainaspecificunitofmeasurearedisplayedinthoseunitsregardlessofthedefaultdurationunitssetting.Manycellformulas,however,useimplicitunitsyntaxandaredisplayedindefaultunits.

Aprogramcancreateacellwhoseformuladisplaysindefaultunitsbysettingthecell'sFormulapropertytoastringinimplicitunitsyntax.Forexample,ifaformulaspecifyingdurationis"=10[em,E]",theresultdisplaysas"0.0069ed"iftheDefaultDurationUnitspropertyisvisElapsedDay,and"600.0000es"iftheDefaultDurationUnitspropertyisvisElapsedSec.

Alternatively,aprogramcansetthecell'sresulttodefaultdurationunitsusingthefollowingstatement:

cellObj.Result(visDurationUnits)=60Inthiscase,theresultis60minutesiftheDefaultDurationUnitspropertyisvisElapsedMinand60secondsiftheDefaultDurationUnitspropertyisvisElapsedSec.

Fordetailsaboutimplicitunitsofmeasure,seeAboutunitsofmeasure.

DefaultFillStyleproperty

Getsorsetsthedefaultfillstyleofadocument.

Versionadded

4.0

Syntax

strRet=object.DefaultFillStyleobject.DefaultFillStyle=stringExpressionstrRet String.Thedefaultfillstyleofthedocument.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenameofthedefaultfillstyletoassignto

thedocument.

Remarks

TheDefaultFillStylepropertycorrespondstothevalueshownintheFillStyleboxontheFormatShapetoolbarwhennothingisselectedonthedrawingpage.

Example

Thedocument'sdefaultfillstyleisappliedtonewshapescreatedwiththeVisiodrawingtoolsorwiththeDrawmethodsviaAutomation.

DefaultGuideStyleproperty

Getsorsetsthedefaultguidestyleofadocument.

Versionadded

2002

Syntax

strRet=object.DefaultGuideStyleobject.DefaultGuideStyle=stringExpressionstrRet String.Thedefaultguidestyleofthedocument.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenameofthedefaultguidestyle.

Remarks

TheDefaultGuideStylepropertyspecifieswhatstyleisappliedtonewguidescreatedinthedocument.

Seealso Example

DefaultLineStyleproperty

Getsorsetsthedefaultlinestyleofadocument.

Versionadded

4.0

Syntax

strRet=object.DefaultLineStyleobject.DefaultLineStyle=stringExpressionstrRet String.Thedefaultlinestyleofthedocument.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenameofthedefaultlinestyletoassign

tothedocument.

Remarks

TheDefaultLineStylepropertycorrespondstothevalueshownintheLineStyleboxontheFormatShapetoolbarwhennothingisselectedonthedrawing

Example

page.Thedocument'sdefaultlinestyleisappliedtonewshapescreatedwiththeVisiodrawingtoolsorwiththeDrawmethodsviaAutomation.

DefaultPageUnitsproperty

Determinesthedefaultunitofmeasureforquantitiesthatrepresentpositionordistance.

Versionadded

2002

Syntax

unitsCode=object.DefaultPageUnitsobject.DefaultPageUnits=unitsNameOrCodeunitsCode Variant.Thedefaultpageunits.object Required.AnexpressionthatreturnsanApplicationobject.unitsNameOrCodeOptionalVariant.Newdefaultpageunits.

Remarks

TheDefaultPageUnitspropertycorrespondstothevalueshowninthePageboxontheRegionaltabintheOptionsdialogbox(ontheToolsmenu,click

Example

Options).

ThereturnvalueunitsCodecontainsoneofthevaluesofVisUnitCodes,whicharedeclaredintheVisiotypelibrary.

YoucanspecifyunitsNameOrCodeasaninteger(amemberofVisUnitCodes)orastringvaluesuchas"inches".Ifthestringisinvalidortheunitcodeisinappropriate(non-distance),anerrorisgenerated.

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

Cellformulasthatcontainaspecificunitofmeasurearedisplayedinthoseunitsregardlessofthedefaultpageunitssetting.Manycellformulas,however,useimplicitunitsyntaxandaredisplayedindefaultunits.

Aprogramcancreateacellwhoseformulaisdisplayedindefaultunitsbysettingthecell'sFormulapropertytoastringinimplicitunitsyntax.Forexample,theformula"=5[in,P]"displaysas"5in."iftheDefaultPageUnitspropertyisvisInches,and"12.7cm"iftheDefaultPageUnitspropertyisvisCentimeters.

Alternatively,aprogramcansetthecell'sresulttodefaultpageunitsusingthefollowingstatement:

cellObj.Result(visPageUnits)=5Inthiscase,theresultis5inchesiftheDefaultPageUnitspropertyisvisInchesand5centimetersiftheDefaultPageUnitspropertyisvisCentimeters.

Fordetailsaboutimplicitunitsofmeasure,seeAboutunitsofmeasure.

ThevalueoftheDefaultPageUnitspropertydetermineshowblankdrawingsarecreated.Ifthevalueisametricunitofmeasure,thentheblankdrawingiscreatedusingmetricunits.Ifthevalueisanimperialunitofmeasure,theblankdrawingiscreatedusingimperialunits.Defaultpageunitsdonotapplytonewdrawingscreatedfromatemplate.

OtheroperationscanchangethevalueoftheDefaultPageUnitsproperty.IfyouchangethescaleormeasurementunitsforaparticularpageusingthePage

Setupdialogbox,Visiochangesthedefaultpageunitsforalldrawingsintheapplication.

NoteVisiomaintainsinternaldefaultunitsettingsforpositionanddistanceinthedrawing(visDrawingUnits)asopposedtothoseonthepage.Defaultdrawingunitscannotbesetexplicitly,orquerieddirectly.However,theycanbeinferredfromtheratioofcellObj.Result(visDrawingUnits)tocellObj.Result(specificUnit)wherespecificUnitidentifiesaknownunitoflengthsuchasvisInches.

Youcanalsouseimplicitsyntaxtocreateformulasthatdisplayindefaultdrawingunits,forexample,"=5[i,D]".

IfyousetthevalueofDefaultPageUnitswhenthecurrentsettingsfordefaultpageunitsanddefaultdrawingunitsarethesame,bothsettingsarechanged.

DefaultStyleproperty

Getsthedefaultfillstyleofadocumentorsetsthedefaultfill,line,andtextstylesofadocument.

Versionadded

4.0

Syntax

strRet=object.DefaultStyleobject.DefaultStyle=stringExpressionstrRet String.Thedefaultfillstyleofthedocument.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenameofthedefaultstyletoassigntothe

document.

Remarks

Adocument'sDefaultStylepropertyreturnsthesamevalueasits

Example

DefaultFillStyleproperty.SettingtheDefaultStylepropertyisequivalenttosettingtheDefaultFillStyle,DefaultLineStyle,andDefaultTextStylepropertiesindividuallytothesamemultiple-attributestyle.Thefill,line,andtextattributesofthedocument'sdefaultstyleareappliedtonewshapescreatedwiththeVisiodrawingtoolsorwiththeDrawmethodsviaAutomation.

DefaultTextStyleproperty

Getsorsetsthedefaulttextstyleofadocument.

Versionadded

4.0

Syntax

strRet=object.DefaultTextStyleobject.DefaultTextStyle=stringExpressionstrRet String.Thedefaulttextstyleofthedocument.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenameofthedefaulttextstyletoassign

tothedocument.

Remarks

TheDefaultTextStylepropertycorrespondstothevalueshownintheTextStyleboxontheFormatTexttoolbarwhennothingisselectedonthedrawingpage.

Example

Thedocument'sdefaulttextstyleisappliedtonewshapescreatedwiththeVisiodrawingtoolsorwiththeDrawmethodsviaAutomation.

DefaultTextUnitsproperty

Determinesthedefaultunitofmeasureforquantitiesthatrepresenttextmetrics.

Versionadded

2002

Syntax

unitsCode=object.DefaultTextUnitsobject.DefaultTextUnits=unitsNameOrCodeunitsCode Variant.Thedefaulttextunits.object Required.AnexpressionthatreturnsanApplicationobject.unitsNameOrCode RequiredVariant.Newdefaulttextunits.

Remarks

TheDefaultTextUnitspropertycorrespondstothevalueshownintheTextboxontheRegionaltabintheOptionsdialogbox(ontheToolsmenu,clickOptions).

Example

ThereturnvalueunitsCodecontainsoneofthevaluesofVisUnitCodes,whicharedeclaredintheVisiotypelibrary.

YoucanspecifyunitsNameOrCodeasaninteger(amemberofVisUnitCodes)orastringvaluesuchas"pt".Ifthestringisinvalidortheunitcodeisinappropriate(non-textual),anerrorisgenerated.

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

Cellformulasthatcontainaspecificunitofmeasurearedisplayedinthoseunitsregardlessofthedefaulttextunitssetting.Manycellformulas,however,useimplicitunitsyntaxandaredisplayedindefaultunits.

Aprogramcancreateacellwhoseformulaisdisplayedindefaultunitsbysettingthecell'sFormulapropertytoastringinimplicitunitsyntax.Forexample,theformula"=8[pt,T]"displaysas"8pt"iftheDefaultTextUnitspropertyisvisPoints,and"0.6272"iftheDefaultTextUnitspropertyisvisCiceros.

Alternatively,aprogramcansetthecell'sresulttodefaulttextunitsusingthefollowingstatement:

cellObj.Result(visTextUnits)=12Inthiscase,thetextis12pointsiftheDefaultTextUnitspropertyisvisPoints,and12cicerosiftheDefaultTextUnitspropertyisvisCiceros.

Fordetailsaboutimplicitunitsofmeasure,seeAboutunitsofmeasure.

DeferRecalcproperty

Determineswhethertheapplicationrecalculatescellformulasduringaseriesofactions.

Versionadded

4.1

Syntax

intRet=object.DeferRecalcobject.DeferRecalc=intExpressionintRet Integer.False(0)ifformulasarerecalculatedasneeded;True

(-1)ifrecalculationisdeferred.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.False(0)torecalculateformulasasneeded;

True(non-zero)todeferrecalculation.

Remarks

Example

UsetheDeferRecalcpropertytoimproveperformanceduringaseriesofactions.Forexample,youcandeferformularecalculationwhilechangingtheformulasorvaluesofseveralcells.

Ifaprogramneglectstoturnrecalculationonagainafterturningitoff,Visioturnsitonwhentheuserperformsanoperation.

IfyoureleaseobjectsorsendalargenumberofcommandstoVisiowhilerecalculationisdeferred,Visiomayattimesneedtoprocessitsqueueofpendingrecalculations.Becauseofthis,usecareinsettingformulasinsideascopewhereyouwantrecalculationdeferred.Ideally,youshouldonlysetformulaswhenrecalculationisturnedoff.

Forexample,considerthefollowingMicrosoftVisualBasicsequence:

visObj.DeferRecalc=TrueshpObj.Cells("height").ResultIU=12shpObj.Cells("width").ResultIU=14visObj.DeferRecalc=False

BecauseVisualBasicmakesandreleasesatemporaryCellobjectintheprecedingcode,Visiowillprocessitsqueueatthatpoint.

Inthefollowingsequence,Visiowillnotprocesstherecalculationqueueuntiltheprogramturnsrecalculationonagain(ortheuserperformssomeoperation).

visObj.DeferRecalc=TrueSetcellObj1=shpObj.Cells("Height")SetcellObj2=shpObj.Cells("Width")cellObj1.ResultIU=12cellObj1.ResultIU=14visObj.DeferRecalc=False

Descriptionproperty

GetsorsetsthevalueoftheDescriptionboxinaDocumentobject'spropertiesorashape'sHyperlinkobject.

Versionadded

2.0

Syntax

strRet=object.Descriptionobject.Description=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentor

Hyperlinkobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

Settingadocument'sDescriptionpropertyisequivalenttoenteringinformation

intheDescriptionboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

Settingahyperlink'sDescriptionpropertyisequivalenttoenteringinformationintheoptionalDescriptionboxintheHyperlinksdialogbox(clickHyperlinksontheInsertmenu).ItisalsoequivalenttosettingtheresultoftheDescriptioncelloftheshape'sHyperlink.Rowrow.

DisplayKeysInTooltipsproperty

DetermineswhetherToolTiptextincludeskeyboardshortcuts.

Versionadded

2000

Syntax

boolVal=object.DisplayKeysInTooltipsobject.DisplayKeysInTooltips=boolValboolVal RequiredBoolean.TrueifToolTiptextshowskeyboard

shortcuts;Falseifitdoesnot.object Required.AnexpressionthatreturnsaUIObjectobject.

Remarks

ToshowToolTips,youmustsettheDisplayTooltipspropertytoTrue.

Itdoesn'tmatterwhichUIObjectobjectyouusewhengettingorsettingthis

Example

property.Thepropertyaffectstheentireapplication,andalwaysaffectstheappearanceofToolTipsinthecurrentvisiblesetoftoolbars.

BeginningwithMicrosoftVisio2002,thissettingcorrespondstotheShowshortcutkeysinScreenTipssettingontheOptionstabintheCustomizedialogbox(ontheToolsmenu,clickCustomize),andissharedbetweenVisio2002andallMicrosoftOfficeXPapplications.

DisplayTooltipsproperty

DetermineswhetherToolTipsareshownintoolbars.

Versionadded

2000

Syntax

boolVal=object.DisplayTooltipsobject.DisplayTooltips=boolValboolVal RequiredBoolean;TrueifToolTipsareshown;Falseifthey

arenot.object Required.AnexpressionthatreturnsaUIObjectobject.

Remarks

Itdoesn'tmatterwhichUIObjectobjectyouusewhengettingorsettingthisproperty.Thepropertyaffectstheentireapplication,andalwaysaffectstheappearanceofToolTipsinthecurrentvisiblesetoftoolbars.

Example

BeginningwithMicrosoftVisio2002,thissettingcorrespondstotheShowScreenTipsontoolbarssettingontheOptionstabintheCustomizedialogbox(ontheToolsmenu,clickCustomize),andissharedbetweenVisio2002andallMicrosoftOfficeXPapplications.

DistanceFromproperty

Returnsthedistancefromoneshapetoanother.Bothshapesmustbeonthesamepageorinthesamemaster.

Versionadded

2000

Syntax

doubleRet=object.DistanceFrom(otherShape,flags)doubleRet Double.Adistanceininternaldrawingunitswithrespecttothe

coordinatespacedefinedbytheparentshape.object Required.AnexpressionthatreturnsaShapeobject.otherShape Required.TheotherShapeobjectinvolvedinthecomparison.flags RequiredInteger.Flagsthatinfluencethetypeofentries

returnedinresults.

Remarks

Example

TheDistanceFrompropertyreturns:

Zeroandraisesanexceptioniftheshapesbeingcomparedareindifferentmastersorondifferentpages.

Zeroiftheshapesbeingcomparedareoverlapping.

Zeroifoneshapecontainstheothershape,oroneshapeiscontainedwithintheothershape.

Theflagsargumentcanbeanycombinationofthevaluesoftheconstantsdefinedinthefollowingtable.TheseconstantsarealsodefinedinVisSpatialRelationFlagsintheVisiotypelibrary.

Constant Value DescriptionvisSpatialIncludeHidden &H10 ConsiderhiddenGeometry

sections.Bydefault,hiddenGeometrysectionsdonotinfluencetheresult.

visSpatialIgnoreVisible &H20 DonotconsidervisibleGeometrysections.Bydefault,visibleGeometrysectionsinfluencetheresult.

UsetheNoShowcelltodeterminewhetheraGeometrysectionishiddenorvisible.HiddenGeometrysectionshaveavalueofTRUEandvisibleGeometrysectionshaveavalueofFALSEintheNoShowcell.

IfobjectorotherShapehasnogeometry,orifflagsexcludesconsiderationofallgeometryofeithershape,thentheDistanceFrompropertyreturnsalargenumber(1E+30)whichshouldbeconstruedasinfinite.

TheDistanceFrompropertydoesnotconsiderthewidthofashape'sline,shadows,lineends,controlpoints,orconnectionpointswhencomparingtwoshapes.

DistanceFromPointproperty

Returnsthedistancefromashapetoapoint.

Versionadded

2000

Syntax

doubleRet=object.DistanceFromPoint(x,y,flags,[pPathIndexdoubleRet Double.Adistanceininternaldrawingunitswithrespecttothecoordinatespacedefinedbythe

point(x,y).object Required.AnexpressionthatreturnsaShapeobject.x RequiredDouble.Anx-coordinate.y RequiredDouble.Ay-coordinate.flags RequiredInteger.Flagsthatinfluencethetypeofentriesreturnedinresults.pPathIndex OptionalVariant.IdentifiesthepointontheshapeinconjunctionwithpCurveIndex OptionalVariant.Identifiesthepointontheshapeinconjunctionwithpt OptionalVariant.Identifiesthepointontheshapeinconjunctionwith

pCurveIndex.

Example

Remarks

The(x,y)pointisexpressedininternaldrawingunits(inchesinthedrawing)withrespecttothecoordinatespacedefinedbythesheetimmediatelycontainingThisShape.

ThepPathIndex,pCurveIndex,andptargumentsoptionallyreturnvaluesthatidentifythepointthereturneddistanceismeasuredfrom.Callthatpoint(xOnThis,yOnThis).Itliesalongthec'thcurveofThisShape'sp'thpathandcanbedeterminedby:

ThisShape.Paths(*pPathIndex).Item(*pCurveIndex).Point(*pt,&xOnThis,&yOnthis)

YoucanusethePointAndDerivativesmethodinsteadofthePointmethodifyouwanttofindthefirstandsecondderivativesatpositiontalongthecurve.

IfpPathIndexorpCurveIndexisnotNull,anInteger(typeVT_I4)isreturned.Ifpisn'tNull,itreturnsaDouble(typeVT_R8).

TheDistanceFromPointpropertyconsidersguidestohaveextentandconsidersashape'sfilledareasandpaths.

Theflagsargumentcanbeanycombinationofthevaluesoftheconstantsdefinedinthefollowingtable.TheseconstantsarealsodefinedinVisSpatialRelationFlagsintheVisiotypelibrary.

Constant Value DescriptionvisSpatialIncludeHidden &H10 ConsiderhiddenGeometry

sections.Bydefault,hiddenGeometrysectionsdonotinfluencetheresult.

visSpatialIgnoreVisible &H20 DonotconsidervisibleGeometrysections.Bydefault,visibleGeometrysectionsinfluencetheresult.

UsetheNoShowcelltodeterminewhetheraGeometrysectionishiddenorvisible.HiddenGeometrysectionshaveavalueofTRUEandvisibleGeometrysectionshaveavalueofFALSEintheNoShowcell.

Ifobjecthasnogeometry,orifflagsexcludesconsiderationofallgeometry,thentheDistanceFromPointpropertyreturnsalargenumber(1E+30)whichshouldbeinterpretedasinfinite.

TheDistanceFromPointpropertydoesnotconsiderthewidthofashape'sline,shadows,lineends,controlpoints,orconnectionpointswhencomputingitsresult.

Documentproperty

GetstheDocumentobjectthatisassociatedwithanobject.

Versionadded

2.0

Syntax

objRet=object.DocumentobjRet TheDocumentobjectthatcontainstheobject.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

TheDocumentpropertyofadockedstencilwindowreturnsaDocumentobjectforthestencilthatiscurrentlyatthetopofthewindow.Ifanotherstencilreplacesthefirstinthetopposition,thefirststencil'sdocumentisclosedsothereferencetoitbecomesinvalid.Forbestresults,assumethatdocumentreferencestodockedstencilsarenotpersistent.

Seealso

IfaWindowobjectshowsnodocumentsareopen,thennodocumentisreturnedandnoexceptionisraised.YoursolutionshouldcheckforNothingreturnedafterretrievingtheDocumentpropertyofaWindowobject.

Documentsproperty

object;DAR_Objects_(A-M)_1015.htm">

ReturnstheDocumentscollectionforaMicrosoftVisioinstance.

Versionadded

2.0

Syntax

objsRet=object.DocumentsobjsRet TheDocumentscollectionoftheApplicationobject.object Required.AnexpressionthatreturnstheApplicationobject

thatownsthecollection.

Remarks

YoucaniteratethroughaDocumentscollectionbyusingtheCountpropertytoretrievethenumberofdocumentsinthecollection.YoucanusetheItempropertytoretrieveindividualelementsfromacollection.

DocumentSheetproperty

ReturnsaShapeobjectwhosecellsrepresentpropertiesofthedocument.

Versionadded

2000

Syntax

objRet=object.DocumentSheetobjRet AShapeobject.object Required.AnexpressionthatreturnsaDocumentobject.

Seealso Example

DrawingPathsproperty

GetsorsetsthepathswhereMicrosoftVisiolooksfordrawings.

Versionadded

4.0

Syntax

strRet=object.DrawingPathsobject.DrawingPaths=pathsStrobject Required.AnexpressionthatreturnsanApplicationobject.strRet,pathsStr String.Atextstringcontainingalistoffolders.

Remarks

Toindicatemorethanonefolder,separateindividualitemsinthepathstringwithsemicolons.

ThestringpassedtoandreceivedfromtheDrawingPathspropertyisthesame

Example

stringshownontheFilePathstabintheOptionsdialogbox(clickOptionsontheToolsmenu).ThisstringisstoredinHKEY_CURRENT_USER\Software\Microsoft\Visio\application\DrawingsPath

VisiolooksfordrawingsinallpathsnamedintheDrawingPathspropertyandallthesubfoldersofthosepaths.IfyoupasstheDrawingPathspropertytotheEnumDirectoriesmethod,itreturnsacompletelistoffullyqualifiedpathsinwhichVisiolooks.

Ifapathisnotfullyqualified,VisiolooksforthefolderinthefolderthatcontainstheVisioprogramfiles(appObj.Path).Forexample,iftheVisioexecutablefileisinstalledinc:\Visio,andtheDrawingPathspropertyis"Drawings;d:\Drawings",Visiolooksforadd-onsinbothc:\Visio\Drawingsandd:\Drawings.

DropActionsproperty

Definesspecialactionstobeperformedonshapescreatedusingamastershortcut.

Versionadded

2000

Syntax

strRet=object.DropActions

object.DropActions=strExpression

strRetString.Oneormoreactionsseparatedbysemicolons.SeeexampleinRemarks.

object Required.AnexpressionthatreturnsaMasterShortcutobject.

strExpressionRequiredString.Oneormoreactionsseparatedbysemicolons.SeeexampleinRemarks.

Remarks

Whenyoudropamastershortcutontoadrawingpage,MicrosoftVisioappliesanydropactionsintheshortcuttothenewlycreatedshape.Eachdropactiondefinesaparticularvalueorformulatobeassignedtoaparticularcellinthenewshape.

Seealso Example

Becausedropactionsaredefinedbytheshortcut,notthetargetmaster,itispossibletocreateseveralshortcutsthatrefertothesametargetmaster,butwhichproduceverydifferenteffectswhendroppedontothedrawingpage.

TheDropActionspropertycanbeblank,orcandefineaseriesofoneormoreindividualdropactions.Actionsareseparatedbysemicolons(;).Eachactionconsistsofthenameofthecelltochange,followedbytheformulatoapplytothatcell,separatedbyanequalssign(=).Forexample:

User.SubType=3;FillForegnd=7;Sheet2!Width=(ThePage!PageWidth/2-4cm)

Theapplicationdoesnotvalidatedropactionsuntiltheyareappliedtoanewshape.IftheDropActionspropertycontainssyntaxerrorsorinvalidcellnames,theoffendingactionsareignored.However,iftheapplicationisrunningindevelopermode,anerrormessageisdisplayed,identifyingtheinvalidactionandthecauseoftheerror.Whenusingshortcutdropactionsinyourcode,alwaystestyourshortcutsindevelopermodetomakesurethedropactionsdonotcontainerrors.Torunindevelopermode,ontheToolsmenu,clickOptions,clicktheAdvancedtab,andthenselecttheRunindevelopermodecheckbox.

DynamicGridEnabledproperty

Determineswhetherthedynamicgridisenabledornot.

Versionadded

2002

Syntax

boolRet=object.DynamicGridEnabledobject.DynamicGridEnabled=boolExpressionboolRet Boolean.Trueifdynamicgridisenabled;Falseifitisnot

enabled.object Required.AnexpressionthatreturnsaDocumentobject.boolExpression RequiredBoolean.Truetoenabledynamicgrid;Falseto

disableit.

Example

EditCopyproperty

Returnsamasterthatisopenforeditingandoriginallycopiedfromthismaster.

Versionadded

2002

Syntax

objRet=object.EditCopy

objRetTheMasterobjectthatisopenforeditingandthatwasoriginallycopiedfromobject.

objectRequired.AnexpressionthatreturnsaMasterobject.

Remarks

Ifthereisnomasterassociatedwithobjectthatisopenforediting,theEditCopypropertyreturnsNothing.

Seealso Example

EmailRoutingDataproperty

Returnse-mailroutingdataforadocument.

Versionadded

2002

Syntax

varRet=object.EmailRoutingDatavarRet Variant.Anarraycontainingthee-mailroutingdatafora

document.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

ThedatacontainedinvarRetistheequivalentofthedatacontainedintheRoutingSlipdialogbox(ontheFilemenu,pointtoSendTo,andthenclickRoutingRecipient).

Seealso Example

Enabledproperty

Determineswhetherornotanobjectiscurrentlyenabled.

Versionadded

4.0

Syntax

intVal=object.Enabledobject.Enabled=intExpressionintVal Integer.False(0)iftheobjectisdisabled;True(-1)ifitis

enabled.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.intExpression RequiredInteger.False(0)todisabletheobject;True(non-

zero)toenabletheobject.

Remarks

Seealso

YoucangetandsettheEnabledpropertyofanEventobject.AnEventobjectthatisdisableddoesn'tperformitsactionwhenitseventoccurs.

Anadd-onimplementedbyanexecutable(EXE)filealwaysreportsitselfasenabled.Anadd-onimplementedbyaVisioSolutionsLibrary(VSL)filereportsitselfasenabledordisabledaccordingtotheenablingpolicythattheVSLfilehasregisteredforthatadd-on.

Youcan'ttellanadd-ontoenableordisableitself.Visiowillnotsendarunmessagetoadisabledadd-on.Thenameofadisabledadd-ononaVisiomenuappearsdimmedorgray.

Endproperty(Charactersobject)

ReturnsorsetstheendingindexoftheindicatedCharactersobjectrepresentingarangeoftextinashape.

Versionadded

3.0

Syntax

intRet=object.Endobject.End=intExpressionintRet Integer.ThecurrentendingindexoftheCharactersobject.object Required.AnexpressionthatreturnsaCharactersobject.intExpression RequiredInteger.ThenewendingindexoftheCharacters

object.

Remarks

TheEndpropertydeterminestheendofthetextrangerepresentedbya

Example

Charactersobject.ThevalueoftheEndpropertyisanindexthatrepresentstheboundarybetweentwocharacters,similartoaninsertionpointintext.Likeselectedtextinadrawingwindow,aCharactersobjectrepresentsthesequenceofcharactersthatareaffectedbysubsequentactions,suchastheCutorCopymethod.WhenyouretrieveaCharactersobject,itscurrenttextrangeincludesalltheshape'stext.YoucanchangethetextrangebysettingtheCharactersobject'sBeginandEndproperties.ChangingthetextrangeofaCharactersobjecthasnoeffectonthetextofthecorrespondingshape.

TheEndpropertycanhaveavaluefromzero(0)tothevalueoftheCharCountpropertyforthecorrespondingshape.Anindexof0ispositionedbeforethefirstcharacterintheshape'stext.AnindexthatisthesameastheCharCountpropertyispositionedafterthelastcharacterintheshape'stext.Ifyouspecifyavaluelessthan0,Visiouses0.Ifyouspecifyavaluethatisinsidetheexpandedcharactersofafield,VisiosetsthevalueoftheEndpropertytotheendofthefield.

ThevalueoftheEndpropertymustalwaysbegreaterthanorequaltothevalueoftheBeginproperty.IfyouattempttosetthevalueoftheEndpropertytoavaluelowerthantheBeginproperty,VisiosetsboththeEndandBeginpropertiestothevaluespecifiedfortheEndproperty.

Endproperty(Curveobject)

ReturnstheendpointofaCurveobject.

Versionadded

5.0

Syntax

retVal=object.EndretVal Double.EndingvalueofaCurveobject'sparameterdomain.object Required.AnexpressionthatreturnsaCurveobject.

Remarks

TheEndpropertyofaCurveobjectreturnstheendpointofacurve.ACurveobjectdescribesitselfintermsofitsparameterdomain,whichistherange[Start(),End()]whereEnd()producesthecurve'sendpoint.

Errorproperty

Getstheerrorcodegeneratedbythelastevaluationofacell'sformula.

Versionadded

2.0

Syntax

intRet=object.ErrorintRet Integer.Theerrorcodefromthelastevaluationofthecell's

formula.object Required.AnexpressionthatreturnsaCellobject.

Remarks

Whenyouevaluateacell'sformula,anerrorcodeisgeneratedalongwiththeresult.TheErrorpropertyallowsyoutoaccessthiserrorcode.ConstantsforvaliderrorcodesaredeclaredbytheVisiotypelibraryandbeginwithvisError.

Seealso Example

Eventproperty

GetsorsetstheeventcodeofanEventobject—anevent-actionpair.Whentheeventoccurs,theactionisperformed.

Versionadded

4.0

Syntax

intRet=object.Eventobject.Event=eventCodeintRet Integer.Thecurrenteventcode.object Required.AnexpressionthatreturnsanEventobject.eventCode RequiredInteger.Theneweventcode.

Remarks

IftheactioncodeoftheEventobjectisvisActCodeRunAddon,theeventalsospecifiesthetargetoftheactionandtheargumentstosendtothetarget.This

Example

informationisstoredintheTargetandTargetArgsproperties,respectively.

IftheactioncodeoftheEventobjectisvisActCodeAdvise,theeventalsospecifiestheobjecttoreceiveeventnotifications(sometimescalledthesinkobject)andargumentstosendtothesinkobjectalongwiththenotification.

EventcodesaredeclaredbytheVisiotypelibrary.Theyareprefixedwith"visEvt"andarelistedineventtopicsinthisAutomationReference.Foralistofeventcodes,seeEventcodes.

AprogramcanusetheTriggermethodtocauseanEventobject'sactiontobeperformedwithoutwaitingfortheeventtooccur.

EventInfoproperty

Getsadditionalinformationassociatedwithanevent,ifanyexists.

Versionadded

4.0

Syntax

strRet=object.EventInfo(eventSeqNum)strRet String.Additionalinformationabouttheevent.object Required.AnexpressionthatreturnsanApplicationobject.eventSeqNum RequiredLong;visEvtIDMostRecent(0)forinformation

aboutthemostrecentlyfiredevent,orthesequencenumberoftheeventtoexamine.

Remarks

WhenVisiofiresanevent,thereareasmallnumberofeventsforwhichadditionalinformationisavailable.TheseeventsareBeforeDocumentSaveAs,DocumentSavedAs,EnterScope,ExitScope,MarkerEvent,ShapesDeleted,

Example

andShapeChanged.Usetheapplication'sEventInfopropertytoobtainthisinformation,whenavailable.

TheEventInfopropertyreturnsthefollowing:

Astringwhosecontentsarespecifictotheeventinquestion,iftheeventdoesrecordextrainformation.

Anemptystringifaneventdoesnotrecordextrainformation.

AnerrorifVisionolongerhasinformationforthespecifiedevent.

FordetailsaboutthecontentsoftheEventInfopropertyforanevent,seethespecificeventtopic.

IfaneventtargetqueriestheEventInfopropertyimmediatelyafterbeingtriggered,themostrecenteventandtheeventwhosesequencenumberwaspassedtothetargetarethesame.However,ifthetargetisanadd-onimplementedbyanexecutable(EXE)file,thismaynotbethecasebecausetheexecutablefileandVisioareseparatetasksthataren'tmodalwithrespecttoeachother.

NoteEventhandlersthatusetheMicrosoftVisualBasicforApplicationsWithEventsvariableonlyhaveaccesstothemostrecenteventandmustusevisEvtIDMostRecent.

ToensurethattheinformationreturnedbytheEventInfopropertyisassociatedwiththesameeventthattriggeredtheadd-on,theexecutablefilecanpass<sequencenumber>asanargumenttotheEventInfoproperty.Youcanobtainthesequencenumberofaneventinthefollowingways:

IftheActionpropertyoftheEventobjectreturnsvisActCodeRunAddon,thenthecommandlinestringpassedtotheadd-oncontainsasubstringoftheform"/eventid=<sequencenumber>".

NoteEventhoughthesubstringislabeledwith"/eventid,"don'tconfusethe<sequencenumber>passedinthecommandlinestringwiththeIDpropertyofthefiringEventobject,whichidentifiestheEventobjectinitsEventListcollection.Thenumberbeingpassedisactuallythefiringsequencenumber.

IftheActionpropertyoftheEventobjectreturnsvisActCodeAdvise,the

sequencenumberispassedasanargumenttotheVisEventProcprocedureimplementedbythetargetobject.

EventListproperty

ReturnstheEventListcollectionofanobjectortheEventListcollectionthatcontainsanEventobject.

Versionadded

4.0

Syntax

objRet=object.EventListobjRet TheEventListcollection.object Required.Anexpressionthatreturnsanobjectfromthe

Appliestolistthatownsthecollection.

EventsEnabledproperty

DetermineswhetheraMicrosoftVisioinstancefiresevents.

Versionadded

4.5

Syntax

intRet=object.EventsEnabledobject.EventsEnabled=intExpressionintRet Integer.False(0)ifeventfiringisdisabled;True(-1)ifevent

firingisenabled.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.False(0)todisableeventfiring;True(non-

zero)toenableeventfiring.

Remarks

IftheEventsEnabledpropertyisFalse,Visiodoesnotfireevents,runadd-ons,

orexecuteMicrosoftVisualBasicforApplicationscodewhenevaluatingRUNADDONoperandsincellformulas.

Bydefault,theEventsEnabledpropertyisTruewhenaninstanceofVisiostarts.

YoumaywanttodisableeventfiringifyouhavecodebehindeventssuchasDocumentOpenedorDocumentCreatedthatdoesnotworkproperly,ortopreventtheincorporationofavirusintoadocument.EventswillnotfireuntiltheEventsEnabledpropertyissettoTrue.

TosettheEventsEnabledpropertytoFalseinanotherway:

OntheToolsmenu,clickOptions.

IntheOptionsdialogbox,clicktheAdvancedtab.

CleartheEnableAutomationeventscheckbox.

ExtraInfoproperty

ReturnsorsetsextraURLrequestinformationusedtoresolvethehyperlink'sURL.

Versionadded

5.0

Syntax

strRet=object.ExtraInfoobject.ExtraInfo=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaHyperlinkobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

SettingtheExtraInfopropertyofashape'sHyperlinkobjectisoptional,andisequivalenttosettingthevalueoftheExtraInfocellintheshape'sHyperlink.Row

Example

row.

Youmight,forexample,settheHyperlinkobject'sExtraInfopropertytothecoordinatesofanimagemap,thecontentsofaform,orafilename.

IftheExtraInfopropertyyouprovidecontainsreservedcharactersotherthanspaces,youmustinputtheescapecharacter"%"andthecharacter'shexequivalent.Forexample:

For"NAME=JohnSmith",settheExtraInfopropertyto"NAME=JohnSmith"becausetheextrainformationcontainsspaces,butnoreservedcharacters.

For"PATH=C:\TEMP",setExtraInfopropertyto"PATH=C%3A%5CTEMP"becauseofthereservedcharacters.

FaceIDproperty

Getsorsetstheiconforanitem.

Versionadded

2000

Syntax

intLong=object.FaceIDobject.FaceID=intLongintLong RequiredInteger.Zeroormorewhenthebuttonusesoneof

theVisiostandardbuilt-inimages.Negativeone(-1)whenthebuttonhasnoicon,orhasacustomimage.

object Required.AnexpressionthatreturnsanobjectintheAppliestolist.

Remarks

YoucanuseanyoftheconstantsprefixedwithvisIconIXthataredeclaredby

theVisiotypelibraryinVisUIIconIDs.

TheFaceIDpropertydeterminesabutton'sicon,butnotitsfunction.UsetheCmdNumpropertyofaToolbarItemorMenuItemobjecttosetabutton'sfunction.

TheFaceIDpropertyisthesameastheTypeSpecific1propertywhentheCtrlTypepropertyistypevisCtrlTypeBUTTON,whichisdeclaredintheVisiotypelibraryinVisUICtrlTypes.

FieldCategoryproperty

Returnsthefieldcategoryforafieldrepresentedbyanobject.

Versionadded

3.0

Syntax

intRet=object.FieldCategoryintRet Integer.Thefieldcategory.object Required.AnexpressionthatreturnsaCharactersobject.

Remarks

IftheCharactersobjectdoesnotcontainafieldorcontainsnon-fieldcharacters,theFieldCategorypropertyreturnsanexception.ChecktheIsFieldpropertyoftheCharactersobjectbeforegettingitsFieldCategoryproperty.

FieldcategoriescorrespondtothoseintheCategorylistintheFielddialogbox(clickFieldontheInsertmenu).

Example

Toaddacustomfield,usetheAddCustomFieldmethod.

ThefollowingconstantsforfieldcategoriesaredeclaredbytheVisiotypelibraryinVisFieldCategories.

Constant ValuevisFCatCustom 0visFCatDateTime 1visFCatDocument 2visFCatGeometry 3visFCatObject 4visFCatPage 5

FieldCodeproperty

Returnsthefieldcodeforafieldrepresentedbyanobject.

Versionadded

3.0

Syntax

intRet=object.FieldCodeintRet Integer.Thefieldcode.object Required.AnexpressionthatreturnsaCharactersobject.

Remarks

IftheCharactersobjectdoesnotcontainafieldorcontainsnon-fieldcharacters,theFieldCodepropertyreturnsanexception.ChecktheIsFieldpropertyoftheCharactersobjectbeforegettingitsFieldCodeproperty.

FieldcodescorrespondtothefieldsintheFieldlistintheFielddialogbox(clickFieldontheInsertmenu).

Example

ThefollowingconstantsforfieldcodesaredeclaredbytheVisiotypelibraryinVisFieldCodes.

Constantsforfieldcodes

FieldFormatproperty

Returnsthefieldformatforafieldrepresentedbyanobject.

Versionadded

3.0

Syntax

intRet=object.FieldFormatintRet Integer.Thefieldformat.object Required.AnexpressionthatreturnsaCharactersobject.

Remarks

IftheCharactersobjectdoesnotcontainafieldorcontainsnon-fieldcharacters,theFieldFormatpropertyreturnsanexception.ChecktheIsFieldpropertyoftheCharactersobjectbeforegettingitsFieldFormatproperty.

FieldformatscorrespondtotheformatsintheFormatlistintheFielddialogbox(clickFieldontheInsertmenu).

Example

ThefollowingconstantsforfieldformatsaredeclaredbytheVisiotypelibraryinVisFieldFormats.

Constantsforfieldformats

FieldFormula[U]property

Returnstheformulaofthecustomfieldrepresentedbyanobject.

Versionadded

3.0

Syntax

strRet=object.FieldFormulastrRet String.Theformulaofthecustomfield.object Required.AnexpressionthatreturnsaCharactersobject.

Remarks

IftheCharactersobjectdoesnotcontainafieldorcontainsnon-fieldcharacters,orifthefieldisnotacustomfield,theFieldFormulapropertyreturnsanexception.ChecktheIsFieldandFieldCategorypropertiesoftheCharactersobjectbeforegettingitsFieldFormulaproperty.

TheformulareturnedbytheFieldFormulapropertycorrespondstotheformula

Example

thatappearsintheCustomformulaboxintheFielddialogbox(clickFieldontheInsertmenu).

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheFieldFormulapropertytogetaformulausinglocalsyntax.UsetheFieldFormulaUpropertytogetaformulausinguniversalsyntax.

FillBasedOnproperty

GetsorsetsthefillstyleonwhichtheStyleobjectisbased.

Versionadded

4.0

Syntax

strVal=object.FillBasedOnobject.FillBasedOn=styleNamestrVal String.Thenameofthecurrentfillstyle.object Required.AnexpressionthatreturnsaStyleobject.styleName RequiredString.Thenameofthenewfillstyle.

Remarks

Tobaseastyleonnostyle,settheFillBasedOnpropertytoazero-lengthstring("").

Example

FillStyleproperty

Returnsorsetsthefillstyleforanobject.

Versionadded

2.0

Syntax

strRet=object.FillStyleobject.FillStyle=stringExpressionstrRet String.Thecurrentfillstyle.object Required.AnexpressionthatreturnsaSelectionorShape

objectthathasorgetsthefillstyle.stringExpression RequiredString.Thenameofthefillstyletoapply.

Remarks

SettingtheFillStylepropertyisequivalenttoselectingastylefromtheFillStylelistontheFormatShapetoolbar.

Settingastyletoanonexistentstylegeneratesanerror.Settingonetypeofstyletoanothertype(forexample,settingtheFillStylepropertytoalinestyle)doesnothing.Settingonetypeofstyletoanothertypethathasmorethanonesetofattributeschangesonlytheappropriateattributes.Forexample,settingtheFillStylepropertytoastylewithline,text,andfillattributeschangesonlythefillattributes.

Topreserveashape'slocalformatting,usetheFillStyleKeepFmtproperty.

BeginningwithMicrosoftVisio2002,azero-lengthstring("")willcausethemaster'sstyletobereappliedtotheselectionorshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionorshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoazero-lengthstring("")isequivalenttoselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistintheStyledialogbox(ontheFormatmenu,clickStyle).

FillStyleKeepFmtproperty

Appliesafillstyletoanobjectwhilepreservinglocalformatting.

Versionadded

2.0

Syntax

object.FillStyleKeepFmt=stringExpressionobject Required.AnexpressionthatreturnsaSelectionorShape

objecttowhichthefillstyleisapplied.stringExpression RequiredString.Thenameofthefillstyletoapply.

Remarks

SettingtheFillStyleKeepFmtpropertyisequivalenttoselectingthePreservelocalformattingcheckboxintheStyledialogbox(clickStyleontheFormatmenu).

Settingastyletoanonexistentstylegeneratesanerror.Settingonetypeofstyle

Example

toanothertype(forexample,settingtheFillStyleKeepFmtpropertytoalinestyle)doesnothing.Settingonetypeofstyletoanothertypethathasmorethanonesetofattributeschangesonlytheappropriateattributes(forexample,settingtheFillStyleKeepFmtpropertytoastylewithline,text,andfillattributeschangesonlythefillattributes).

BeginningwithMicrosoftVisio2002,anemptystring("")willcausethemaster'sstyletobereappliedtotheselectionorshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionorshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoanemptystringisequivalenttoselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistsintheStyledialogbox(ontheFormatmenu,clickStyle).

FilterPathsproperty

GetsorsetsthepathwhereMicrosoftVisiolooksforimportandexportfilters.

Versionadded

4.0

Syntax

strRet=object.FilterPathsobject.FilterPaths=pathsStrstrRet String.Atextstringcontainingthenameofafolder.object Required.AnexpressionthatreturnsanApplicationobject.pathsStr RequiredString.Atextstringcontainingthenewfoldername.

Remarks

ThestringpassedtoandreceivedfromtheFilterPathspropertyisthesamestringshownontheFilePathstabintheOptionsdialogbox(clickOptionsontheToolsmenu).Thisstringisstoredin

HKEY_CURRENT_USER\Software\Microsoft\Visio\application\FiltersPath32

UnlikesimilarpropertiessuchasAddonPathsandTemplatePaths,youcannameonlyonepathintheFilterPathspropertyandVisiowillnotlookforfiltersinthesubfoldersofthepathyouspecify.

Ifapathisnotfullyqualified,VisiolooksforthefolderinthefolderthatcontainstheVisioprogramfiles(appObj.Path).

Flagsproperty

GetsorsetstheflagsthatspecifyhowyouuseaColorobject.

Versionadded

4.0

Syntax

intRet=object.Flagsobject.Flags=intValintRet Integer.Thecurrentvalueofthecolor'sflagscomponent.object Required.AnexpressionthatreturnsaColorobject.intVal RequiredInteger.Thenewvalueofthecolor'sflags

component.

Remarks

TheFlagspropertyofaColorobjectcorrespondstothepeFlagsmemberofaMicrosoftWindowsPALETTEENTRYdatastructure.Fordetails,searchfor

Example

"PALETTEENTRY"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Flavorproperty

MicrosoftVisionolongersupportsthispropertyandignoresitincode.TheVisiouserinterfaceusesonlytheMicrosoftOfficetoolbarset.

Seealso Example Appliesto

Fontsproperty

ReturnstheFontscollectionofaDocumentobject.

Versionadded

4.0

Syntax

objRet=object.FontsobjRet Required.Anexpressionthatreturnsadocument'sFonts

collection.object Required.AnexpressionthatreturnsaDocumentobject.

Example

FooterCenterproperty

Containsthetextstringthatappearsinthecenterportionofadocument'sfooter.

Versionadded

2002

Syntax

strRet=object.FooterCenterobject.FooterCenter=stringExpressionstrRet String.Thetextinthecenterportionofthefooter.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Newtextforthecenterportionofthefooter.

Remarks

YoucanalsosetthisvalueintheCenterboxunderFooterintheHeaderandFooterdialogbox(ontheViewmenu,clickHeaderandFooter).

Example

BothstrRetandstrExpressioncancontainescapecodesthatrepresentdata.Theseescapecodescanbeconcatenatedwithothertext.ForalistofvalidescapecodesyoucanusewiththeFooterCenterproperty,seetheFooterLeftproperty.

Example

Thefollowingmacroisusedtoplaceastringcontainingthecurrentpagenumberandtotalnumberofpagesintothecenterportionofadocument'sfooter.

SubSetFooterCenter()DimszFooterasString'BuildfooterstringszFooter="Page&pof&P"'SetfooterofcurrentdocumentThisDocument.FooterCenter=szFooterEndSub

Ifthisisaone-pagedocument,thecenterportionofthefootercontains"Page1of1"afterrunningthismacro.

FooterLeftproperty

Containsthetextstringthatappearsintheleftportionofadocument'sfooter.

Versionadded

2002

Syntax

strRet=object.FooterLeftobject.FooterLeft=stringExpressionstrRet String.Thetextintheleftportionofthefooter.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Newtextfortheleftportionofthefooter.

Remarks

YoucanalsosetthisvalueintheLeftboxunderFooterintheHeaderandFooterdialogbox(ontheViewmenu,clickHeaderandFooter).

Example

BothstrRetandstrExpressioncancontainescapecodesthatrepresentdata.Theseescapecodescanbeconcatenatedwithothertext.

Followingisalistofvalidescapecodesfordocumentfootersandheaders.

Escapecode Description&p Pagenumber&tor&T Currenttime&d(shortversion)or&D(longversion)

Currentdate

&& Ampersand&e Filenameextension&f Filename&f&e Filenameandextension&n Pagename&P Totalprintedpages

Example

Thefollowingmacroisusedtoplaceastringcontainingthecurrentdateintotheleftportionofadocument'sfooter.

SubSetFooterLeft()DimszFooterasString'BuildfooterstringszFooter="TheDateis"&"&D"'SetfooterofcurrentdocumentThisDocument.FooterLeft=szFooterEndSub

IfthedatewasMay4,2002,theleftportionofthefootercontains"TheDateisThursday,May4,2002"afterrunningthismacro.

FooterMarginproperty

Getsorsetsthemarginofadocument'sfooter.

Versionadded

2002

Syntax

retVal=object.FooterMargin([unitsNameOrCode])object.FooterMargin([unitsNameOrCode])=newValretVal Double.Themarginsize.object Required.AnexpressionthatreturnsaDocumentobject.unitsNameOrCodeOptionalVariant.Theunitstousewhenretrievingorsetting

thecell'svalue.Defaultstointernaldrawingunits(inches).newVal RequiredDouble.Thenewmarginsize.

Remarks

IfunitsNameorCodeisnotprovided,theFooterMarginpropertywilldefaultto

Example

internaldrawingunits.

YoucanalsosetthisvalueintheMarginboxunderFooterintheHeaderandFooterdialogbox(ontheViewmenu,clickHeaderandFooter).

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

FooterRightproperty

Containsthetextstringthatappearsintherightportionofadocument'sfooter.

Versionadded

2002

Syntax

strRet=object.FooterRightobject.FooterRight=stringExpressionstrRet String.Thetextintherightportionofthefooter.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Newtextfortherightportionofthefooter.

Remarks

YoucanalsosetthisvalueintheRightboxunderFooterintheHeaderandFooterdialogbox(ontheViewmenu,clickHeaderandFooter).

Example

BothstrRetandstrExpressioncancontainescapecodesthatrepresentdata.Theseescapecodescanbeconcatenatedwithothertext.ForalistofvalidescapecodesyoucanusewiththeFooterRightproperty,seetheFooterLeftproperty.

ForeignDataproperty

Returnsmetafile,bitmap,orOLEdataforashapethatrepresentsaforeignobject.

Versionadded

2002

Syntax

retVal=object.ForeignTyperetVal Byte.Anarraycontainingmetafile,bitmap,orOLEdataforthe

shape.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

Todeterminewhetherashaperepresentsaforeignobject,usetheForeignTypeproperty.

Example

ForeignTypeproperty

ReturnsthesubtypeofaShapeobjectthatrepresentsaforeignobject.

Versionadded

4.1

Syntax

retVal=object.ForeignTypeRemarks

IftheTypepropertyofaShapeobjectreturnsanyvalueotherthanvisTypeForeignObject,theForeignTypepropertyreturnsthesamevalueastheShapeobject'sTypeproperty.IftheTypepropertyofaShapeobjectreturnsvisTypeForeignObject,theForeignTypepropertyreturnsacombinationofthefollowingvalues.

Constant ValuevisTypeMetafile &H0010

Example

visTypeBitmap &H0020visTypeIsLinked &H0100visTypeIsEmbedded &H0200visTypeIsControl &H0400visTypeIsOLE2 &H8000

IftheshaperepresentsanOLE2.0embeddedobject,forexample,itsForeignTypepropertyis&H8200.

Formula[U]property

ReturnsorsetstheformulaforaCellobject.

Versionadded

2.0

Syntax

strRet=object.Formulaobject.Formula=stringExpressionstrRet String.Thecell'sformula.object Required.AnexpressionthatreturnsaCellobject.stringExpression RequiredString.Thenewformulaforthecell.

Remarks

Ifacell'sformulaisprotectedwiththeGUARDfunction,youmustusetheFormulaForcepropertytochangethecell'sformula.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheFormulapropertytogetacell'sformulastringinlocalsyntaxortosetitusingamixoflocalanduniversalsyntax.UsetheFormulaUpropertytogetorparsetheformulausinguniversalsyntax.WhenusingFormulaU,thedecimalpointisalways"."andthedelimiterisalways","anduniversalunitstringsmustbeused(fordetailsonuniversalstrings,seeAboutunitsofmeasure).

FormulaForce[U]property

SetstheformulainaCellobject,eveniftheformulaisprotectedwithaGUARDfunction.

Versionadded

2.0

Syntax

object.FormulaForce=stringExpressionobject Required.AnexpressionthatreturnsaCellobject.stringExpression RequiredString.Thenewformulaforthecell.

Remarks

ManyoftheSmartShapessymbolsprovidedwithVisiohaveguardedcellstomaintaintheirsmartbehavior.Whenyouchangetheformulainaguardedcell,theshape'sbehaviormightchangeinunexpectedways.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,

Example

pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheFormulaForcepropertytogetorparsetheformulausinglocalsyntax.UsetheFormulaForceUpropertytogetorparsetheformulausinguniversalsyntax.

Frameproperty

ReturnsorsetsthenameofanHTMLframeintheshape'sHyperlinkobject.

Versionadded

5.0

Syntax

strRet=object.Frameobject.Frame=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaHyperlinkobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

SettingtheFramepropertyofashape'sHyperlinkobjectisoptionalandonlyapplieswhenaVisioinstanceisopeninabrowser,forexample,MicrosoftInternetExplorer3.0orlater.

Example

SettingtheFramepropertyisequivalenttosettingtheresultoftheFramecellintheshape'sHyperlink.Rowrow.

FromCellproperty

Returnsthecellfromwhichaconnectionoriginates.

Versionadded

2.0

Syntax

objRet=object.FromCellobjRet TheCellobjectfromwhichtheconnectionoriginates.object Required.AnexpressionthatreturnsaConnectobject.

Remarks

Aconnectionisdefinedbyareferenceinacellintheshapefromwhichtheconnectionoriginatestoacellintheshapetowhichtheconnectionismade.TheFromCellpropertyreturnstheCellobjectforthecellfromwhichtheconnectionoriginates.

Followingisalistofpossibleconnectionsandthevaluesoftheirrelated

FromCellproperties.

Fromthebeginorendcellofa1-Dshapeto…

Fromtheedge(acellintheAlignmentsection)ofa2-Dshapeto…

Fromanoutwardorinward/outwardconnectionpointcellofa1-Dshapeto…

Fromanoutwardorinward/outwardconnectionpointcellofa2-Dshapeto…

Fromacontrolpointcellto…

FromConnectsproperty

ReturnsaConnectscollectionoftheshapesconnectedtoashape.

Versionadded

4.5

Syntax

objRet=object.FromConnectsobjRet TheConnectscollectionofshapesconnectedtothisshape.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

TheFromConnectspropertyofashapereturnsaConnectscollectionthatcontainseveryConnectobjectforwhichtheshapeistheToSheetproperty.Thistellsyoualltheshapesconnectedtoashape.

ToobtainaConnectscollectionthatcontainseveryConnectobjectforwhichtheshapeistheFromSheetproperty,usetheshape'sConnectsproperty.This

Example

tellsyoualltheshapestowhichtheshapeisconnected.

FromPartproperty

Returnsthepartofashapefromwhichaconnectionoriginates.

Versionadded

2.0

Syntax

retVal=object.FromPartretVal Integer.Thepartoftheshapewheretheconnectionoriginates.object Required.AnexpressionthatreturnsaConnectobject.

Remarks

ThefollowingconstantsdeclaredbytheVisiotypelibraryshowreturnvaluesfortheFromPartproperty.

Constant ValuevisConnectFromError -1visFromNone 0

visLeftEdge 1visCenterEdge 2visRightEdge 3visBottomEdge 4visMiddleEdge 5visTopEdge 6visBeginX 7visBeginY 8visBegin 9visEndX 10visEndY 11visEnd 12visFromPin 13visFromAngle 14visControlPoint 100+zero-basedrowindex(forexample,

visControlPoint=100ifthecontrolpointisinrow0;visControlPoint=101ifthecontrolpointisinrow1)

FromSheetproperty

Returnstheshapefromwhichaconnectionorconnectionsoriginate.

Versionadded

2.0

Syntax

objRet=object.FromSheetobjRet TheShapeobjectfromwhichtheconnectionsoriginate.object Required.AnexpressionthatreturnstheConnectobjector

Connectscollectiontoexamine.

Remarks

TheFromSheetpropertyforaConnectobjectisstraightforward.ItalwaysreturnstheshapefromwhichtheConnectobjectoriginates.

AConnectscollectionrepresentsseveralconnections.Ifeveryconnectionrepresentedbythecollectionoriginatesfromthesameshape,theFromSheet

propertyforthecollectionreturnsthatshape.Otherwise,theFromSheetpropertyreturnsNothinganddoesnotraiseanexception.

FullBuildproperty

Returnsthefullbuildnumberoftherunninginstance.

Versionadded

2002

Syntax

retVal=object.FullBuildretVal Long.Thebuildnumber.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

Theformatofthebuildnumberisdescribedinthefollowingtable.

Bits Description0-15 Internalbuildnumber16-20 Internalrevisionnumber

Example

21-25 Minorversionnumber26-30 Majorversionnumber(Visio2002=10)31 Reserved

ThebuildnumberoftherunninginstanceiswrittentotheFullBuildNumberCreatedpropertywhenanewdocumentiscreated,andtotheFullBuildNumberEditedpropertywhenadocumentisedited.

FullBuildNumberCreatedproperty

Returnsthefullbuildnumberoftheinstanceusedtocreatethedocument.

Versionadded

2002

Syntax

retVal=object.FullBuildNumberCreatedretVal Long.Thebuildnumberwhenthedocumentwascreated.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Theformatofthebuildnumberisdescribedinthefollowingtable.

Bits Description0-15 Internalbuildnumber16-20 Internalrevisionnumber

Example

21-25 Minorversionnumber26-30 Majorversionnumber(Visio2002=10)31 Reserved

FullBuildNumberEditedproperty

Returnsthefullbuildnumberoftheinstancelastusedtoeditthedocument.

Versionadded

2002

Syntax

retVal=object.FullBuildNumberEditedretVal Long.Thebuildnumberwhenthedocumentwaslastedited.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Theformatofthebuildnumberisdescribedinthefollowingtable.

Bits Description0-15 Internalbuildnumber16-20 Internalrevisionnumber

Example

21-25 Minorversionnumber26-30 Majorversionnumber(Visio2002=10)31 Reserved

FullNameproperty

Returnsthenameofadocument,includingthedriveandpath.

Versionadded

2.0

Syntax

strRet=object.FullNamestrRet String.Thefilenameofthedocument.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

UsetheFullNamepropertytoobtainadocument'sdrive,folderpath,andfilenameasonestring.ThereturnedvaluecanincludeUNCdrivenames(forexample,\\bob\leo).

Example

GeometryCountproperty

ReturnsthenumberofGeometrysectionsforashape.

Versionadded

2.0

Syntax

intRet=object.GeometryCountintRet Integer.ThenumberofGeometrysectionsfortheshape.object Required.AnexpressionthatreturnsaShapeobject.

GestureFormatSheetproperty

Returnsareferencetoadocument'sGestureFormatsheet,whichcontainstheline,fill,andtextformattingthatisappliedtoshapesdrawnonthepage.

Versionadded

2000

Syntax

objRet=object.GestureFormatSheetobjRet AShapeobjectthatcontainsline,fill,andtextformattingtobe

appliedtoshapesdrawnonthepage.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Bydefault,anewshapeinheritsallitsformattingfromthedocument'sdefaultstyles.However,iftheGestureFormatsheetcontainslocalformatting,thatformattingisappliedtothenewshape.UsetheFillStyle,LineStyle,andTextStylepropertiestoapplylocalformattingtotheGestureFormatShape

Example

object.

GestureFormatsheetformattingdoesnotapplytoinstancesofmasters,connectors,pastedobjects,orembeddedobjects.

Adocument'sGestureFormatsheetisclearedautomaticallywhenadocumentisopened.

Ifausermakeschangestoanyshapeusingshapeformattingcommandsonthemenusandtoolbars,butnoshapesarecurrentlyselected,thisformattingisstoredinthegestureformatsheetandappliedtonewshapestheuserdraws.

GlueEnabledproperty

Determineswhetherglueisenabledinthedocument.

Versionadded

2002

Syntax

retVal=object.GlueEnabledobject.GlueEnabled=newValretVal Boolean.Trueifglueisenabled;otherwiseFalse.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredBoolean.Truetoenablegluebehavior;Falseto

disablegluebehavior.

Remarks

ThevalueoftheGlueEnabledpropertycorrespondstothesettingoftheGluecheckboxontheGeneraltabintheSnap&Gluedialogbox(ontheToolsmenu,clickSnap&Glue).

Seealso Example

GlueSettingsproperty

Determinestheobjectsthatshapesgluetowhenglueisenabledinthedocument.

Versionadded

2002

Syntax

retVal=object.GlueSettingsobject.GlueSettings=newValretVal VisGlueSettings.Theobjectsinadocumentthatshapesglue

to.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredVisGluesettings.Theobjectsinadocumentthat

shapesglueto.

Remarks

ThevalueoftheGlueSettingspropertyisequivalenttoselectingoptionsunderGluetoontheGeneraltabintheSnap&Gluedialogbox(ontheToolsmenu,clickSnap&Glue).

TheGlueSettingspropertycanbeanycombinationofthefollowingVisGlueSettingsconstants,whicharedeclaredintheVisiotypelibrary.

Constant Value Description

Seealso Example

visGlueToNone &H0 Glueisenabledbutnoothergluesettingsareon.

visGlueToGuides &H1 Gluetoguides.visGlueToHandles &H2 Gluetoshapehandles.visGlueToVertices &H4 Gluetoshapevertices.visGlueToConnectionPoints &H8 Gluetoconnectionpoints.visGlueToGeometry &H20 Gluetoshapegeometry.visGlueToDisabled &H8000 Disableglue.

Greenproperty

GetsorsetstheintensityofthegreencomponentofaColorobject.

Versionadded

4.0

Syntax

intRet=object.Greenobject.Green=intValintRet Integer.Thecurrentvalueofthecolor'sgreencomponent.object Required.AnexpressionthatreturnsaColorobject.intVal RequiredInteger.Thenewvalueofthecolor'sgreen

component.

Remarks

TheGreenpropertycanbeavaluefrom0to255.

Example

Acolorisrepresentedbyred,green,andbluecomponents.Italsohasflagsthatindicatehowthecoloristobeused.ThesecorrespondtomembersoftheMicrosoftWindowsPALETTEENTRYdatastructure.Fordetails,searchfor"PALETTEENTRY"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

HeaderCenterproperty

Containsthetextstringthatappearsinthecenterportionofadocument'sheader.

Versionadded

2002

Syntax

strRet=object.HeaderCenterobject.HeaderCenter=stringExpressionstrRet String.Thetextinthecenterportionoftheheader.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Newtextforthecenterportionoftheheader.

Remarks

YoucanalsosetthisvalueintheCenterboxunderHeaderintheHeaderandFooterdialogbox(ontheViewmenu,clickHeaderandFooter).

Example

BothstrRetandstrExpressioncancontainescapecodesthatrepresentdata.Theseescapecodescanbeconcatenatedwithothertext.ForalistofvalidescapecodesyoucanusewiththeHeaderCenterproperty,seetheFooterLeftproperty.

Example

Thefollowingmacroisusedtoplacethestringcontaining"DocumentTitle"intothecenterportionofthedocument'sheader.

SubSetHeaderCenter()'SetheaderofcurrentdocumentThisDocument.HeaderCenter="DocumentTitle"EndSub

Afterrunningthismacro,"DocumentTitle"isdisplayedinthecenterofthedocumentheader.

HeaderFooterColorproperty

Specifiesthecoloroftheheaderandfootertext.

Versionadded

2002

Syntax

colorRet=object.HeaderFooterColorobject.HeaderFooterColor=colorValcolorRet OLE_COLOR.Thecoloroftheheaderandfootertext.object Required.AnexpressionthatreturnsaDocumentobject.colorVal RequiredOLE_COLOR.Thenewcolorfortheheaderand

footertext.

Remarks

ValidvaluesforanOLE_COLORpropertywithinVisiocanbeoneofthefollowing:

Example

&H00bbggrr,wherebbisthebluevaluebetween0and0xFF(255),ggthegreenvalue,andrrtheredvalue.

&H800000x,wherexxisavalidGetSysColorindex.

FordetailsabouttheGetSysColorfunction,searchfor"GetSysColor"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

TheOLE_COLORdatatypeisusedforpropertiesthatreturncolors.WhenapropertyisdeclaredasOLE_COLOR,thePropertieswindowwilldisplayacolor-pickerdialogboxthatallowstheusertoselectthecolorforthepropertyvisually,ratherthanhavingtorememberthenumericequivalent.

YoucanalsosetthisvalueintheColorboxintheChooseFontdialogbox(ontheViewmenu,clickHeaderandFooter,andthenclickChooseFont).

Example

Thefollowingmacroisusedtoassignthecolorbluetotextintheheaderandfooter.

SubSetHeaderFooterColor()'Setcoloroftheheaderofthis'documenttoblueThisDocument.HeaderFooterColor=&H00FF0000EndSub

Afterrunningthismacro,theheadertextwilldisplaybluetext.

HeaderFooterFontproperty

Specifiesthefontusedfortheheaderandfootertext.

Versionadded

2002

Syntax

fontRet=object.HeaderFooterFontobject.HeaderFooterFont=fontValfontRet AnIFontDispobjectthatrepresentsthefontoftheheaderand

footertext.object Required.AnexpressionthatreturnsaDocumentobject.fontVal RequiredIFontDisp.AnIFontDispobjectrepresentingthe

newfontfortheheaderandfootertext.

Remarks

COMprovidesastandardimplementationofafontobjectwiththeIFontDisp

Example

interfaceontopoftheunderlyingsystemfontsupport.TheIFontDispinterfaceexposesafontobject'spropertiesandisimplementedinthestdoletypelibraryasaStdFontobjectthatcanbecreatedinMicrosoftVisualBasic.ThestdoletypelibraryisautomaticallyreferencedfromallVisualBasicforApplications(VBA)projectsinVisio.

TogetinformationabouttheStdFontobjectthatsupportstheIFontDispinterface:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,clickstdole.

UnderClasses,examinetheclassnamedStdFont.

FordetailsabouttheIFontDispinterface,seetheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

ThisistheequivalentofsettingvaluesintheFontboxintheChooseFontdialogbox(ontheViewmenu,clickHeaderandFooter,andthenclickChooseFont).

Example

ThefollowingsamplecodeillustratesgettingareferencetothecurrentFontobjectandchangingtwoofitsattributes,itsnameandboldness.

PublicSubSetHeaderFooterFontNonBoldArial()DimoStdFontAsStdFontSetoStdFont=ThisDocument.HeaderFooterFontoStdFont.Name="Arial"oStdFont.Bold=FalseSetThisDocument.HeaderFooterFont=oStdFontEndSub

Afterrunningthismacro,theheaderandfootertextaredisplayedinno-bold,Arial.

HeaderLeftproperty

Containsthetextstringthatappearsintheleftportionofadocument'sheader.

Versionadded

2002

Syntax

strRet=object.HeaderLeftobject.HeaderLeft=stringExpressionstrRet String.Thetextintheleftportionoftheheader.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Newtextfortheleftportionoftheheader.

Remarks

YoucanalsosetthisvalueintheLeftboxunderHeaderintheHeaderandFooterdialogbox(ontheViewmenu,clickHeaderandFooter).

Example

BothstrRetandstrExpressioncancontainescapecodesthatrepresentdata.Theseescapecodescanbeconcatenatedwithothertext.ForalistofvalidescapecodesyoucanusewiththeHeaderLeftproperty,seetheFooterLeftproperty

Example

Thefollowingmacroisusedtoplaceastringcontainingthecurrentdateintotheleftportionofadocument'sheader.

SubSetHeaderLeft()DimszHeaderasString'BuildheaderstringszHeader="TheDateis"&"&D"'SetheaderofcurrentdocumentThisDocument.HeaderLeft=szHeaderEndSub

IfthedatewasMay4,2002,theleftportionoftheheadercontains"TheDateisThursday,May4,2002"afterrunningthismacro.

HeaderMarginproperty

Getsorsetsthemarginofadocument'sheader.

Versionadded

2002

Syntax

retVal=object.HeaderMargin([unitsNameOrCode])object.HeaderMargin([unitsNameOrCode])=newValretVal Double.Themarginsize.object Required.AnexpressionthatreturnsaDocumentobject.unitsNameOrCodeOptionalVariant.Theunitstousewhenretrievingorsetting

thecell'svalue.Defaultstointernaldrawingunits(inches).newVal RequiredDouble.Thenewmarginsize.

Remarks

YoucanalsosetthisvalueintheMarginboxunderHeaderintheHeaderand

Example

Footerdialogbox(ontheViewmenu,clickHeaderandFooter).

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

HeaderRightproperty

Containsthetextstringthatappearsintherightportionofadocument'sheader.

Versionadded

2002

Syntax

strRet=object.HeaderRightobject.HeaderRight=stringExpressionstrRet String.Thetextintherightportionoftheheader.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Newtextfortherightportionoftheheader.

Remarks

YoucanalsosetthisvalueintheRightboxunderHeaderintheHeaderandFooterdialogbox(ontheViewmenu,clickHeaderandFooter).

Example

BothstrRetandstrExpressioncancontainescapecodesthatrepresentdata.Theseescapecodescanbeconcatenatedwithothertext.ForalistofvalidescapecodesyoucanusewiththeHeaderRightproperty,seetheFooterLeftproperty.

Heightproperty

Getstheheightofamenusetortoolbar.

Versionadded

2000

Syntax

intRet=object.HeightintRet Integer.Theheight.object Required.AnexpressionthatreturnsaMenuSetorToolbar

objectforwhichyouwanttogettheheight.

Remarks

Iftheobjectisdockedorprotectedfromresizing,theapplicationreturnsanerror.

Example

Helpproperty

Getsorsetsthehelpstringforashape.

Versionadded

3.0

Syntax

strRet=object.Helpobject.Help=strExpressionstrRet String.Thecurrenthelpstring.object Required.AnexpressionthatreturnsaShapeobject.strExpression RequiredString.Thenewhelpstring.

Remarks

UsingtheHelppropertyisequivalenttoenteringavalueintheHelpboxforashapeintheSpecialdialogbox(clickSpecialontheFormatmenu).Thelimitforahelpstringis127characters.

Seealso Example

HelpContextIDproperty

GetsorsetsthehelpcontextIDtobeusedbyamenuortoolbaritem.

Versionadded

4.0

Syntax

object.HelpContextID=intValintVal=object.HelpContextIDobject Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemobjectthathasorgetsthecontextID.intVal Integer.ThecontextIDofatopicinahelpfile.

Remarks

ForVisiocommands,theHelpContextIDpropertyisusuallythesamevalueastheCmdNumproperty,whichcontainsthecommandID.CommandIDsaredeclaredbytheVisiotypelibraryandhavetheprefixvisCmd.

Example

Bydefault,thevalueoftheHelpContextIDpropertyiszero(0),whichdisplaystheContentstopicofthehelpfileindicatedbytheHelpFileproperty.

IfthevalueoftheHelpContextIDpropertyiszeroandtheobject'sCmdNumpropertyissettooneoftheVisiocommandIDs,itusesthedefaulthelpcontextIDfromthebuilt-inVisiouserinterface.

HelpFileproperty

Getsorsetsthehelpfiletobeusedbyamenuortoolbaritem.

Versionadded

4.0

Syntax

object.HelpFile=fileStrfileStr=object.HelpFileobject Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemobjectthathasorgetsthehelpfile.fileStr RequiredString.Thenameofthehelpfile.

Remarks

Ifyouprovideafullyqualifiedpathalongwiththenameofthehelpfile,theapplicationsearchesthefoldersspecifiedintheHelpPathspropertyoftheApplicationobject.

Example

IfHelpFileisnullandtheobject'sCmdNumpropertyissettooneoftheVisiocommandIDs,yourprogramusesthedefaulthelpfilefromthebuilt-inVisiouserinterface.

NoteSettheHelpContextIDpropertyoftheobjecttodisplayaparticulartopicwithinahelpfile.

HelpPathsproperty

GetsorsetsthepathswhereMicrosoftVisiolooksforhelpfiles.

Versionadded

4.0

Syntax

strRet=object.HelpPathsobject.HelpPaths=pathsStrstrRet String.AtextstringcontainingalistoffolderswhereVisio

looksforhelpfiles.Individualitemsareseparatedbysemicolons.

object Required.AnexpressionthatreturnsanApplicationobject.pathsStr RequiredString.Atextstringcontainingalistoffolders;to

indicatemorethanonefolder,separateindividualitemsinthepathstringwithsemicolons.

Remarks

ThestringpassedtoandreceivedfromtheHelpPathspropertyisthesamestringshownontheFilePathstabintheOptionsdialogbox(clickOptionsontheToolsmenu).ThisstringisstoredinHKEY_CURRENT_USER\Software\Microsoft\Visio\application\HelpPath.

Whentheapplicationlooksforhelpfiles,itlooksinallpathsnamedintheHelpPathspropertyandallthesubfoldersofthosepaths.IfyoupasstheHelpPathspropertytotheEnumDirectoriesmethod,itreturnsacompletelistoffullyqualifiedpathsinwhichVisiolooks.

Ifapathisnotfullyqualified,theapplicationlooksforthefolderinthefolderthatcontainstheVisioprogramfiles(appObj.Path).Forexample,iftheVisioexecutablefileisinstalledinc:\Visio,andtheHelpPathspropertyis"Help;d:\Help",theVisioapplicationlooksforhelpfilesinbothc:\Visio\Helpandd:\Help.

Hiddenproperty

Hidesamasteronastencilorastyleintheuserinterface.

Versionadded

2000

Syntax

intRet=object.Hiddenobject.Hidden=intExpressionintRet Integer.True(-1)iftheobjectishidden;otherwiseFalse(0).object Required.AnexpressionthatreturnsaMasterorStyleobject

thatishidden.intExpression RequiredInteger.True(-1)tohidetheobject;otherwiseFalse

(0).

Remarks

AmasterthatishiddenstillappearsintheDrawingExplorer.

Seealso Example

HitTestproperty

Determinesifagivenx,ypositionhitsoutside,inside,orontheboundaryofashape.

Versionadded

4.5

Syntax

intRet=object.HitTest(x,y,tolerance)intRet Integer.Anycombinationofthevaluesoftheconstants

prefixedbyvisHit.SeeRemarks.object Required.AnexpressionthatreturnsaShapeobject.x RequiredDouble.Thex-coordinatetobetestedforahit.y RequiredDouble.They-coordinatetobetestedforahit.tolerance RequiredDouble.Howclosex,ymustbetoashapeforahitto

occur.

Remarks

Example

TheHitTestpropertyconsidersonlyvisiblegeometry,andignoreshiddengeometry.

Useinternaldrawingunits(inchesinthedrawing)forthex,y,andtolerancevalues.Thesevaluesshouldalsobein,andwithrespectto,thecoordinatespaceofthepage,master,orgroupshapethatcontainstheshapebeinghittested.

ThefollowingarepossiblevaluesofintRet,andaredeclaredbytheVisiotypelibraryinVisHitTestResults.

Constant ValuevisHitOutside 0visHitOnBoundary 1visHitInside 2

hwndproperty

GetsorsetstheHWNDfieldoftheMSGstructurebeingwrapped.

Versionadded

2002

Syntax

retVal=object.hwnd

object.hwnd=newValretVal Long.Ahandletothewindowthatfiredthe

OnKeystrokeMessageForAddonevent.object Required.AnexpressionthatreturnsaMSGWrapobject.newVal RequiredLong.Thenewwindowhandle.

Remarks

ThepropertiesoftheMSGWrapobjectcorrespondtothefieldsintheMSG

Example

structuredefinedaspartoftheMicrosoftWindowsoperatingsystem.

Fordetails,searchfor"MSGstructure"ontheMicrosoftDeveloperNetwork(MSDN)Website.

Hyperlinkproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertyreturnedaHyperlinkobjectthatrepresentedashape'shyperlink.

Seealso Example Appliesto

HyperlinkBaseproperty

GetsorsetsthevalueoftheHyperlinkbasefieldinaDocumentobject'sproperties.

Versionadded

5.0

Syntax

strRet=object.HyperlinkBaseobject.HyperlinkBase=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueofthefield.

Remarks

SettingtheHyperlinkBasepropertyisequivalenttoenteringinformationintheHyperlinkbaseboxinthePropertiesdialogbox(clickPropertiesontheFile

Example

menu).

Hyperlinksproperty

ReturnstheHyperlinkscollectionforaShapeobject.

Versionadded

2000

Syntax

objsRet=object.HyperlinksobjsRet TheHyperlinkscollectionforaShapeobject.object Required.AnexpressionthatreturnsaShapeobject.

Seealso Example

Iconproperty

Returnstheiconcontainedinamaster,mastershortcut,orwindow.

VersionAdded

2002

Syntax

objRet=object.Icon

object.Icon=objValobjRet AnIPictureDispobjectthatrepresentsanicon.object Required.AnexpressionthatreturnsaMaster,

MasterShortcut,orWindowobject.objVal AnIPictureDispobjectthatrepresentsanewicon.

Remarks

TheIconpropertyreturnsandacceptsonlyHICONfiles.Visioraisesan

Example

exceptionifobjExpressioncontainsanon-HICONfile.

COMprovidesastandardimplementationofapictureobjectwiththeIPictureDispinterfaceontopoftheunderlyingsystempicturesupport.TheIPictureDispinterfaceexposesapictureobject'spropertiesandisimplementedinthestdoletypelibraryasaStdPictureobjectcreatablewithinMicrosoftVisualBasic.ThestdoletypelibraryisautomaticallyreferencedfromallVisualBasicforApplicationprojectsinVisio.

TogetinformationabouttheStdPictureobjectthatsupportstheIPictureDispinterface:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,clickstdole.

UnderClasses,examinetheclassnamedStdPicture.

FordetailsabouttheIPictureDispinterface,seetheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Currently,onlyin-procsolutionscanusetheIconpropertybecausetheIPictureDispinterfacecannotbemarshaled.

IconSizeproperty

Getsorsetsthesizeofamastericon.

Versionadded

2.0

Syntax

intRet=object.IconSize

object.IconSize=newSizeintRet Thecurrentsizeofthemastericon.object Required.AnexpressionthatreturnsaMasteror

MasterShortcutobject.newSize Thenewsizeforthemastericon.

Remarks

ThefollowingconstantsdeclaredbytheVisiotypelibraryshowthepossible

Example

valuesfortheIconSizeproperty.

Constant ValuevisNormal 1visTall 2visWide 3visDouble 4

IconUpdateproperty

Determineswhetheramastericonisupdatedmanuallyorautomatically.

Versionadded

2.0

Syntax

intRet=object.IconUpdate

object.IconUpdate=updateModeintRet Thecurrentupdatemodeforthemastericon.object Required.AnexpressionthatreturnsaMasterobject.updateMode Thenewupdatemodeforthemastericon.

Remarks

ThefollowingconstantsdeclaredbytheVisiotypelibraryshowthepossiblevaluesfortheIconUpdateproperty.

Example

Constant ValuevisManual 0visAutomatic 1

IDproperty

GetstheIDofanobject.

Versionadded

4.0

Syntax

intVal=object.IDintVal Long.TheIDoftheobject.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

TheIDofashapeisuniqueonlywithinthescopeofthepageormaster.TheIDofapage,master,orstyleisuniquewithinthescopeofthedocument.

Ifashape,page,master,orstyleisdeleted,futureobjectsinthesamescopemaybeassignedthesameID.ThereforepersistingshapeorstyleIDsinseparatedata

Example

storesisgenerallynotassoundaspersistinguniqueIDsusingtheUniqueIDproperty.

ForShapeobjects,youcanusetheIDpropertywithmethodssuchasGetResultsandPutResultstogetorsetmanycellvaluesatonce,possiblycellsinmanydifferentshapes.Todothis,youneedtopassshapeIDstothemethods.IfyoucreateshapesusingtheDropManymethod,themethodreturnstheIDsoftheshapesitcreatestoyourprogram.

ForFontobjects,theIDpropertycorrespondstothenumberstoredintheFontcelloftherowinashape'sCharacterPropertiessection.Forexample,toapplythefontnamed"Arial"toashape'stext,createaFontobjectrepresenting"Arial"andgettheIDofthatfont,thensettheCharPropspropertyoftheShapeobjecttothatID.

TheIDassociatedwithaparticularfontvariesfromsystemtosystemorasfontsareinstalledandremovedonagivensystem.

ForWindowobjects,theIDpropertycanbeusedwiththeItemFromIDpropertyofaWindowscollectiontoretrieveaWindowobjectfromaWindowscollectionwithoutiteratingthroughthecollection.AWindowobjectwithaTypepropertyofvisAnchorBarBuiltInreturnsanIDofvisWinIDCustProp,visWinIDDrawingExplorer,visWinIDPanZoom,orvisWinIDSizePos.AWindowobjectwithaTypepropertyofvisAnchorBarAddonreturnsanIDthatisuniquewithinitsWindowscollectionforthelifetimeofthatcollection.IfaWindowobjecthasanIDofvisInvalWinID,youcannotretrievetheWindowobjectfromitscollectionusingtheItemFromIDproperty.

ForEventobjects,theIDpropertyuniquelyidentifiesanEventobjectinitsEventListcollection.AslongasareferenceisheldonanEventListcollection,oronthesourceobjectofanEventListcollection,youcancachetheIDpropertyofanyEventobjectinthelist.Evenifothereventsareaddedtoorremovedfromthelist,thecachedIDcanbeusedlatertoidentifytheoriginalevent.Ifaneventispersistent,itsIDcanbecachedindefinitely.WhiletheeventwiththatIDmightberemoved,nonewEventobjectinthesameEventListcollectionisgiventhesameID.

IncludesFillproperty

Indicateswhetherthestyleincludesfillattributes.

Versionadded

4.0

Syntax

intRet=object.IncludesFillobject.IncludesFill=intExpressionintRet Integer.False(0)iftheobjectdoesn'tdefinefillattributes;

True(-1)ifitdoes.object Required.AnexpressionthatreturnsaStyleobject.intExpression RequiredInteger.False(0)todisablefillattributes;True(non-

zero)toenablethem.

Remarks

TheIncludesFillpropertycorrespondstotheFillcheckboxunderIncludesin

Example

theDefineStylesdialogbox(clickDefineStylesontheFormatmenu).

IncludesLineproperty

Indicateswhetherthestyleincludeslineattributes.

Versionadded

4.0

Syntax

intRet=object.IncludesLineobject.IncludesLine=intExpressionintRet Integer.False(0)iftheobjectdoesn'tdefinelineattributes;

True(-1)ifitdoes.object Required.AnexpressionthatreturnsaStyleobject.intExpression RequiredInteger.False(0)todisablelineattributes;True

(non-zero)toenablethem.

Remarks

TheIncludesLinepropertycorrespondstotheLinecheckboxunderIncludes

Example

intheDefineStylesdialogbox(clickDefineStylesontheFormatmenu).

IncludesTextproperty

Indicateswhetherthestyleincludestextattributes.

Versionadded

4.0

Syntax

intRet=object.IncludesTextobject.IncludesText=intExpressionintRet Integer.False(0)iftheobjectdoesn'tdefinetextattributes;

True(-1)ifitdoes.object Required.AnexpressionthatreturnsaStyleobject.intExpression RequiredInteger.False(0)todisabletextattributes;True

(non-zero)toenablethem.

Remarks

TheIncludesTextpropertycorrespondstotheTextcheckboxunderIncludesin

Example

theDefineStylesdialogbox(clickDefineStylesontheFormatmenu).

Indexproperty

Getstheordinalpositionofanobjectinacollection.

Versionadded

2.0

Syntax

intRet=object.IndexintRet IntegerorLong.Theindexoftheobjectwithinitscollection.

SeeRemarksforreturndatatypeinformation.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

Object ReturndatatypeAddon,Document,Event,Font,Layer,Master,MasterShortcut,Row,Section,Window

Integer

Example

Color,Connect,Menu,MenuItem,Shape,Style,Toolbar,ToolbarItem

Long

Mostcollectionsareindexedstartingwith1ratherthanzero(0),sotheindexofthefirstelementis1,theindexofthesecondelementis2,andsoforth.Theindexofthelastelementinacollectionisthesameasthevalueofthatcollection'sCountproperty.Youcaniteratethroughacollectionbyusingtheseindexvalues.Addingobjectstoordeletingobjectsfromacollectioncanchangetheindexvaluesofotherobjectsinthecollection.

Therearesomeexceptions.TheColorcollectionisindexedstartingwith0.ThisisconsistentwiththenumberingdisplayednexttothecolorsthatappearintheColorPalettedialogbox(clickColorPaletteontheToolsmenu).

Thesecollectionsarealsoindexedstartingwith0:AccelItems,AccelTables,MenuSets,MenuItems,Menus,ToolbarItems,Toolbars,andToolbarSets.

Indexproperty(Pageobject)

GetsorsetstheordinalpositionofapageinaPagescollection.

Versionadded

2002

Syntax

intRet=object.Indexobject.Index=intExpressionintRet Integer.Theindexofthepagewithinitscollection.object Required.AnexpressionthatreturnsaPageobject.intExpression RequiredInteger.Thenewindexofapagewithinits

collection.

Remarks

ThePagescollectionisindexedstartingwith1ratherthanzero(0),sotheindexofthefirstelementis1,theindexofthesecondelementis2,andsoon.The

Example

indexofthelastelementinacollectionisthesameasthevalueofthatcollection'sCountproperty.Youcaniteratethroughacollectionbyusingtheseindexvalues.Addingobjectstoordeletingobjectsfromacollectioncanchangetheindexvaluesofotherobjectsinthecollection.

Youmayonlyassignanewindextoaforegroundpage.Backgroundpagesareunordered.UsetheBackgroundpropertytodetermineifagivenpageisabackgroundpage.

UsetheBackPagepropertytoassignabackgroundpagetoaforegroundpageortoanotherbackgroundpage.

IndexInStencilproperty

Containstheindexofamasterormastershortcutobjectwithinitsstencil.

Versionadded

2000

Syntax

intRet=object.IndexInStencilobject.IndexInStencil=intExpressionintRet Integer.Theindexoftheobjectwithinitsstencil.object Required.AnexpressionthatreturnsaMasteror

MasterShortcutobject.intExpression RequiredInteger.Thenewindexoftheobjectwithinits

stencil.

Remarks

BeginningwithVisio2000,thedocumentstencilwindowshowsallMasterandMasterShortcutobjectsinaVisiodocument.TheVisioobjectmodelexposestheMasterandMasterShortcutobjectsinaDocumentobjectastwodistinctcollections.TheindexreturnedbyaMasterobjectisitsindexwithrespecttootherMasterobjectsinitsDocumentobjectandisunrelatedtothepresenceorabsenceofMasterShortcutobjectsinthedocument.TheindexreturnedbyaMasterShortcutobjectisitsindexwithrespecttootherMasterShortcutobjectsinitsDocumentobjectandisunrelatedtothepresenceorabsenceof

Seealso Example

Masterobjectsinthedocument.

UsetheIndexInStencilpropertytomaintaintherelativeorderofMasterandMasterShortcutobjectswhenconsideredasasinglecollection.

InheritedFormulaSourceproperty

Returnsthecellfromwhichthiscellinheriteditsformula.

Versionadded

2002

Syntax

objRet=object.InheritedFormulaSourceobjRet TheCellobjectthatcontainstheformulathatobjectinherited.object TheCellobjectthatcontainstheformula.

Remarks

IftheformulainthisCellisalocalformula,thentheInheritedFormulaSourcepropertyreturnsitself.

Example

InheritedValueSourceproperty

Returnsthecellfromwhichthiscellinheriteditsvalue.

Versionadded

2002

Syntax

objRet=object.InheritedValueSourceobjRet TheCellobjectthatcontainsthevaluewhichobjectinherited.object TheCellobjectthatcontainsthevalue.

Remarks

Ifthevalueinobjectisalocalvalue,thentheInheritedValueSourcepropertyreturnsitself.

Example

InhibitSelectChangeproperty

Determineswhethershapesareselectedinthedrawingwindow.

Versionadded

2002

Syntax

boolRet=object.InhibitSelectChangeobject.InhibitSelectChange=boolExpressionboolRet Boolean.Trueifshapesarenotselected;otherwise,False.object Required.AnexpressionthatreturnsanApplicationobject.boolExpression RequiredBoolean.Truetonotselectshapes;otherwise,False.

Remarks

UsetheInhibitSelectChangepropertytocontrolshapeselectionandincreaseperformancewhendroppingaseriesofshapesinthedrawingwindow.WhentheInhibitSelectChangepropertyisTrue,Visiodoesnotselectanyshapesaftertheyaredropped.Yoursolution,however,canselectshapes.

Additionally,Visioattemptstopreservecurrentlyselectedshapeswheneverpossible,unlessshapesaredeselectedbythesolution.

IfaprogramneglectstoturntheInhibitSelectChangepropertyoff(False)afterturningiton,theVisioinstancewillturnitbackoffwhentheuserperformsan

Seealso Example

operation.

InPlaceproperty

Specifieswhetherawindowisopenin-place,orwhetheradocumentisbeingviewedthroughawindowthatisopenin-place.

Versionadded

2002

Syntax

intRet=object.InPlaceintRet Integer.True(-1)ifawindowordocumentinawindowis

openin-place;otherwise,False(0).object Required.AnexpressionthatreturnsaDocumentorWindow

object.

Remarks

WhenthevalueoftheInPlacepropertyisTrueforaWindowobject,itmeansthatthewindowisanin-placeactivewindow.ItcontainsadocumentthatisbeingeditedinanOLEcontainerapplication.

WhenthevalueoftheInPlacepropertyisTrueforaDocumentobject,itmeansthatthedocumentisopeninanin-placeeditingwindowinanOLEcontainerapplication.

Seealso Example

InstanceHandle32property

GetstheinstancehandleoftheApplicationobjectfora32-bitversionofMicrosoftVisio.

Versionadded

4.0

Syntax

longRet=object.InstanceHandle32longRet Long.Theinstancehandleoftheobject(a4-bytevalue).object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

CallstotheInstanceHandlepropertyaredirectedtotheInstanceHandle32property.

Example

IsChangedproperty

Determineswhetheramasterhaschangedsinceitwasopened.

Versionadded

2002

Syntax

boolRet=object.IsChangedboolRet Boolean.Trueifthemasterhaschangedsinceitwasopened;

otherwise,False(0).object Required.AnexpressionthatreturnsaMasterobject.

Seealso Example

IsConstantproperty

Determineswhetheraformulaofthecellisaconstantexpression.

Versionadded

4.0

Syntax

intRet=object.IsConstantintRet Integer.True(-1)iftheobject'sformulaisaconstant;

otherwise,False(0).object Required.AnexpressionthatreturnsaCellobject.

Example

IsDefaultLinkproperty

DeterminesthedefaultHyperlinkobjectforashape.

Versionadded

2000

Syntax

boolVal=object.IsDefaultLinkobject.IsDefaultLink=boolExpression

boolVal Boolean.TrueiftheHyperlinkobjectisthedefault;Falseifitisn'tthedefault.

object Required.AnexpressionthatreturnsaHyperlinkobject.

boolExpression RequiredBoolean.TruetosettheHyperlinkobjectasthedefault;otherwise,False.

Remarks

WhenyousetthevalueoftheIsDefaultLinkpropertytoTrueforaHyperlinkobject,thevalueforallotherHyperlinkobjectsisautomaticallysettoFalse.WhenyousetthevalueofthispropertytoFalseforaHyperlinkobject,theotherHyperlinkobjectsaren'taffected.

Seealso Example

IsEditingOLEproperty

DetermineswhetheradrawingwindowcontainsanActiveXcontrolthathasfocus,oranembeddedorlinkedobjectthatisbeingedited.

Versionadded

2000

Syntax

boolRet=object.IsEditingOLEboolRet RequiredBoolean.TrueifanActiveXcontrolhasfocusoran

OLEobjectisbeingedited;Falseifnot,orifthewindowbeingexaminedisnotadrawingwindow.

object Required.AnexpressionthatreturnsaWindowobject.

Seealso Example

IsEditingTextproperty

Determineswhetheratexteditingsessionisactiveinthedrawingwindow.

Versionadded

2000

Syntax

boolRet=object.IsEditingTextboolRet RequiredBoolean.Trueifatexteditingsessionisactive;

Falseifatexteditingsessionisnotactiveorthewindowbeingexaminedisnotadrawingwindow.

object Required.AnexpressionthatreturnsaWindowobject.

Example

IsFieldproperty

DetermineswhetheraCharactersobjectrepresentstheexpandedtextofasinglefieldwithnoadditionalnon-fieldcharacters.

Versionadded

3.0

Syntax

intRet=object.IsFieldintRet Integer.True(-1)iftheCharactersobjectrepresentsonlythe

expandedtextofafield;otherwise,False(0)iftheCharactersobjectcontainscharactersinadditiontotheexpandedtextofafield.

object Required.AnexpressionthatreturnsaCharactersobject.

Remarks

TochangetherangeoftextrepresentedbyaCharacterobject,setitsBeginandEndproperties.

Example

IsHierarchicalproperty

Indicateswhetheramenu,menuitem,ortoolbaritemishierarchical,thatis,itcontainsadrop-downmenucontainingmoreitems,whichcanbeaccessedthroughitsownMenuItemsorToolbarItemscollectionmenu.

Versionadded

4.0

Syntax

intRet=object.IsHierarchicalintRet Integer.True(-1)iftheobjectrepresentsahierarchicalmenu,

menuitem,ortoolbaritem;otherwise,False(0).object Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemobject.

Remarks

ThevalueoftheCmdNumpropertyofaMenuItemobjectthatrepresentsahierarchicalmenushouldbezero(0).

IsInheritedproperty

Determineswhetheraformulaofthecellisinheritedfromamasterorastyle.

Versionadded

4.0

Syntax

intRet=object.IsInheritedintRet Integer.True(-1)iftheobject'sformulaisinherited;

otherwise,False(0).object Required.AnexpressionthatreturnsaCellobject.

Remarks

IntheShapeSheetwindow,thevaluesandformulasofcellswithlocalvaluesappearinblue.Valuesandformulasofcellsthatinheritfromamasterorstyleappearinblack.

Example

IsInScopeproperty

DetermineswhetheracalltoaneventhandlerisbetweenanEnterScopeeventandanExitScopeeventforascope.

Versionadded

2000

Syntax

boolVal=object.IsInScope(nScopeID)boolVal Boolean.TrueifanEnterScopeeventhasfiredforthescope

ID,butanExitScopeeventhasn'tfiredyet;FalseifanEnterScopeeventhasn'tfiredorEnterScopeandExitScopeeventshavebothfired.

object Required.AnexpressionthatreturnsanApplicationobject.nScopeID RequiredLong.ThescopeID.

Remarks

ConstantsrepresentingscopeIDsareprefixedwithvisCmdandaredeclaredby

theVisiotypelibrary.YoucanalsouseanIDreturnedbytheBeginUndoScopemethod.

YoucouldusethispropertyinaCellChangedeventhandlertodeterminewhetheracellchangewastheresultofaparticularoperation.

IsOpenForTextEditproperty

Indicateswhetherashapeiscurrentlyopenforinteractivetextediting.

Versionadded

2000

Syntax

boolRet=object.IsOpenForTextEditboolRet RequiredBoolean.Trueiftheshapeisopenfortexteditingin

atleastonewindow;Falseiftheshapeisnotopenfortextediting.

object Required.AnexpressionthatreturnsaShapeobject.

Example

IsSeparatorproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,theIsSeparatorpropertyrepresentedaseparatoronamenu.

Seealso Example Appliesto

IsUndoingOrRedoingproperty

DetermineswhetherthecurrenteventhandlerisbeingcalledasaresultofanUndoorRedoactionintheapplication.

Versionadded

2000

Syntax

boolRet=object.IsUndoingOrRedoingboolRet RequiredBoolean.True(-1)iftheapplicationisfiringevents

relatedtoanUndoorRedoaction;otherwise,False(0).object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

TheIsUndoingOrRedoingpropertyreturnsTruewhentheapplicationisfiringeventsrelatedtoanUndoorRedoactionthattheuserhasinitiatedthroughtheuserinterface,orwhichanAutomationclienthasinitiatedbycallingtheUndoorRedomethodofanApplicationobject.

Whentheapplicationcallsaneventhandler,theeventhasa"cause."Ifthatcauseisauseractionoranothereventhandler,thenitislegitimatetoperformundoableactionsduringthecourseofhandlingthatevent.However,ifthecauseoftheeventfiringisanUndoorRedoaction,thentheeventhandlershouldnotperformundoableactions.Doingsoeliminatestheabilitytoredoanaction.

YouwilltypicallyonlyperformundoableactionsinsideaneventhandlerwhenthispropertyisFalse.YoucanperformundoableactionswhentheflagisTrue,buttheredoqueueisdestroyed.

Item[U]property

Returnsanobjectfromacollection.TheItempropertyisthedefaultpropertyforallcollections.

Versionadded

2.0

Syntax

objRet=object.Item(nameUIDOrIndex)objRet Theobjectretrievedfromthecollection.object Required.Anexpressionthatreturnsacollectioninthe

Appliestolist.nameUIDOrIndex RequiredLong,String,orVariant(seeRemarksfordetails).

Containsthename,uniqueID,orindexoftheobjecttoretrieve.

Remarks

ThedatatypefornameUIDOrIndexdependsonthevalueofobject.

DatatypefornameUIDOrIndex

Valuesofobject

Long AccelItems,Acceltables,Colors,Connects,MenuItems,Menu,Menusets,Path,Paths,Selection,ToolbarItems,Toolbars,andToolbarSets

String Eventlist,WindowsVariant Addons,Documents,Fonts,Hyperlinks,Layers,

Masters,MasterShortcuts,OLEObjects,Pages,Shapes,andStyles

Whenretrievingobjectsfromacollection,youcanomitItemfromtheexpressionbecauseitisthedefaultpropertyforallcollections.Thefollowingstatementsareequivalenttothesyntaxexamplegivenabove:

objRet=object(index)objRet=object(stringExpression)

YoucanretrieveanobjectinaPages,Documents,Fonts,Layers,Masters,MasterShortcuts,Styles,Shapes,Addons,orOLEObjectscollectionbypassingtheobject'snameasastringexpressioninaVariant.

IfyouretrieveaShapeobjectbyname,theItempropertysearchesallshapesintheShapescollection'scontainingpageorcontainingmaster,inadditiontothecollection'scontainingshape.Therefore,theShapeobjectreturnedbytheItempropertycanbeashapethatisnotintheShapescollection.

YoucanalsopasstheuniqueIDstringofaMasterorShapeobjecttotheItemproperty.Forexample:

objRet=shpsObj.Item("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

IfsuchastringispassedtotheItempropertyofaShapescollection,alltheshapescontainedinthecollectionaresearched.Shapeswithinthegroupshapesinthecontainingshapearenotsearched.

Tosearchallshapesinthecollection,plustheshapesinsidegroupsandthecontainingshapeofthecollection,prefixtheuniqueIDstringwith"*".For

example:

objRet=shpsObj.Item("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")

NoteInVisio2000only,shpsObj.Item("{guid}")examinedtheShapescollection'scontainingshapeandalldescendants,andshpsObj.Item("*{guid}")examinedallshapesintheShapescollection'scontainingpageorcontainingmaster.

BeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheItempropertytoaccessanobjectintheMasters,Pages,Shapes,Styles,Layers,orMasterShortcutscollectionusingitslocalname.UsetheItemUpropertytoaccessanobjectfromoneofthesecollectionsusingtheobject'suniversalname.

ItemAtIDproperty

ReturnstheAccelTable,MenuSet,orToolbarSetobjectforanIDwithinacollection.

Versionadded

4.0

Syntax

objRet=object.ItemAtID(id)objRet Theobjectretrievedfromthecollection.object Required.AnexpressionthatreturnsanAccelTables,

MenuSets,orToolbarSetscollection.id RequiredLong.TheVisiocontextIDoftheobjecttoretrieve.

Remarks

TheIDcorrespondstoawindoworcontextmenu.ConstantsforIDsareprefixedwithvisUIObjSetandaredeclaredbytheVisiotypelibrary.ForalistofvalidIDsbycollection,seetheSetIDproperty.

ItemFromIDproperty

ReturnsanitemofacollectionusingtheIDoftheitem.

Versionadded

4.0

Syntax

objRet=object.ItemFromID(id)objRet Theobjectretrievedfromthecollection.object Required.Anexpressionthatreturnsacollectionfromthe

Appliestolist.id RequiredLong.TheIDoftheobjecttoretrieve.

Remarks

TheIDofaShapeobjectuniquelyidentifiestheshapewithinitspageormaster.

TheIDofaStyleobjectuniquelyidentifiesthestylewithinitsdocument.

Example

TheIDofaFontobjectcorrespondstothenumberstoredintheFontcellofarowinashape'sCharacterPropertiessection.TheIDassociatedwithaparticularfontvariesbetweensystemsorasfontsareinstalledonandremovedfromagivensystem.

TheIDofanEventobjectuniquelyidentifiesaneventinitsEventListcollectionforthelifeofthecollection.

ItemStatusproperty

IndicatesifaniteminaSelectionobjectissubselected,ifthegrouptowhichitbelongsisselected,orifitistheprimaryitem.

Versionadded

2000

Syntax

intRet=object.ItemStatus(index)intRet Integer.Statusoftheitem.object Required.AnexpressionthatreturnsaSelectionobject.index RequiredLong.Indexoftheitemforwhichyouwantto

retrievethestatus.

Remarks

TheItemStatuspropertyreportsacombinationofthefollowingvalues.

Constant Value Description

Example

visSelIsPrimaryItem &H1 Theitemistheprimaryitem.visSelIsSubItem &H2 Theitemisasubselecteditem.visSelIsSuperItem &H4 Theitemisasuperselecteditem.

IterationModeproperty

ControlswhetheraSelectionobjectreportssubselectedshapesandgroupsinwhichashapeisselected.

Versionadded

2000

Syntax

intRet=object.IterationModeobject.IterationMode=intExpressionintRet Long.Modeoftheselection.object Required.AnexpressionthatreturnsaSelectionobject.intExpression RequiredLong.Bitmaskindicatingwhethersub-andsuper-

selecteditemsshouldbereported.

Remarks

TheitemsinaSelectionobjectareasubsetofthedescendantsoftheSelection

Example

object'scontainingshape.

Atop-levelshapeinaSelectionobjectisanimmediatechildoftheselection'scontainingshape.

AsubselectedshapeinaSelectionobjectisnotanimmediatechildoftheselection'scontainingshape.

AsuperselectedshapeinaSelectionobjecthasatleastoneimmediatechildthatissubselected.

Ifashapeissubselected,theneachofitsancestors—exceptthecontainingshapeitself—issuperselected.

ThevalueoftheIterationModepropertyisacombinationofthefollowingvalues.

Constant Value DescriptionvisSelModeSkipSuper &H0100 Selectiondoesnotreport

superselectedshapes.visSelModeOnlySuper &H0200 Selectiononlyreports

superselectedshapes.visSelModeSkipSub &H0400 Selectiondoesnotreport

subselectedshapes.visSelModeOnlySub &H0800 Selectiononlyreports

subselectedshapes.

WhenaSelectionobjectiscreated,itsinitialiterationmodeisvisSelModeSkipSub+visSelModeSkipSuper.ItreportsneithersubselectednorsuperselectedshapesandbehavesidenticallytoSelectionobjectsinversionsofVisiopriortoVisio2000.

YoucandeterminewhetheranindividualiteminaSelectionobjectisasubselectedorsuperselecteditemusingtheItemStatusproperty.

Keyproperty

GetsorsetstheASCIIkeycodevalueforanaccelerator.

Versionadded

4.0

Syntax

keyVal=object.Keyobject.Key=keyValkeyVal RequiredInteger.TheASCIIvalueofthekeyusedbythe

accelerator.object Required.AnexpressionthatreturnsanAccelItemobject.

Remarks

ForalistofASCIIkeycodevalues,searchfor"Virtual-KeyCodes"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Example

Keywordsproperty

ReturnsorsetsthevalueoftheKeywordsboxinadocument'sproperties.

Versionadded

2.0

Syntax

strRet=object.Keywordsobject.Keywords=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueofthefield.

Remarks

SettingtheKeywordspropertyisequivalenttoenteringinformationintheKeywordsboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

Languageproperty

RepresentsthelanguageIDoftheversionoftheMicrosoftVisioinstancerepresentedbytheApplicationobject.

Versionadded

3.0

Syntax

longRet=object.LanguagelongRet Long.ThelanguageID.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

TheLanguagepropertyreturnsthelanguageIDrecordedintheobject'sVERSIONINFOresource.TheIDsreturnedarethestandardIDsusedbyMicrosoftWindowstoencodedifferentlanguageversions.Forexample,theLanguagepropertyreturns&H0409fortheU.S.EnglishversionofVisio.Fordetails,searchfor"VERSIONINFO"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Seealso Example

LargeButtonsproperty

Determineswhetherlargetoolbarbuttonsareshown.

Versionadded

2000

Syntax

boolVal=object.LargeButtonsobject.LargeButtons=boolExpressionboolVal Boolean.True(non-zero)iflargebuttonsareshown;False(0)

iflargebuttonsarenotshown.object Required.AnexpressionthatreturnsaUIObjectobject.boolExpression RequiredBoolean.True(non-zero)toshowlargebuttons;

Falsetoshowsmallbuttons.

Remarks

YoucanuseanyUIObjectobjecttogetorsetthisproperty.Thepropertyaffectstheentireapplication,andaffectstheappearanceofbuttonsinthecurrentvisiblesetoftoolbars.

BeginningwithMicrosoftVisio2002,thissettingcorrespondstotheLargeiconscheckboxontheOptionstabintheCustomizedialogbox(ontheToolsmenu,clickCustomize)andissharedbetweenVisio2002andallMicrosoftOfficeXPapplications.

Seealso Example

Layerproperty

Returnsthelayertowhichashapeisassigned.

Versionadded

4.0

Syntax

objRet=object.Layer(index)objRet ALayerobjectthatrepresentstherequestedlayer.object Required.AnexpressionthatreturnsaShapeobject.index Integer.Theordinalofthelayertoget.

Remarks

Ifashapeisassignedtothreelayers,thenthevalidindexesthatcanbepassedtoitsLayerpropertyare1through3.

Togetthenumberoflayerstowhichashapeisassigned,usetheLayerCountproperty.

LayerCountproperty

Returnsthenumberoflayerstowhichashapeisassigned.

Versionadded

4.0

Syntax

intRet=object.LayerCountintRet Integer.Thenumberoflayerstowhichtheshapeisassigned.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

Ashapeisassignedtozeroormorelayers.

Layersproperty

ReturnstheLayerscollectionofanobject.

Versionadded

4.0

Syntax

objRet=object.LayersobjRet TheLayerscollectionoftheMasterorPageobject.object Required.AnexpressionthatreturnsaMasterorPageobject.

Example

Leftproperty

Getsthedistancebetweentheleftedgeoftheobjectandtheleftsideofthedockingarea.SetsthedistancebetweentheleftedgeofaMenuorToolbarobjectandtheleftedgeofthescreen.

Versionadded

2000

Syntax

intLong=object.Leftobject.Left=intLongobject Required.AnexpressionthatreturnsaMenuSetorToolbar

object.intLong RequiredInteger.Distanceinpixels.

Remarks

ThevalueofintLongmustbegreaterthanorequaltozero.

LeftMarginproperty

Specifiestheleftmargin,whichisusedwhenprinting.

Versionadded

4.0

Syntax

retVal=object.LeftMargin([unitsNameOrCode])object.LeftMargin([unitsNameOrCode])=newValueretVal Double.Themarginvalueexpressedinthegivenunits.object Required.AnexpressionthatreturnsaDocumentobject.unitsNameOrCodeOptionalVariant.Theunitstousewhenretrievingorsetting

themarginvalue.Defaultstointernaldrawingunits.newValue RequiredDouble.Thenewmarginvalue.

Remarks

TheLeftMarginpropertycorrespondstotheLeftsettinginthePrintSetup

Example

dialogbox(ontheFilemenu,clickPageSetup,clickthePrintSetuptab,andthenclickSetup).

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Ifthestringisinvalid,anerrorisgenerated.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

Cell.LeftMargin(visInches)=newValue

Cell.LeftMargin(65)=newValue

Cell.LeftMargin("in")=newValuewhere"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

LengthIUproperty

Returnsthelength(perimeter)oftheobjectininternalunits.

Versionadded

4.0

Syntax

retVal=object.LengthIUretVal Double.Thelength(perimeter)oftheobjectininternalunits

(inches).object Required.AnexpressionthatreturnsaShapeobject.

Example

LineBasedOnproperty

GetsorsetsthelinestyleonwhichaStyleobjectisbased.

Versionadded

4.0

Syntax

strVal=object.LineBasedOnobject.LineBasedOn=styleNamestrVal String.Thenameofthecurrentbased-onlinestyle.object Required.AnexpressionthatreturnsaStyleobject.styleName RequiredString.Thenameofthenewbased-onlinestyle.

Remarks

Tobaseastyleonnostyle,settheLineBasedOnpropertytoazero-lengthstring("").

Example

LineStyleproperty

Specifiesthelinestyleforanobject.

Versionadded

2.0

Syntax

strRet=object.LineStyleobject.LineStyle=stringExpressionstrRet String.Thenameofthecurrentlinestyle.object Required.AnexpressionthatreturnsaShapeorSelection

object.stringExpression RequiredString.Thenameofthelinestyletoapply.

Remarks

SettingtheLineStylepropertyisequivalenttoselectingalinestylefromtheLineStylelistontheFormatShapetoolbarinVisio.

Settingastyletoanonexistentstylegeneratesanerror.Settingonekindofstyletoanexistingstyleofanotherkind(forexample,settingtheLineStylepropertytoafillstyle)doesnothing.Settingonekindofstyletoanexistingstylethathasmorethanonesetofattributeschangesonlytheattributesforthatcomponent.Forexample,settingtheLineStylepropertytoastylewithline,text,andfillattributeschangesonlythelineattributes.

Topreserveashape'slocalformatting,usetheLineStyleKeepFmtproperty.

BeginningwithMicrosoftVisio2002,azero-lengthstring("")willcausethemaster'sstyletobereappliedtotheselectionorshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionorshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoazero-lengthstringistheequivalentofselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistintheStyledialogbox(ontheFormatmenu,clickStyle).

LineStyleKeepFmtproperty

Appliesalinestyletoanobjectwhilepreservinglocalformatting.

Versionadded

2.0

Syntax

object.LineStyleKeepFmt=stringExpressionobject Required.AnexpressionthatreturnsaShapeorSelection

object.stringExpression RequiredString.Thenameofthestyletoapply.

Remarks

SettingtheLineStyleKeepFmtpropertyisequivalenttoselectingthePreservelocalformattingcheckboxintheStyledialogbox(clickStyleontheFormatmenu).

Settingastyletoanonexistentstylegeneratesanerror.Settingonekindofstyle

Example

toanexistingstyleofanotherkind(forexample,settingtheLineStyleKeepFmtpropertytoafillstyle)doesnothing.Settingonekindofstyletoanexistingstylethathasmorethanonesetofattributeschangesonlytheattributesforthatcomponent(forexample,settingtheLineStyleKeepFmtpropertytoastylewithline,text,andfillattributeschangesonlythelineattributes).

BeginningwithMicrosoftVisio2002,azero-lengthstring("")willcausethemaster'sstyletobereappliedtotheselectionorshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionorshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoazero-lengthstringistheequivalentofselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistintheStyledialogbox(ontheFormatmenu,clickStyle).

LiveDynamicsproperty

ControlswhetherMicrosoftVisiorecalculatesshapepropertiesduringdragoperationsoneverymousemoveoronlyafterthemousebuttonisreleased.

Versionadded

2000

Syntax

bLiveDynamics=object.LiveDynamicsobject.LiveDynamics=bLiveDynamicsbLiveDynamics RequiredBoolean.Trueiflivedynamicsisenabled;Falseif

livedynamicsisnotenabled.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

TheLiveDynamicspropertytracksactions,suchasresizingandrotatingshapes,andiseffectivewhenshapesaregluedorrelatedtoeachother.Whenthevalue

Example

oftheLiveDynamicspropertyisTrue,moreeventssuchasCellChangedoccur.SolutionsthatrespondtosucheventsmayoperatemorequicklyiftheLiveDynamicspropertyissettoFalse.

LocalNameproperty

Returnsthelocalnameofacell.

Versionadded

4.0

Syntax

strRet=object.LocalNamestrRet String.Thelocalnameofthecell.object Required.AnexpressionthatreturnsaCellobject.

Remarks

Acellhasbothalocalnameandauniversalname.ThelocalnamediffersaccordingtothelocaleforwhichMicrosoftWindowsisinstalledontheuser'ssystem.Theuniversalnameisthesameregardlessoflocale.

Togettheuniversalnameofacell,usetheNameproperty.

Example

lParamproperty

GetsorsetsthelParamfieldoftheMSGstructurebeingwrapped.

Versionadded

2002

Syntax

intRet=object.lParamobject.lParam=intValueintRet Long.Additionalinformationaboutthemessagethatis

dependentonthemessagenumber.object Required.AnexpressionthatreturnsaMSGWrapobject.intValue RequiredLong.ThenewvalueofthelParamfield.

Remarks

ThelParampropertycorrespondstothelParamfieldintheMSGstructuredefinedaspartoftheMicrosoftWindowsoperatingsystem.IfaneventhandlerishandlingtheOnKeystrokeMessageForAddonevent,VisiopassesaMSGWrapobjectasanargumentwhenthiseventfires.AMSGWrapobjectisawrapperaroundtheWindowsMSGstructure.

Fordetails,searchfor"MSGstructure"ontheMicrosoftDeveloperNetwork(MSDN)Website.

Seealso Example

Managerproperty

ReturnsorsetsthevalueoftheManagerboxinadocument'sproperties.

Versionadded

5.0

Syntax

strRet=object.Managerobject.Manager=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueofthefield.

Remarks

SettingtheManagerpropertyisequivalenttoenteringinformationintheManagerboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

Example

Masterproperty

Getsthemasterthatisdisplayedinawindow,returnsthemasterfromwhichtheShapeobjectwascreated,orreturnsthemasterthatcontainstheLayerobjectorLayerscollection.

Versionadded

2.0

Syntax

objRet=object.MasterobjRet AMasterobjectthatrepresentstheobject'smaster.object Required.AnexpressionthatreturnsaLayerobject,Layers

collection,Shapeobject,orWindowobject.

Remarks

YoucanusetheTypepropertyoftheWindowobjecttodeterminewhethertheWindowobjectshowsamaster.IftheWindowobjectdoesnotshowamaster,theMasterpropertyraisesanexception.

Example

IftheWindowobjectshowsamasterthatisopenforediting,themasterreturnedistheactualmasterbeingedited,notthetemporarymasterthatexistswhiletheactualmasterisbeingedited.

IftheShapeobjectisnotaninstanceofamaster,itsMasterpropertyreturnsNothing.

IftheShapeobjectisinagroup,itsMasterpropertyisthesameasthegroup'sMasterproperty.

IftheLayerobjectorLayerscollectionisfromapageratherthanamaster,itsMasterpropertyreturnsNothing.

Mastersproperty

ReturnstheMasterscollectionforadocument'sstencil.

Versionadded

2.0

Syntax

objsRet=object.MastersobjsRet TheMasterscollectionforadocument.object Required.AnexpressionthatreturnsaDocumentobject.

MasterShapeproperty

Returnstheshapeinthemasterthatthisshapeinheritsfromifthisshapeispartofamasterinstance.

Versionadded

2002

Syntax

objRet=object.MasterShapeobjRet TheShapeobjectinthemasterthatthisobjectinheritsfrom.object Required.AnexpressionthatreturnsaShapeobjectthatispart

ofamasterinstance.

Remarks

Eachshapeinaninstanceofamaster(thegroupandallofitssubshapes)pointtotheircorrespondingshapeinthemaster.TheMasterShapepropertyreturnstheShapeobjectinthemasterfromwhichobjectinherits.

Ifobjectisnotpartofamasterinstance,theMasterShapepropertyreturnsNothing.

Seealso Example

MasterShortcutproperty

Getsthemastershortcutthatisdisplayedinawindow.

Versionadded

2000

Syntax

objRet=object.MasterShortcutobjRet AMasterShortcutobjectthatisdisplayedinawindow.object Required.AnexpressionthatreturnsaWindowobject.

Seealso Example

MasterShortcutsproperty

ReturnstheMasterShortcutscollectionforadocumentstencil.

Versionadded

2000

Syntax

objsRet=object.MasterShortcutsobjsRet TheMasterShortcutscollectionforadocument.object Required.AnexpressionthatreturnsaDocumentobject.

Seealso

MatchByNameproperty

Determineshowtheapplicationdecidesifadocumentmasterisalreadypresentwhenaninstanceofamasterisdroppedonthedrawingpage.Itallowschangesmadetoadocumentmastertoapplytonewinstancesofthemaster,eveniftheinstancesaredraggedfromastand-alonestencilfile.

Versionadded

5.0

Syntax

intRet=object.MatchByNameobject.MatchByName=intExpressionintRet Integer.Non-zeroifmatchbynameisenabled;otherwise,zero

(0).object Required.AnexpressionthatreturnsaMasterobject.intExpression RequiredInteger.Non-zeroifmatchbynameisenabled;

otherwise,0.

Remarks

SettingtheMatchByNamepropertyisequivalenttoselectingorclearingtheMatchmasternameondropcheckboxintheMasterPropertiesdialogbox(right-clickthemaster,andthenclickMasterPropertiesontheshortcutmenu).

Supposeyoucreateaninstanceofamasterfromastencilinadocument

Seealso Example

(producingalocalcopyofthemasterinthatdocument),andthenmakemodificationstothedocumentmaster(suchaschangingitsfillcolor).IftheMatchByNamepropertyofthedocumentmasterisFalse,thendraggingtheoriginalmasterfromthestand-alonestencilintothedrawingcreatesaninstancewiththestand-alonemaster'sattributesandproducesaseconddocumentmaster.IftheMatchByNamepropertyofthedocumentmasterisTrue,thendraggingtheoriginalmasterfromthestand-alonestencilintothedrawingcreatesaninstancewiththedocumentmaster'sattributesanddoesn'tproduceaseconddocumentmaster.

MDIWindowMenuproperty

DetermineswhetherthismenucanbeusedbytheMDIwindowmanagertolistthecurrentlyopenMDIwindows.

Versionadded

4.0

Syntax

intVal=object.MDIWindowMenuobject.MDIWindowMenu=intValintVal RequiredInteger.Non-zeroiftheMenuobjectshouldbethe

MDIwindowmenu;otherwise,zero(0).object Required.AnexpressionthatreturnsaMenuobject.

Remarks

TheMDIWindowMenupropertyusuallyreferstotheWindowmenu.

Seealso Example

MenuAnimationStyleproperty

Getsorsetsthewayinwhichamenuisdisplayed.

Versionadded

2000

Syntax

int=object.MenuAnimationStyleobject.MenuAnimationStyle=intobject Required.AnexpressionthatreturnsaUIObjectobjectfor

whichyouwanttosetthemenuanimationstyle.int RequiredInteger.Aconstantthatrepresentsananimationstyle.

Remarks

YoucanuseanyUIObjectobjecttogetorsetthisproperty.Thepropertyaffectstheentireapplication,andaffectstheappearanceofbuttonsinthecurrentvisiblesetoftoolbars.

BeginningwithMicrosoftVisio2002,thissettingcorrespondstotheMenuanimationsboxontheOptionstabintheCustomizedialogbox(ontheToolsmenu,clickCustomize)andissharedbetweenVisio2002andallMicrosoftOfficeXPapplications.

ConstantsrepresentinganimationstylesareprefixedwithvisMenuAnimation

Seealso Example

andaredeclaredbytheVisiotypelibraryinmemberVisUIMenuAnimation.

Constant ValuevisMenuAnimationNone 0visMenuAnimationRandom 1visMenuAnimationUnfold 2visMenuAnimationSlide 3

MenuItemsproperty

ReturnstheMenuItemscollectionofaMenuorMenuItemobject.

Versionadded

4.0

Syntax

objRet=object.MenuItemsobjRet TheMenuItemscollectionoftheobject.object Required.AnexpressionthatreturnsaMenuorMenuItem

objectthatownsthecollection.

Remarks

IfaMenuobjectrepresentsahierarchicalmenu,itsMenuItemscollectioncontainssubmenuitems.Otherwise,itsMenuItemscollectionisempty.

Menusproperty

ReturnstheMenuscollectionofaMenuSetobject.

Versionadded

4.0

Syntax

objRet=object.MenusobjRet TheMenuscollectionoftheMenuSetobject.object Required.AnexpressionthatreturnsaMenuSetobject.

Remarks

AMenuobject'sindexwithintheMenuscollectiondeterminesitsleft-to-rightpositiononthemenubar.

MenuSetsproperty

ReturnstheMenuSetscollectionofaUIObjectobject.

Versionadded

4.0

Syntax

objRet=object.MenuSetsobjRet TheMenuSetscollectionofaUIObjectobject.object Required.AnexpressionthatreturnstheUIObjectobjectthat

ownsthecollection.

Remarks

IfaUIObjectobjectrepresentsmenusandaccelerators(forexample,iftheobjectwasretrievedusingtheBuiltInMenuspropertyofanApplicationorDocumentobject),itsMenuSetscollectionrepresentsallofthemenusforthatUIObjectobject.

UsetheItemAtIDpropertyofaMenuSetsobjecttoretrievemenusforaparticularwindowcontextsuchasthedrawingwindow.Ifacontextdoesnotincludemenus,ithasnoMenuSetscollection.

MergeCaptionproperty

Returnstheabbreviatedcaptionthatappearsonthepagetabwhenthewindowismergedwithotherwindows.

VersionAdded

2002

Syntax

strRet=object.MergeCaption

object.MergeCaption=strValstrRet String.Thetextthatappearsinthepagetabwhenthiswindow

ismergedwithotherwindows.object Required.AnexpressionthatreturnsaWindowobject.strVal RequiredString.Thetexttoappearinthepagetabwhenthis

windowismergedwithotherwindows.

Remarks

Example

TheMergeCaptionpropertyappliesonlytoanchoredwindows.IftheWindowobjectisanMDIframewindow,Visioraisesanexception.

UsetheTypepropertytodeterminewindowtype.

MergeClassproperty

Specifiesalistofwindowclassesthatthisanchoredwindowcanmergewith.

VersionAdded

2002

Syntax

strRet=object.MergeClass

object.MergeClass=strValstrRet String.Alistofwindowclassesthatthiswindowcanpresently

mergewith.object Required.AnexpressionthatreturnsaWindowobject.strVal RequiredString.Anewlistofwindowclassesthatthiswindow

canmergewith.

Remarks

Example

Usesemicolonstoseparateindividualitemsinthelist.IftheMergeClasspropertyreturnsastringcontaining"123;789",itcanmergewithanywindowsthatalsocontain"123"or"789"initsmergeclasslist.Windowswithamergeclasslistthatcontainsazero-lengthstring("")canmergewithotherwindowsthatcontainazero-lengthstring("")intheirmergeclasslist.

TheMergeClasspropertyappliesonlytoanchoredwindows.IftheWindowobjectisanMDIframewindow,Visioraisesanexception.

Atpresent,windowsoftypevisDockedcanbemergedonlywithotherwindowsoftypevisDocked,andwindowsoftypevisAnchorBarcanbemergedonlywithotherwindowsoftypevisAnchorBar.

UsetheTypepropertytodeterminewindowtype.

MergeIDproperty

Specifiesthestringversionofamergedwindow'sgloballyuniqueidentifier(GUID).

VersionAdded

2002

Syntax

strRet=object.MergeIDobject.MergeID=strValstrRet String.ThestringversionofaGUID.object Required.AnexpressionthatreturnsaWindowobject.strVal RequiredString.ThenewGUID.

Remarks

IfthisWindowobjectisnotmerged,theGUIDwillcontainallzeros(GUID_NULL).

Example

TheMergeIDpropertyappliesonlytoanchoredwindows.IftheWindowobjectisanMDIframewindow,Visioraisesanexception.

UsetheTypepropertytodeterminewindowtype.

MergePositionproperty

Specifiestheleft-to-righttabpositionofamergedanchoredwindow.

VersionAdded

2002

Syntax

intRet=object.MergePosition

object.MergePosition=intValintRet Long.Thetabpositionofthemergedwindow.object Required.AnexpressionthatreturnsaWindowobject.intVal RequiredLong.Thenewtabpositionofthemergedwindow.

Remarks

Iftherearentabs,theleftmostpositionis1andtherightmostpositionisn.Ifthewindowsaremergedinadockedstencilfashion,1isthetopmostandnisthe

Example

bottommost.Avalueof–1meansthatthewindowisnotmerged.

TheMergePositionpropertyappliesonlytoanchoredwindows.IftheWindowobjectisanMDIframewindow,Visioraisesanexception.

UsetheTypepropertytodeterminewindowtype.

messageproperty

GetsorsetsthemessagefieldoftheMSGstructurebeingwrapped.

Versionadded

2002

Syntax

retVal=object.messageobject.message=newValretVal Long.Themessageidentifier.object Required.AnexpressionthatreturnsaMSGWrapobject.newVal RequiredLong.Thenewmessageidentifier.

Remarks

ThemessagepropertycorrespondstothemessagefieldintheMSGstructuredefinedaspartoftheMicrosoftWindowsoperatingsystem.IfaneventhandlerishandlingtheOnKeystrokeMessageForAddonevent,VisiopassesaMSGWrapobjectasanargumentwhenthiseventfires.AMSGWrapobjectisawrapperaroundtheWindowsMSGstructure.

TheOnKeystrokeMessageForAddoneventfiresformessagesinthefollowingrange:

WM_KEYDOWN 0x0100

Seealso Example

WM_KEYUP 0x0101WM_CHAR 0x0102WM_DEADCHAR 0x0103WM_SYSKEYDOWN 0x0104WM_SYSKEYUP 0x0105WM_SYSCHAR 0x0106WM_SYSDEADCHAR 0x0107

Fordetails,searchfor"MSGstructure"ontheMicrosoftDeveloperNetwork(MSDN)Website.

Modeproperty

Determineswhetheradocumentisinrunmodeordesignmode.

Versionadded

5.0

Syntax

retVal=object.Modeobject.Mode=newValretVal VisDocModeArgs.Currentmodeofthedocument.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredVisDocModeArgs.Thenewmodeofthedocument;

visDocModeRun(0)tosetrunmode,orvisDocModeDesign(1)tosetdesignmode.

Remarks

AVisiodocumentiseitherinrunmodeorindesignmode,justasaMicrosoft

Example

VisualBasicformiseitherrunningorbeingdesigned.

Thefollowingarethefundamentaldistinctionsbetweenrunmodeanddesignmode:

ActiveXcontrolshostedinadocumentaretoldnottofireeventswhenthedocumentisindesignmode,andtofireeventswheninrunmode.

Visiodoesn'tsourceeventsfromanyobjectwhosedocumentisindesignmode.

Therun/designmodeofaVisiodocumentisreportedintheVisiouserinterfacebytheDesignModebuttonontheDevelopertoolbar.TheappearanceofthisbuttonisthesameastheDesignModebuttonintheVisualBasicEditorwindow.Ifpressed,thedocument(project)isindesignmode.Ifnotpressed,thedocument(project)isinrunmode.

Therun/designmodeofaVisiodocumentissynchronizedwiththerun/designstateofthedocument'sVisualBasicforApplications(VBA)project,providedthedocumenthasaproject.Ifthedocumenttransitionsto/fromrunmode,thentheproject'smodeswitches,andviceversa.Thismeansthatifcodeinadocument'sprojectsetsthedocument'smodetodesignmode(ThisDocument.Mode=visDocModeDesign),theprojectinwhichthecodeexecutestransitionstodesignmodeandanystatementsfollowingthemodeassignmentstatementdon'texecute.However,codeinadocumentcanputanotherdocument(project)intodesignmodeandkeeprunning.

Adocument'smodeisnotapersistentproperty.Adocument'sinitialmodeisdeterminedbythesettingontheSecurityLeveltabintheSecuritydialogbox(ontheToolsmenu,pointtoMacros,andthenclickSecurity).Thesecuritylevelsaredescribedasfollows:

Low(notrecommended),thedocumentopensinrunmode.

Medium,thedocumentopensinrunmodeifitdoesnotcontainaprojectorcontainsaprojectfromatrustedsource.Ifthedocumentcontainsaprojectthatisunsignedorfromanuntrustedsource,analertappearswithbuttonstoDisableMacrosorEnableMacros.IfEnableMacrosisselected,thedocumentopensinrunmode;ifDisableMacrosisselected,itopensandremainsindesignmode.

High,thedocumentopensinrunmodeifitdoesnotcontainaprojector

containsasignedprojectfromatrustedsource.Ifthedocumentcontainsanunsignedproject,itopensandremainsindesignmode.Ifthedocumentcontainsasignedprojectfromanuntrustedsource,analertappearswithaDisablebuttonandadimmedEnablebutton(unlesstheAlwaystrustmacrosfromthissourcecheckboxisselected).IfDisableisselectedthedocumentopensandremainsindesignmode;otherwise,ifEnableisselected,itopensinrunmode.

Name[U]property

Specifiesthenameofanobject.

Versionadded

2.0

Syntax

strRet=object.Nameobject.Name=stringExpressionstrRet String.Thecurrentnameoftheobject.object Required.AnexpressionthatreturnsaobjectfromtheApplies

tolist.stringExpression RequiredString.Thenewnameoftheobject.

Remarks

Youcanget,butnotset,theNamepropertyofaDocumentobject.Ifadocumentisnotyetnamed,thispropertyreturnsthedocument'stemporary

name,suchasDrawing1orStencil1.

Youcanget,butnotset,theNamepropertyofanAddonobjectoraFontobject.

YoucansettheNamepropertyofaStyleobjectthatrepresentsastylethatisnotadefaultVisiostyle.IfyouattempttosettheNamepropertyofadefaultVisiostyle,anerrorisgenerated.

Youcanget,butnotset,thenameofacell.Somecellsareinnamedrows;youcangetandsetthenameofanamedrowusingtheRowNameproperty.

Acellhasbothalocalnameandauniversalname.ThelocalnamediffersdependingonthelocaleforwhichtherunningversionofMicrosoftWindowsisinstalled.Theuniversalnameisthesameregardlessofwhatlocaleisinstalled.Togettheuniversalnameofacell,usetheNameproperty.Togetthelocalname,usetheLocalNameproperty.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheNamepropertytogetorsetaCell,Master,Page,Shape,Style,Layer,Row,orMasterShortcutobject'slocalname.UsetheNameUpropertytogetorsetitsuniversalname.

NameIDproperty

Returnsauniquenameforashape.

Versionadded

2.0

Syntax

strRet=object.NameIDstrRet String.Theuniquenameoftheshape.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

TheNameIDpropertyreturnsauniqueidentifierforeachshapeonapageormaster.Theidentifierhasthefollowingform:sheet.N,whereNistheshape'sIDproperty.

ThevalueoftheNameIDpropertyisuniquewithinapageormaster,butnotacrosspagesormasters.Atanymoment,noothershapeonthesamepageor

Example

masterhasthesameNameIDproperty.However,shapesonotherpagesormastersmayhavethesameNameIDproperty.Thevalueofashape'sUniqueIDpropertyisuniqueacrosspagesandmasters.

Also,NameIDpropertiesarereused.IfashapewhoseNameIDpropertyissheet.Nisdeleted,thenashapesubsequentlyaddedtothesamecontextmaybeassignedsheet.NasitsNameIDproperty.Therefore,persistingNameIDpropertiesinseparatedatastoresisgenerallynotassoundaspersistingUniqueIDproperties.

NewBaseIDproperty

GeneratesanewbaseIDforamaster.

Versionadded

2000

Syntax

strRet=object.NewBaseIDstrRet String.ThenewbaseIDforthemaster.object Required.AnexpressionthatreturnsaMasterobject.

Example

NewWindowproperty

DetermineswhetherMicrosoftVisioopensanewwindowwhenitnavigatestoaURL.

Versionadded

5.0

Syntax

intRet=object.NewWindowobject.NewWindow=intExpressionintRet Integer.Non-zerotoopenanewwindow;otherwise,zero(0).object Required.AnexpressionthatreturnsaHyperlinkobject.intExpression RequiredInteger.Non-zerotoopenanewwindow;otherwise,

zero(0).

Remarks

SettingtheNewWindowpropertyofaHyperlinkobjectisequivalenttosetting

theNewWindowcellintheshape'sHyperlink.Rowrow.

Objectproperty

ReturnsanIDispatchinterfaceontheActiveXcontrolorembeddedorlinkedOLE2.0objectrepresentedbyaShapeobjectoranOLEObjectobject.

Versionadded

4.1

Syntax

dispRet=object.ObjectdispRet IDispatchinterfaceontheActiveXcontrolorOLEobject

representedbytheshape.object Required.AnexpressionthatreturnsaShapeorOLEObject

object.

Remarks

TheObjectpropertyraisesanexceptioniftheobjectdoesn'trepresentanActiveXcontroloranOLE2.0embeddedorlinkedobject.AshaperepresentsanActiveXcontroloranOLE2.0embeddedorlinkedobjectifthe

Example

visTypeIsOLE2bit(&H8000)issetinthevaluereturnedbytheForeignTypeproperty.

IftheObjectpropertysucceeds,itreturnsanIDispatchinterfaceonthecontrolorobject.Youoweaneventualreleaseonthereturnedvalue(setittoNothingorletitgooutofscopeifyou'reusingMicrosoftVisualBasic).Youcandeterminethekindofobjectyou'veobtainedaninterfaceonbyusingtheClassIDorProgIDproperty.

BeginningwithVisio5.0,iftheobjectreturnedbytheObjectpropertyisembeddedandtheshapeinheritstheobjectfromitsmaster,thentheObjectpropertyseverstheinstance—thatis,itcopiestheinheriteddataintotheinstance.OtherwiseiftheclientreceivingtheIDispatchinterfacefromtheObjectpropertymakeschangestotheobject,allinstancesofthemaster,notjusttheinstancebeingqueried,change.IftheobjectreturnedbytheObjectpropertyislinked,theObjectpropertydoesnotsevertheinstancebecause,bydefinition,theremaybeotherentitiesreferencingthelink.TheObjectIsInheritedpropertywasaddedtoVisio5.0sothatclientprogramscanknowifashapeinheritsitsobjectandaccessthemaster'sobject(s).

ObjectIsInheritedproperty

IndicatesifashaperepresentsanActiveXorOLEobjectthatisinheritedfromtheshape'smaster.

Versionadded

5.0

Syntax

intRet=object.ObjectIsInheritedintRet Integer.True(-1)ifobjectisinherited;otherwise,False(0).object Required.AnexpressionthatreturnsaShapeobject.

Example

ObjectTypeproperty

Returnsanobject'stype.

Versionadded

4.1

Syntax

intRet=object.ObjectTypeintRet Integer.Thetypeoftheobject.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

ConstantsrepresentingobjecttypesareprefixedwithvisObjTypeandaredeclaredbytheVisiotypelibraryinVisObjectTypes.

Constantsrepresentingobjecttypes

Seealso

OLEObjectsproperty

ReturnstheOLEObjectscollectionofadocument,master,orpage.

Versionadded

5.0

Syntax

objRet=object.OLEObjectsobjRet AnOLEObjectscollection.object Required.AnexpressionthatreturnsaDocument,Master,or

Pageobject.

Remarks

TheOLEObjectspropertyreturnsanOLEObjectscollectionthatincludesanyOLE2.0linkedorembeddedobjects,orActiveXcontrolscontainedinadocument,master,orpage.

OnDataChangeDelayproperty

ControlshowlongtheMicrosoftVisioinstancewaitsbeforeadvisingacontainerapplicationthataVisiodocumentbeingshownbythecontainerhaschangedandshouldberedisplayed.

Versionadded

3.0

Syntax

intRet=object.OnDataChangeDelayobject.OnDataChangeDelay=intExpressionintRet Long.Thecurrentsettingoftheobject.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredLong.Thenewsettingoftheobject.

Remarks

TheOnDataChangeDelaypropertyonlyaffectsinstancesofVisiothatarerunfromwithinanOLEcontainerdocument.

SettingthevalueoftheOnDataChangeDelaypropertytozero(0)causesVisiotosendimmediateadvisestothecontainerasdatachangesinopenVisiodocuments.

SettingthevalueoftheOnDataChangeDelaypropertyto-1causesVisiotouse

Seealso Example

theintervalspecifiedintheOLEUpdateDelayentryintheregistry.Iftheregistrydoesn'tcontainthissetting,Visiodefaultstousingavalueof10000(milliseconds).

SettingtheOnDataChangeDelaypropertytoanyvalueotherthan-1or0overridestheregistrysettingandsetsthedelaybetweenadvisestothevalueofOnDataChangeDelay.IftheOnDataChangeDelaypropertyisnotsetorsetto1andtheOLEUpdateDelaysettingis0,Visioneversendsadvisestothecontainer.

OneDproperty

Determineswhetheranobjectbehavesasaone-dimensional(1-D)object.

Versionadded

2.0

Syntax

retVal=object.OneDobject.OneD=intExpressionretVal Integer.Trueiftheshapeis1-D;Falseiftheshapeis2-D.object Required.AnexpressionthatreturnsaMasterorShapeobject.intExpression RequiredInteger.Zerotodeclareobjectas2-D;non-zeroto

declareitas1-D.

Remarks

SettingtheOneDpropertyisequivalenttochangingashape'sinteractionstyleintheBehaviordialogbox(clickBehaviorontheFormatmenu).SettingtheOneDpropertyfora1-DshapetoFalsedeletesits1-DEndpointssection,evenifthecellsinthatsectionwereprotectedwiththeGUARDfunction.

Youcanget,butnotset,theOneDpropertyofaMasterobject.

AguidedoesnothaveaOneDproperty.

Seealso Example

TheOneDpropertyofanobjectfromanotherapplicationisalwaysFalse.

Originalproperty

Returnstheoriginalmasterthatproducedthisopenmaster.

Versionadded

2002

Syntax

mastObj=object.OriginalmastObj TheoriginalMasterobjectthatproducedthisopenmaster.object Required.AnexpressionthatreturnsaMasterobject.

Remarks

IfthisMasterobjectisnotanopencopyofanotherMasterobject,thentheOriginalpropertyreturnsNothing.

Seealso Example

Pageproperty(Layerobject,Layerscollection)

Getsthepagethatcontainsthelayer.

Versionadded

2.0

Syntax

objRet=LayerOrLayersObj.PageobjRet ThePageobjectthatcontainsthelayerorlayers.LayerOrLayersObj Required.AnexpressionthatreturnsaLayerobjector

Layerscollection.

Remarks

IftheLayerobjectorLayerscollectionisinamasterratherthaninapage,thePagepropertyreturnsNothing.YoucannotsetthePagepropertyofaLayerobjectorLayerscollection.

Pageproperty(Windowobject)

Getsorsetsthepagethatisdisplayedinawindow.

Versionadded

2.0

Syntax

objVariantRet=windowObj.PagewindowObj.Page=stringVariantobjVariantRet Variant.APageobjectthatrepresentsthepagebeingshown

returnedinaVariant.windowObj Required.AnexpressionthatreturnsaWindowobject.stringVariant RequiredVariant.Containsastringthatnamesthepagetobe

shown.

Remarks

Ifawindowisnotshowingapage(maybeitisshowingamaster),thePagepropertyreturnsNothing.YoucanusetheTypepropertyoftheWindowobjecttodeterminewhethertheWindowobjectisshowingapage.Otherwise,thereturnedVariantreferstothePageobjectthatthewindowisshowing.

BeginningwithVisio5.0b,thePagepropertynolongerreturnsanexceptionifawindowisnotshowingapage—itreturnsNothing.Youcanusethefollowingcodetohandlebothreturnvalues.

Seealso Example

'CloseWindow(i)ifitisshowingapage.Setw=Windows(i)OnErrorResumeNextSetwp=w.PageOnErrorGoTo0IfNotwpIsNothingThenw.CloseEndIf

NoteInversionsofVisiothroughversion4.1,thePagepropertyofaWindowobjectreturnedanObject(asopposedtoaVariantoftypeObject)andthePagepropertyofaWindowobjectacceptedaString(asopposedtoaVariantoftypeString).DuetochangesinAutomationsupporttools,thepropertywaschangedtoacceptandreturnaVariant.Forbackwardcompatibility,thePageAsObjandPageFromNamepropertieswereadded.ThePageAsObjandPageFromNamepropertieshavethesamesignaturesandoccupythesamevtableslotsasdidthepriorversionofthePageproperty.

PageAsObjproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertygotthepagethatwasdisplayedinawindow.

Seealso Example Appliesto

PageFromNameproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Seealso Example Appliesto

Pagesproperty

ReturnsthePagescollectionforadocument.

Versionadded

2.0

Syntax

objsRet=object.PagesobjsRet ThePagescollectionforadocument.object Required.AnexpressionthatreturnsaDocumentobject.

PageSheetproperty

Returnsthepagesheetofapageormaster.

Versionadded

4.0

Syntax

objRet=object.PageSheetobjRet AShapeobjectthatrepresentsapagesheet.object Required.AnexpressionthatreturnsaMasterorPageobject.

Remarks

EverypageandmastercontainsatreeofShapeobjects.ConstantsrepresentingshapetypesareprefixedwithvisTypeandaredeclaredbytheVisiotypelibrary.

Inthetreeofshapesofamasterorpage,thereisexactlyoneshapeoftypevisTypePage.Thisshapeisalwaystherootshapeinthetree,andthePageSheetpropertyreturnsthisshape.

Example

Thepagesheetcontainsimportantsettingsforthepageormastersuchasitssizeandscale.ItalsocontainstheLayerssectionthatdefinesthelayersforthatpageormaster.

Analternativewaytoobtainapage'sormaster'spageshapeistousethefollowingcode:

shpObj=pageOrMasterObj.Shapes("ThePage")

PageTabWidthproperty

Getsorsetsthewidthofthepagetabcontrolinadrawingwindow.

Versionadded

2002

Syntax

dblRet=object.PageTabWidthobject.PageTabWidth=dblValdblRet Double.Thecurrentwidthofthepagetabcontrolinthe

drawingwindow.object Required.AnexpressionthatreturnsaWindowobject.dblVal RequiredDouble.Thenewwidthofthepagetabcontrolinthe

drawingwindow.

Remarks

ThevalueinthePageTabWidthpropertyisapercentageofthedrawingwindowwidth,from0to100.Tousethedefaultpagetabcontrolwidth,setthePageTabWidthpropertyto–1.

Seealso Example

PaletteEntryproperty

Getsorsetsthered,green,blue,andflagscomponentsofacolor.

Versionadded

4.0

Syntax

intRet=object.PaletteEntryobject.PaletteEntry=intValintRet Long.Thecurrentvalueofthecolor'scomponents.object Required.AnexpressionthatreturnsaColorobject.intVal RequiredLong.Thenewvalueofthecolor'scomponents.

Remarks

Acolorisrepresentedby1-bytered,green,andbluecomponents.Italsohasa1-byteflagsfieldindicatinghowyouusethecolor.ThesecorrespondtomembersoftheWindowsPALETTEENTRYdatastructure.Fordetails,searchfor

Example

"PALETTEENTRY"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

ThevaluepassedisfourtightlypackedBYTEfields.ThecorrespondencebetweenthePaletteEntrypropertyandred,green,blue,andflagsvaluesis:

palentry==r+256(b+256(g+256f))

PaletteWidthproperty

Getsorsetsthewidthofapaletteinpixels.

Versionadded

2000

Syntax

intRet=object.PaletteWidthobject.PaletteWidth=intValueintRet Integer.Containsthewidthinpixels.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.intValue RequiredInteger.Containsthewidthinpixels.

Remarks

Apalette,likeatoolbar,isorganizedhorizontallyanditemswraptoanewrowifthereisnotenoughhorizontalspaceavailable.Bydefault,onlytheiconsofthe

Seealso

itemsareshown.

PaperHeightproperty

Returnstheheightofadocument'sprintedpage.

Versionadded

4.5

Syntax

retVal=object.PaperHeight(units)retVal Double.Thedocument'spaperheightexpressedinthegiven

units.object Required.AnexpressionthatreturnsaDocumentobject.units RequiredVariant.Theunitstousewhenretrievingthepaper

height.

Remarks

Unitscanbeastringsuchas"inches","inch","in.",or"i".StringsmaybeusedforallsupportedVisiounitssuchascentimeters,meters,miles,andsoon.YoucanalsouseanyoftheunitsconstantsdeclaredbytheVisiotypelibraryin

Example

memberVisUnitCodes.

PaperSizeproperty

Getsorsetsthepapersizeofadocument.

Versionadded

4.5

Syntax

retVal=object.PaperSizeobject.PaperSize=newValretVal VisPaperSizes.Thepresentpagesize.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredVisPaperSizes.Thenewpagesize.

Remarks

ThisistheequivalentofchoosingapagesizeonthePageSizetabinthePageSetupdialogbox(ontheFilemenu,clickPageSetup).ThevalueofretValandnewValcanbeoneofthefollowingVisPaperSizesconstants.

Example

Constant Value DescriptionvisPaperSizeUnknown 0 NotknownvisPaperSizeLetter 1 Letter81/2x11invisPaperSizeLegal 5 Legal81/2x14invisPaperSizeA3 8 A3297x420mmvisPaperSizeA4 9 A4210x297mmvisPaperSizeA5 11 A5148x210mmvisPaperSizeB4 12 B4(JIS)250x354mmvisPaperSizeB5 13 B5(JIS)182x257mmvisPaperSizeFolio 14 Folio81/2x13invisPaperSizeNote 18 Note81/2x11invisPaperSizeSizeC 24 Csizesheet17x22in.visPaperSizeSizeD 25 Dsizesheet22x34in.visPaperSizeSizeE 26 Esizesheet34x44in.

PaperWidthproperty

Returnsthewidthofadocument'sprintedpage.

Versionadded

4.5

Syntax

retVal=object.PaperWidth(units)retVal Double.Thedocument'spaperwidthexpressedinthegiven

units.object Required.AnexpressionthatreturnsaDocumentobject.units RequiredVariant.Theunitstousewhenretrievingthepaper

width.

Remarks

Unitscanbeastringsuchas"inches","inch","in.",or"i".StringsmaybeusedforallsupportedVisiounitssuchascentimeters,meters,miles,andsoon.YoucanalsouseanyoftheunitsconstantsdeclaredbytheVisiotypelibrary.

Example

ParaPropsproperty

SetstheparagraphpropertyofaCharactersobjecttoanewvalue.

Versionadded

3.0

Syntax

object.ParaProps(intWhichProp)=intExpressionobject Required.AnexpressionthatreturnsaCharactersobject.intWhichProp RequiredInteger.Thepropertytoset.intExpression RequiredInteger.Thenewvalueoftheproperty.

Remarks

ThevaluesoftheintWhichPropargumentcorrespondtonamedcellsintheParagraphsectionoftheShapeSheetwindow.ConstantsforintWhichProparedeclaredbytheVisiotypelibraryinVisCellIndices.

Constant Value

Example

visIndentFirst 0visIndentLeft 1visIndentRight 2visSpaceLine 3visSpaceBefore 4visSpaceAfter 5visHorzAlign 6visBulletIndex 7visBulletString 8

Dependingontheextentofthetextrangeandtheformat,settingtheParaPropspropertymaycauserowstobeaddedorremovedfromtheParagraphsectionoftheShapeSheetwindow.

Toretrieveinformationaboutanexistingformat,usetheParaPropsRowproperty.

ParaPropsRowproperty

ReturnstheindexoftherowintheParagraphsectionofaShapeSheetwindowthatcontainsparagraphformattinginformationforaCharactersobject.

Versionadded

3.0

Syntax

intRet=object.ParaPropsRow(bias)intRet Integer.TheindexoftherowthatdefinestheCharacter

object'sparagraphformat.object Required.AnexpressionthatreturnsaCharactersobject.bias RequiredInteger.Thedirectionofthesearch.

Remarks

IftheformattingfortheCharactersobjectisrepresentedbymorethanonerowintheParagraphsectionintheShapeSheetwindow,theParaPropsRowpropertyreturns-1.IftheCharactersobjectrepresentsaninsertionpointrather

Example

thanasequenceofcharacters(itsBeginandEndpropertiesreturnthesamevalue),usethebiasargumenttodeterminewhichrowindextoreturn.

Constant ValuevisBiasLetVisioChoose 0visBiasLeft 1visBiasRight 2

SpecifyvisBiasLeftfortherowthatcoversparagraphformattingforthecharactertotheleftoftheinsertionpoint,orvisBiasRightfortherowthatcoversparagraphformattingforthecharactertotherightoftheinsertionpoint.

Parentproperty

Determinestheparentofanobject.

Versionadded

3.0

Syntax

objRet=object.ParentobjRet Theparentoftheobject.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

Ingeneral,anobject'sparentistheobjectthatcontainsit.Forexample,theparentofaMenuobjectistheMenuscollectionthatcontainstheMenuobject,ortheparentofaWindowobjectistheWindowscollectionthatcontainstheWindowobject.

Example

Parentproperty(Shapeobject)

DeterminestheparentofaShapeobject.

Versionadded

2002

Syntax

objRet=object.Parentobject.Parent=objExpressionobjRet Theparentoftheobject.object Required.AnexpressionthatreturnsaShapeobject.objExpression Required.Thenewparentoftheobject.

Remarks

Ingeneral,anobject'sparentistheobjectthatcontainsit.IfaShapeobjectisamemberofagroup,theparentisthatgroup.Otherwise,itsparentisaPageoraMasterobject.

Example

Whenassigninganewparentshape,youmustassignaShapeobject.Ifyouwanttoassignapageormastertobetheparentofashape,youmustassigntheShapeobjectreturnedbythePageorMasterobject'sPageSheetproperty.

Ashapeanditsparentshapemustbeinthesamecontainingpageorcontainingmaster.IfthenewparentisnotaShapeobject,oriftheContainingPageorContainingMasterpropertyoftheparentshapeisdifferentfromthatoftheshape,Visioraisesanexception.

ParentItemproperty

Returnstheparentobjectofahierarchicalmenuortoolbar.

Versionadded

2000

Syntax

objRet=object.ParentItemobjRet Theparentobject.object Required.AnexpressionthatreturnsaMenuItemsor

ToolbarItemscollection.

Seealso Example

ParentWindowproperty

ReturnstheWindowobjectthatistheparentofanotherWindowobject.

Versionadded

2000

Syntax

objRet=object.ParentWindowobjRet TheparentWindowobject.object Required.AnexpressionthatreturnsaWindowobject.

Remarks

ParentWindowreturnsnothingandraisesnoexceptionifthewindowisatoplevelwindow.AtoplevelwindowisamemberoftheWindowscollectionofanApplicationobject.

UsetheParentpropertyofaWindowobjecttogettheWindowscollectiontowhichaWindowobjectbelongs.

Example

Passwordproperty

Resetsthedocument'spassword.

Versionadded

2002

Syntax

object.Password([bStrExistingPassword])=strValobject Required.AnexpressionthatreturnsaDocumentobject.bStrExistingPasswordOptionalVariant.Theexistingpassword.strVal String.Thenewpassword.

Remarks

Youcanalsosetadocument'spasswordintheProtectDocumentdialogbox(intheDrawingExplorer,right-clickthedrawingname,andthenclickProtectDocument).Ifthereisanexistingpassword,youmustfirstremoveitbyenteringitintheUnprotectDocumentdialogbox(intheDrawingExplorer,right-clickthedrawingname,andthenclickUnprotectDocument).

Example

Pathproperty

ReturnsthedriveandfolderpathoftheMicrosoftVisioapplicationoradocument.

Versionadded

2.0

Syntax

strRet=object.PathstrRet String.ThepathofVisioortheindicateddocument.object Required.AnexpressionthatreturnsanApplicationor

Documentobject.

Remarks

Ifthedocumenthasnotbeensaved,thePathpropertyoftheDocumentobjectreturnsazero-lengthstring("").

Example

Pathsproperty

ReturnsaPathscollectionthatreportsthecoordinatesofashape'spathsinthecoordinatesystemoftheshape'sparent.

Versionadded

5.0

Syntax

objRet=object.PathsobjRet APathsobjectthatrepresentstheshape'sstrokes.object Required.AnexpressionthatreturnsaShapeobject.

PathsLocalproperty

ReturnsaPathscollectionthatreportsthecoordinatesofashape'spathsintheshape'slocalcoordinatesystem.

Versionadded

5.0

Syntax

objRet=object.PathsLocalobjRet APathsobjectthatrepresentstheshape'sstrokes.object Required.AnexpressionthatreturnsaShapeobject.

Example

PatternFlagsproperty

Determineswhetheramasterbehavesasacustompattern.

Versionadded

5.0

Syntax

intRet=object.PatternFlagsobject.PatternFlags=intExpressionintRet Integer.Thecurrentvalue.object Required.AnexpressionthatreturnsaMasterobject.intExpression RequiredInteger.Thenewvalue.

Remarks

Visioallowsamastertobeusedasacustomlinepattern,lineend,orfillpattern.

ThePatternFlagspropertydetermineswhetheryoucanuseamasterasapattern(non-zero);whetheritisaline,fill,orlineendpattern;andwhichpatternmodetousewhenapplyingittoshapes.

IfyoucanusethePatternFlagspropertyasapattern(non-zero),thepropertycanincludeacombinationofthefollowingbits.

Constant Value Description

Seealso Example

visMasIsLinePat &H1 LinepatternvisMasIsLineEnd &H2 LineendpatternvisMasIsFillPat &H4 Fillpattern

IfvisMasIsLinePatisselected,thepatternmodeshouldbeoneofthefollowingvalues.

Constant ValuevisMasLPTileDeform &H0visMasLPTile &H10visMasLPStretch &H20visMasLPAnnotate &H30

Inaddition,visMasLPScale(&H40)canoptionallybeincludedinthePatternFlagpropertyvalue.

IfvisMasIsLineEndisselected,thepatternmodeshouldbeoneofthefollowingvalues.

Constant ValuevisMasLEDefault &H0visMasLEUpright &H100

Inaddition,visMasLEScale(&H400)canoptionallybeincludedinthePatternFlagpropertyvalue.

IfvisMasIsFillPatisselected,thepatternmodeshouldbeoneofthefollowingvalues.

Constant ValuevisMasFPTile &H0visMasFPCenter &H1000visMasFPStretch &H2000

Inaddition,visMasFPScale(&H4000)canoptionallybeincludedinthePatternFlagpropertyvalue.

Persistableproperty

Determineswhetheraneventcanpotentiallypersistwithinitsdocument.

Versionadded

4.1

Syntax

intRet=object.PersistableintRet Integer.False(0)iftheeventcannotbemadepersistent;True

(-1)ifitcan.object Required.AnexpressionthatreturnsanEventobject.

Remarks

ThePersistablepropertyofanEventobjectindicateswhethertheeventcanpersist,thatis,whethertheEventobjectcanbestoredwithaVisiodocumentbetweenexecutionsofaprogram.AnEventobjectcanpersistifthefollowingconditionsaretrue:

Example

TheactioncodeoftheEventobjectmustbevisActCodeRunAddon.IftheactioncodeisvisActCodeAdvise,theeventwon'tpersistandmustbere-createdbyaprogramatruntime.

ThesourceobjectmustbecapableofcontainingpersistenteventsinitsEventListcollection.Thesourceobject'sPersistsEventspropertyindicateswhetheritcancontainpersistentevents.TheonlysourceobjectscurrentlycapableofcontainingpersistenteventsareDocument,Master,andPageobjects.

Iftheseconditionsaremet,anEventobjectwithanyofthefollowingeventcodesispersistable:

DocumentCreated

DocumentOpened

MasterAdded

MasterDeleted

PageAdded

PageDeleted

ShapesDeleted

AlthoughanEventobject'sPersistablepropertyindicateswhetheraneventcanpersist,itsPersistentpropertyindicateswhetherthateventactuallypersists.WhenanEventobjectisfirstcreated,itsPersistentpropertyissettothesamevalueasitsPersistableproperty.Thatis,apersistableevent'sPersistentpropertyissettoTrue,andanonpersistableevent'sPersistentpropertyissettoFalse.

AnonpersistenteventexistsaslongasareferenceisheldontheEventobject,theEventListobjectthatcontainstheEventobject,orthesourceobjectthathastheEventListobject.Whenthelastreferencetoanyoftheseobjectsisreleased,thenonpersistenteventceasestoexist.

YoucanchangetheinitialsettingforapersistableeventbysettingitsPersistentpropertytoFalse.Inthiscase,theeventdoesn'tpersistwithitsdocument,eventhoughitcould.However,youcannotchangethePersistentpropertyofa

nonpersistentevent;attemptingtodosowillcauseanexception.

NoteEventshandledinaMicrosoftVisualBasicforApplicationsprojectarepersistent.

Persistentproperty

Determineswhetherornotaneventpersistswithitsdocument.

Versionadded

4.1

Syntax

intRet=object.Persistentobject.Persistent=intExpressionintRet Integer.False(0)iftheeventwon'tbesavedwiththe

document;True(-1)ifitwill.object Required.AnexpressionthatreturnsanEventobject.intExpression RequiredInteger.False(0)tomaketheeventnonpersistent;

True(non-zero)tomakeitpersistent.

Remarks

AneventispersistableifitsactioncodeisvisActCodeRunAddonandthe

Example

event'ssourceobjectiscapableofcontainingpersistentevents.

Whenaneventisfirstcreated,itsPersistentpropertyissettothesamevalueasitsPersistableproperty;ifaneventcanpersist,Visioassumesitshouldpersist.YoucanchangetheinitialsettingforapersistableeventbysettingitsPersistentpropertytoFalse.However,youcannotchangethePersistentpropertyofanonpersistableevent—attemptingtodosocausesanexception.

AnonpersistenteventexistsaslongasareferenceisheldontheEventobject,theEventListobjectthatcontainstheEventobject,orthesourceobjectthathastheEventListobject.Whenthelastreferencetoanyoftheseobjectsisreleased,thenonpersistenteventceasestoexist.

ApersistenteventexistsuntilitsEventobjectisdeletedfromthesourceobject'sEventListcollection.

NoteEventshandledinaMicrosoftVisualBasicforApplicationsprojectarepersistent.

PersistsEventsproperty

IndicateswhetheranobjectiscapableofcontainingpersistenteventsinitsEventListcollection.

Versionadded

4.1

Syntax

intRet=object.PersistsEventsintRet Integer.False(0)ifthisobjectcannotcontainpersistent

events;True(1)ifitcan.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

EveryobjectthathasanEventListpropertyalsohasaPersistsEventsproperty.Tobepersistable,anevent'sactioncodemustbevisActCodeRunAddon,butitmustalsobeintheEventListcollectionofanobjectwhosePersistsEvents

propertyisTrue.TheonlyobjectsthatcurrentlypersisteventsareDocument,Master,andPageobjects.

WhetherapersistableeventactuallydoespersistdependsonthevalueofitsPersistentproperty.

Pictureproperty

Returnsapicturethatrepresentsanenhancedmetafile(EMF)containedinamaster,shape,selectionorpage.

VersionAdded

2002

Syntax

objRet=object.PictureobjRet AnIPictureDispobjectthatrepresentstheenhancedmetafile.object Required.AnexpressionthatreturnsaMaster,Shape,

Selection,orPageobjectthatcontainsthepicture.

Remarks

ThePicturepropertyreturnsonlyEMFfiles(enhancedmetafiles).

COMprovidesastandardimplementationofapictureobjectwiththeIPictureDispinterfaceontopoftheunderlyingsystempicturesupport.The

Example

IPictureDispinterfaceexposesapictureobject'spropertiesandisimplementedinthestdoletypelibraryasaStdPictureobjectcreatablewithinMicrosoftVisualBasic.ThestdoletypelibraryisautomaticallyreferencedfromallVisualBasicforApplicationsprojectsinVisio.

TogetinformationabouttheStdPictureobjectthatsupportstheIPictureDispinterface:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,clickstdole.

UnderClasses,examinetheclassnamedStdPicture.

FordetailsabouttheIPictureDispinterface,seetheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Currently,onlyin-procsolutionscanusethePicturepropertybecausetheIPictureDispinterfacecannotbemarshaled.

PitchAndFamilyproperty

ReturnsthepitchandfamilycodeforaFontobject.

Versionadded

4.0

Syntax

intRet=object.PitchAndFamilyintRet Integer.ThepitchandfamilycodeoftheFontobject.object Required.AnexpressionthatreturnsaFontobject.

Remarks

UsethePitchAndFamilypropertytospecifyafont'spitchandassignittoafontfamily.Youcanspecifypitch,family,orboth.Tospecifyboth,useanorexpression.Fontfamiliesareusedtospecifyafontwhenanexacttypefaceisunavailable.

ThepossiblevaluesofthePitchAndFamilypropertycorrespondtothoseofthe

Example

lfPitchAndFamilymemberoftheWindowsLOGFONTdatastructure.Fordetails,searchfor"LOGFONT"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Pointsproperty

ReturnsanarrayofpointsthatdefinesapolylinethatapproximatesaPathorCurveobjectwithinagiventolerance.

Versionadded

5.0

Syntax

object.PointsTolerance,xyArrayobject Required.AnexpressionthatreturnsaPathorCurveobject.Tolerance RequiredDouble.Specifieshowclosethereturnedarrayof

pointsmustapproximatethetruepath.xyArray RequiredDouble.Returnsanarrayofalternatingxandyvalues

specifyingpointsalongapath'sorcurve'sstroke.

Remarks

UsethePointspropertyofthePathorCurveobjecttoobtainanarrayofx,ycoordinatesspecifyingpointsalongthepathorcurvewithinagiventolerance.

Thetoleranceandreturnedx,yvaluesareexpressedininternaldrawingunits(inches).

IfyouusedthePathspropertyofaShapesobjecttoobtainthePathorCurveobjectbeingqueried,thecoordinatesareexpressedintheparent'scoordinatesystem.IfyouusedthePathsLocalpropertyofaShapeobjecttoobtainthePathorCurveobject,thecoordinatesareexpressedinthelocalcoordinatesystem.

IfVisioisunabletoachievetherequestedtolerance,Visioapproximatesthepointsasclosetotherequestedtoleranceaspossible.Generallyspeaking,thelowerthetolerance,themorepointsVisioreturns.Visiodoesn'tacceptatoleranceofzero(0).

Thearrayreturnedincludesboththestartingandendingpointsofthepathorcurveevenifitisclosed.

Positionproperty

Getsorsetsthepositionofanobject.

Versionadded

2000

Syntax

intRet=object.Positionobject.Position=intExpressionintRet Integer.Theobject'sposition.object Required.AnexpressionthatreturnsaMenuSetorToolbar

object.intExpression RequiredInteger.Theobject'snewposition.

Remarks

ConstantsrepresentingpossiblePositionpropertyvaluesarelistedbelow.TheyarealsodeclaredbytheVisiotypelibraryinVisUIBarPosition.

Constant ValuevisBarLeft 0visBarTop 1visBarRight 2visBarBottom 3visBarFloating 4visBarPopup 5visBarMenu 6

posttimeproperty

GetsorsetsthetimefieldoftheMSGstructurebeingwrapped.

Versionadded

2002

Syntax

intRet=object.posttimeobject.posttime=intExpressionintRet Long.Thecurrentvalueofthetimefield.object Required.AnexpressionthatreturnsaMSGWrapobject.intExpression RequiredLong.Thenewvalueofthetimefield.

Remarks

TheposttimepropertycorrespondstothetimefieldintheMSGstructuredefinedaspartoftheMicrosoftWindowsoperatingsystem.IfaneventhandlerishandlingtheOnKeystrokeMessageForAddonevent,Visiopassesa

Example

MSGWrapobjectasanargumentwhenthiseventfires.AMSGWrapobjectisawrapperaroundtheWindowsMSGstructure.

Fordetails,searchfor"MSGstructure"ontheMicrosoftDeveloperNetwork(MSDN)Website.

PreviewPictureproperty

GetsorsetsthepreviewpictureshownintheOpenorChooseDrawingTypedialogbox.

Versionadded

2002

Syntax

objRet=object.PreviewPictureobject.PreviewPicture=objExpressionobjRet AnIPictureDispobjectthatrepresentscurrentpreviewpicture.object Required.AnexpressionthatreturnsaDocumentobject.objExpression Required.AnIPictureDispobjectthatrepresentsthenew

previewpicture.

Remarks

ThePreviewPicturepropertyreturnsandacceptsonlyEMFfiles(enhancedmetafiles).VisiowillraiseanexceptionifobjExpressioncontainsanon-EMFfile.

TodeleteanexistingpreviewsetthePreviewPicturepropertytoNothing.

YoucanusethePreviewPicturepropertytoincludeapreviewpicturesinatemplatethatdoesnothaveanydiagramsstoredinit.

Seealso Example

COMprovidesastandardimplementationofapictureobjectwiththeIPictureDispinterfaceontopoftheunderlyingsystempicturesupport.TheIPictureDispinterfaceexposesapictureobject'spropertiesandisimplementedinthestdoletypelibraryasaStdPictureobjectcreatablewithinMicrosoftVisualBasic.ThestdoletypelibraryisautomaticallyreferencedfromallVisualBasicforApplicationsprojectsinVisio.

TogetinformationabouttheStdPictureobjectthatsupportstheIPictureDispinterface:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,clickstdole.

UnderClasses,examinetheclassnamedStdPicture.

FordetailsabouttheIPictureDispinterface,seetheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Currently,onlyin-procsolutionscanusethePreviewPicturepropertybecausetheIPictureDispinterfacecannotbemarshaled.

PrimaryItemproperty

ReturnstheShapeobjectthatisaSelectionobject'sprimaryitem.

Versionadded

2000

Syntax

objRet=object.PrimaryItemobjRet TheShapeobjectthatistheprimaryitem.object Required.AnexpressionthatreturnsaSelectionobject.

Remarks

Inadrawingwindow,theprimaryselecteditemisshownwithgreenselectionhandlesandnon-primaryselecteditemsareshownwithblueselectionhandles.Theoutcomeofsomeoperationsisaffectedbywhichselecteditemistheprimaryitem.Forexample,theAlignShapescommandalignsnon-primaryselecteditemswiththeprimaryselecteditem.

Example

IfaSelectionobjectcontainsnoShapeobjects,ortheprimaryShapeobjectisonethatisn'tenumeratedgiventheSelectionobject'sIterationModeproperty,thePrimaryItempropertyreturnsNothingandraisesnoexception.

PrintCenteredHproperty

Indicateswhetherdrawingsarecenteredbetweentheleftandrightedgesofthepaperwhenprinted.

Versionadded

4.0

Syntax

boolRet=object.PrintCenteredHobject.PrintCenteredH=boolValueboolRet Boolean.Trueifthedocumentwillcenterdrawings

horizontallywhenprinting;otherwise,False.object Required.AnexpressionthatreturnsaDocumentobject.boolValue RequiredBoolean.Truetocenterdrawingshorizontallywhen

printing;otherwise,False.

Remarks

Example

ThePrintCenteredHpropertycorrespondstotheCenterhorizontallycheckboxinthePrintSetupdialogbox(clickPageSetupontheFilemenu,andthenclickSetuponthePrintSetuptab).

PrintCenteredVproperty

Indicateswhetherdrawingsarecenteredbetweenthetopandbottomedgesofthepaperwhenprinted.

Versionadded

4.0

Syntax

boolRet=object.PrintCenteredVobject.PrintCenteredV=boolValueboolRet Boolean.Trueifthedocumentwillcenterdrawingsvertically

whenprinting;otherwise,False.object Required.AnexpressionthatreturnsaDocumentobject.boolValue RequiredBoolean.Truetocenterdrawingsvertically;

otherwise,False.

Remarks

Example

ThePrintCenteredVpropertycorrespondstotheCenterverticallycheckboxinthePrintSetupdialogbox(clickPageSetupontheFilemenu,andthenclickSetuponthePrintSetuptab).

Printerproperty

Specifiesthenameoftheprintertousewhenprintingthedocument.

Versionadded

2002

Syntax

strRet=object.Printerobject.Printer=strExpressionstrRet String.Thecurrentprinter.object Required.AnexpressionthatreturnsaDocumentobject.strExpression RequiredString.Thenewprinter.

Remarks

ThePrinterpropertycorrespondstotheNameboxinthePrintdialogbox(clickPrintontheFilemenu).

Example

PrintFitOnPagesproperty

Indicateswhetherdrawingsinadocumentareprintedonaspecifiednumberofsheetsacrossanddown.

Versionadded

4.0

Syntax

boolRet=object.PrintFitOnPagesobject.PrintFitOnPages=boolValueboolRet Boolean.Trueifthedocumentwillfitdrawingsonaspecified

numberofsheets;otherwise,False.object Required.AnexpressionthatreturnsaDocumentobject.boolValue RequiredBoolean.Truetofitdrawingsonaspecifiednumber

ofsheets;otherwise,False.

Remarks

Example

ThePrintFitOnPagespropertycorrespondstotheFittosettingsinthePageSetupdialogbox(clickPageSetupontheFilemenu).IfthispropertyisTrue,Visioprintsthedocument'sdrawingsonthenumberofsheetsspecifiedbythePrintPagesAcrossandPrintPagesDownproperties.

PrintLandscapeproperty

Indicateswhetheradocument'sdrawingsprintinlandscapeorportraitorientation.

Versionadded

4.0

Syntax

boolRet=object.PrintLandscapeobject.PrintLandscape=boolValueboolRet Boolean.Trueifthedocumentwillprintdrawingsinlandscape

orientation;otherwise,False.object Required.AnexpressionthatreturnsaDocumentobject.boolValue RequiredBoolean.Truetoprintdrawingsinlandscape

orientation;otherwise,False.

Remarks

ThePrintLandscapepropertycorrespondstothePortraitandLandscapesettingsinthePrintSetupdialogbox(clickPageSetupontheFilemenu,andthenclickSetup).

Seealso Example

PrintPagesAcrossproperty

Indicatesthenumberofsheetsofpaperonwhichadrawingisprintedhorizontally.

Versionadded

4.0

Syntax

intRet=object.PrintPagesAcrossobject.PrintPagesAcross=newValueintRet Integer.Thecurrentnumberofpagesacrossonwhich

drawingsareprinted.object Required.AnexpressionthatreturnsaDocumentobject.newValue RequiredInteger.Thenewnumberofpagesacrossonwhichto

printdrawings.

Remarks

Example

YoumustsetthevalueofthePrintFitOnPagespropertytoTrueinordertousethePrintPagesAcrossproperty.IfthevalueofthePrintFitOnPagespropertyisFalse,VisioignoresthePrintPagesAcrossproperty.

ThePrintPagesAcrosspropertycorrespondstotheFittosheet(s)acrosssettinginthePageSetupdialogbox(clickPageSetupontheFilemenu).

PrintPagesDownproperty

Indicatesthenumberofsheetsofpaperonwhichadrawingisprintedvertically.

Versionadded

4.0

Syntax

intRet=object.PrintPagesDownobject.PrintPagesDown=newValueintRet Integer.Thenumberofsheetsonwhichdrawingsareprinted

vertically.object Required.AnexpressionthatreturnsaDocumentobject.newValue RequiredInteger.Thenumberofsheetsonwhichtoprint

drawingsvertically.

Remarks

YoumustsetthevalueofthePrintFitOnPagespropertytoTruetousethe

Example

PrintPagesDownproperty.IfthevalueofthePrintFitOnPagespropertyisFalse,VisioignoresthePrintPagesDownproperty.

ThePrintPagesDownpropertycorrespondstotheFittobysheetsdownsettinginthePageSetupdialogbox(clickPageSetupontheFilemenu).

PrintScaleproperty

Indicateshowmuchdrawingsarereducedorenlargedwhenprinted.

Versionadded

4.0

Syntax

retVal=object.PrintScaleobject.PrintScale=newValueretVal Double.Thescaleatwhichdrawingsareprinted;1.0equals

100%.object Required.AnexpressionthatreturnsaDocumentobject.newValue RequiredDouble.Thenewscalevalue.

Remarks

ThePrintScalepropertycorrespondstotheAdjusttosettingonthePrintSetuptabinthePageSetupdialogbox(clickPageSetupontheFilemenu).Toprinta

Example

drawingathalfitssize,specify0.5.Toprintadrawingattwiceitssize,specify2.0.

PrintTileCountproperty

Returnsthenumberofprinttilesforadrawingpage.

Versionadded

2002

Syntax

intRet=object.PrintTileCountintRet Long.Thenumberofprinttilesonthedrawingpage.object Required.AnexpressionthatreturnsaPageobject.

Remarks

Whendrawingsspanmultiplephysicalprinterpages,youcanusethePrintTileCountpropertytodeterminethenumberofprinttilesthereareforaVisiodrawingpage.YoucanusethePrintTileCountpropertywiththePrintTilemethodtoidentifyandprintselectedtilesofanactivedrawingpage.

Example

Priorityproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertydeterminedwhetheratoolbarorstatusbaritemwasdroppedfromviewwhentheVisiowindowwastoonarrowtoshowallitems.

Seealso Example Appliesto

ProcessIDproperty

ReturnsauniqueprocessIDforaMicrosoftVisioinstance.

Versionadded

2.0

Syntax

retVal=object.ProcessIDretVal Long.TheprocessIDfortheVisioinstance.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

TheProcessIDpropertyreturnsavalueuniquetotheindicatedinstance.Theapplicationdoesn'treusethevalueuntil4294967296(2^32)moreprocesseshavebeencreatedonthecurrentworkstation.

Seealso

ProductNameproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertyreturnedthenameoftheproduct,Visio,usingitskeyintheregistry.

Seealso Example Appliesto

ProfileNameproperty

BeginningwithMicrosoftVisio2002,thismethodisobsolete.

Remarks

InVisioversionsearlierthan2002,theProfileNamepropertyreturnedthepathtotheMicrosoftVisioinformationstoredintheregistry.

Seealso Example Appliesto

ProgIDproperty

ReturnstheprogrammaticidentifierofashaperepresentinganActiveXcontrol,anembeddedobject,orlinkedobject.

Versionadded

5.0

Syntax

strRet=object.ProgIDstrRet String.TheprogramidentifieroftheOLEobjectrepresented

bytheshape.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

TheProgIDpropertyraisesanexceptioniftheshapedoesn'trepresentanActiveXcontrolorOLE2.0embeddedorlinkedobject.AshaperepresentsanActiveXcontrol,anembeddedobject,orlinkedobjectiftheForeignTypepropertyreturnsvisTypeIsOLE2inthevalue.

UsetheProgIDpropertyofaShapeobjectorOLEObjecttoobtaintheprogrammaticidentifieroftheobject.EveryOLEobjectclassstoresaprogrammaticidentifierforitselfintheregistry.Typicallythisoccurswhentheprogramthatservicestheobjectinstallsitself.Clientprogramsusethisidentifiertoidentifytheobject.YouareusingtheVisioidentifierwhenyouexecuteastatementsuchasGetObject(,"Visio.Application")fromaMicrosoftVisualBasicprogram.

ThesearestringsthattheProgIDpropertymightreturn:

Visio.Drawing.5MSGraph.Chart.5Forms.CommandButton.1

Afterusingashape'sObjectpropertytoobtainanIDispatchinterfaceontheobjecttheshaperepresents,youcanobtaintheshape'sClassIDorProgIDpropertytodeterminethemethodsandpropertiesprovidedbythatinterface.

Promptproperty

Getsorsetsthepromptstringforamasterormastershortcut.

Versionadded

2.0

Syntax

strRet=object.Prompt

object.Prompt=strValstrRet String.Thecurrentpromptstring.object Required.AnexpressionthatreturnsaMasteror

MasterShortcutobject.strVal String.Thenewpromptstring.

Seealso Example

PromptForSummaryproperty

DetermineswhetherMicrosoftVisiopromptsfordocumentpropertieswhenitsavesadocument.

Versionadded

4.0

Syntax

intRet=object.PromptForSummaryobject.PromptForSummary=intExpressionintRet Integer.Zero(0)ifpromptingisoff;-1ifitison.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.Zero(0)toturnpromptingoff;non-zeroto

turniton.

Remarks

ThispropertycorrespondstothePromptfordocumentpropertiescheckbox

ontheSavetabintheOptionsdialogbox(clickOptionsontheToolsmenu).

Protectionproperty

Determineshowanobjectisprotectedfromusercustomization.

Versionadded

2000

Syntax

intRet=object.Protectionobject.Protection=intExpressionintRet Integer.TheexistingprotectionsforaMenuSetorToolbar

object.object Required.AnexpressionthatreturnsaMenuSetorToolbar

object.intExpression RequiredInteger.ThenewprotectionsforaMenuSetor

Toolbarobject.

Remarks

Seealso

ThevalueofintExpressioncanbeoneoracombinationofthefollowingconstantsdeclaredbytheVisiotypelibraryinVisUIBarProtection.

Constant Value DescriptionvisBarNoProtection 0 Noprotection.visBarNoCustomize 1 Can'tbecustomized.visBarNoResize 2 Can'tberesized.visBarNoMove 4 Can'tbemoved.visBarNoChangeDock 16 Can'tbedockedorfloating.visBarNoVerticalDock 32 Can'tbedockedvertically.visBarNoHorizontalDock 64 Can'tbedockedhorizontally.

Protectionproperty(Documentobject)

Determineshowadocumentisprotectedfromusercustomization.

Versionadded

2002

Syntax

retVal=object.Protection([bstrPassword])object.Protection([bstrPassword])=newValueretVal VisProtection.Thecurrentprotectionsettings.object Required.AnexpressionthatreturnsaDocumentobject.bstrPassword OptionalVariant.Theexistingpassword.newValue RequiredVisProtection.Thenewprotectionsettings.

Remarks

Example

Ifthedocumentispasswordprotected,youmustprovidetheexistingpasswordtosettheProtectionproperty.Ifyouprovideanincorrectpassword,theProtectionpropertywillraiseanexception.

TheProtectionpropertyignoresbstrPasswordwhenyouaregettingthevalueoftheproperty.

ThispropertyistheequivalentofcheckingtheStyles,Shape,Preview,Backgrounds,andMastershapesboxesontheProtectDocumentdialogbox(intheDrawingExplorer,right-clickthedrawingname,andthenclickProtectDocument).Ifthereisanexistingpassword,youmustfirstremoveitbyenteringitintheUnprotectDocumentdialogbox(intheDrawingExplorer,right-clickthedrawingname,andclickUnprotectDocument).

ThevalueofretValandnewValcanbeacombinationofthefollowingVisProtectionconstants.

Constant ValuevisProtectNone &H0visProtectStyles &H1visProtectShapes &H2visProtectMasters &H4visProtectBackgrounds &H8visProtectPreviews &H10

ptxproperty

Getsorsetsthept.xfieldoftheMSGstructurebeingwrapped.

Versionadded

2002

Syntax

intRet=object.ptxobject.ptx=intExpressionintRet Long.Thex-coordinateofthecursorpositionwhenthis

messagewasposted.object Required.AnexpressionthatreturnsaMSGWrapobject.intExpression RequiredLong.Thenewvalueofthept.xfield.

Remarks

Theptxpropertycorrespondstothept.xfieldintheMSGstructuredefinedaspartoftheMicrosoftWindowsoperatingsystem.IfaneventhandlerishandlingtheOnKeystrokeMessageForAddonevent,VisiopassesaMSGWrapobjectasanargumentwhenthiseventfires.AMSGWrapobjectisawrapperaroundtheWindowsMSGstructure.

Fordetails,searchfor"MSGstructure"ontheMicrosoftDeveloperNetwork(MSDN)Website.

Seealso Example

ptyproperty

Getsorsetsthept.yfieldoftheMSGstructurebeingwrapped.

Versionadded

2002

Syntax

intRet=object.ptyobject.pty=intExpressionintRet Long.They-coordinateofthecursorpositionwhenthis

messagewasposted.object Required.AnexpressionthatreturnsaMSGWrapobject.intExpression RequiredLong.Thenewvalueofthept.yfield.

Remarks

Theptypropertycorrespondstothept.yfieldintheMSGstructuredefinedaspartoftheMicrosoftWindowsoperatingsystem.IfaneventhandlerishandlingtheOnKeystrokeMessageForAddonevent,VisiopassesaMSGWrapobjectasanargumentwhenthiseventfires.AMSGWrapobjectisawrapperaroundtheWindowsMSGstructure.

Fordetails,searchfor"MSGstructure"ontheMicrosoftDeveloperNetwork(MSDN)Website.

Seealso Example

ReadOnlyproperty

Indicateswhetherafileisopenasread-only.

Versionadded

2.0

Syntax

intRet=object.ReadOnlyintRet Integer.Non-zero(True)ifthedocumentisopenasread-only;

otherwise,0(False).object Required.AnexpressionthatreturnsaDocumentobject.

Seealso Example

Redproperty

GetsorsetstheintensityoftheredcomponentofaColorobject.

Versionadded

4.0

Syntax

intRet=object.Redobject.Red=intValintRet Integer.Thecurrentvalueofthecolor'sredcomponent.object Required.AnexpressionthatreturnsaColorobject.intVal RequiredInteger.Thenewvalueofthecolor'sredcomponent.

Remarks

TheRedpropertycanbeavaluefromzero(0)to255.

Acolorisrepresentedbyred,green,andbluecomponents.Italsohasflagsthat

Example

indicatehowthecoloristobeused.ThesecorrespondtomembersoftheMicrosoftWindowsPALETTEENTRYdatastructure.Fordetails,searchfor"PALETTEENTRY"intheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

Resultproperty

Getsorsetsacell'svalue.

Versionadded

2.0

Syntax

retVal=object.Result(unitsNameOrCode)object.Result(unitsNameOrCode)=newValueretVal Double.Thevalueinthecell.object Required.AnexpressionthatreturnsaCellobject.unitsNameOrCode RequiredVariant.Theunitstousewhenretrievingor

settingthecell'svalue.newValue RequiredDouble.Thenewvalueforthecell.

Remarks

UsetheResultpropertytosetthevalueofanunguardedcell.Ifthecell's

formulaisprotectedwiththeGUARDfunction,theformulaisnotchangedandanerrorisgenerated.Ifthecellcontainsonlyatextstring,thenzero(0)isreturned.Ifthestringisinvalid,anerrorisgenerated.

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

retVal=Cell.Result(visInches)

retVal=Cell.Result(65)

retVal=Cell.Result("in")where"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

Tospecifyinternalunits,passazero-lengthstring("").Internalunitsareinchesfordistanceandradiansforangles.Tospecifyimplicitunits,youmustusetheFormulaproperty.

ResultForceproperty

Setsacell'svalue,evenifthecell'sformulaisprotectedwiththeGUARDfunction.

Versionadded

2.0

Syntax

object.ResultForce(unitsNameOrCode)=newValueobject Required.AnexpressionthatreturnsaCellobject.unitsNameOrCode RequiredVariant.Theunitstousewhensettingthecell's

value.newValue RequiredDouble.Thenewvalueforthecell.

Remarks

UsetheResultForcemethodtosetacell'svalueevenifthecell'sformulaisprotectedwithaguardfunction.Ifthestringisinvalid,anerrorisgenerated.

Example

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

Cell.ResultForce(visInches)=newValue

Cell.ResultForce(65)=newValue

Cell.ResultForce("in")=newValuewhere"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

Tospecifyinternalunits,passazero-lengthstring("").Internalunitsareinchesfordistanceandradiansforangles.Tospecifyimplicitunits,youmustusetheFormulaproperty.

ResultFromIntproperty

Setsthevalueofacelltoanintegervalue.

Versionadded

4.5

Syntax

object.ResultFromInt(unitsNameOrCode)=newValueobject Required.AnexpressionthatreturnsaCellobject.unitsNameOrCode RequiredVariant.Theunitstousewhensettingthecell's

value.newValue RequiredLong.Thenewvalueforthecell.

Remarks

SettingtheResultFromIntpropertyissimilartosettingacell'sResultproperty.ThedifferenceisthattheResultFromIntpropertyacceptsanintegerforthevalueofthecell,whereastheResultpropertyacceptsafloatingpointnumber.

Example

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Ifthestringisinvalid,anerrorisgenerated.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

Cell.ResultFromInt(visInches)=newValue

Cell.ResultFromInt(65)=newValue

Cell.ResultFromInt("in")=newValuewhere"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

Ifthecell'sformulaisprotectedwithaGUARDfunction,usetheResultFromIntForceproperty.

ResultFromIntForceproperty

Setsthevalueofacelltoanintegervalue,evenifthecell'sformulaisprotectedwiththeGUARDfunction.

Versionadded

4.0

Syntax

object.ResultFromIntForce(unitsNameOrCode)=newValueobject Required.AnexpressionthatreturnsaCellobject.unitsNameOrCode RequiredVariant.Theunitstousewhensettingthecell'svalue.newValue RequiredLong.Thenewvalueforthecell.

Remarks

UsetheResultFromIntForcepropertytosetacell'svalueevenifthecell'sformulaisprotectedwithaGUARDfunction.Otherwise,itisidenticalinbehaviortotheResultFromIntproperty.

Example

ResultIntproperty

Getsthevalueofacellexpressedasaninteger.

Versionadded

4.0

Syntax

intRet=object.ResultInt(unitsNameOrCode,roundFlag)intRet Long.Thecell'svaluereturnedasaninteger.object Required.AnexpressionthatreturnsaCellobject.unitsNameOrCode RequiredVariant.Theunitstousewhenretrievingthecell's

value.roundFlag RequiredInteger.Zero(0)totruncatethevalue;non-zeroto

roundit.

Remarks

SettingtheResultIntpropertyissimilartoasettingacell'sResultproperty.The

Example

differenceisthattheResultIntpropertyreturnsanintegerforthevalueofthecell,whereastheResultpropertyreturnsafloatingpointnumber.

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Ifthestringisinvalid,anerrorisgenerated.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

intRet=Cell.ResultInt(visInches,roundFlag)

intRet=Cell.ResultInt(65,roundFlag)

intRet=Cell.ResultInt("in",roundFlag)where"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

ThefollowingconstantsforroundFlagaredeclaredintheVisiotypelibraryinmemberVisRoundFlags.

Constant Value DescriptionvisTruncate 0 TruncatetheresultvisRound 1 Roundtheresult

ResultIUproperty

Getsorsetsacell'svalueininternalunits.

Versionadded

2.0

Syntax

retVal=object.ResultIUobject.ResultIU=newValueretVal Double.Thecell'svalueininternalunits.object Required.AnexpressionthatreturnsaCellobject.newValue RequiredDouble.Thenewvalueforthecell.

Remarks

UsetheResultIUpropertytosetthevalueofanunguardedcell.Ifacell'sformulaisprotectedwithaGUARDfunction,theformulaisnotchangedandanerrorisgenerated.

Example

TheunitsdefaulttotheVisiointernalunits,whichareinchesfordistanceandradiansforangles.

ResultIUForceproperty

Setsacell'svalueininternalunits,evenifthecell'sformulaisprotectedwiththeGUARDfunction.

Versionadded

2.0

Syntax

object.ResultIUForce=newValueobject Required.AnexpressionthatreturnsaCellobject.newValue RequiredDouble.Thenewvalueforthecell.

Remarks

Thecell'sunitsdefaulttotheVisiointernalunits,whichareinchesfordistanceandradiansforangles.

Example

ResultStrproperty

Getsthevalueofacellexpressedasastring.

Versionadded

4.0

Syntax

stringRet=object.ResultStr(unitsNameOrCode)stringRet String.Thecell'svaluereturnedasastring.object Required.AnexpressionthatreturnsaCellobject.unitsNameOrCode RequiredVariant.Theunitstousewhenretrievingthe

value.

Remarks

SettingtheResultStrpropertyissimilartosettingacell'sResultproperty.ThedifferenceisthatResultStrpropertyreturnsastringforthevalueofthecell,whereastheResultpropertyreturnsafloatingpointnumber.

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Ifthestringisinvalid,anerrorisgenerated.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

stringRet=Cell.ResultStr(visInches)

stringRet=Cell.ResultStr(65)

stringRet=Cell.ResultStr("in")where"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

Passingazero(0)issufficientforgettingthevalueoftextstringcells.

YoucanusetheResultStrpropertytoconvertbetweenunits.Forexample,youcangetthevalueininches,thengetanequivalentvalueincentimeters.

TheResultStrpropertyisusefulforfillingcontrolssuchaseditboxeswiththevalueofacell.

RightMarginproperty

Specifiestherightmargin,whichisusedwhenprinting.

Versionadded

4.0

Syntax

retVal=object.RightMargin([unitsNameOrCode])object.RightMargin([unitsNameOrCode])=newValueretVal Double.Themarginvalueexpressedinthegivenunits.object Required.AnexpressionthatreturnsaDocumentobject.unitsNameOrCodeOptionalVariant.Theunitstousewhenretrievingorsetting

themarginvalue.newValue RequiredDouble.Thenewmarginvalue.

Remarks

IfunitsNameOrCodeisnotprovided,theRightMarginpropertywilldefaultto

Example

internaldrawingunits(inches).

TheRightMarginpropertycorrespondstotheRightsettinginthePrintSetupdialogbox(clickPageSetupontheFilemenu,andthenclickSetup).

YoucanspecifyunitsNameOrCodeasanintegerorastringvalue.Ifthestringisinvalid,anerrorisgenerated.Forexample,thefollowingstatementsallsetunitsNameOrCodetoinches.

Cell.RightMargin(visInches)=newValue

Cell.RightMargin(65)=newValue

Cell.RightMargin("in")=newValuewhere"in"canalsobeanyofthealternatestringsrepresentinginches,suchas"inch","in.",or"i".

ForacompletelistofvalidunitstringsalongwithcorrespondingAutomationconstants(integervalues),seeAboutunitsofmeasure.

AutomationconstantsforrepresentingunitsaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

RootShapeproperty

Returnsthetop-levelshapeofaninstanceifthisshapeispartofamasterinstance.

Versionadded

2002

Syntax

objRet=object.RootShapeobjRet TheShapeobjectthatisthetoplevelshapeofthisinstance.object Required.AnexpressionthatreturnsaShapeobject.

Remarks

IfthisshapeisnotpartofamasterinstancetheRootShapepropertyreturnsNothing.

Seealso Example

Rowproperty

Returnstherowindexofacellorlayer.

Versionadded

4.0

Syntax

intRet=object.RowintRet Integer.Theindexoftherowthatdefinesthecellorlayer.object Required.AnexpressionthatreturnsaCell,Hyperlink,Layer,

orSectionobject.

Example

RowCountproperty

ReturnsthenumberofrowsinaShapeSheetsection.

Versionadded

2.0

Syntax

retVal=object.RowCount(section)retVal Integer.Thenumberofrowsinthesection.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thesectiontocount.

Remarks

Thesectionargumentmustbeasectionconstant.Foralistofsectionconstants,seetheAddSectionmethod.

UsetheRowCountpropertyprimarilywithsectionsthatcontainavariablenumberofrows,suchasGeometryandConnectionPointssections.Thevalue

returnedbytheRowCountpropertyforsectionsthathaveafixednumberofrowsisthenumberofrowsinthesectionthatpossessatleastonecellwhosevalueislocaltotheshape.Thisisopposedtorowswhosecellsareallinheritedfromamasterorstyle,whichistypicallybetterbecauseVisiodoesn'tneedtostoreasmuchinformation.IntheShapeSheetwindow,cellswithlocalvaluesappearinblue,andcellswithinheritedvaluesappearinblack.UsingAutomation,youcandetermineifacellisinheritedusingtheIsInheritedproperty.

RowExistsproperty

DetermineswhetheraShapeSheetrowexists.

Versionadded

4.0

Syntax

intRet=object.RowExists(section,row,fExistsLocally)intRet Integer.False(0)ifrowdoesn'texist;otherwise,True(-1).object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Therow'ssectionindex.row RequiredInteger.Therow'srowindex.fExistsLocally RequiredInteger.Thescopeofthesearch.

Remarks

IffExistsLocallyisFalse(0),theRowExistspropertyreturnsTrueiftheobjecteithercontainsorinheritsthespecifiedrow.

Example

IffExistsLocallyisTrue(non-zero),theRowExistspropertyreturnsTrueonlyiftheobjectcontainsthespecifiedrowlocally;iftherowisinherited,theRowExistspropertyreturnsFalse.

Foralistofrowindexvalues,seetheAddRowmethodorviewtheVisiotypelibraryforthemembersofclassvisRowIndices.Foralistofsectionindexvalues,seetheAddSectionmethodorviewtheVisiotypelibraryforthemembersofclassvisSectionIndices.

RowIndexproperty

GetsorsetsthedockingorderofaMenuSetorToolbarobjectinrelationtootheritemsinthesamedockingarea.

Versionadded

2000

Syntax

intLong=object.RowIndexobject.RowIndex=intLongobject Required.AnexpressionthatreturnsaMenuSetorToolbar

object.intLong RequiredInteger.

Remarks

Objectswithlowernumbersaredockedfirst.Severalitemscansharethesamerowindex.Iftwoormoreitemssharethesamerowindex,theitemmost

Example

recentlyassignedisdisplayedfirstinitsgroup.

Constantsrepresentingthefirstandlastpositions(seethefollowingtable)aredeclaredbytheVisiotypelibraryinmembervisUIBarRow.

Constant ValuevisBarRowFirst 0visBarRowLast -1

RowName[U]property

GetsorsetsthenameoftherowthatcontainstheCellobject.

Versionadded

4.0

Syntax

strRet=object.RowNameobject.RowName=stringExpressionstrRet String.Thecurrentnameoftherow.object Required.AnexpressionthatreturnsaCellobject.stringExpression RequiredString.Thenewnametoassigntotherow.

Remarks

Ifthecellisinarowinashape'sUser-definedCells,CustomProperties,orConnectionPointssection,theRowNamepropertycangetorsetthenameoftherow.Ifthecellisnotinoneofthesesections,attemptingtogetorsetthename

Example

generatesanerror.

TheConnectionPointssectioncancontaineithernamedorunnamedrows,butnotacombinationofthetwo.GettingthenameofanunnamedConnectionPointsrowreturnsazero-lengthstring("")anddoesnotgenerateanerror.SettingthenameofanunnamedrowinaConnectionPointsrowassignsthenametothetargetrowandconvertsallremainingrowsinthesectiontonamedrows,usingtheirdefaultnames(Row_1,Row_2,andsoon).Assigningazero-lengthstring("")toanamedrowinaConnectionPointssectionresetsthenamedrowtoitsdefaultname,buthasnoeffectonanunnamedConnectionPointsrow.

Whenyouchangearowname,anycellobjectsreferringtocellsinthatrowbecomeinvalidandyoumustreassignthem.Also,ifotherConnectionPointsrowsbecomenamedasaresultofarownamechange,youmustalsoreassignreferencestocellsinthoserows.

NoteBeginningwithVisio2000,youcanrefertoVisioshapes,masters,styles,pages,rows,andlayersusinglocalanduniversalnames.Whenausernamesashape,forexample,theuserisspecifyingalocalname.Universalnamesarenotvisiblethroughtheuserinterface.Asadeveloper,youcanuseuniversalnamesinaprogramwhenyoudon'twanttochangeanameeachtimeasolutionislocalized.UsetheRowNamepropertytogetorsetanobject'slocalrowname.UsetheRowNameUpropertytogetorsetanobject'suniversalrowname.

RowsCellCountproperty

ReturnsthenumberofcellsinarowofaShapeSheetsection.

Versionadded

2.0

Syntax

intRet=object.RowsCellCount(section,row)intRet Integer.Thenumberofcellsintherow.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Theindexofthesectionthatcontainsthe

row.row RequiredInteger.Theindexoftherowtocount.

Remarks

UsesectionandrowindexconstantsdeclaredbytheVisiotypelibraryinmembersVisSectionIndicesandVisRowIndices.Theyarealsolistedinthe

Example

AddRowandAddSectionmethodtopics.

RowTypeproperty

GetsorsetsthetypeofarowinaGeometry,ConnectionPoints,Controls,orTabsShapeSheetsection.

Versionadded

2.0

Syntax

retVal=object.RowType(section,row)object.RowType(section,row)=rowTagretVal Integer.Thecurrenttypeoftherow.object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Theindexofthesectionthatcontainsthe

row.row RequiredInteger.Theindexoftherow.rowTag RequiredInteger.Thenewtypefortherow.

Remarks

Afteryouchangearow'stype,thenewrowtypemayormaynothavethesamecells.Yourprogrammustprovidetheappropriateformulasfortheneworchangedcells.

TherowTypeargumentspecifiesthetypeofrowyouwant.YoucanuseanyofthefollowingconstantsdeclaredbytheVisiotypelibraryinmemberVisRowTags.

Constant ValuevisTagComponent 137visTagMoveTo 138visTagLineTo 139visTagArcTo 140visTagInfiniteLine 141visTagEllipse 143visTagEllipticalArcTo 144visTagSplineBeg 165visTagSplineSpan 166visTagPolylineTo 193visTagNURBSTo 195visTagTab0 136visTagTab2 150visTagTab10 151visTagTab60 181visTagCnnctPt 153visTagCnnctNamed 185visTagCtlPt 162visTagCtlPtTip 170

Ifaninappropriaterowtagispassedortherowdoesnotexist,nochangesoccurandanerrorisreturned.

UsetheRowNamepropertytotransitionfromunnamedtonamedConnectionPointsrows.

SeetheAddRowmethodforalistofvalidrowconstantsandrowtagconstants.

SeetheAddSectionmethodforalistofvalidsectionconstants.

RunBeginproperty

Returnsthebeginningindexofatypeofrun—asequenceofcharactersthatshareaparticularattribute,suchascharacter,paragraph,ortabformatting;oraword,paragraph,orfield.

Versionadded

3.0

Syntax

intRet=object.RunBegin(runType)intRet Long.Thebeginningindexoftherun.object Required.AnexpressionthatreturnsaCharactersobject.runType RequiredInteger.Thetypeofruntoget.

Remarks

InaShapeSheetwindow,eachrowintheCharacterandParagraphsectionsrepresentsarunofthecorrespondingformatinashape'stext.Certainwordsmaybeboldoritalic,oroneparagraphmaybecenteredandanotherleft-aligned.

Example

Eachchangeofformatrepresentsarunofthatformat.Similarly,delimiterssuchasspacesandparagraphmarksrepresentthebeginningandendofwords,paragraphs,andfields.

Inaddition,youcanretrieverowsthatrepresentrunsofcharacter,paragraph,andtabformatsbyspecifyingarowindexasanargumenttotheCellsSRCpropertyofashape.

UsetheRunBeginpropertytodeterminethebeginningofasequenceofidenticallyformattedcharactersorthebeginningofaword,paragraph,orfield.YoucanchecktheIsFieldpropertytodeterminewhetherarunisafield.

TheindexthattheRunBeginpropertyreturnsislessthanorequaltothebeginningindexofaCharactersobject.IftheBeginpropertyoftheCharactersobjectisalreadyatthestartofarun,thevalueoftheRunBeginpropertyisequaltothevalueofBegin.

UsetherunTypeargumenttospecifythetypeofrunyouwant.YoucanalsouseanyofthefollowingconstantsdeclaredbytheVisiotypelibraryinmemberVisRunTypes.

Constant Value DescriptionvisCharPropRow 1 Reportsrunsofcharacterswith

commoncharacterproperties.Correspondstosetofcharacterscoveredbyonerowinshape'sCharactersection.

visParaPropRow 2 Reportsrunsofcharacterswithcommonparagraphproperties.Correspondstosetofcharacterscoveredbyonerowinshape'sParagraphsection.

visTabPropRow 3 Reportsrunsofcharacterswithcommontabproperties.Correspondstosetofcharacterscoveredbyonerowinshape'sTabssection.

visWordRun 10 Reportsrunswhoseboundariesarebetweensuccessivewordsin

shape'stext.Mimicsdouble-clickingtoselecttext.

visParaRun 11 Reportsrunswhoseboundariesarebetweensuccessiveparagraphsinshape'stext.Mimicstriple-clickingtoselecttext.

visFieldRun 20 Reportsrunswhoseboundariesarebetweencharactersthatareandaren'ttheresultoftheexpansionofatextfield,orbetweencharactersthataretheresultoftheexpansionofdistincttextfields.

RunEndproperty

Returnstheendingindexofatypeofrun—asequenceofcharactersthatshareaparticularattribute,suchascharacter,paragraph,ortabformatting;oraword,paragraph,orfield.

Versionadded

3.0

Syntax

intRet=object.RunEnd(runType)intRet Long.Theendingindexoftherun.object Required.AnexpressionthatreturnsaCharactersobject.runType RequiredInteger.Thetypeofruntoget.

Remarks

InaShapeSheetwindow,eachrowintheCharacterandParagraphsectionsrepresentsarunofthecorrespondingformatinashape'stext.Certainwordsmaybeboldoritalic,oroneparagraphmaybecenteredandanotherleft-aligned.

Example

Eachchangeofformatrepresentsarunofthatformat.Similarly,delimiterssuchasspacesandparagraphmarksrepresentthebeginningandendofwords,paragraphs,andfields.

Inaddition,youcanretrieverowsthatrepresentrunsofcharacter,paragraph,andtabformatsbyspecifyingarowindexasanargumenttotheCellsSRCpropertyofashape.

UsetheRunEndpropertytodeterminetheendofasequenceofidenticallyformattedcharactersortheendofaword,paragraph,orfield.YoucanchecktheIsFieldpropertytodeterminewhetherarunisafield.

TheindexthattheRunEndpropertyreturnsisgreaterthanorequaltotheendingindexofaCharactersobject.IftheEndpropertyoftheCharactersobjectisalreadyattheendofarun,thevalueoftheRunEndpropertyisequaltothevalueoftheEndproperty.

UsetherunTypeargumenttospecifythetypeofrunyouwant.YoucanalsouseanyoftheconstantsdeclaredbytheVisiotypelibraryinVisRunTypes.TofindalistofrunTypevalues,seetheRunBeginproperty.

Savedproperty

Determineswhetheradocumenthasanyunsavedchanges.

Versionadded

2.0

Syntax

boolRet=object.Savedobject.Saved=boolExpressionboolRet Boolean.Trueifthedocumenthasnounsavedchanges;

otherwise,False.object Required.AnexpressionthatreturnsaDocumentobject.boolExpression RequiredBoolean.Truetoindicatethedocumentissaved;

Falsetoindicateunsavedchanges.

Remarks

SettingtheSavedpropertyforadocumenttoTrueshouldbedonewithcaution.

Seealso

IfyousettheSavedpropertytoTrueandauser,oranotherprogram,makeschangestothedocumentbeforeitisclosedthosechangeswillbelost—Visiodoesnotprovideaprompttosavethedocument.

AdocumentthatcontainsembeddedorlinkedOLEobjectsmayreportitselfasunsavedevenifthedocument'sSavedpropertyissettoTrue.

SavePreviewModeproperty

Determineshowapreviewpictureissavedinafile.

Versionadded

4.0

Syntax

retVal=object.SavePreviewModeobject.SavePreviewMode=newValretVal VisSavePreviewMode.ThetypeofpreviewpicturethatVisio

saves.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredVisSavePreviewMode.Thetypeofpreviewpicture

thatVisiosaves.

Remarks

ThevalueoftheSavePreviewModepropertyisequivalenttothePreviewsettingontheSummarytabinthePropertiesdialogbox(clickPropertiesontheFilemenu).ApreviewofthefirstpageappearsintheOpendialogbox.ThevalueofretValandnewValcanbeoneofthefollowingVisSavePreviewModeconstants.

Constant Value Description

Seealso Example

visSavePreviewNone 0 Nopreviewpicture.visSavePreviewDraft1st 1 ThefirstpagewithonlyVisio

shapes.Doesnotincludeembeddedobjects,text,orgradientfills.

visSavePreviewDetailed1st 2 Thefirstpagewithallobjects.visSavePreviewDraftAll 4 AllfilepageswithonlyVisio

shapes.Doesnotincludeembeddedobjects,text,orgradientfills.

visSavePreviewDetailedAll 8 Allfilepageswithallobjects.

ScreenUpdatingproperty

Determineswhetherthescreenisupdated(redrawn)duringaseriesofactions.

Versionadded

3.0

Syntax

intRet=object.ScreenUpdatingobject.ScreenUpdating=intExpressionintRet Integer.Zero(0)ifscreenupdatingisoff;-1ifscreenupdating

ison.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.Zero(0)toturnscreenupdatingoff;non-

zerototurnscreenupdatingon.

Remarks

UsetheScreenUpdatingpropertytoincreaseperformanceduringaseriesof

actions.Forexample,youcanturnoffscreenupdatingwhileaseriesofshapesarecreatedsothescreenisnotredrawnaftereachshapeappears,andthenturnscreenupdatingontoupdatethescreen.

IfyousendalargenumberofcommandstoaVisioinstancewhilescreenupdatingisturnedoff,theVisioinstancemayredisplaythescreenoccasionallyinordertoflushitsbuffers.

Ifaprogramneglectstoturnscreenupdatingonafterturningitoff,theVisioinstanceturnsscreenupdatingbackonwhenauserperformsanoperation.

NoteBeginningwithVisio2000,theShowChangespropertyisincluded.TheShowChangesandScreenUpdatingpropertiesaresimilarinthattheyarebothdesignedtoincreaseperformanceduringaseriesofactions,buttheyworkdifferently.SettingtheShowChangespropertyalsosetstheScreenUpdatingproperty,butsettingtheScreenUpdatingpropertydoesnotsettheShowChangesproperty.Forinformationcomparingthesetwoproperties,seetheShowChangesproperty.

Sectionproperty

ReturnstherequestedSectionobjectbelongingtoashapeorstyle.

Versionadded

4.0

Syntax

objRet=object.Section(index)objRet TheSectionobjectthatcorrespondstotheindex.object Required.AnexpressionthatreturnsaShapeorStyleobject.index RequiredInteger.Asectionindex.

Remarks

ConstantsrepresentingsectionsareprefixedwithvisSectionandaredeclaredbytheVisiotypelibraryinVisSectionIndices.YoucanalsoviewalistofconstantsintheAddSectionmethod.

Example

Sectionproperty(Cellobject)

Returnstheindexofthecell'ssection.

Versionadded

4.0

Syntax

intRet=object.SectionintRet Integer.Theindexofthecell'ssection.object Required.AnexpressionthatreturnsaCellobject.

Remarks

ConstantsrepresentingsectionsareprefixedwithvisSectionandaredeclaredbytheVisiotypelibraryinVisSectionIndices.YoucanalsoviewalistofconstantsintheAddSectionmethod.

Example

SectionExistsproperty

DetermineswhetheraShapeSheetsectionexistsforaparticularshape.

Versionadded

4.0

Syntax

intRet=object.SectionExists(section,fExistsLocally)intRet Integer.False(0)ifsectiondoesn'texist;otherwise,True(1).object Required.AnexpressionthatreturnsaShapeobject.section RequiredInteger.Thesectionindex.fExistsLocally RequiredInteger.Thescopeofthesearch.

Remarks

IffExistsLocallyisFalse(0),theSectionExistspropertyreturnsTrueiftheobjecteithercontainsorinheritsthesection.IffExistsLocallyisTrue(non-zero),theSectionExistspropertyreturnsTrueonlyiftheobjectcontainsthesection

Example

locally;ifthesectionisinherited,theSectionExistspropertyreturnsFalse.

ConstantsrepresentingsectionsareprefixedwithvisSectionandaredeclaredbytheVisiotypelibraryinVisSectionIndices.YoucanalsoviewalistofconstantsintheAddSectionmethod.

Selectionproperty

ReturnsaSelectionobjectthatrepresentswhatispresentlyselectedinthewindow.

Versionadded

2.0

Syntax

objRet=object.SelectionobjRet ASelectionobject.object Required.AnexpressionthatreturnsaWindowobject.

Remarks

TheSelectionobjectisindependentoftheselectioninthewindow,whichcansubsequentlychangeasaresultofuseractions.

ASelectionobjectisasetofshapesinacommoncontextonwhichyoucanperformactions.ASelectionobjectisanalogoustomorethanselectedshapesin

adrawingwindow.OnceyouretrieveaSelectionobject,youcanchangethesetofshapestheobjectrepresentsusingtheSelectmethod.

SetIDproperty

ReturnsthesetIDofanAccelTable,Menuset,orToolbarobjectinitscollection.

Versionadded

4.0

Syntax

intRet=object.SetIDintRet Long.ThesetIDoftheobject.object Required.AnexpressionthatreturnsanAccelTable,MenuSet,

orToolbarSetobject.

Remarks

EachAccelTable,MenuSet,andToolbarSetobjecthasasetIDthatcorrespondstoaVisiowindowcontext.ForMenuSetobjects,IDsalsocorrespondtoshortcutmenusets.AndforToolbarSetobjects,theyalsocorrespondtodrop-downmenusundertoolbarbuttons(suchasFillColoror

Example

LineWeight).

YoucanusethesetIDtoretrieveanobjectfromitscollectionwiththeItemAtIDproperty.YoucanalsosetthesetIDofanobjectusingtheAddAtIDmethod.

ValidsetIDvaluesaredeclaredbytheVisiotypelibraryinVisUIObjSets.

IDconstantsforAccelTableobjects

IDconstantsforMenuSetobjects

IDconstantsforToolbarSetobjects

Shapeproperty

ReturnstheShapeobjectthatownsaCellorCharactersobjectorthatisassociatedwithanOLEObjectorHyperlinkobject.

Versionadded

3.0

Syntax

objRet=object.ShapeobjRet TheShapeobjectthatcontainsorisassociatedwiththeobject.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

ShapeHelpproperty

GetsorsetsthehelpstringusedwhentheuserclicksHelpontheshortcutmenuofamastershortcut.

Versionadded

2000

Syntax

strRet=object.ShapeHelp

object.ShapeHelp=strExpressionstrRet String.Thecurrenthelpstring.object Required.AnexpressionthatreturnsaMasterShortcutobject.strExpression RequiredString.Thenewhelpstring.

Remarks

Ifthehelpstringisblank,theHelpcommandusesthehelpstringdefinedbytheshortcut'stargetmaster,determinedbytheHelppropertyofthatmaster'stop-levelshape.

Seealso Example

Shapesproperty

ReturnstheShapescollectionforapage,master,orgroup.

Versionadded

2.0

Syntax

objsRet=object.ShapesobjsRet TheShapescollectionoftheobject.object Required.AnexpressionthatreturnsaPage,Master,orShape

objectthatownsthecollection.

Shiftproperty

DetermineswhethertheSHIFTkeyisamodifierforanAccelItemobject.

Versionadded

4.0

Syntax

intRet=object.Shiftobject.Shift=intExpressionintRet Integer.True(-1)ifmodifiedbySHIFTkey;otherwise,False

(0).object Required.AnexpressionthatreturnsanAccelItemobject.intExpression RequiredInteger.True(non-zero)ifmodifiedbySHIFTkey;

otherwise,False(0).

Example

ShowChangesproperty

Determineswhetherthescreenisupdated(redrawn)duringaseriesofactions.

Versionadded

2000

Syntax

boolRet=object.ShowChangesobject.ShowChanges=boolExpressionboolRet Boolean.Trueifthescreenisupdatedforeachdocument

change;Falseifitisnot.object Required.AnexpressionthatreturnsanApplicationobject.boolExpression RequiredBoolean.Truetoupdatethescreenforeach

documentchange;Falsetoleavethescreenunchanged.

Remarks

UsetheShowChangespropertytoincreaseperformanceduringaseriesof

Example

actions.Forexample,youcansettheShowChangespropertytoFalsewhileaseriesofshapesarecreatedsothescreenisnotredrawnaftereachshapeappears,andthensetittoTruetoupdatethescreen.

IfaprogramneglectstoturntheShowChangespropertyonafterturningitoff,theVisioinstancewillturnitbackonwhentheuserperformsanoperation.

TheShowChangespropertyissimilartotheScreenUpdatingproperty,whichwasimplementedinVisio3.0.InmostcasesusingtheShowChangespropertyispreferabletousingtheScreenUpdatingproperty.SettingtheShowChangespropertyautomaticallysetstheScreenUpdatingproperty;however,settingtheScreenUpdatingpropertydoesnotsettheShowChangesproperty.

WhenShowChangesisFalse,theVisioinstancewillnotrefreshthescreenasdocumentschange.AllshapesindrawingandstencilwindowsaredeselectedandtheVisioinstancewon'tallowprogramstochangetheselectionsofwindows.

WhenonlyScreenUpdatingisFalse,theVisioinstancewilloccasionallyrefreshthescreenasdocumentschange.ScreenUpdatingdoesnotcausedeselectstooccurorrestrictselectionchanges.

TheVisioinstancewillusuallyrunfasterwhenboththeShowChangesandScreenUpdatingpropertiesareFalsethanwhenonlytheScreenUpdatingpropertyisFalse.WhenboththeShowChangesandScreenUpdatingpropertiesareFalse,theVisioviewswillnotreacttodocumentchangesuntiltheShowChangespropertybecomesTrue.Thiscancausenoticeabledelaysafteraprogramhascompletedasequenceofmanyoperations.Tocausesomechangestooccurastheyhappen,setScreenUpdatingtoTrueimmediatelyaftersettingShowChangestoFalse.ThiscanshortenthedelaythatoccursafterShowChangesbecomesTrue,butwillprobablylengthenthetimetocompletetheoverallsequenceofactions.

ShowConnectPointsproperty

Determineswhetherconnectionpointsareshowninawindow.

Versionadded

4.5

Syntax

intRet=object.ShowConnectPointsobject.ShowConnectPoints=intExpression

intRet Integer.True(-1)ifconnectionpointsareshown;otherwise,False(0).

object Required.AnexpressionthatreturnsaWindowobject.

intExpression RequiredInteger.True(-1)toshowconnectionpoints;False(0)tohideconnectionpoints.

Example

Remarks

UsingtheShowConnectPointspropertyisequivalenttoclickingConnectionPointsontheViewmenu.

ShowGridproperty

Determineswhetheragridisshowninawindow.

Versionadded

4.5

Syntax

intRet=object.ShowGridobject.ShowGrid=intExpressionintRet Integer.True(-1)ifgridsareshowing;False(0)ifgridsare

hidden.object Required.AnexpressionthatreturnsaWindowobject.intExpression RequiredInteger.True(non-zero)toshowagrid;False(0)to

hideagrid.

Remarks

SettingtheShowGridpropertyisequivalenttoclickingGridontheView

menu.

ShowGuidesproperty

Determineswhetherguidesareshowninawindow.

Versionadded

4.5

Syntax

intRet=object.ShowGuidesobject.ShowGuides=intExpressionintRet Integer.True(-1)ifguidesareshowing;False(0)ifguidesare

hidden.object Required.AnexpressionthatreturnsaWindowobject.intExpression RequiredInteger.True(non-zero)toshowguides;False(0)to

hideguides.

Remarks

SettingtheShowGuidespropertyisequivalenttoclickingGuidesontheView

Example

menu.

ShowMenusproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertydeterminedwhethermenuswereshown(seetheShowToolbarproperty).

Seealso Example Appliesto

ShowPageBreaksproperty

Determineswhetherpagebreaksareshowninawindow.

Versionadded

4.5

Syntax

intRet=object.ShowPageBreaksobject.ShowPageBreaks=intExpressionintRet Integer.True(-1)ifpagebreaksareshowing;False(0)ifpage

breaksarehidden.object Required.AnexpressionthatreturnsaWindowobject.intExpression RequiredInteger.True(non-zero)toshowpagebreaks;False

(0)tohidepagebreaks.

Remarks

SettingtheShowPageBreakspropertyisequivalenttoclickingPageBreakson

Example

theViewmenu.

ShowPageTabsproperty

Determineswhetherpagetabcontrolsareshowninthedrawingwindow.

Versionadded

2002

Syntax

boolRet=object.ShowPageTabsobject.ShowPageTabs=boolExpressionboolRet Boolean.Trueifpagetabsareshowing;otherwise,False.object Required.AnexpressionthatreturnsaWindowobject.boolExpression RequiredBoolean.Truetoshowpagetabs;otherwise,False.

Seealso Example

ShowProgressproperty

Determineswhetheraprogressindicatorisshownwhileperformingcertainoperations.

Versionadded

4.1

Syntax

intRet=object.ShowProgressobject.ShowProgress=intExpressionintRet Integer.True(-1)ifaprogressindicatorisshowing;otherwise,

False(0).object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.True(non-zero)toshowaprogress

indicator;otherwise,False(0).

Remarks

Ifyouwanttoperformanoperation,suchasprinting,thattypicallydisplaysaprogressindicatorbutyoudon'twanttheprogressindicatortoappear,settheShowProgresspropertytoFalse(0).Bydefault,theShowProgresspropertyisTrue(non-zero).

Inmostcasesyoushouldrestorethesettingtoitspriorvaluewhenyou'vecompletedtheoperation.

ShowRulersproperty

Determineswhetherrulersareshowninthedrawingwindow.

Versionadded

4.5

Syntax

intRet=object.ShowRulersobject.ShowRulers=intExpressionintRet Integer.True(-1)ifrulersareshowing;False(0)ifrulersare

hidden.object Required.AnexpressionthatreturnsaWindowobject.intExpression RequiredInteger.True(non-zero)toshowrulers;False(0)to

hiderulers.

Remarks

SettingtheShowRulerspropertyisthesameasclickingRulersontheView

menu.

ShowScrollBarsproperty

Determineswhetherscrollbarsareshowninthedrawingwindow.

Versionadded

2002

Syntax

intRet=object.ShowScrollBarsobject.ShowScrollBars=intExpressionintRet Integer.Non-zeroifoneormorescrollbarsareshowing;

otherwise,zero(0).object Required.AnexpressionthatreturnsaWindowobject.intExpression RequiredInteger.SeeRemarksforpossiblevalues.

Remarks

TheintExpressionargumentcanbeanycombinationofthefollowingVisScrollbarStatesconstants,whicharedeclaredintheVisiotypelibrary.

Example

Constant ValuevisScrollBarNeither &H0visScrollBarHoriz &H1visScrollBarVert &H4visScrollBarBoth &H5

ShowStatusBarproperty

Determineswhetherastatusbarisshown.

Versionadded

4.5

Syntax

intRet=object.ShowStatusBarobject.ShowStatusBar=intExpressionintRet Integer.True(-1)ifthestatusbarisshowing;otherwise,False

(0).object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.True(-1)toshowastatusbar;False(0)to

hideastatusbar.

Remarks

TheShowStatusBarpropertypersistseachtimeyouruntheapplication.The

ShowMenusandShowToolbarpropertiesarevalidforaVisioinstanceonly.

ShowToolbarproperty

Determineswhethertoolbarsandmenubarsarevisible.

Versionadded

5.0

Syntax

intRet=object.ShowToolbarobject.ShowToolbar=intExpressionintRet Integer.True(-1)iftoolbarsandmenubarsareshowing;

False(0)iftoolbarsandmenubarsarehidden.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredInteger.True(non-zero)toshowtoolbarsandmenu

bars;False(0)tohidetoolbarsandmenubars.

Remarks

TheShowToolbarpropertyisvalidforaVisioinstanceonly.The

Example

ShowStatusBarpropertypersistseachtimeyouruntheapplication.

SnapAnglesproperty

Determinesthedegreeoftheanglethatisdrawnwhenisometricanglelinesischosenasashapeextensionoption.

Versionadded

2002

Syntax

retVal=object.SnapAnglesobject.SnapAngles=newValretVal Double.Anarrayofupto10entriescontainingthecurrent

degree(s)oftheisometricangleshapeextensions.Separatemultiplevalueswithcommas.

object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredDouble.Anarrayofupto10entriescontainingnew

degreevalues(s)oftheisometricangleshapeextensions.Separatemultiplevalueswithcommas.

Example

Remarks

ThevalueoftheSnapAnglespropertyisequivalenttothevalueoftheIsometricangles(degs)fieldontheAdvancedtabintheSnap&Gluedialogbox(ontheToolsmenu,clickSnap&Glue).

SnapEnabledproperty

Determineswhethersnapisactiveinthedocument.

Versionadded

2002

Syntax

retVal=object.SnapEnabledobject.SnapEnabled=newValretVal Boolean.Trueifsnapisactive;otherwise,False.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredBoolean.Truetoenablesnapbehavior;Falseto

disablesnapbehavior.

Remarks

ThevalueoftheSnapEnabledpropertyisequivalenttoselectingtheSnapcheckboxontheGeneraltabintheSnap&Gluedialogbox(ontheToolsmenu,clickSnap&Glue).

Seealso Example

SnapExtensionsproperty

Determinestheshapeextensionsthatareactiveinadocument.

Versionadded

2002

Syntax

retVal=object.SnapExtensionsobject.SnapExtensions=newValretVal VisSnapExtensions.Theshapeextensionoptionscurrently

activeinadocument.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredVisSnapExtensions.Theshapeextensionoptionsto

activateinadocument.

Remarks

YoucanalsosetthisvaluebycheckingoptionsintheShapeextensionoptionsboxontheAdvancedtabintheSnap&Gluedialogbox(ontheToolsmenuclickSnap&Glue).

TheSnapExtensionspropertycanbeanycombinationofthefollowingVisSnapExtensionsconstants,whicharedeclaredintheVisiotypelibrary.

Constant Value

Seealso Example

visSnapExtNone &H0visSnapExtAlignmentBoxExtension &H1visSnapExtCenterAxes &H2visSnapExtCurveTangent &H4visSnapExtEndpoint &H8visSnapExtMidpoint &H10visSnapExtLinearExtension &H20visSnapExtCurveExtension &H40visSnapExtEndpointPerpendicular &H80visSnapExtMidpointPerpendicular &H100visSnapExtEndpointHorizontal &H200visSnapExtEndpointVertical &H400visSnapExtEllipseCenter &H800visSnapExtIsometricAngles &H1000

SnapSettingsproperty

Determinestheobjectsthatshapessnaptowhensnapisactiveinthedocument.

Versionadded

2002

Syntax

retVal=object.SnapSettingsobject.SnapSettings=newValretVal VisSnapSettings.Theobjectsinadocumentthatshapessnap

to.object Required.AnexpressionthatreturnsaDocumentobject.newVal RequiredVisSnapsettings.Theobjectsinadocumentthat

shapessnapto.

Remarks

ThevalueoftheSnapSettingspropertyisequivalenttoselectingcheckboxesunderSnaptoontheGeneraltabintheSnap&Gluedialogbox(ontheToolsmenuclickSnap&Glue).

TheSnapSettingspropertycanbeanycombinationofthefollowingVisSnapSettingsconstants,whicharedeclaredintheVisiotypelibrary.

Constant Value Description

Seealso Example

visSnapToNone &H0 Snaptonothing.visSnapToRulerSubdivisions &H1 Snaptotickmarksonthe

ruler.visSnapToGrid &H2 Snaptothegrid.visSnapToGuides &H4 Snaptoguides.visSnapToHandles &H8 Snaptoselectionhandles.visSnapToVertices &H10 Snaptovertices.visSnapToConnectionPoints &H20 Snaptoconnectionpoints.visSnapToGeometry &H100 Snaptothevisibleedgesof

shapes.visSnapToAlignmentBox &H200 Snaptothealignmentbox.visSnapToExtensions &H400 Snaptoshapeextensions

options.visSnapToDisabled &H8000 Disablesnap.visSnapToIntersections &H10000 Snaptointersections.

SolutionXMLElementproperty

Containssolution-specific,well-formedXMLdatastoredwithadocument.

Versionadded

2002

Syntax

xmlData=object.SolutionXMLElement(elementName)object.SolutionXMLElement(elementName)=xmlValuexmlData String.ThecurrentXMLdatastoredinelementName.object Required.AnexpressionthatreturnsaDocumentobject.elementName RequiredString.Thecase-sensitivenameofthe

SolutionXMLdataelement.xmlValue RequiredString.Thenewvalid,well-formedXMLdatato

storeinelementName.

Remarks

Example

ThevalueofelementNamemustmatchthevalueoftheSolutionXMLelement'sNameattribute.Forexample,ifasolution'sXMLdatabeganwiththestatement<SolutionXMLName='somename'>,usetheelementName"somename"toretrievethatdata.

IfelementNamealreadyexists,theSolutionXMLElementpropertyoverwritesexistingXMLdata.UsetheSolutionXMLElementExistspropertybeforewritingXMLdatatoavoidlosingdataunintentionally.

IfelementNamedoesnotexist,theSolutionXMLElementpropertycreatesanelementbythatname.

BecauseyourXMLdataisvalidatedwhenyouwriteit,youwilltypicallyperformthisoperationduringadocumentsaveeventforperformancereasons.

SolutionXMLElementCountproperty

ReturnsthenumberofSolutionXMLelementsinadocument.

Versionadded

2002

Syntax

intRet=object.SolutionXMLElementCountintRet Long.ThenumberofSolutionXMLelementsinthedocument.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Thefirstelementinthedocumenthasanindexof1.

Example

SolutionXMLElementExistsproperty

IndicateswhetheranamedSolutionXMLelementexistsinthedocument.

Versionadded

2002

Syntax

boolRet=object.SolutionXMLElementExists(elementNameboolRet Boolean.True(-1)ifaSolutionXMLelementnamedelementName

exists;False(0)ifitdoesnot.object Required.AnexpressionthatreturnsaDocumentobject.elementName RequiredString.Thecase-sensitivenameoftheSolutionXML

element.

Remarks

BecausetheSolutionXMLElementpropertycanoverwriteexistingXMLdata,alwaysusetheSolutionXMLElementExistspropertytoverifywhetherelementNamealreadyexistsinthedocument.

Example

SolutionXMLElementNameproperty

ReturnsthenameoftheSolutionXMLelement.

Versionadded

2002

Syntax

strRet=object.SolutionXMLElementName(index)strRet String.Thecase-sensitivenameoftheSolutionXML

element.object Required.AnexpressionthatreturnsaDocumentobject.index RequiredLong.TheindexoftheSolutionXMLelementin

thedocument.

Remarks

TheonlywaytoretrieveSolutionXMLdataisbyname.YoucanusetheSolutionXMLElementNamepropertytogettheelementnametopasstotheSolutionXMLElementproperty.

Example

Spacingproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertydeterminedthespacingbetweenmenus,menuitems,andtoolbaritems.

Seealso Example Appliesto

SpatialNeighborsproperty

ReturnsaSelectionobjectthatrepresentstheshapesthatmeetcertaincriteriainrelationtoaspecifiedshape.

Versionadded

2000

Syntax

objRet=object.SpatialNeighbors(relation,tolerance,flagsobjRet ASelectionobject.object Required.AnexpressionthatreturnsaShapeobject.relation RequiredInteger.Anintegerdescribingthetypeofrelationshiptobeused.tolerance RequiredDouble.Adistanceininternaldrawingunitswithrespecttothe

coordinatespacedefinedbytheparentshape.flags RequiredInteger.Flagsthatinfluencethetypeofentriesreturnedinresults.resultRoot OptionalVariant.AShapeobjectthatrepresentsapageorgroup.

Remarks

Forvaluesoftherelationargument,seetheSpatialRelationproperty.

Theflagsargumentcanbeanycombinationofthevaluesoftheconstantsdefinedinthefollowingtable.TheseconstantsarealsodefinedinVisSpatialRelationFlagsintheVisiotypelibrary.

Constant Value DescriptionvisSpatialIncludeGuides &H2 Consideraguide'sGeometry

section.Bydefault,guidesdonotinfluencetheresult.

visSpatialFrontToBack &H4 Orderitemsfronttoback.visSpatialBackToFront &H8 Orderitemsbacktofront.visSpatialIncludeHidden &H10 ConsiderhiddenGeometry

sections.Bydefault,hiddenGeometrysectionsdonotinfluencetheresult.

visSpatialIgnoreVisible &H20 DonotconsidervisibleGeometrysections.Bydefault,visibleGeometrysectionsinfluencetheresult.

UsetheNoShowcelltodeterminewhetheraGeometrysectionishiddenorvisible.HiddenGeometrysectionshaveavalueofTRUEandvisibleGeometrysectionshaveavalueofFALSEintheNoShowcell.

BeginningwithVisio2002,ifflagscontainsVisSpatialFrontToBack,itemsintheSelectionobjectreturnedbytheSpatialNeighborspropertyareorderedfronttoback.IfvisSpatialBackToFrontisset,theitemsreturnedareorderedbacktofront.Ifthisflagisnotset,orifyouarerunninganearlierversionofVisio,theorderisunpredictable.YoucandeterminetheorderusingtheIndexpropertyoftheshapesidentifiedintheSelectionobject.

Ifyoudon'tspecifyresultRoot,thispropertyreturnsaSelectionobjectthatrepresentstheshapesthatmeetcertaincriteriainrelationtothespecifiedshape.IfyouspecifyresultRoot,thispropertyreturnsaSelectionobjectthatrepresentsalltheshapesintheShapeobjectspecifiedbyresultRootthatmeetcertaincriteriainrelationtothespecifiedshape.Forexample,specifyresultRoottofindallshapeswithinagroupthatarenearaspecifiedshape.

IfresultRootisspecifiedbutisn'tonthesamepageorinthesamemasterastheShapeobjecttowhichyouarecomparingit,theSpatialNeighborspropertyraisesanexceptionandreturnsNothing.

Ifrelationisnotspecified,theSpatialNeighborspropertyusesallthepossiblerelationshipsascriteria.

TheSpatialNeighborspropertydoesnotconsiderthewidthofashape'sline,shadows,lineends,controlpoints,orconnectionpointswhencomparingtwoshapes.

SpatialRelationproperty

Returnsanintegerthatrepresentsthespatialrelationshipofoneshapetoanothershape.Bothshapesmustbeonthesamepageorinthesamemaster.

Versionadded

2000

Syntax

relation=object.SpatialRelation(otherShape,tolerance,relation Integer.Therelationshipbetweentwoshapes.SeeRemarksforthe

valuesofthisargument.object Required.AnexpressionthatreturnsaShapeobject.otherShape Required.TheotherShapeobjectinvolvedinthecomparison.tolerance RequiredDouble.Adistanceininternaldrawingunitswithrespectto

thecoordinatespacedefinedbytheShapeobject'sparent.flags RequiredInteger.Flagsthatinfluencetheresult.SeeRemarksforthe

valuesofthisargument.

Remarks

Valuesforrelation

Valuesforflags

NoteTheSpatialRelationpropertydoesnotconsiderthewidthofashape'sline,shadows,lineends,controlpoints,orconnectionpointswhencomparingtwoshapes.

SpatialSearchproperty

ReturnsaSelectionobjectwhoseshapesmeetcertaincriteriainrelationtoapointthatisexpressedinthecoordinatespaceofapage,master,orgroup.

Versionadded

2000

Syntax

objRet=object.SpatialSearch(x,y,relation,tolerance,flagsobjRet ASelectionobject.object Required.AnexpressionthatreturnsaPage,Master,orShape

object.x RequiredDouble;x-coordinate.y RequiredDouble,y-coordinate.relation RequiredInteger.Anycombinationofthevaluesoftheconstants

visSpatialContainedInandvisSpatialTouching.tolerance RequiredDouble.Adistanceininternaldrawingunitswithrespect

tothecoordinatespace.

Example

flags RequiredInteger.Flagsthatinfluencetheresult.

Remarks

Forvaluesoftherelationargument,seetheSpatialRelationproperty.

Ifrelationisnotspecified,theSpatialSearchpropertyusesbothrelationshipsascriteria.

Valuesofflags

TheSpatialSearchpropertydoesnotconsiderthewidthofashape'sline,shadows,lineends,controlpoints,orconnectionpointswhencomparingtwoshapes.

Startproperty

ReturnsthestartofaCurveobject'sparameterdomain.

Versionadded

5.0

Syntax

retVal=object.StartretVal Double.StartingvalueofaCurveobject'sparameterdomain.object Required.AnexpressionthatreturnsaCurveobject.

Remarks

TheStartpropertyofcurvereturnsthecoordinatesofthecurve'sstartingpoint.ACurveobjectdescribesitselfintermsofitsparameterdomain,whichistherange[Start(),End()]whereStart()producesthecurve'sstartingpoint.

StartupPathsproperty

GetsorsetsthepathswhereMicrosoftVisiolooksforadd-onstorunwhentheapplicationisstarted.

Versionadded

Visio4.0

Syntax

strRet=object.StartupPathsobject.StartupPaths=pathsStrstrRet String.Atextstringcontainingalistoffolders.Foldersare

separatedbysemicolons.object Required.AnexpressionthatreturnsanApplicationobject.pathsStr RequiredString.Atextstringcontainingalistoffolders;to

indicatemorethanonefolder,separateindividualitemsinthepathstringwithsemicolons.

Remarks

ThestringpassedtoandreceivedfromtheStartupPathspropertyisthesamestringshownontheFilePathstabintheOptionsdialogbox(clickOptionsontheToolsmenu,andthenclickFilePaths).ThisstringisstoredinHKEY_CURRENT_USER\Software\Microsoft\Visio\application\StartUpPath

Whentheapplicationlooksforstartupfiles,itlooksinallpathsnamedintheStartupPathspropertyandallthesubfoldersofthosepaths.IfyoupasstheStartupPathspropertytotheEnumDirectoriesmethod,itreturnsacompletelistoffullyqualifiedpathsinwhichtheapplicationlooks.

Ifapathisnotfullyqualified,theapplicationlooksforthefolderinthefolderthatcontainstheVisioprogramfiles(appObj.Path).Forexample,iftheVisioexecutablefileisinstalledinc:\Visio,andtheStartupPathspropertyis"Startup;d:\Startup",theapplicationlooksforstartupfilesinbothc:\Visio\Startupandd:\Startup.

Statproperty

Returnsstatusinformationforanobject.

Versionadded

3.0

Syntax

intRet=object.StatintRet Integer.Abitmaskofstatusbits.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Remarks

Ifanobjectisareferencetoanentityinadocument,andifthatdocumentcloses,theStatpropertyreturnsavalueinwhichthevisStatClosedbitisset.

Ifanobjectisareferencetoanentitythathasbeendeleted,theStatpropertyreturnsavalueinwhichthevisStatDeletedbitisset.

AComponentObjectModel(COM)object,suchasaVisiodocumentobject,livesaslongasitisheld(pointedto)byaclient,eveniftheobjectislogicallyinadeletedorclosedstate.

Stateproperty

Determinesabutton'sstate—pressedornotpressed.

Versionadded

2000

Syntax

intRet=object.Stateobject.State=intExpressionintRet Integer.Thestateofthebutton.object Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemobject.intExpression RequiredInteger.Thenewstateofthebutton.

Remarks

TheStatepropertycanbeoneofthefollowingconstantsdeclaredbytheVisiotypelibraryinVisUIButtonState.

Seealso

Constant Value DescriptionvisButtonUp 0 ButtonisnotpressedvisButtonDown -1 Buttonispressed

StencilPathsproperty

GetsorsetsthepathswhereMicrosoftVisiolooksforstencils.

Versionadded

4.0

Syntax

strRet=object.StencilPathsobject.StencilPaths=pathsStrstrRet String.Atextstringcontainingalistoffolders.object Required.AnexpressionthatreturnsanApplicationobject.pathsStr RequiredString.Atextstringcontainingalistoffolders.Use

semicolonstoseparateindividualfoldersinthepathstring.

Remarks

ThestringpassedtoandreceivedfromtheStencilPathspropertyisthesamestringshownontheFilePathstabintheOptionsdialogbox(clickOptionson

theToolsmenu,andthenclickFilePaths).

WhentheVisioapplicationlooksforstencils,itlooksinallpathsnamedintheStencilPathspropertyandallthesubfoldersofthosepaths.IfyoupasstheStencilPathspropertytotheEnumDirectoriesmethod,itreturnsacompletelistoffullyqualifiedpathsinwhichtheVisioapplicationlooks.

Ifapathisnotfullyqualified,theVisioapplicationlooksforthefolderinthefolderthatcontainstheVisioprogramfiles(appObj.Path).Forexample,iftheVisioexecutablefileisinstalledinc:\Visio,andtheStencilPathspropertyis"Stencils;d:\Stencils",Visiolooksforstencilsinbothc:\Visio\Stencilsandd:\Stencils.

StatusBarItemsproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertyreturnedtheStatusBarItemscollectionofaStatusBarorStatusBarItemobject.

Seealso Example Appliesto

StatusBarsproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertyreturnedtheStatusBarscollectionofaUIObjectobject.

Seealso Example Appliesto

Styleproperty

Determineswhetheratoolbarbuttonormenuitemshowsanicon,acaption,orsomecombination.

Versionadded

2000

Syntax

intRet=object.Style

object.Style=intExpressionintRet Integer.Thecurrentstyleofatoolbarbuttonormenuitem.object Required.AnexpressionthatreturnsaMenu,MenuItem,or

ToolbarItemobject.intExpression RequiredInteger.Thenewstyleforatoolbarbuttonormenu

item.

Remarks

Seealso

Ifastyleconsistsofdifferenttext,line,andfillstyles,theStylepropertyreturnsthefillstyle.IfyousettheStylepropertytoanonexistentstyle,yourprogramgeneratesanerror.

PossibleintvalandintExpressionvaluesarelistedinthefollowingtable.TheseconstantsaredeclaredbytheVisiotypelibraryinVisUIButtonStyle.

Constant ValuevisButtonAutomatic 0visButtonCaption 1visButtonIcon 2visCaptionAndIcon 3

Styleproperty(Cellobject)

GetsthestylethatcontainsaCellobject.

Versionadded

2.0

Syntax

objRet=object.StyleobjRet AStyleobjectthatrepresentsthestylecontainingthecell.object Required.AnexpressionthatreturnsaCellobject.

Remarks

Ifastyleconsistsofdifferenttext,line,andfillstyles,theStylepropertyreturnsthefillstyle.

IfaCellobjectisinastyle,itsStylepropertyreturnsthestylethatcontainsthecell,anditsShapepropertyreturnsNothing.

Example

IfaCellobjectisinashape,itsShapepropertyreturnstheshapethatcontainsthecell,anditsStylepropertyreturnsNothing.

Styleproperty(Sectionobject)

GetsthestylethatcontainsaSectionobject.

Versionadded

2.0

Syntax

objRet=object.StyleobjRet AStyleobjectthatrepresentsthestylecontainingthesection.object Required.AnexpressionthatreturnsaSectionobject.

Remarks

Ifastyleconsistsofdifferenttext,line,andfillstyles,theStylepropertyreturnsthefillstyle.

IfaSectionobjectisinastyle,itsStylepropertyreturnsthestylethatcontainsthecell,anditsShapepropertyreturnsNothing.

Example

IfaSectionobjectisinashape,itsShapepropertyreturnstheshapethatcontainsthecell,anditsStylepropertyreturnsNothing.

Styleproperty(Shapeobject)

GetsorsetsthestyleforaShapeobject.

Versionadded

2.0

Syntax

strRet=object.Styleobject.Style=stringExpressionstrRet String.Thefillstylecomponentofthestyle.object Required.AnexpressionthatreturnsaShapeobjectthathas

orgetsthestyle.stringExpression RequiredString.Thenameofthestyletoapply.

Remarks

Ifastyleconsistsofdifferenttext,line,andfillstyles,theStylepropertyreturnsthefillstyle.IfyousettheStylepropertytoanonexistentstyle,yourprogram

Example

generatesanerror.

Topreservelocalformatting,usetheStyleKeepFmtproperty.

BeginningwithVisio2002,anemptystring("")willcausethemaster'sstyletobereappliedtotheshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoanemptystringistheequivalentofselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistintheStyledialogbox(ontheFormatmenu,clickStyle).

Styleproperty(Selectionobject)

GetsorsetsthestyleforaSelectionobject.

Versionadded

2.0

Syntax

strRet=object.Styleobject.Style=stringExpressionstrRet String.Thefillstylecomponentofthestyle.object Required.AnexpressionthatreturnsaSelectionobjectthat

hasorgetsthestyle.stringExpression RequiredString.Thenameofthestyletoapply.

Remarks

Ifastyleconsistsofdifferenttext,line,andfillstyles,theStylepropertyreturnsthefillstyle.IfyousettheStylepropertytoanonexistentstyle,yourprogram

Example

generatesanerror.

Topreservelocalformatting,usetheStyleKeepFmtproperty.

BeginningwithVisio2002,anemptystring("")willcausethemaster'sstyletobereappliedtotheselection.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionhasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoanemptystringistheequivalentofselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistintheStyledialogbox(ontheFormatmenu,clickStyle).

Styleproperty(Rowobject)

GetsthestylethatcontainsaRowobject.

Versionadded

2.0

Syntax

objRet=object.StyleobjRet AStyleobjectthatrepresentsthestylecontainingtherow.object Required.AnexpressionthatreturnsaRowobject.

Remarks

Ifastyleconsistsofdifferenttext,line,andfillstyles,theStylepropertyreturnsthefillstyle.

IfaRowobjectisinastyle,itsStylepropertyreturnsthestylethatcontainsthecell,anditsShapepropertyreturnsNothing.

Example

IfaRowobjectisinashape,itsShapepropertyreturnstheshapethatcontainsthecell,anditsStylepropertyreturnsNothing.

StyleKeepFmtproperty

Appliesastyletoanobjectwhilepreservinglocalformatting.

Versionadded

2.0

Syntax

object.StyleKeepFmt=stringExpressionobject Required.AnexpressionthatreturnsaShapeorSelection

objectthatgetsthestyle.stringExpression RequiredString.Thenameofthestyletoapply.

Remarks

SettingtheStyleKeepFmtpropertyisequivalenttoselectingthePreservelocalformattingcheckboxintheStyledialogbox(clickStyleontheFormatmenu).Settingastyletoanonexistentstylegeneratesanerror.

BeginningwithVisio2002,anemptystring("")willcausethemaster'sstyletobereappliedtotheselectionorshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionorshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoanemptystringistheequivalentofselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistontheStyledialogbox(ontheFormatmenu,clickStyle).

Seealso Example

Stylesproperty

ReturnstheStylescollectionforadocument.

Versionadded

2.0

Syntax

objRet=object.StylesobjRet TheStylescollectionoftheDocumentobject.object Required.AnexpressionthatreturnsaDocumentobject.

SubAddressproperty

Getsorsetsthesubaddressinashape'sHyperlinkobject.

Versionadded

5.0

Syntax

strRet=object.SubAddressobject.SubAddress=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaHyperlinkobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

SettingtheSubAddresspropertyofashape'sHyperlinkobjectisoptionalunlesstheAddresspropertyisblank.InthiscasetheSubAddressmustcontainthenameofthedrawingpage.

Settingahyperlink'sSubaddresspropertyisequivalenttoenteringinformationinSub-addressboxintheHyperlinksdialogbox(clickHyperlinksontheInsertmenu).ThisisalsoequivalenttosettingtheresultoftheSubaddresscellintheshape'sHyperlink.RowrowintheShapeSheetwindow.

TheSubAddresspropertyforaHyperlinkobjectspecifiesasublocationwithinthehyperlink'saddress.ForVisiofiles,thiscanbeapagename.ForMicrosoftExcel,thiscanbeaworksheetorarangewithinaworksheet.ForHTMLpages,thiscanbeasub-anchor.

Thehyperlinkaddressforwhichasubaddressisbeingsuppliedmustsupportsubaddresslinking.

Subjectproperty

GetsorsetsthevalueoftheSubjectfieldinadocument'sproperties.

Versionadded

2.0

Syntax

strRet=object.Subjectobject.Subject=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

SettingtheSubjectpropertyisequivalenttoenteringinformationintheSubjectboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

SubTypeproperty

ReturnsthesubtypeofaWindowobjectthatrepresentsadrawingwindow.

Versionadded

4.0

Syntax

intRet=object.SubTypeintRet Integer.ThesubtypeoftheWindowobject.object Required.AnexpressionthatreturnsaWindowobject.

Remarks

IftheTypepropertyofaWindowobjectreturnsanyvalueotherthanvisDrawing,theSubTypepropertyreturnsthesamevalueastheTypeproperty.IftheTypepropertyofaWindowobjectreturnsvisDrawing,theSubTypepropertyreturnsoneofthefollowingvalues.

Constant Value Description

Example

visPageWin 128 Adrawingwindowshowingapage.

visPageGroupWin 160 Agroupeditingwindowofagrouponapage.

visMasterWin 64 Amasterdrawingpagewindow.visMasterGroupWin 96 Agroupeditingwindowofagroup

inamaster.

TableNameproperty

GetsorsetsthenameofanAccelTableobject.

Versionadded

4.0

Syntax

strRet=object.TableNameobject.TableName=nameStrstrRet String.Thecurrentnameoftheobject.object Required.AnexpressionthatreturnsanAccelTableobject.nameStr RequiredString.Thenewnamefortheobject.

Remarks

Thispropertyisnotcurrentlyused.

Seealso Example

TabPropsRowproperty

ReturnstheindexoftheTabPropertiesrowthatcontainstabformattinginformationforaCharactersobject.

Versionadded

3.0

Syntax

intRet=object.TabPropsRow(bias)intRet Integer.TheindexoftherowthatdefinestheCharacter

object'sformatting.object Required.AnexpressionthatreturnsaCharactersobject.bias RequiredInteger.Thedirectionofthesearch.

Remarks

YoucanretrieverowsthatrepresentrunsoftabformattingbyspecifyingarowindexasanargumenttotheCellsSRCpropertyofashape.YoucanalsovieworchangetabformatsontheTabstab(clickTextontheFormatmenu,andthen

Example

clickTabs).

IfthetabformatfortheCharactersobjectisrepresentedbymorethanoneTabPropertiesrow,theTabPropsRowpropertyreturns-1.IftheCharactersobjectrepresentsaninsertionpointratherthanasequenceofcharacters(thatis,ifitsBeginandEndpropertiesreturnthesamevalue),usethebiasargumenttodeterminewhichrowindextoreturn.

Constant ValuevisBiasLetVisioChoose 0visBiasLeft 1visBiasRight 2

SpecifyvisBiasLeftfortherowthatcoverstabformattingforthecharactertotheleftoftheinsertionpoint.UsevisBiasRightfortherowthatcoverstabformattingforthecharactertotherightoftheinsertionpoint.

Targetproperty

Getsorsetsthetargetofanevent.

Versionadded

4.0

Syntax

strRet=object.Targetobject.Target=stringExpressionstrRet String.Thecurrenttarget.object Required.AnexpressionthatreturnsanEventobject.stringExpression RequiredString.Thetargettoset.

Remarks

Aneventconsistsofanevent-actionpair.Whentheeventoccurs,theactionisperformed.Aneventalsospecifiesthetargetoftheactionandargumentstosendtothetarget.

Example

IftheactioncodeoftheeventisvisActCodeRunAddon,theTargetpropertycontainsthenameoftheadd-ontorun.

IftheactioncodeoftheeventisvisActCodeAdvise,theTargetpropertyisnotavailable.AttemptingtogetorsettheTargetpropertyforsuchaneventcausesanexception.

TargetArgsproperty

Getsorsetstheargumentstobesenttothetargetofanevent.

Versionadded

4.0

Syntax

strRet=object.TargetArgsobject.TargetArgs=stringExpressionstrRet String.Thecurrentarguments.object Required.AnexpressionthatreturnsanEventobject.stringExpression RequiredString.Thenewargumentstoset.

Remarks

Aneventconsistsofanevent-actionpair.Whentheeventoccurs,theactionisperformed.Aneventalsospecifiesthetargetoftheactionandargumentstosendtothetarget.

Example

WhenyouusevisActCodeRunAddon,theTargetArgspropertycontainstheargumentstosendtotheadd-onwhenitisrun.

WhenyouusevisActCodeAdvise,theTargetArgspropertycontainsthestringspecifiedwiththeAddAdvisemethodwhentheEventobjectwascreated.Whentheprogramreceivesnotificationoftheevent,itcangettheEventobjectanditsTargetArgspropertytoobtainthestring.

TargetDocumentNameproperty

GetsandsetsthepathandfilenameofaMicrosoftVisiodocument(usuallyastencil)thatcontainsthemastertowhichamastershortcutrefers.

Versionadded

2000

Syntax

strRet=object.TargetDocumentName

object.TargetDocumentName=strExpressionstrRet String.Pathandfilenameofthedocument.object Required.AnexpressionthatreturnsaMasterShortcutobject.strExpression RequiredString.Thenewpathandfilenameofthedocument.

Remarks

Ifthetargetdocumentismoved,deleted,orrenamed,orthepropertyissettothe

Example

pathofanonexistentfile,theapplicationwillnotbeabletoaccesstheshortcut'stargetmaster.Asaresult,theenduserwillnotbeabletousetheshortcuttodropshapesontotheirdrawing.

IftheTargetDocumentNamepropertycontainsafilenamebutnopath,theapplicationlooksforthetargetdocumentinthefilepathsetontheFilePathtabintheOptionsdialogbox(clickOptionsontheToolsmenu,andthenclickFilePaths).Thenamemayrefereithertothedocument'sfilenameortooneofitsalternatefilenames.Tosetanalternatenameforadocument,usetheAlternateNamesproperty.

TheTargetDocumentNamepropertydoesnotsupportfilenameswithrelativepaths.

TargetMasterNameproperty

Getsorsetsthenameofthemastertowhichthemastershortcutrefers.

Versionadded

2000

Syntax

strRet=object.TargetMasterName

object.TargetMasterName=strExpressionstrRet String.Thenameofthemaster.object Required.AnexpressionthatreturnsaMasterShortcutobject.strExpression RequiredString.Thenewnameofthemaster.

Remarks

Thenamespecifiedbythispropertymustbethetargetmaster'suniversalname,notitslocalizedname.

Example

Whentheuserdropsamastershortcutontoadrawingpage,theapplicationfirstlocatesthedocumentidentifiedbytheshortcut'sTargetDocumentNameproperty,thenitsearchesthatdocumentforamasterwhoseuniversalnamematchestheshortcut'sTargetMasterNameproperty.Oncelocated,thetargetmaster(nottheshortcut)isusedtocreatethenewshapeinstanceonthedrawingpage.

Templateproperty

Returnsthenameofthetemplatefromwhichthedocumentwascreated.

Versionadded

4.0

Syntax

strRet=object.TemplatestrRet String.ThenameofthetemplatefromwhichtheDocument

objectwascreated.object Required.AnexpressionthatreturnsaDocumentobject.

Seealso

TemplatePathsproperty

GetsorsetsthepathswhereMicrosoftVisiolooksfortemplates.Toindicatemorethanonefolder,separateindividualitemsinthepathstringwithsemicolons.

Versionadded

4.0

Syntax

strRet=object.TemplatePathsobject.TemplatePaths=pathsStrstrRet String.Atextstringcontainingalistoffolders.object Required.AnexpressionthatreturnsanApplicationobject.pathsStr RequiredString.Atextstringcontainingalistoffolders.

Remarks

ThestringpassedtoandreceivedfromtheTemplatePathspropertyisthesame

stringshownontheFilePathstabintheOptionsdialogbox(clickOptionsontheToolsmenu,andthenclickFilePaths).

Whentheapplicationlooksfortemplates,itlooksinallpathsnamedintheTemplatePathspropertyandallthesubfoldersofthosepaths.IfyoupasstheTemplatePathspropertytotheEnumDirectoriesmethod,itreturnsacompletelistoffullyqualifiedpathsinwhichtheapplicationlooks.

Ifapathisnotfullyqualified,theapplicationlooksforthefolderinthefolderthatcontainstheVisioprogramfiles(appObj.Path).Forexample,iftheVisioexecutablefileisinstalledinc:\Visio,andtheTemplatePathspropertyis"Templates;d:\Templates",theVisioapplicationlooksfortemplatesinbothc:\Visio\Templatesandd:\Templates.

Textproperty(Charactersobject)

ReturnstherangeoftextrepresentedbyaCharactersobject,whichmaybeasubsetoftheshape'stextdependingonthevaluesoftheCharactersobject'sBeginandEndproperties.

Versionadded

2.0

Syntax

strRet=object.Textobject.Text=stringExpressionstrRet Variant.ThetextoftheCharactersobjectreturnedina

VariantoftypeString.object Required.AnexpressionthatreturnstheCharactersobject

thatownsthetext.stringExpression RequiredVariant.ThetextoftheCharactersobjectina

VariantoftypeString.

Remarks

ThetextforaCharactersobjectisreturnedinaVariantoftypeString,asopposedtoinaString.Thisistypicallytransparentifyou'reusingMicrosoftVisualBasicorVisualBasicforApplications.IfyouareusingC/C++andwantaStringratherthanaVariant,usetheTextAsStringproperty.

InthetextreturnedbyaCharactersobject,fieldsareexpandedtothenumberofcharactersthatarevisibleinthedrawingwindow.Forexample,ifashape'stextcontainsafieldthatdisplaysthefilenameofadrawing,theTextpropertyofaCharactersobjectreturnstheexpandedfilename(providedtheBeginandEndpropertieswerenotaltered).

IfaCharactersobjectrepresentsthetextofashapethatisagroup,itwillalwaysreturnthetextofthegroup.

Objectsfromotherapplicationsandguidesdon'thaveaTextproperty.

Textproperty(Shapeobject)

Returnsalloftheshape'stext.

Versionadded

2.0

Syntax

strRet=object.Textobject.Text=stringExpressionstrRet String.ThetextoftheShapeobjectreturnedasastring.object Required.AnexpressionthatreturnsaShapeobject.stringExpression RequiredString.NewtextfortheShapeobject.

Remarks

InthetextreturnedbytheTextpropertyofaShapeobject,fieldsarerepresentedbyanescapecharacter(30(&H1E))Forexample,ifaShapeobject'stextcontainsafieldthatdisplaysthefilenameofadrawing,theShapeobject'sText

Example

propertyreturnsanescapecharacterwherethatfieldisinsertedintothetext.Ifyouwantthetexttocontaintheexpandedfield,gettheshape'sCharactersproperty,thengettheTextpropertyoftheresultingCharactersobject.

Iftheshapeisagroup,thetextreturnedisdependentonthevalueoftheIsTextEditTargetcell.

IfIsTextEditTargetisTRUE,thentheTextpropertyoftheShapeobjectreturnsthetextofthegroup.

IfIsTextEditTargetisFALSE,thentheTextpropertyoftheShapeobjectreturnsthetextoftheshapeinthegroupatthetopofthestackingorder.

Objectsfromotherapplicationsandguidesdon'thaveaTextproperty.

TextAsStringproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertyreturnedtherangeoftextrepresentedbyaCharactersobject.

Seealso Example Appliesto

TextBasedOnproperty

GetsorsetsthetextstyleonwhichaStyleobjectisbased.

Versionadded

4.0

Syntax

strVal=object.TextBasedOnobject.TextBasedOn=styleNamestrVal String.Thenameofthecurrentbased-ontextstyle.object Required.AnexpressionthatreturnsaStyleobject.styleName RequiredString.Thenameofthenewbased-onstyle.

Remarks

Tobaseastyleonnostyle,settheTextBasedOnpropertytoazero-lengthstring("").

Example

TextStyleproperty

Getsorsetsthetextstyleforanobject.

Versionadded

2.0

Syntax

strRet=object.TextStyleobject.TextStyle=stringExpressionstrRet String.Thecurrenttextstyle.object Required.AnexpressionthatreturnsaShapeorSelection

object.stringExpression RequiredString.Thenameofthetextstyletoapply.

Remarks

SettingthispropertyisequivalenttoselectingastylefromtheTextStylelistinVisio.

Example

Settingastyletoanonexistentstylegeneratesanerror.Settingonekindofstyletoanexistingstyleofanotherkind(forexample,settingtheTextStylepropertytoafillstyle)doesnothing.Settingonekindofstyletoanexistingstylethathasmorethanonesetofattributeschangesonlytheattributesforthatcomponent(forexample,settingtheTextStylepropertytoastylewithline,text,andfillattributeschangesonlythetextattributes).

Topreserveashape'slocalformatting,usetheTextStyleKeepFmtproperty.

BeginningwithMicrosoftVisio2002,anemptystring("")willcausethemaster'sstyletobereappliedtotheselectionorshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionorshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoanemptystringistheequivalentofselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistintheStyledialogbox(ontheFormatmenu,clickStyle).

TextStyleKeepFmtproperty

Appliesatextstyletoanobjectwhilepreservinglocalformatting.

Versionadded

2.0

Syntax

object.TextStyleKeepFmt=stringExpressionobject Required.AnexpressionthatreturnsaShapeorSelection

object.stringExpression RequiredString.Thenameofthestyletoapply.

Remarks

SettingtheTextStyleKeepFmtpropertyisequivalenttoselectingthePreservelocalformattingcheckboxintheStyledialogbox(clickStyleontheFormatmenu).

Settingastyletoanonexistentstylegeneratesanerror.Settingonekindofstyle

Example

toanexistingstyleofanotherkind(forexample,settingtheTextStyleKeepFmtpropertytoafillstyle)doesnothing.Settingonekindofstyletoanexistingstylethathasmorethanonesetofattributeschangesonlytheattributesforthatcomponent(forexample,settingtheTextStyleKeepFmtpropertytoastylewithline,text,andfillattributeschangesonlythetextattributes).

BeginningwithMicrosoftVisio2002,anemptystring("")willcausethemaster'sstyletobereappliedtotheselectionorshape.(Earlierversionsgeneratea"nosuchstyle"exception.)Iftheselectionorshapehasnomaster,itsstyleremainsunchanged.SettingstringExpressiontoanemptystringistheequivalentofselectingUsemaster'sformatintheTextstyle,Linestyle,orFillstylelistintheStyledialogbox(ontheFormatmenu,clickStyle).

Timeproperty

Returnsthemostrecentlyrecordeddateandtime.

Versionadded

2002

Syntax

dateRet=object.TimedateRet Date.Thecurrentdateandtime.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

TheTimepropertyisupdatedwheneveranyvaluesareupdatedinthefollowing:theTimeEditedproperty,theTimePrintedproperty,theTimeCreatedproperty,theTimeSavedproperty,ortheNOWfunction.

Thevaluetotheleftofthedecimalpointrepresentsthedate,andthevaluetotherightofthedecimalpointrepresentsthetime.

Example

TimeCreatedproperty

Returnsthedateandtimethedocumentwascreated.

Versionadded

2002

Syntax

dateRet=object.TimeCreateddateRet Date.Thedateandtimethedocumentwascreated.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Thevaluetotheleftofthedecimalpointrepresentsthedate,andthevaluetotherightofthedecimalpointrepresentsthetime.

Example

TimeEditedproperty

Returnsthedateandtimethedocumentwaslastedited.

Versionadded

2002

Syntax

dateRet=object.TimeEditeddateRet Date.Thedateandtimethedocumentwaslastedited.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Thevaluetotheleftofthedecimalpointrepresentsthedate,andthevaluetotherightofthedecimalpointrepresentsthetime.

Example

TimePrintedproperty

Returnsthedateandtimethedocumentwaslastprinted.

Versionadded

2002

Syntax

dateRet=object.TimePrinteddateRet Date.Thedateandtimethedocumentwaslastprinted.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Thevaluetotheleftofthedecimalpointrepresentsthedate,andthevaluetotherightofthedecimalpointrepresentsthetime.

Example

TimeSavedproperty

Returnsthedateandtimethedocumentwaslastsaved.

Versionadded

2002

Syntax

dateRet=object.TimeSaveddateRet Date.Thedateandtimethedocumentwaslastsaved.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

Thevaluetotheleftofthedecimalpointrepresentsthedate,andthevaluetotherightofthedecimalpointrepresentsthetime.

Example

Titleproperty

GetsorsetsthevalueoftheTitlefieldinadocument'sproperties.

Versionadded

2.0

Syntax

strRet=object.Titleobject.Title=stringExpressionstrRet String.Thecurrentvalueofthefield.object Required.AnexpressionthatreturnsaDocumentobject.stringExpression RequiredString.Thenewvalueforthefield.

Remarks

SettingtheTitlepropertyisequivalenttoenteringinformationintheTitleboxinthePropertiesdialogbox(clickPropertiesontheFilemenu).

ToCellproperty

Getsthecelltowhichaconnectionismade.

Versionadded

2.0

Syntax

objRet=object.ToCellobjRet TheCellobjecttowhichtheconnectionismade.object Required.AnexpressionthatreturnsaConnectobject.

Remarks

Aconnectionisdefinedbyareferenceinacellintheshapefromwhichtheconnectionoriginatestoacellintheshapetowhichtheconnectionismade.TheToCellpropertyreturnstheCellobjecttowhichtheconnectionismade.

FollowingisalistofpossibleconnectionsandtheirrelatedToCellpropertyvalues.

Fromthebeginorendcellofa1-Dshapeto…

Fromtheedge(acellintheAlignmentsection)ofa2-Dshapeto…

Fromanoutwardorinward/outwardconnectionpointcellofa1-Dshapeto…

Fromanoutwardorinward/outwardconnectionpointcellofa2-Dshapethatisnotaguideorguidepointto…

Fromacontrolhandleto…

ToolbarItemsproperty

ReturnstheToolbarItemscollectionofaToolbarobject.

Versionadded

4.0

Syntax

objRet=object.ToolbarItemsobjRet TheToolbarItemscollectionoftheToolbarobject.object Required.AnexpressionthatreturnsaToolbarobject.

Toolbarsproperty

ReturnstheToolbarscollectionofaToolbarSetobject.

Versionadded

4.0

Syntax

objRet=object.ToolbarsobjRet TheToolbarscollectionoftheToolbarSetobject.object Required.AnexpressionthatreturnsaToolbarSetobject.

ToolbarSetsproperty

ReturnstheToolbarSetscollectionofaUIObjectobject.

Versionadded

4.0

Syntax

objRet=object.ToolbarSetsobjRet TheToolbarSetscollectionoftheUIObjectobject.object Required.AnexpressionthatreturnsaUIObjectobject.

Remarks

IfaUIObjectobjectrepresentstoolbarsandstatusbars(forexample,iftheobjectwasretrievedusingtheBuiltInToolbarspropertyofanApplicationobject),itsToolbarSetscollectionrepresentsallofthetoolbarsforthatUIObjectobject.

UsetheItemAtIDpropertyofaToolbarSetsobjecttoretrievetoolbarsfora

particularwindowcontext,forexample,thedrawingwindow.Ifacontextdoesnotincludetoolbars,ithasnoToolbarSetscollection.

ToolbarStyleproperty

BeginningwithMicrosoftVisio2002,thispropertyisobsolete.

Remarks

Inearlierversions,thispropertydeterminedwhetherMicrosoftVisioshowedorhidatoolbar.

Seealso Example Appliesto

Topproperty

Getsthedistancebetweenthetopofanobjectandthetopofthedockingareaorthetopofthescreeniftheobjectisn'tdocked;itsetsthedistancebetweenthetopofaMenuorToolbarobjectandthetopofthescreen.

Versionadded

2000

Syntax

intRet=object.Topobject.Top=intExpressionintRet Integer.Thedistanceinpixels.object Required.AnexpressionthatreturnsaMenuSetorToolbar

object.intExpression RequiredInteger.Thenewdistanceinpixels.

ToPartproperty

Returnsthepartofashapetowhichaconnectionismade.

Versionadded

2.0

Syntax

intRet=object.ToPartintRet Integer.Thepartoftheshapetowhichaconnectionismade.object Required.AnexpressionthatreturnsaConnectobject.

Remarks

TheToPartpropertyidentifiesthepartofashapetowhichanothershapeisglued,suchasitsbeginpointorendpoint,oneofitsedges,oraconnectionpoint.ThefollowingconstantsdeclaredbytheVisiotypelibraryinmemberVisToPartsshowpossiblereturnvaluesfortheToPartproperty.

Constant Value

visConnectToError -1visToNone 0visGuideX 1visGuideY 2visWholeShape 3visGuideIntersect 4visToAngle 7visConnectionPoint 100+rowindexofconnectionpoint

TopMarginproperty

Specifiesthetopmarginwhenprintingadocument.

Versionadded

4.0

Syntax

retVal=object.TopMargin([units])object.TopMargin([units])=newValueretVal Double.Themarginvalueexpressedinthegivenunits.object Required.AnexpressionthatreturnsaDocumentobject.units OptionalVariant.Theunitstousewhenretrievingorsetting

themarginvalue.newValue RequiredDouble.Thenewmarginvalue.

Remarks

Ifunitsisnotprovided,theTopMarginpropertywilldefaulttointernaldrawing

Example

units(inches).

TheTopMarginpropertycorrespondstotheTopsettinginthePrintSetupdialogbox(ontheFilemenu,clickPageSetup,andthenclickSetuponthePrintSetuptab).

Unitscanbeanintegerorstringvaluesuchas"inches","inch","in.",or"i".StringsmaybeusedforallsupportedVisiounitssuchascentimeters,meters,miles,andsoon.YoucanalsouseanyoftheunitsconstantsdeclaredbytheVisiotypelibraryinmemberVisUnitCodes.

ForalistofvalidintegerandstringvaluesseeAboutunitsofmeasure.

ToSheetproperty

Returnstheshapetowhichoneormoreconnectionsaremade.

Versionadded

2.0

Syntax

objRet=object.ToSheetobjRet TheShapeobjecttowhichtheconnectionismade.object Required.AnexpressionthatreturnsaConnectobjector

Connectscollection.

Remarks

TheToSheetpropertyforaConnectobjectalwaysreturnstheshapetowhichtheconnectionismade.

TheConnectscollectionrepresentsseveralconnections.Ifeveryconnectionrepresentedbythecollectionismadetothesameshape,theToSheetproperty

returnsthatshape.Otherwise,itreturnsNothinganddoesnotraiseanexception.

TraceFlagsproperty

GetsorsetseventsloggedduringaMicrosoftVisioinstance.

Versionadded

5.0

Syntax

intRet=object.TraceFlagsobject.TraceFlags=intExpressionintRet Long.Currenttraceflags.object Required.AnexpressionthatreturnsanApplicationobject.intExpression RequiredLong.Newtraceflags.

Remarks

ThevalueoftheTraceFlagspropertycanbeacombinationofthefollowingvalues.

Seealso

Constant Value DescriptionvisTraceEvents &H1 EventoccurrencesvisTraceAdvises &H2 OutgoingadvisecallsvisTraceAddonInvokes &H4 Add-oninvocationsvisTraceCallsToVBA &H8 VBAinvocations

ThevisTraceEventsflagcausestheImmediatewindowtologmostVisioeventsastheyhappen.Inmostcasesthisoccursevenifnoexternalagentislisteningorrespondingtotheevent.Inafewcases,Visioknowsthereisnolistenerforaneventanddoesnotlogthoseevents.Visioalsodoesnotlogidleeventsoradvises.Inaddition,someeventsarespecializationsofothereventsandaren'trecorded.Forexample,theSelectionAddedeventismanufacturedfromdistinctShapeAddedevents,sotheImmediatewindowrecordstheShapeAddedeventsbutnottheSelectionAddedevents.

HereisastringVisiomightlogwhenvisTraceEventsisselected:

-event:0x8040/doc=1/page=1/shape=Sheet.1

Thenumberafter-event:isthecodeoftheeventthatoccurred.Inthiscase0x8040isthecodefortheShapeAddedevent.Thetextfollowingtheeventcodediffersfromeventtoevent.

ThevisTraceAdvisesflagwritesalinetotheImmediatewindowjustbeforeVisiocallsaneventhandlerprocedure,andanotherlinejustaftertheeventhandlerreturns.ThisincludeseventproceduresinVBAprojects,forexample,proceduresinThisDocument.Hereisanexampleofwhatyoumightsee:

>adviseseq=4event=0x8040sink=0x40097598>adviseseq=4

Thesestringsindicatethecalltoandreturnfromaneventhandler.ThesequencenumberalsoindicatesthiseventwasthefourthonefiredbyVisio.Thecodeoftheeventis0x8040andtheaddressoftheinterfaceVisiocalledis0x40097598.

ThevisTraceAddonInvokesflagrecordswhenVisioinvokesanEXEorVSLadd-on,andwhenVisioregainscontrol.Hereisanexample:

>invokeAO:SHOWARGS.EXE<invokeAO:completed

ThevisTraceAddonInvokesflagalsotracesattemptstoinvokeadd-onsthatarenotpresent.Forexample,ifacell'sformulais=RunAddon("xxx")andthereisnoadd-onnamed"xxx",thenthemessage"InvokeAO:Failedtomap'xxx'toknownAdd-on"islogged.

ThevisTraceCallToVBAflagwritesalinetotheImmediatewindowjustbeforeitmakesacalltoVBAotherthanacalltoaneventprocedure(usevisTraceAdvisestologcallstoVBAeventprocedures),andanotherlinejustafterVBAreturnscontroltoVisio.Thisflagtracesmacroinvocations,callstoVBAproceduresresultingfromevaluationofcellsthatmakeuseofRunAddonorCallThisoperands,andcallsresultingfromselectionofcustommenuortoolbaritems.Hereisanexample:

>invokeVBA:Module1.MyMacro<invokeVBA:completed

Amessagedoesn'tappearintheImmediatewindowunlessadocumentwithaVBAprojectisopen.Visioqueuesasmallnumberofmessagestologwhensuchadocumentopens.However,messagesarelostifnodocumentwithaprojectisavailableforlengthyperiods.MessagesarealsolostifVBAresetsorifthereareundismissedbreakpoints.

CodeinVBAprojectscaninterspersetheirmessageswiththoseloggedbyVisiousingstandardDebug.Printstatements.Codeinnon-VBAprojectscanlogmessagestotheVBAImmediatewindowusingDocument.VBProject.ExecuteLine("Debug.Print""somestring""").

TheTraceFlagspropertyisrecordedintheTraceFlagsentryoftheApplicationsectionoftheregistry.

Typeproperty

Returnsthetypeoftheobject.

Versionadded

2.0

Syntax

retVal=object.TyperetVal Integer.ThetypeoftheShapeorWindowobject.object Required.AnexpressionthatreturnsaShapeorWindow

object.

Remarks

TypevaluesforShapeobjects

TypevaluesforWindowobjects

TypelibMajorVersionproperty

ReturnsthemajorversionnumberoftheMicrosoftVisiotypelibrary.

Versionadded

2000

Syntax

intRet=object.TypelibMajorVersionintRet Integer.ThemajorversionnumberoftheVisiotypelibrary.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

Themajorand/orminorversionnumberoftheVisiotypelibrarywillincreasewhenevertheVisiotypelibraryisextended.AprogramcanusetheTypelibMajorVersionandTypelibMinorVersionpropertiestoguaranteethattheVisioversionitisworkingwithprovidessupportforthefeaturesitisusing.

SmallchangestotheVisiotypelibrarydonotaffecttheApplicationobject's

Example

Versionproperty.

TypelibMinorVersionproperty

ReturnstheminorversionnumberoftheMicrosoftVisiotypelibrary.

Versionadded

2000

Syntax

intRet=object.TypelibMinorVersion

intRet Integer.TheminorversionnumberoftheVisiotypelibrary.

object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

Themajorand/orminorversionnumberoftheVisiotypelibrarywillincreasewhenevertheVisiotypelibraryisextended.AprogramcanusetheTypelibMajorVersionandTypelibMinorVersionpropertiestoguaranteethattheVisioversionitisworkingwithprovidessupportforthefeaturesitisusing.

Example

SmallchangestotheVisiotypelibrarydonotaffecttheApplicationobject'sVersionproperty.

TypeSpecific1property

Getsorsetsthetypeofamenuortoolbaritem.

Versionadded

4.0

Syntax

intVal=object.TypeSpecific1object.TypeSpecific1=intExpression

object Required.AnexpressionthatreturnsaMenu,MenuItem,orToolbarItemobject.

intVal,intExpression

RequiredInteger.Thetypeofthemenu,menuitem,ortoolbaritem.

Remarks

Example

Thevalueofanobject'sTypeSpecific1propertydependsonthevalueofitsCntrlTypeproperty.

CntrlTypevalue TypeSpecific1valuevisCtrlTypeBUTTON Anyconstantprefixedwith

visIconIXthatisdeclaredbytheVisiotypelibrary

visCtrlTypeEDITBOXvisCtrlTypeCOMBOBOX

Zero(0)

visCtrlTypeLABEL AnyconstantprefixedwithvisStrIDthatisdeclaredbytheVisiotypelibrary

TypeSpecific2property

Getsorsetsthetypeofamenu,menuitem,ortoolbaritem.

Versionadded

4.0

Syntax

intVal=object.TypeSpecific2object.TypeSpecific2=intExpression

intVal Integer.Thetypeofmenu,menuitem,ortoolbar.

object Required.AnexpressionthatreturnsaMenu,MenuItem,orToolbarItemobject.

intExpression RequiredInteger.Thenewtypeofmenu,menuitem,ortoolbaritem.

Example

Remarks

Thevalueofanobject'sTypeSpecific2propertydependsonthevalueofitsCntrlTypeproperty.

CntrlTypevalue TypeSpecific1valuevisCtrlTypeBUTTON TheTypeSpecific2

propertyisnotused.visCtrlTypeEDITBOXvisCtrlTypeCOMBOBOX

Thecurrentwidthofthecontrolexpressedinpixels.

visCtrlTypeLABEL TheTypeSpecific2propertyisnotused.

UndoEnabledproperty

Determineswhetherundoinformationismaintainedinmemory.

Versionadded

2000

Syntax

boolVal=object.UndoEnabledobject.UndoEnabled=boolExpressionboolVal Boolean.Trueifthepropertyisenabled;Falseifitisnot.object Required.AnexpressionthatreturnsanApplicationobject.boolExpression RequiredBoolean.Truetoenableundo;otherwise,False.

Remarks

WhenVisiostarts,thevalueoftheUndoEnabledpropertyisTrue.SettingthevalueoftheUndoEnabledpropertytoFalsediscontinuesthecollectionofundoinformationinmemoryandpurgestheexistingundoinformation.

Anattemptshouldbemadetomaintainthepropertyatitscurrentvalueacrossthecompleteoperationthatyouperform.Inotherwords,usecodestructuredlikethis:

bPrev=Application.UndoEnabledApplication.UndoEnabled=False'largeoperationhereApplication.UndoEnabled=bPrev

UniqueIDproperty(Masterobject)

ReturnstheuniqueIDofamaster.

Versionadded

4.0

Syntax

strRet=object.UniqueIDstrRet String.TheuniqueIDoftheMasterobject.object Required.AnexpressionthatreturnsaMasterobject.

Remarks

AMasterobjectalwayshasauniqueID.Ifyoucopyamaster,thenewmasterhasthesameuniqueIDastheoriginalmaster(aswellasthesamebaseID).However,ifyouchangethenewmaster,anewuniqueIDisassignedbutthebaseIDremainsthesame.

FordetailsaboutthebaseID,seetheBaseIDproperty.

Example

YoucandetermineaMasterobject'suniqueIDusingthefollowing:

idStr=mastObj.UniqueID

Thevalueitreturnsisastringinthefollowingform:

{2287DC42-B167-11CE-88E9-0020AFDDD917}

YoucanaccessamasterbyitsuniqueIDusingMasters.Item(uniqueIDString).

UniqueIDproperty(Shapeobject)

ReturnsorclearstheuniqueIDofashape.

Versionadded

4.0

Syntax

strRet=object.UniqueID(flag)strRet String.TheuniqueIDoftheShapeobject.object Required.AnexpressionthatreturnsaShapeobject.flag RequiredInteger.Gets,assigns,orclearstheuniqueIDofa

Shapeobject.

Remarks

Bydefault,ashapedoesnothaveauniqueID.AshapeacquiresauniqueIDonlyifyousetitsUniqueIDproperty.

IfaShapeobjecthasauniqueID,noothershapeinanyotherdocumentwill

Example

havethesameID.

TheflagargumentcontrolsthebehavioroftheUniqueIDproperty.Itshouldhaveoneofthefollowingvalues.

Constant ValuevisGetGUID 0visGetOrMakeGUID 1visDeleteGUID 2

TheconstantvisGetGUIDreturnstheuniqueIDstringonlyiftheshapealreadyhasauniqueID.Otherwiseitreturnsazero-lengthstring("").

TheconstantvisGetOrMakeGUIDreturnstheuniqueIDstringoftheshape.IftheshapedoesnotyethaveauniqueID,itassignsonetotheshapeandreturnsthenewID.

TheconstantvisDeleteGUIDclearstheuniqueIDofashapeandreturnsazero-lengthstring("").

YoucanaccessashapewithitsuniqueIDusingShapes.Item(uniqueIDString).

Unitsproperty

IndicatestheunitofmeasureassociatedwithaCellobject.

Versionadded

3.0

Syntax

intRet=object.UnitsintRet Integer.Theunitsassociatedwithacell'scurrentvalue.object Required.AnexpressionthatreturnsaCellobject.

Remarks

TheUnitspropertycanbeusedtodeterminetheunitofmeasurecurrentlyassociatedwithacell'svalue.ThevariousunitcodesaredeclaredbytheVisiotypelibraryinmemberVisUnitCodes.Forexample,acell'swidthmightbeexpressedininches(visInches)orincentimeters(visCentimeters).Insomecasesaprogrammightbehavedifferentlydependingonwhetheracell'svalueisinmetricorinimperialunits.

Foralistofvalidunitcodes,seeAboutunitsofmeasure.

Seealso Example

UserNameproperty

GetsorsetstheusernameofanApplicationobject.

Versionadded

4.0

Syntax

strRet=object.UserNameobject.UserName=strExpressionstrRet String.Theusername.object Required.AnexpressionthatreturnsanApplicationobject.strExpression RequiredString.Theusername.

Remarks

SettingtheUserNamepropertyisequivalenttoenteringanameintheUsernameboxontheGeneraltabintheOptionsdialogbox(clickOptionsontheToolsmenu,andthenclickGeneral).

Seealso Example

VBEproperty

object;DAR_Objects_(A-M)_1015.htm">

GetstherootobjectoftheobjectmodelexposedbyMicrosoftVisualBasicforApplications(VBA).UsethispropertytoaccessandmanipulatetheVBAprojectsassociatedwithcurrentlyopenMicrosoftVisiodocuments.

Versionadded

4.5

Syntax

objRet=object.VBEobjRet ProgrammableobjectthatexposesVBAmethodsand

properties.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

TogetinformationabouttheobjectreturnedbytheVBEproperty:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

IntheVisualBasicEditor,ontheToolsmenu,clickReferences.

IntheReferencesdialogbox,clickMicrosoftVisualBasicforApplicationsExtensibility,andthenclickOK.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,selecttheVBIDEtypelibrary.

IntheClasseslist,examinetheclassnamedVBE.

BeginningwithMicrosoftVisio2002,theVBEpropertyraisesanexceptionifyouarerunninginasecureenvironmentandyoursystemadministratorhasblockedaccesstotheVBAobjectmodel.Thereisnouserinterfaceorprogrammaticwaytoturnthison—thesystemadministratormustturnon(oroff)accessviaaGroupPolicy.ThisisaprotectionmechanismagainstvirusesthatspreadbyaccessingtheVisualBasicprojectsincommonlyusedtemplatesandinjectingtheviruscodeintothem.

VBProjectproperty

ReturnsaprogrammableobjectthroughwhichtheMicrosoftVisualBasicforApplications(VBA)projectofthedocumentcanbecontrolled.

Versionadded

4.5

Syntax

objRet=object.VBProjectobjRet Programmableobjectthatexposesmethodsandpropertiesof

thedocument'sVBAproject.object Required.AnexpressionthatreturnsaDocumentobject.

Remarks

TogetinformationabouttheobjectreturnedbytheVBProjectproperty:

OntheToolsmenu,pointtoMacros,andthenclickVisualBasicEditor.

IntheVisualBasicEditor,ontheToolsmenu,clickReferences.

IntheReferencesdialogbox,clickMicrosoftVisualBasicforApplicationsExtensibility,andthenclickOK.

OntheViewmenu,clickObjectBrowser.

IntheProject/Librarylist,selecttheVBIDEtypelibrary.

IntheClasseslist,examinetheclassnamedVBProject.

BeginningwithMicrosoftVisio2002,theVBProjectpropertyraisesanexceptionifyouarerunninginasecureenvironmentandyoursystemadministratorhasblockedaccesstotheVisualBasicobjectmodel.Thereisnouserinterfaceorprogrammaticwaytoturnthison—thesystemadministratormustturnon(oroff)accessviaaGroupPolicy.ThisisaprotectionmechanismagainstvirusesthatspreadbyaccessingtheVisualBasicprojectsincommonlyusedtemplatesandinjectingtheviruscodeintothem.

VBProjectDataproperty

ReturnstheMicrosoftVisualBasicprojectdatastoredwithadocument.

Versionadded

2002

Syntax

valRet=object.VBProjectDatavalRet Byte.Anarrayofdatastoredwithadocument'sVisualBasic

project.object Required.AnexpressionthatreturnsaDocumentobject.

Example

YoucanusetheVBProjectDatapropertytodeterminewhetheradocumenthasaproject.ThefollowingmacrodemonstratesgettingareferencetoadocumentinVisiotodeterminewhetherthedocumenthasaproject.ThecoderunsfromaprogramoutsideoftheVisiodocument.

Seealso

PrivateSubForm_Load()'Declaredocumentvariable'andArrayvariabletoholdprojectdataDimdocObjAsObjectDimprojdata()AsByte'GetthefirstobjectintheDocumentscollection'ofthisinstanceofVisioSetdocObj=GetObject(,"Visio.Application").Documents(1)'Populatethearraywithprojectdataprojdata=docObj.VBProjectDataDebug.PrintLBound(projdata);UBound(projdata)EndSub

Ifthedocumenthadnoprojectassociatedwithit,"0–1"wouldbereportedintheImmediatewindow.Ifthedocumenthadaproject,theupperboundwouldbesomenumbergreaterthanzero(0).Forexample,"01535"wouldindicatethataprojecthad1,536bytesofdata.

Versionproperty(Applicationobject)

ReturnstheversionofarunningMicrosoftVisioinstance.

Versionadded

2.0

Syntax

strRet=object.VersionstrRet String.TheVisiomajorandminorversionnumbers.object Required.AnexpressionthatreturnsanApplicationobject.

Remarks

UsetheVersionpropertyoftheApplicationobjecttoverifytheversionofaparticularVisioinstance.Thisinformationishelpfulifyourprogramrequiresaparticularversion.Boththemajorandminorversionnumbersarereturned.ThestringreturnedbyMicrosoftVisio2002is"10.0".

Versionproperty(Documentobject)

Determinestheversionofasaveddocument.

Versionadded

2.0

Syntax

intRet=object.Versionobject.Version=intExpressionintRet VisDocVersions.Thefileformatversionthedocumentissaved

in.object Required.AnexpressionthatreturnsaDocumentobject.intExpression RequiredVisDocVersions.Thefileformatversioninwhichto

savethedocument.

Remarks

SettingtheVersionpropertyofadocumenttellsVisiowhichfileformatversiontosavethedocumentinthenexttimethedocumentissaved.TheVisiotypelibrarydeclaresconstantsforfileformatversionsinVisDocVersions.

Visio2002cansavethefollowingversions.

Constant Value DescriptionvisVersion50 &H50000 Visio5.0document

Seealso Example

visVersion60 &H60000 Visioversion2000or2002document

WhenVisioopensadocumentthatwassavedinanearlierversionformat,itconvertsthedocument'sin-memoryrepresentationtothecurrentversion.However,whenclosingthedocument,Visiorecognizesthatthedocumentwassavedinanearlierversionformatandallowstheusertochoosetheversioninwhichtosavethedocument.

ViewFitproperty

Determineswhichauto-fitmodeawindowisin,ifany.

Versionadded

2000

Syntax

longRet=object.ViewFitobject.ViewFit=longVallongRet Long.Aconstantthatidentifiesthewindowmode.object Required.AnexpressionthatreturnsaWindowobject.longVal Long.Aconstantthatidentifiesthenewwindowmode.

Remarks

TheViewFitpropertyappliestodrawingwindowsonly,andcanhavethefollowingvalues.

Example

Constant ValuevisFitNone 0visFitPage 1visFitWidth 2

Ifthevalueofthewindow'sTypepropertyisnotvisDrawing,thentheViewFitpropertyreturnsvisFitNone.AttemptingtosettheViewFitpropertyofthistypeofwindowraisesanexception.

Visibleproperty

Determineswhetheranobjectisvisible.

Versionadded

2000

Syntax

boolVal=object.Visibleobject.Visible=boolExpressionboolVal Boolean.Trueiftheobjectisvisible;Falseiftheobjectisnot

visible.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.boolExpression RequiredBoolean.Trueiftheobjectisvisible;Falseifthe

windowisnotvisible.

Widthproperty

Getsthewidthofanobject.

Versionadded

2000

Syntax

intLong=object.WidthintLong Long.Thewidthinpixels.object Required.AnexpressionthatreturnsanobjectintheAppliesto

list.

Example

WindowHandle32property

Returnsthe32-bithandleofaMicrosoftVisiowindow.

Versionadded

4.0

Syntax

retVal=object.WindowHandle32retVal Long.TheHWNDoftheobject'swindow.object Required.AnexpressionthatreturnsanApplicationor

Windowobject.

Remarks

TheWindowHandle32propertyofanApplicationobjectreturnsoneofthefollowing:

TheHWNDforthemainVisio(frame)window(mostcommon).

TheHWNDforthecontainerapplication'smainframewindowifVisioisrunningin-placeandactive.

TheHWNDforthewindowreturnedbytheGetActiveWindow()functionifeitherframewindowisdisabled(forexample,ifamodaldialogboxisrunning),FordetailsabouttheGetActiveWindowfunction,seetheMicrosoftPlatformSDKontheMicrosoftDeveloperNetwork(MSDN)Website.

UsetheWindowHandle32propertyoftheWindowobjecttoobtaintheHWNDforawindowintheWindowscollectionofaVisioinstance.

YoucanusetheobtainedHWNDinWindowsAPIcalls.

NoteCallstotheWindowHandleproperty(nowhidden)aredirectedtotheWindowHandle32property.

Windowsproperty

object;DAR_Objects_(A-M)_1015.htm">

ReturnstheWindowscollectionforaMicrosoftVisioinstanceorwindow.

Versionadded

2.0

Syntax

objRet=object.WindowsobjRet TheWindowscollectionoftheApplicationobject.object Required.AnexpressionthatreturnsanApplicationor

Windowobjectthatownsthecollection.

WindowStateproperty

Getsorsetsthestateofawindow.

Versionadded

2000

Syntax

intRet=object.WindowStateobject.WindowState=intExpressionintRet Long.Aconstantthatidentifiesthestateofthewindow.object Required.AnexpressionthatreturnsaWindowobject.intExpression RequiredLong.Thenewstateofthewindow.

Remarks

ThevaluesofintRetandintExpressioncanbeacombinationofthefollowingconstants,whicharedeclaredintheVisiotypelibraryinVisWindowStates.

NoteThevarFlagsparametertotheAddmethodfortheWindowscollectioncanbecomposedofthevariousbitsofVisWindowStates.

VisWindowStatesconstants

wParamproperty

GetsorsetsthewParamfieldoftheMSGstructurebeingwrapped.

Versionadded

2002

Syntax

intRet=object.wParamobject.wParam=intExpressionintRet Long.Additionalinformationaboutthemessagethatis

dependentonthemessagenumber.object Required.AnexpressionthatreturnsaMSGWrapobject.intExpression RequiredLong.ThenewvalueofthewParamfield.

Remarks

ThewParampropertycorrespondstothewParamfieldintheMSGstructuredefinedaspartoftheMicrosoftWindowsoperatingsystem.Ifaneventhandler

Example

ishandlingtheOnKeystrokeMessageForAddonevent,VisiopassesaMSGWrapobjectasanargumentwhenthiseventfires.AMSGWrapobjectisawrapperaroundtheWindowsMSGstructure.

Fordetails,searchfor"MSGstructure"ontheMicrosoftDeveloperNetwork(MSDN)Website.

Zoomproperty

Getsorsetsthecurrentdisplaysize(magnificationfactor)forapageinawindow.

Versionadded

2.0

Syntax

retVal=object.Zoomobject.Zoom=newZoomretVal Double.Thecurrentdisplaysizeforthewindow.object Required.AnexpressionthatreturnsaWindowobject.newZoom RequiredDouble.Thenewdisplaysizeforthewindow.

Remarks

Validvaluesrangefrom0.05to9.99(5%to999%).Thevalue-1fitsthepageintothewindow.

Seealso Example

Newcells(alphabeticlist)

CellsthathavebeenaddedtotheMicrosoftVisio2002ShapeSheetarelistedinthefollowingtable(sortedalphabetically).

Newcell SectionConLineRouteExt ShapeLayoutFillBkgndTrans FillFormatFillForegndTrans FillFormatLineColorTrans LineFormatLineRouteExt PageLayoutPlaceFlip PageLayoutShapePlaceFlip ShapeLayoutShdwBkgndTrans FillFormatShdwForegndTrans FillFormatTextBkgndTrans TextBlockFormatTransparency CharactersTransparency Layers

Newobjects

ThefollowingnewobjecthasbeenaddedtoMicrosoftVisio2002.

Newobject DescriptionMSGWrap UsedwiththeOnKeystrokeMessageForAddon

eventtoprovideaccesstoWindowskeystrokemessages.

Newproperties(alphabeticlist)

PropertiesthathavebeenaddedtoMicrosoftVisio2002arelistedinthefollowingtable(sortedalphabetically).

Newproperty ObjectActivePrinter ApplicationAllowEditing WindowAvailablePrinters ApplicationBeginGroup MenuItem,ToolbarItemBuild ApplicationBuildNumberCreated DocumentBuildNumberEdited DocumentCOMAddins ApplicationCommandBars ApplicationContainsWorkspace DocumentDefaultAngleUnits ApplicationDefaultDurationUnits ApplicationDefaultGuideStyle DocumentDefaultPageUnits ApplicationDefaultTextUnits ApplicationDynamicGridEnabled DocumentEditCopy MasterEmailRoutingData DocumentFooterCenter DocumentFooterLeft Document

FooterMargin DocumentFooterRight DocumentForeignData ShapeFullBuild ApplicationFullBuildNumberCreated DocumentFullBuildNumberEdited DocumentGlueEnabled DocumentGlueSettings DocumentHeaderCenter DocumentHeaderFooterColor DocumentHeaderFooterFont DocumentHeaderLeft DocumentHeaderMargin DocumentHeaderRight Documenthwnd MSGWrapIcon Master,MasterShortcut,WindowInheritedFormulaSource CellInheritedValueSource CellInhibitSelectChange ApplicationInPlace Document,WindowIsChanged MasterlParam MSGWrapMasterShape ShapeMergeCaption WindowMergeClass WindowMergeID WindowMergePosition Windowmessage MSGWrapOriginal MasterPageTabWidth WindowPassword DocumentPicture Master,Page,Selection,Shapeposttime MSGWrapPreviewPicture Document

PrintCopies DocumentPrinter DocumentPrintTileCount Pageptx MSGWrappty MSGWrapRootShape ShapeShowPageTabs WindowShowScrollBars WindowSnapAngles DocumentSnapEnabled DocumentSnapExtensions DocumentSnapSettings DocumentSolutionXMLElement DocumentSolutionXMLElementCount DocumentSolutionXMLElementExists DocumentSolutionXMLElementName DocumentTime DocumentTimeCreated DocumentTimeEdited DocumentTimePrinted DocumentTimeSaved DocumentVBProjectData DocumentwParam MSGWrap

Newproperties(byobject)

PropertiesthathavebeenaddedtoMicrosoftVisio2002arelistedinthefollowingtable(sortedbyobject).

Object NewpropertyApplication ActivePrinter,Build,COMAddins,

CommandBars,DefaultAngleUnits,DefaultDurationUnits,DefaultGuideStyle,DefaultPageUnits,DefaultTextUnits,DynamicGridEnabled,FullBuild,InhibitSelectChange

Cell InheritedFormulaSource,

InheritedValueSource Document AvailablePrinters,BuildNumberCreated,

BuildNumberEdited,ContainsWorkspace,FooterCenter,FooterLeft,FooterMargin,FooterRight,FullBuildNumberCreated,FullBuildNumberEdited,GlueEnabled,GlueSettings,HeaderCenter,HeaderFooterColor,HeaderFooterFont,HeaderLeft,HeaderMargin,HeaderRight,InPlace,Password,PreviewPicture,PrintCopies,Printer,SnapAngles,SnapEnabled,SnapExtensions,SnapSettings,SolutionXMLElement,

SolutionXMLElementCount,SolutionXMLElementExists,SolutionXMLElementName,Time,TimeCreated,TimeEdited,TimePrinted,TimeSaved,VBProjectData

Master EditCopy,Icon,IsChanged,Original,Picture MasterShortcut Icon MenuItem BeginGroup MSGWrap hwnd,lParam,message,posttime,ptx,pty,

wParam Page Picture,PrintTileCount Selection Picture Shape ForeignData,MasterShape,Picture,

RootShape ToolbarItem BeginGroup Window AllowEditing,AvailablePrinters,Icon,

InPlace,MergeCaption,MergeClass,MergeID,MergePosition,PageTabWidth,ShowPageTabs,ShowScrollBars

Newmethods(alphabeticlist)

MethodsthathavebeenaddedtoMicrosoftVisio2002arelistedinthefollowingtable(sortedalphabetically).

Newmethod ObjectCopyPreviewPicture DocumentDeleteSolutionXMLElement DocumentGetFilterCommands EventGetFilterObjects EventGetFilterSRC EventPasteSpecial Master,Page,ShapePrintTile PageRenameCurrentScope ApplicationResizeToFitContents Master,PageSetFilterCommands EventSetFilterObjects EventSetFilterSRC EventSwapEnds Selection,Shape

Newmethods(byobject)

MethodsthathavebeenaddedtoMicrosoftVisio2002arelistedinthefollowingtable(sortedbyobject).

Object NewmethodApplication RenameCurrentScope Document CopyPreviewPicture,

DeleteSolutionXMLElement Event GetFilterCommands,GetFilterObjects,

GetFilterSRC,SetFilterCommands,SetFilterObjects,SetFilterSRC

Master PasteSpecial,ResizeToFitContents Page PasteSpecial,PrintTile,ResizeToFitContents Selection SwapEnds Shape PasteSpecial,SwapEnds

Newevents

ThefollowingneweventhasbeenaddedtoMicrosoftVisio2002.

Newevent ObjectOnKeystrokeMessageForAddon Application,Window

PrintCopiesproperty

Specifiesthenumberofcopiestoprint.

Versionadded

2002

Syntax

intRet=object.PrintCopiesobject.PrintCopies=intValueintRet Long.Thecurrentnumberofcopies.object Required.AnexpressionthatreturnsaDocumentobject.intValue RequiredLong.Thenewnumberofcopies.

Remarks

ThePrintCopiespropertycorrespondstotheNumberofcopiesboxinthePrintdialogbox(clickPrintontheFilemenu).

Example