microsoft office powerpoint 2003 visual basic referencein visual basic, there are two ways to apply...

2567
New Objects Visit the Office Developer Center on the Microsoft Developer Network Web site for the latest information about programming with Office PowerPoint 2003, including product news, technical articles, downloads, and samples. No new objects are added to the Office PowerPoint 2003 object model.

Upload: others

Post on 11-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewObjectsVisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.

NonewobjectsareaddedtotheOfficePowerPoint2003objectmodel.

Page 2: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewProperties(AlphabeticalList)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistspropertiesaddedtotheOfficePowerPoint2003objectmodel(sortedalphabetically).

NewProperty Object(s)DocumentLibraryVersions PresentationPermission PresentationSharedWorkspace PresentationSync Presentation

Page 3: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewProperties(byObject)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistspropertiesaddedtotheOfficePowerPoint2003objectmodel(sortedbyobjectname).

Object NewProperties

Presentation DocumentLibraryVersions,Permission,SharedWorkspace,Sync

Page 4: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewMethodsVisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistsmethodsaddedtotheOfficePowerPoint2003objectmodel.

NewMethod ObjectPresentation SendFaxOverInternet

Page 5: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewEventsVisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistseventsaddedtotheOfficePowerPoint2003objectmodel.

NewEvent ObjectPresentationSync Application

Page 6: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingEventswiththeApplicationObjectTocreateaneventhandlerforaneventoftheApplicationobject,youneedtocompletethefollowingthreesteps:

1. Declareanobjectvariableinaclassmoduletorespondtotheevents.2. Writethespecificeventprocedures.3. Initializethedeclaredobjectfromanothermodule.

Page 7: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DeclaretheObjectVariable

BeforeyoucanwriteproceduresfortheeventsoftheApplicationobject,youmustcreateanewclassmoduleanddeclareanobjectoftypeApplicationwithevents.Forexample,assumethatanewclassmoduleiscreatedandcalledEventClassModule.Thenewclassmodulecontainsthefollowingcode.

PublicWithEventsAppAsApplication

Page 8: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WritetheEventProcedures

Afterthenewobjecthasbeendeclaredwithevents,itappearsintheObjectlistintheclassmodule,andyoucanwriteeventproceduresforthenewobject.(WhenyouselectthenewobjectintheObjectlist,thevalideventsforthatobjectarelistedintheProcedurelist.)SelectaneventfromtheProcedurelist;anemptyprocedureisaddedtotheclassmodule.

PrivateSubApp_NewPresentation()

EndSub

Page 9: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InitializingtheDeclaredObject

Beforetheprocedurewillrun,youmustconnectthedeclaredobjectintheclassmodule(Appinthisexample)withtheApplicationobject.Youcandothiswiththefollowingcodefromanymodule.

DimXAsNewEventClassModule

SubInitializeApp()

SetX.App=Application

EndSub

RuntheInitializeAppprocedure.Aftertheprocedureisrun,theAppobjectintheclassmodulepointstotheMicrosoftPowerPointApplicationobject,andtheeventproceduresintheclassmodulewillrunwhentheeventsoccur.

Page 10: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Workingwithshapes(drawingobjects)Shapes,ordrawingobjects,arerepresentedbythreedifferentobjects:theShapescollection,theShapeRangecollection,andtheShapeobject.Ingeneral,youusetheShapescollectiontocreateshapesandwhenyouwanttoiteratethroughalltheshapesonaslide;youusetheShapeobjectwhenyouwanttomodifyasingleshape;andyouusetheShapeRangecollectionwhenyouwanttomodifymultipleshapesthesamewayyoucanworkwithmultipleselectedshapesintheuserinterface.

Page 11: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Settingpropertiesforashape

Manyformattingpropertiesofshapesaren'tsetbypropertiesthatapplydirectlytotheShapeorShapeRangeobject.Instead,relatedshapeattributesaregroupedundersecondaryobjects,suchastheFillFormatobject,whichcontainsallthepropertiesthatrelatetotheshape'sfill,ortheLinkFormatobject,whichcontainsallthepropertiesthatareuniquetolinkedOLEobjects.Tosetpropertiesforashape,youmustfirstreturntheobjectthatrepresentsthesetofrelatedshapeattributesandthensetpropertiesofthatreturnedobject.Forexample,youusetheFillpropertytoreturntheFillFormatobject,andthenyousettheForeColorpropertyoftheFillFormatobjecttosetthefillforegroundcolorforthespecifiedshape,asshowninthefollowingexample.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).Fill.ForeColor.RGB=RGB(255,0,0)

Page 12: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Applyingapropertyormethodtoseveralshapesatthesametime

Intheuserinterface,therearesomeoperationsyoucanperformwithseveralshapesselected;forexample,youcanselectseveralshapesandsetalltheirindividualfillsatonce.Thereareotheroperationsyoucanonlyperformwithasingleshapeselected;forexample,youcanonlyeditthetextinashapeifasingleshapeisselected.

InVisualBasic,therearetwowaystoapplypropertiesandmethodstoasetofshapes.Thesetwowaysallowyoutoperformanyoperationthatyoucanperformonasingleshapeonarangeofshapes,whetherornotyoucanperformthesameoperationintheuserinterface.

Iftheoperationworksonmultipleselectedshapesintheuserinterface,youcanperformthesameoperationinVisualBasicbyconstructingaShapeRangecollectionthatcontainstheshapesyouwanttoworkwith,andapplyingtheappropriatepropertiesandmethodsdirectlytotheShapeRangecollection.Iftheoperationdoesn'tworkonmultipleselectedshapesintheuserinterface,youcanstillperformtheoperationinVisualBasicbyloopingthroughtheShapescollectionorthroughaShapeRangecollectionthatcontainstheshapesyouwanttoworkwith,andapplyingtheappropriatepropertiesandmethodstotheindividualShapeobjectsinthecollection.

ManypropertiesandmethodsthatapplytotheShapeobjectandShapeRangecollectionfailifappliedtocertainkindsofshapes.Forexample,theTextFramepropertyfailsifappliedtoashapethatcannotcontaintext.IfyouarenotpositivethateachshapeinaShapeRangecollectioncanhaveacertainpropertyormethodappliedtoit,don'tapplythepropertyormethodtotheShapeRangecollection.Ifyouwanttoapplyoneofthesepropertiesormethodstoacollectionofshapes,youmustloopthroughthecollectionandtesteachindividualshapetomakesureitisanappropriatetypeofshapebeforeapplyingthepropertyormethodtoit.

Page 13: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ApplyingapropertyormethodtoaShapeRangecollection

Ifyoucanperformanoperationonmultipleselectedshapesintheuserinterfaceatthesametime,youcandotheprogrammaticequivalentbyconstructingaShapeRangecollectionandthenapplyingtheappropriatepropertiesormethodstoit.ThefollowingexampleconstructsashaperangethatcontainstheAutoShapesnamed"BigStar"and"LittleStar"onmyDocumentandappliesagradientfilltothem.

SetmyDocument=ActivePresentation.Slides(1)

SetmyRange=myDocument.Shapes_

.Range(Array("BigStar","LittleStar"))

myRange.Fill.PresetGradientmsoGradientHorizontal,_

1,msoGradientBrass

Thefollowingaregeneralguidelinesforhowpropertiesandmethodsbehavewhenthey'reappliedtoaShapeRangecollection.

ApplyingamethodtoathecollectionisequivalenttoapplyingthemethodtoeachindividualShapeobjectinthatcollection.Settingthevalueofapropertyofthecollectionisequivalenttosettingthevalueofthepropertyofeachindividualshapeinthatrange.Apropertyofthecollectionthatreturnsaconstantreturnsthevalueofthepropertyforanindividualshapeinthecollectionifallshapesinthecollectionhavethesamevalueforthatproperty.Ifnotallshapesinthecollectionhavethesamevaluefortheproperty,itreturnsthe"mixed"constant.Apropertyofthecollectionthatreturnsasimpledatatype(suchasLong,Single,orString)returnsthevalueofthepropertyforanindividualshapeifallshapesinthecollectionhavethesamevalueforthatproperty.Thevalueofsomepropertiescanbereturnedorsetonlyifthere'sexactlyoneshapeinthecollection.Ifthere'smorethanoneshapeinthecollection,arun-timeerroroccurs.Thisisgenerallythecaseforreturningorsettingpropertieswhentheequivalentactionintheuserinterfaceispossibleonlywithasingleshape(actionssuchaseditingtextinashapeoreditingthepointsofafreeform).

Page 14: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TheprecedingguidelinesalsoapplywhenyouaresettingpropertiesofshapesthataregroupedundersecondaryobjectsoftheShapeRangecollection,suchastheFillFormatobject.Ifthesecondaryobjectrepresentsoperationsthatcanbeperformedonmultipleselectedobjectsintheuserinterface,youwillbeabletoreturntheobjectfromaShapeRangecollectionandsetitsproperties.Forexample,youcanusetheFillpropertytoreturntheFillFormatobjectthatrepresentsthefillsofalltheshapesintheShapeRangecollection.SettingthepropertiesofthisFillFormatobjectwillsetthesamepropertiesforalltheindividualshapesintheShapeRangecollection.

Page 15: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LoopingthroughaShapesorShapeRangecollection

Evenifyoucannotperformanoperationonseveralshapesintheuserinterfaceatthesametimebyselectingthemandthenusingacommand,youcanperformtheequivalentactionprogrammaticallybyloopingthroughtheShapescollectionorthroughaShapeRangecollectionthatcontainstheshapesyouwanttoworkwith,andapplyingtheappropriatepropertiesandmethodstotheindividualShapeobjectsinthecollection.ThefollowingexampleloopsthroughalltheshapesonmyDocumentandaddstexttoeachshapethatisanAutoShape.

SetmyDocument=ActivePresentation.Slides(1)

ForEachshInmyDocument.Shapes

Ifsh.Type=msoAutoShapeThen

sh.TextFrame.TextRange.InsertAfter"(version1)"

EndIf

Next

ThefollowingexampleconstructsShapeRangecollectionthatcontainsallthecurrentlyselectedshapesintheactivewindowandsetsthetextineachshapeinthecollectionthatcancontaintext.

ForEachshinActiveWindow.Selection.ShapeRange

Ifsh.HasTextFrameThen

sh.TextFrame.TextRange="Initiallyselected"

EndIf

Next

Page 16: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Aligning,distributing,andgroupingshapesinashaperange

UsetheAlignandDistributemethodstopositionasetofshapesrelativetooneanotherorrelativetothedocumentthatcontainsthem.UsetheGroupmethodortheRegroupmethodtoformasinglegroupedshapefromasetofshapes.

Page 17: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WorkingwithPanesandViews

Page 18: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ChangingtheActiveView

YoucanreturnorsetthecurrentviewintheactivedocumentwindowwiththeViewTypeproperty.Thisexamplechangestheviewintheactivedocumentwindowtoslideview.

ActiveWindow.ViewType=ppViewSlide

Page 19: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ChangingPanesinNormalView

Innormalview,youcanusetheViewTypepropertywiththeactivePaneobjecttoreturntheactivepane.TheViewTypepropertyreturnsoneofthefollowingPpViewTypeconstants,identifyingtheactivepane:ppViewNotesPage,ppViewOutline,orppViewSlide.AllotherviewshaveonlyonepaneandtheViewTypepropertyreturnsthesamePpViewTypeconstantvalueastheactivedocumentwindow.

YoucanactivateapanebysettingtheViewTypepropertyorbyusingtheActivatemethod.ThisexamplereturnsthevalueoftheViewTypepropertytoidentifytheactiveviewandactivepane.Iftheactiveviewisnormalviewandtheactivepaneisthenotespane,thentheslidepaneisactivatedwiththeActivatemethod.

WithActiveWindow

If.ViewType=ppViewNormaland_

.ActivePane.ViewType=ppViewNotesPageThen

.Panes(2).Activate

EndIf

EndWith

Page 20: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Resizingpanes

YoucanusetheSplitHorizontalandtheSplitVerticalpropertiestorepositionthepanedividersinnormalviewtothespecifiedpercentageoftheavailabledocumentwindow.Thisresizesthepanesoneithersideofthedivider.Themaximumvalueofthesepropertiesisalwayslessthan100%becausetheslidepanehasaminimumsizethatdependsona10%zoomlevel.Thisexamplesetsthepercentageoftheavailabledocumentwindowheightthattheslidepaneoccupiesto65percent,leavingthenotespaneat35percent.

ActiveWindow.SplitVertical=65

Page 21: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PublishingaWebPresentationInMicrosoftPowerPoint,youcanpublishapresentationdirectlytoaWebserverandyoucaneditHTMLdocumentsdirectlyinPowerPoint.

Page 22: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SavingaPresentationasaWebPage

SavingapresentationasaWebpageistheprocessofcreatingandsavinganHTMLversionofapresentation.Todothis,usetheSaveAsmethod,asshowninthefollowingexamplewhichsavesthecurrentpresentationasc:\myfile.htm.

ActivePresentation.SaveAs"c:\myfile.htm",ppSaveAsHTMLv3,msoTrue

Page 23: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PublishingaWebPresentation

PublishingaWebpresentationistheprocessofcreatinganHTMLversionofapresentationandsavingittoaWebserverorafileserverusingthePublishmethod.ThisdiffersfromsavingapresentationasaWebpageusingtheSaveAsmethodinthatwhenyoupublishaWebpresentation,youcancustomizethepresentationbysettingvariousattributes,andyoucanpublishthepresentationdirectlytoaWebserver.AftersettingvariouspropertiesoftheWebOptionsobject,thisexamplepublishestheactivepresentationtoaWebserverwiththeURLaddresshttp://www.someones.homepage/mallard.htm.

WithActivePresentation

With.WebOptions

.FrameColors=ppFrameColorsWhiteTextOnBlack

.RelyonVML=True

.OrganizeInFolder=True

EndWith

With.PublishObjects(1)

.FileName="http://www.someones.homepage/mallard.htm"

.SourceType=ppPublishAll

.SpeakerNotes=True

.Publish

EndWith

EndWith

Page 24: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WebOptionsandDefaultWebOptions

WhenusingthePublishmethod,youcancustomizetheappearance,content,browsersupport,editingsupport,graphicsformats,screenresolution,fileorganization,andencodingoftheHTMLdocumentbysettingpropertiesoftheDefaultWebOptionsobjectandtheWebOptionsobject.TheDefaultWebOptionsobjectcontainsapplication-levelproperties.Thesesettingsareoverriddenbyanypresentation-levelpropertysettingsthathavethesamename,containedintheWebOptionsobject.

Thisexamplesetsvariousapplication-levelpropertiesforWebpublishing.Theywillbethedefaultsettingsforanycurrentorfutureloadedpresentationuntilthesettingsarechangedagain.ThecodethenresetstheResizeGraphicspropertyfortheactivepresentation,whichoverridestheapplication-leveldefault.Itpublishestheactivepresentationas"c:\mallard.htm."

WithApplication.DefaultWebOptions

.FrameColors=ppFrameColorsWhiteTextOnBlack

.IncludeNavigation=False

.ResizeGraphics=True

EndWith

WithActivePresentation

.WebOptions.ResizeGraphics=False

With.PublishObjects(1)

.FileName="c:\mallard.htm"

.SourceType=ppPublishAll

.SpeakerNotes=True

.Publish

EndWith

EndWith

Page 25: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OpeninganHTMLdocumentinPowerPoint

ToeditanHTMLdocumentinPowerPoint,opentheHTMLdocumentusingtheOpenmethod.Thisexampleopensthefile"myfile.htm"forediting.

Presentations.OpenFilename:="c:\Windows\myfile.htm"

Page 26: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 27: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingActiveXcontrolsonslidesYoucanaddcontrolstoyourslidestoprovideasophisticatedwaytoexchangeinformationwiththeuserwhileaslideshowisrunning.Forexample,youcouldusecontrolsonslidestoallowviewersofashowdesignedtoberuninakioskawaytochooseoptionsandthenrunacustomshowbasedontheviewer'schoices.

Forgeneralinformationonaddingandworkingwithcontrols,seeUsingActiveXControlsonaDocumentandCreatingaCustomDialogBox.

Keepthefollowingpointsinmindwhenyouareworkingwithcontrolsonslides.

Acontrolonaslideisindesignmodeexceptwhentheslideshowisrunning.Ifyouwantacontroltoappearonallslidesinapresentation,addittotheslidemaster.TheMekeywordinaneventprocedureforacontrolonaslidereferstotheslide,notthecontrol.

Writingeventcodeforcontrolsonslidesisverysimilartowritingeventcodeforcontrolsonforms.Thefollowingproceduresetsthebackgroundfortheslidethebuttonnamed"cmdChangeColor"isonwhenthebuttonisclicked.

PrivateSubcmdChangeColor_Click()

WithMe

.FollowMasterBackground=Not.FollowMasterBackground

.Background.Fill.PresetGradient_

msoGradientHorizontal,1,msoGradientBrass

EndWith

EndSub

YoumaywanttousecontrolstoprovideyourslideshowwithnavigationtoolsthataremorecomplexthanthosebuiltintoMicrosoftPowerPoint.Forexample,ifyouaddtwobuttonsnamed"cmdBack"and"cmdForward"totheslidemasterandwritethefollowingcodebehindthem,allslidesbasedonthemaster(andsettoshowmasterbackgroundgraphics)willhavetheseprofessional-lookingnavigationbuttonsthatwillbeactiveduringaslideshow.

Page 28: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrivateSubcmdBack_Click()

Me.Parent.SlideShowWindow.View.Previous

EndSub

PrivateSubcmdForward_Click()

Me.Parent.SlideShowWindow.View.Next

EndSub

ToworkwithalltheActiveXcontrolsonaslidewithoutaffectingtheothershapesontheslide,youcanconstructaShapeRangecollectionthatcontainsonlycontrols.Youcanthenapplypropertiesandmethodstotheentirecollectionoriteratethroughthecollectiontoworkwitheachcontrolindividually.Thefollowingexamplealignsallthecontrolsonslideoneintheactivepresentationanddistributesthemvertically.

WithActivePresentation.Slides(1).Shapes

numShapes=.Count

IfnumShapes>1Then

numControls=0

ReDimctrlArray(1TonumShapes)

Fori=1TonumShapes

If.Item(i).Type=msoOLEControlObjectThen

numControls=numControls+1

ctrlArray(numControls)=.Item(i).Name

EndIf

Next

IfnumControls>1Then

ReDimPreservectrlArray(1TonumControls)

SetctrlRange=.Range(ctrlArray)

ctrlRange.DistributemsoDistributeVertically,True

ctrlRange.AlignmsoAlignLefts,True

EndIf

EndIf

EndWith

Page 29: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 30: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingActiveXcontrolsonadocumentJustasyoucanaddActiveXcontrolstocustomdialogboxes,youcanaddcontrolsdirectlytoadocumentwhenyouwanttoprovideasophisticatedwayfortheusertointeractdirectlywithyourmacrowithoutthedistractionofdialogboxes.UsethefollowingproceduretoaddActiveXcontrolstoyourdocument.FormorespecificinformationaboutusingActiveXcontrolsinMicrosoftPowerPoint,seeUsingActiveXcontrolsonslides.

1. Addcontrolstothedocument

DisplaytheControlToolbox,clickthecontrolyouwanttoadd,andthenclickthedocument.

2. Setcontrolproperties

Right-clickacontrolindesignmodeandclickPropertiestodisplaythePropertieswindow.

3. Initializethecontrols

Youcaninitializecontrolsinaprocedure.

4. Writeeventprocedures

Allcontrolshaveapredefinedsetofevents.Forexample,acommandbuttonhasaClickeventthatoccurswhentheuserclicksthecommandbutton.Youcanwriteeventproceduresthatrunwhentheeventsoccur.

5. Usecontrolvalueswhilecodeisrunning

Somepropertiescanbesetatruntime.

Page 31: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 32: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CreatingacustomdialogboxUsethefollowingproceduretocreateacustomdialogbox:

1. CreateaUserForm

OntheInsertmenuintheVisualBasicEditor,clickUserForm.

2. AddcontrolstotheUserForm

FindthecontrolyouwanttoaddintheToolboxanddragthecontrolontotheform.

3. Setcontrolproperties

Right-clickacontrolindesignmodeandclickPropertiestodisplaythePropertieswindow.

4. Initializethecontrols

Youcaninitializecontrolsinaprocedurebeforeyoushowaform,oryoucanaddcodetotheInitializeeventoftheform.

5. Writeeventprocedures

Allcontrolshaveapredefinedsetofevents.Forexample,acommandbuttonhasaClickeventthatoccurswhentheuserclicksthecommandbutton.Youcanwriteeventproceduresthatrunwhentheeventsoccur.

6. Showthedialogbox

UsetheShowmethodtodisplayaUserForm.

7. Usecontrolvalueswhilecodeisrunning

Somepropertiescanbesetatruntime.Changesmadetothedialogboxbytheuserarelostwhenthedialogboxisclosed.

Page 33: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 34: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 35: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ControllingoneMicrosoftOfficeapplicationfromanotherIfyouwanttoruncodeinoneMicrosoftOfficeapplicationthatworkswiththeobjectsinanotherapplication,followthesesteps.

1. Setareferencetotheotherapplication'stypelibraryintheReferencesdialogbox(Toolsmenu).Afteryouhavedonethis,theobjects,properties,andmethodswillshowupintheObjectBrowserandthesyntaxwillbecheckedatcompiletime.Youcanalsogetcontext-sensitiveHelponthem.

2. Declareobjectvariablesthatwillrefertotheobjectsintheotherapplicationasspecifictypes.Makesureyouqualifyeachtypewiththenameoftheapplicationthatissupplyingtheobject.Forexample,thefollowingstatementdeclaresavariablethatwillpointtoaMicrosoftWorddocument,andanotherthatreferstoaMicrosoftExcelapplication.DimappWDAsWord.Application,wbXLAsExcel.Application

NoteYoumustfollowthestepsaboveifyouwantyourcodetobeearlybound.

3. UsetheNewkeywordwiththeOLEProgrammaticIdentifieroftheobjectyouwanttoworkwithintheotherapplication,asshowninthefollowingexample.Ifyouwanttoseethesessionoftheotherapplication,settheVisiblepropertytoTrue.

DimappWDAsWord.Application

SetappWD=NewWord.Application

appWd.Visible=True

4. Applypropertiesandmethodstotheobjectcontainedinthevariable.Forexample,thefollowinginstructioncreatesanewWorddocument.

DimappWDAsWord.Application

SetappWD=NewWord.Application

appWD.Documents.Add

Page 36: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

5. Whenyouaredoneworkingwiththeotherapplication,usetheQuitmethodtocloseit,asshowninthefollowingexample.

appWd.Quit

Page 37: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OLEProgrammaticIdentifiersYoucanuseanOLEprogrammaticidentifier(sometimescalledaProgID)tocreateanAutomationobject.ThefollowingtableslistOLEprogrammaticidentifiersforActiveXcontrols,MicrosoftOfficeapplications,andMicrosoftOfficeWebComponents.

ActiveXControls

MicrosoftAccess

MicrosoftExcel

MicrosoftGraph

MicrosoftOfficeWebComponents

MicrosoftOutlook

MicrosoftPowerPoint

MicrosoftWord

Page 38: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActiveXControls

TocreatetheActiveXcontrolslistedinthefollowingtable,usethecorrespondingOLEprogrammaticidentifier.

Tocreatethiscontrol UsethisidentifierCheckBox Forms.CheckBox.1ComboBox Forms.ComboBox.1CommandButton Forms.CommandButton.1Frame Forms.Frame.1Image Forms.Image.1Label Forms.Label.1ListBox Forms.ListBox.1MultiPage Forms.MultiPage.1OptionButton Forms.OptionButton.1ScrollBar Forms.ScrollBar.1SpinButton Forms.SpinButton.1TabStrip Forms.TabStrip.1TextBox Forms.TextBox.1ToggleButton Forms.ToggleButton.1

Page 39: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MicrosoftAccess

TocreatetheMicrosoftAccessobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofAccessavailableonthemachinewherethemacroisrunning.

Tocreatethisobject UseoneoftheseidentifiersApplication Access.ApplicationCurrentData Access.CodeData,Access.CurrentDataCurrentProject Access.CodeProject,Access.CurrentProjectDefaultWebOptions Access.DefaultWebOptions

Page 40: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MicrosoftExcel

TocreatetheMicrosoftExcelobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofExcelavailableonthemachinewherethemacroisrunning.

Tocreatethisobject

Useoneoftheseidentifiers Comments

Application Excel.ApplicationWorkbook Excel.AddIn

Workbook Excel.ChartReturnsaworkbookcontainingtwoworksheets;oneforthechartandoneforitsdata.Thechartworksheetistheactiveworksheet.

Workbook Excel.Sheet Returnsaworkbookwithoneworksheet.

Page 41: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MicrosoftGraph

TocreatetheMicrosoftGraphobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofGraphavailableonthemachinewherethemacroisrunning.

Tocreatethisobject UseoneoftheseidentifiersApplication MSGraph.ApplicationChart MSGraph.Chart

Page 42: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MicrosoftOfficeWebComponents

TocreatetheMicrosoftOfficeWebComponentsobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofMicrosoftOfficeWebComponentsavailableonthemachinewherethemacroisrunning.

Tocreatethisobject UseoneoftheseidentifiersChartSpace OWC10.ChartDataSourceControl OWC10.DataSourceControlExpandControl OWC.ExpandControlPivotTable OWC10.PivotTableRecordNavigationControlOWC10.RecordNavigationControlSpreadsheet OWC10.Spreadsheet

Page 43: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MicrosoftOutlook

TocreatetheMicrosoftOutlookobjectgiveninthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofOutlookavailableonthemachinewherethemacroisrunning.

Tocreatethisobject UseoneoftheseidentifiersApplication Outlook.Application

Page 44: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MicrosoftPowerPoint

TocreatetheMicrosoftPowerPointobjectgiveninthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofPowerPointavailableonthemachinewherethemacroisrunning.

Tocreatethisobject UseoneoftheseidentifiersApplication PowerPoint.Application

Page 45: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MicrosoftWord

TocreatetheMicrosoftWordobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofWordavailableonthemachinewherethemacroisrunning.

Tocreatethisobject UseoneoftheseidentifiersApplication Word.ApplicationDocument Word.Document,Word.TemplateGlobal Word.Global

Page 46: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActionSettingsCollectionObjectMultipleobjects ActionSettings

ActionSettingMultipleobjects

AcollectionthatcontainsthetwoActionSettingobjectsforashapeortextrange.OneActionSettingobjectrepresentshowthespecifiedobjectreactswhentheuserclicksitduringaslideshow,andtheotherActionSettingobjectrepresentshowthespecifiedobjectreactswhentheusermovesthemousepointeroveritduringaslideshow.

Page 47: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheActionSettingsCollection

UsetheActionSettingspropertytoreturntheActionSettingscollection.UseActionSettings(index),whereindexiseitherppMouseClickorppMouseOver,toreturnasingleActionSettingobject.ThefollowingexamplespecifiesthattheCalculateTotalmacroberunwheneverthemousepointerpassesovertheshapeduringaslideshow.

WithActivePresentation.Slides(1).Shapes(3)_

.ActionSettings(ppMouseOver)

.Action=ppActionRunMacro

.Run="CalculateTotal"

.AnimateAction=True

EndWith

Page 48: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 49: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddInsCollectionObjectApplication AddIns

AddIn

AcollectionofAddInobjectsthatrepresentalltheMicrosoftPowerPoint-specificadd-insavailabletoPowerPoint,regardlessofwhetherornotthey'reloaded.ThisdoesnotincludeComponentObjectModel(COM)add-ins.

Page 50: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAddInsCollection

UsetheAddInsmethodtoreturntheAddInscollection.Thefollowingexampledisplaysthenamesofalltheadd-insthatarecurrentlyloadedinPowerPoint.

ForEachadInAddIns

Ifad.LoadedThenMsgBoxad.Name

Next

UsetheAddmethodtoaddaPowerPoint-specificadd-intothelistofthoseavailable.TheAddmethodaddsanadd-intothelistbutdoesn'tloadtheadd-in.Toloadtheadd-in,settheLoadedpropertyoftheadd-intoTrueafteryouusetheAddmethod.Youcanperformthesetwoactionsinasinglestep,asshowninthefollowingexample(notethatyouusethenameoftheadd-in,notitstitle,withtheAddmethod).

AddIns.Add("graphdrs.ppa").Loaded=True

UseAddIns(index),whereindexistheadd-in'stitleorindexnumber,toreturnasingleAddInobject.Thefollowingexampleloadsthehypotheticaladd-intitled"myppttools."

AddIns("myppttools").Loaded=True

Don'tconfusetheadd-intitlewiththeadd-inname,whichisthefilenameoftheadd-in.Youmustspelltheadd-intitleexactlyasit'sspelledintheAdd-Insdialogbox,butthecapitalizationdoesn'thavetomatch.

Page 51: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AdjustmentsObject

Multipleobjects Adjustments

ContainsacollectionofadjustmentvaluesforthespecifiedAutoShape,WordArtobject,orconnector.Eachadjustmentvaluerepresentsonewayanadjustmenthandlecanbeadjusted.Becausesomeadjustmenthandlescanbeadjustedintwoways—forinstance,somehandlescanbeadjustedbothhorizontallyandvertically—ashapecanhavemoreadjustmentvaluesthanithasadjustmenthandles.Ashapecanhaveuptoeightadjustments.

Page 52: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAdjustmentsObject

UsetheAdjustmentspropertytoreturnanAdjustmentsobject.UseAdjustments(index),whereindexistheadjustmentvalue'sindexnumber,toreturnasingleadjustmentvalue.

Differentshapeshavedifferentnumbersofadjustmentvalues,differentkindsofadjustmentschangethegeometryofashapeindifferentways,anddifferentkindsofadjustmentshavedifferentrangesofvalidvalues.Forexample,thefollowingillustrationshowswhateachofthefouradjustmentvaluesforaright-arrowcalloutcontributestothedefinitionofthecallout'sgeometry.

NoteBecauseeachadjustableshapehasadifferentsetofadjustments,thebestwaytoverifytheadjustmentbehaviorforaspecificshapeistomanuallycreateaninstanceoftheshape,makeadjustmentswiththemacrorecorderturnedon,andthenexaminetherecordedcode.

Thefollowingtablesummarizestherangesofvalidadjustmentvaluesfordifferenttypesofadjustments.Inmostcases,ifyouspecifyavaluethat'sbeyondtherangeofvalidvalues,theclosestvalidvaluewillbeassignedtotheadjustment.

Typeofadjustment Validvalues

Linear(horizontal

Generallythevalue0.0representstheleftortopedgeoftheshapeandthevalue1.0representstherightorbottomedgeoftheshape.Validvaluescorrespondtovalidadjustmentsyoucanmaketotheshapemanually.Forexample,ifyoucanonlypullanadjustmenthandlehalfwayacrosstheshapemanually,themaximumvaluefor

Page 53: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

orvertical) thecorrespondingadjustmentwillbe0.5.Forshapessuchasconnectorsandcallouts,wherethevalues0.0and1.0representthelimitsoftherectangledefinedbythestartingandendingpointsoftheconnectororcalloutline,negativenumbersandnumbersgreaterthan1.0arevalidvalues.

Radial Anadjustmentvalueof1.0correspondstothewidthoftheshape.Themaximumvalueis0.5,orhalfwayacrosstheshape.

Angle Valuesareexpressedindegrees.Ifyouspecifyavalueoutsidetherange–180to180,itwillbenormalizedtobewithinthatrange.

Thefollowingexampleaddsaright-arrowcallouttomyDocumentandsetsadjustmentvaluesforthecallout.Notethatalthoughtheshapehasonlythreeadjustmenthandles,ithasfouradjustments.Adjustmentsthreeandfourbothcorrespondtothehandlebetweentheheadandneckofthearrow.

SetmyDocument=ActivePresentation.Slides(1)

Setrac=myDocument.Shapes_

.AddShape(msoShapeRightArrowCallout,10,10,250,190)

Withrac.Adjustments

.Item(1)=0.5'adjustswidthoftextbox

.Item(2)=0.15'adjustswidthofarrowhead

.Item(3)=0.8'adjustslengthofarrowhead

.Item(4)=0.4'adjustswidthofarrowneck

EndWith

Page 54: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimationBehaviorsCollectionEffect AnimationBehaviors

AnimationBehaviorMultipleobjects

RepresentsacollectionofAnimationBehaviorobjects.

Page 55: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAnimationBehaviorscollection

UsetheAddmethodtoaddananimationbehavior.Thefollowingexampleaddsafive-secondanimatedrotationbehaviortothemainanimationsequenceonthefirstslide.

SubAnimationObject()

DimtimeMainAsTimeLine

'Referencethemainanimationtimeline

SettimeMain=ActivePresentation.Slides(1).TimeLine

'Addafive-secondanimatedrotationbehavior

'asthefirstanimationinthemainanimationsequence

timeMain.MainSequence(1).Behaviors.AddType:=msoAnimTypeRotation,Index:=1

EndSub

Page 56: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimationPointsCollectionPropertyEffect AnimationPoints

AnimationPoint

RepresentsacollectionofanimationpointsforaPropertyEffectobject.

Page 57: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAnimationPointscollection

UsethePointspropertyofthePropertyEffectobjecttoreturnanAnimationPointscollectionobject.Thefollowingexampleaddsananimationpointtothefirstbehaviorintheactivepresentation'smainanimationsequence.

SubAddPoint()

ActivePresentation.Slides(1).TimeLine.MainSequence(1)_

.Behaviors(1).PropertyEffect.Points.Add

EndSub

Transitionsfromoneanimationpointtoanothercansometimesbeabruptorchoppy.UsetheSmoothpropertytomaketransitionssmoother.Thisexamplesmoothesthetransitionsbetweenanimationpoints.

SubSmoothTransition()

ActivePresentation.Slides(1).TimeLine.MainSequence(1)_

.Behaviors(1).PropertyEffect.Points.Smooth=msoTrue

EndSub

Page 58: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 59: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BordersCollectionObjectMultipleobjects Borders

LineFormatColorFormat

AcollectionofLineFormatobjectsthatrepresentthebordersanddiagonallinesofacellorrangeofcellsinatable.

Page 60: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheBordersCollection

EachCellobjectorCellRangecollectionhassixelementsintheBorderscollection.YoucannotaddobjectstotheBorderscollection.

UseBorders(index),whereindexidentifiesthecellborderordiagonalline,toreturnasingleBorderobject.IndexcanbeanyPPBorderTypeconstant.

PPBorderTypecanbeoneofthesePPBorderTypeconstants.ppBorderBottomppBorderLeftppBorderRightppBorderTopppBorderDiagonalDownppBorderDiagonalUp

UsetheDashStylepropertytoapplyadashedlinestyletoaBorderobject.Thisexampleselectsthesecondrowfromthetableandappliesadashedlinestyletothebottomborder.

ActiveWindow.Selection.ShapeRange.Table.Rows(2)_

.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash

Page 61: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CellRangeCollectionObjectMultipleobjects CellRange

Borders

AcollectionofCellobjectsinatablecolumnorrow.TheCellRangecollectionrepresentsallthecellsinthespecifiedcolumnorrow.TousetheCellRangecollection,usetheCellskeyword.

Page 62: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheCellRangeCollection

UsetheCellspropertytoreturntheCellRangecollection.Thisexamplesetstherightborderforthecellsinthefirstcolumnofthetabletoadashedlinestyle.

WithActivePresentation.Slides(2).Shapes(5).Table.Columns(1).Cells

.Borders(ppBorderRight).DashStyle=msoLineDash

EndWith

Thisexamplereturnsthenumberofcellsinrowoneoftheselectedtable.

num=ActiveWindow.Selection.ShapeRange.Table.Rows(1).Cells.Count

UseCell(row,column),whererowistherownumberandcolumnisthecolumnnumber,orCells(index),whereindexisthenumberofthecellinthespecifiedroworcolumn,toreturnasingleCellobject.Cellsarenumberedfromlefttorightinrowsandfromtoptobottomincolumns.Withright-to-leftlanguagesettings,thisschemeisreversed.Theexamplebelowmergesthefirsttwocellsinrowoneofthetableinshapefiveonslidetwo.

WithActivePresentation.Slides(2).Shapes(5).Table

.Cell(1,1).MergeMergeTo:=.Cell(1,2)

EndWith

Page 63: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

AlthoughthecollectionobjectisnamedCellRangeandisshownintheObjectBrowser,thiskeywordisnotusedinprogrammingthePowerPointobjectmodel.ThekeywordCellsisusedinstead.

YoucannotprogrammaticallyaddcellstoordeletecellsfromaPowerPointtable.UsetheAddTablemethodwiththeTableobjecttoaddanewtable.UsetheAddmethodoftheColumnsorRowscollectionstoaddacolumnorrowtoatable.UsetheDeletemethodoftheColumnsorRowscollectionstodeleteacolumnorrowfromatable.

Page 64: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorSchemesCollectionObjectPresentation ColorSchemes

ColorScheme

AcollectionofalltheColorSchemeobjectsinthespecifiedpresentation.EachColorSchemeobjectrepresentsacolorscheme,whichisasetofcolorsthatareusedtogetheronaslide.

Page 65: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheColorSchemesCollection

UsetheColorSchemespropertytoreturntheColorSchemescollection.UseColorSchemes(index),whereindexisthecolorschemeindexnumber,toreturnasingleColorSchemeobject.Thefollowingexampledeletescolorschemetwofromtheactivepresentation.

ActivePresentation.ColorSchemes(2).Delete

UsetheAddmethodtocreateanewcolorschemeandaddittotheColorSchemescollection.Thefollowingexampleaddsacolorschemetotheactivepresentationandsetsthetitlecolorandbackgroundcolorforthecolorscheme(becausenoargumentwasusedwiththeAddmethod,theaddedcolorschemeisinitiallyidenticaltothefirststandardcolorschemeinthepresentation).

WithActivePresentation.ColorSchemes.Add

.Colors(ppTitle).RGB=RGB(255,0,0)

.Colors(ppBackground).RGB=RGB(128,128,0)

EndWith

SettheColorSchemepropertyofaSlide,SlideRange,orMasterobjecttoreturnthecolorschemeforoneslide,asetofslides,oramaster,respectively.Thefollowingexamplesetsthecolorschemeforalltheslidesintheactivepresentationtothethirdcolorschemeinthepresentation.

WithActivePresentation

.Slides.Range.ColorScheme=.ColorSchemes(3)

EndWith

Page 66: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColumnsCollectionObjectTable Columns

ColumnCellRange

AcollectionofColumnobjectsthatrepresentthecolumnsinatable.

Page 67: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheColumnsCollection

UsetheColumnspropertytoreturntheColumnscollection.Thisexamplefindsthefirsttableintheactivepresentation,countsthenumberofColumnobjectsintheColumnscollection,anddisplaysinformationtotheuser.

DimColCount,sl,shAsInteger

WithActivePresentation

Forsl=1To.Slides.Count

Forsh=1To.Slides(sl).Shapes.Count

If.Slides(sl).Shapes(sh).HasTableThen

ColCount=.Slides(sl).Shapes(sh)_

.Table.Columns.Count

MsgBox"Shape"&sh&"onslide"&sl&_

"containsthefirsttableandhas"&_

ColCount&"columns."

ExitSub

EndIf

Next

Next

EndWith

UsetheAddmethodtoaddacolumntoatable.Thisexamplecreatesacolumninanexistingtableandsetsthewidthofthenewcolumnto72points(oneinch).

WithActivePresentation.Slides(2).Shapes(5).Table

.Columns.Add.Width=72

EndWith

UseColumns(index)toreturnasingleColumnobject.IndexrepresentsthepositionofthecolumnintheColumnscollection(usuallycountingfromlefttoright;althoughtheTableDirectionpropertycanreversethis).Thisexampleselectsthefirstcolumnofthetableinshapefiveonthesecondslide.

ActivePresentation.Slides(2).Shapes(5).Table.Columns(1).Select

Page 68: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 69: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CommentsCollectionMultipleobjects Comments

Comment

RepresentsacollectionofCommentobjects.

Page 70: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheCommentscollection

UsetheCommentspropertytorefertotheCommentscollection.Thefollowingexampledisplaysthenumberofcommentsonthecurrentslide.

SubCountComments()

MsgBox"Youhave"&ActiveWindow.Selection.SlideRange(1)_

.Comments.Count&"commentsonthisslide."

EndSub

UsetheAddmethodtoaddacommenttoaslide.Thisexampleaddsanewcommenttothefirstslideoftheactivepresentation.

SubAddComment()

DimsldNewAsSlide

DimcmtNewAsComment

SetsldNew=ActivePresentation.Slides.Add(Index:=1,_

Layout:=ppLayoutBlank)

SetcmtNew=sldNew.Comments.Add(Left:=12,Top:=12,_

Author:="JeffSmith",AuthorInitials:="JS",_

Text:="Youmightconsiderreviewingthenewspecs"&_

"formoreup-to-dateinformation.")

EndSub

Page 71: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DesignsCollectionPresentation Designs

Design

Representsacollectionofslidedesigntemplates.

Page 72: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDesignscollection

UsetheDesignspropertyofthePresentationobjecttoreferenceadesigntemplate.

Toaddorcloneanindividualdesigntemplate,usetheDesignscollection'sAddorClonemethods,respectively.Torefertoanindividualdesigntemplate,usetheItemmethod.

Toloadadesigntemplate,usetheLoadmethod.

ThefollowingexampleaddsanewdesigntemplatetotheDesignscollectionandconfirmsitwasaddedcorrectly.

SubAddDesignMaster()

WithActivePresentation.Designs

.AdddesignName:="MyDesignName"

MsgBox.Item("MyDesignName").Name

EndWith

EndSub

Page 73: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DiagramNodesCollectionDiagram DiagramNodes

DiagramNodeMultipleobjects

AcollectionofDiagramNodeobjectsthatrepresentsallthenodesinadiagram.

Page 74: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDiagramNodescollection

UsetheNodespropertyoftheDiagramobjecttoreturnaDiagramNodescollection.UsetheItemmethodtoselectandworkwithasinglediagramnodeinadiagram.Thisexampleassumesthefirstshapeonthefirstslideintheactivepresentationisadiagram,selectsthefirstnode,anddeletesit.

SubFillDiagramNode()

ActivePresentation.Slides(1).Shapes(1).Diagram.Nodes.Item(1).Delete

EndSub

UsetheSelectAllmethodtoselectandworkwithallnodesinadiagram.Thisexampleassumesthefirstshapeonthefirstslideintheactivepresentationisadiagram,selectsallnodes,andfillsthemwiththespecifiedpattern.

SubFillDiagramNodes()

ActivePresentation.Slides(1).Shapes(1).Diagram.Nodes.SelectAll

ActiveWindow.Selection.ShapeRange.Fill.Patterned_

Pattern:=msoPatternSmallConfetti

EndSub

Page 75: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DocumentWindowsCollectionObjectMultipleobjects DocumentWindows

DocumentWindowMultipleobjects

AcollectionofalltheDocumentWindowobjectsthatarecurrentlyopeninPowerPoint.Thiscollectiondoesn'tincludeopenslideshowwindows,whichareincludedintheSlideShowWindowscollection.

Page 76: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDocumentWindowsCollection

UsetheWindowspropertytoreturntheDocumentWindowscollection.Thefollowingexampletilestheopendocumentwindows.

Windows.ArrangeppArrangeTiled

UsetheNewWindowmethodtocreateadocumentwindowandaddittotheDocumentWindowscollection.Thefollowingexamplecreatesanewwindowfortheactivepresentation.

ActivePresentation.NewWindow

UseWindows(index),whereindexisthewindowindexnumber,toreturnasingleDocumentWindowobject.Thefollowingexampleclosesdocumentwindowtwo.

Windows(2).Close

Page 77: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontsCollectionObjectPresentation Fonts

FontColorFormat

AcollectionofalltheFontobjectsinthespecifiedpresentation.EachFontobjectrepresentsafontthat'susedinthepresentation.

TheFontscollectionisusedbytheGeniWizardtodeterminewhetheranyofthefontsinthespecifiedpresentationwon'tbesupportedwhenGenigraphicsimagestheslides.Ifyoujustwanttosetcharacterformattingforaparticularbulletortextrange,usetheFontpropertytoreturntheFontobjectforthebulletortextrange.

TheGenigraphicswizardenablesuserstotransmittheirpresentationsdirectlytoGenigraphicsforconversionintofilmslides,overheadtransparencies,orotherspecializedmediaformats.FormoreinformationabouttheservicesGenigraphicsprovides,visittheGenigraphicsWebsiteathttp://www.genigraphics.com/.ThisservicemaynotbeavailableoutsidetheUnitedStates.

Page 78: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheFontsObject

UsetheFontspropertytoreturntheFontscollection.Thefollowingexampledisplaysthenumberoffontsusedintheactivepresentation.

MsgBoxActivePresentation.Fonts.Count

UseFonts(index),whereindexisthefont'snameorindexnumber,toreturnasingleFontobject.Thefollowingexamplecheckstoseewhetherfontoneintheactivepresentationisembeddedinthepresentation.

IfActivePresentation.Fonts(1).Embedded=TrueThen

MsgBox"Font1isembedded"

Page 79: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HeadersFootersObjectMultipleobjects HeadersFooters

HeaderFooter

ContainsalltheHeaderFooterobjectsonthespecifiedslide,notespage,handout,ormaster.EachHeaderFooterobjectrepresentsaheader,footer,dateandtime,orslidenumber.

NoteHeaderFooterobjectsaren'tavailableforSlideobjectsthatrepresentnotespages.TheHeaderFooterobjectthatrepresentsaheaderisavailableonlyforanotesmasterorhandoutmaster.

Page 80: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheHeaderFootersObject

UsetheHeadersFooterspropertytoreturntheHeadersFootersobject.UsetheDateAndTime,Footer,Header,orSlideNumberpropertytoreturnanindividualHeaderFooterobject.Thefollowingexamplesetsthefootertextforslideoneintheactivepresentation.

ActivePresentation.Slides(1).HeadersFooters.Footer_

.Text="VolcanoCoffee"

Page 81: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NamedSlideShowsCollectionObjectSlideShowSettings NamedSlideShows

NamedSlideShow

AcollectionofalltheNamedSlideShowobjectsinthepresentation.EachNamedSlideShowobjectrepresentsacustomslideshow.

Page 82: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheNamedSlideShowsCollection

UsetheNamedSlideShowspropertytoreturntheNamedSlideShowscollection.UseNamedSlideShows(index),whereindexisthecustomslideshownameorindexnumber,toreturnasingleNamedSlideShowobject.Thefollowingexampledeletesthecustomslideshownamed"QuickShow."

ActivePresentation.SlideShowSettings_

.NamedSlideShows("QuickShow").Delete

UsetheAddmethodtocreateanewslideshowandaddittotheNamedSlideShowscollection.Thefollowingexampleaddstotheactivepresentationthenamedslideshow"QuickShow"thatcontainsslides2,7,and9.Theexamplethenrunsthiscustomslideshow.

DimqSlides(1To3)AsLong

WithActivePresentation

With.Slides

qSlides(1)=.Item(2).SlideID

qSlides(2)=.Item(7).SlideID

qSlides(3)=.Item(9).SlideID

EndWith

With.SlideShowSettings

.NamedSlideShows.Add"QuickShow",qSlides

.RangeType=ppShowNamedSlideShow

.SlideShowName="QuickShow"

.Run

EndWith

EndWith

Page 83: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PanesCollectionObjectDocumentWindow Panes

Pane

AcollectionofPaneobjectsthatrepresenttheslide,outline,andnotespanesinthedocumentwindowfornormalview,orthesinglepaneofanyotherviewinthedocumentwindow.

Page 84: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePanesCollection

UsethePanespropertytoreturnthePanescollection.Thefollowingexampletestsforthenumberofpanesintheactivewindow.Ifthevalueisone,indicatinganyviewotherthatnormalview,thennormalviewisactivatedandtheverticalpanedividerissettodividethedocumentwindowat15%outlinepaneand85%slidepane.

WithActiveWindow

If.Panes.Count=1Then

.ViewType=ppViewNormal

.SplitHorizontal=15

EndIf

EndWith

Page 85: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Innormalview,thePanescollectioncontainsthreemembers.Allotherdocumentwindowviewshaveonlyasinglepane,resultinginaPanescollectionwithonemember.

Page 86: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 87: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlaceholdersCollectionObjectShapes Placeholders

ShapeMultipleobjects

AcollectionofalltheShapeobjectsthatrepresentplaceholdersonthespecifiedslide.EachShapeobjectinthePlaceholderscollectionrepresentsaplaceholderfortext,achart,atable,anorganizationalchart,orsomeothertypeofobject.Iftheslidehasatitle,thetitleisthefirstplaceholderinthecollection.

Page 88: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePlaceholdersCollection

UsethePlaceholderspropertytoreturnthePlaceholderscollection.UsePlaceholders(index),whereindexistheplaceholderindexnumber,toreturnaShapeobjectthatrepresentsasingleplaceholder.Notethatforanyslidethathasatitle,Shapes.TitleisequivalenttoShapes.Placeholders(1).ThefollowingexampleaddsanewslidewithaBulletedListslidelayouttothebeginningofthepresentation,setsthetextforthetitle,andthenaddstwoparagraphstothetextplaceholder.

SetsObj=ActivePresentation.Slides.Add(1,ppLayoutText).Shapes

sObj.Title.TextFrame.TextRange.Text="Thisisthetitletext"

sObj.Placeholders(2).TextFrame.TextRange.Text=_

"Item1"&Chr(13)&"Item2"

YoucandeleteindividualplaceholdersbyusingtheDeletemethod,andyoucanrestoredeletedplaceholdersbyusingtheAddPlaceholdermethod,butyoucannotaddanymoreplaceholderstoaslidethanithadwhenitwascreated.Tochangethenumberofplaceholdersonagivenslide,settheLayoutproperty.

Page 89: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationsCollectionObjectApplication Presentations

PresentationMultipleobjects

AcollectionofallthePresentationobjectsinPowerPoint.EachPresentationobjectrepresentsapresentationthat'scurrentlyopeninPowerPoint.

Page 90: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePresentationsCollection

UsethePresentationspropertytoreturnthePresentationscollection.UsetheAddmethodtocreateanewpresentationandaddittothecollection.Thefollowingexamplecreatesanewpresentation,addsaslidetothepresentation,andthensavesthepresentation.

SetnewPres=Presentations.Add(True)

newPres.Slides.Add1,1

newPres.SaveAs"Sample"

UsePresentations(index),whereindexisthepresentation'snameorindexnumber,toreturnasinglePresentationobject.Thefollowingexampleprintspresentationone.

Presentations(1).PrintOut

UsetheOpenmethodtoopenapresentationandaddittothePresentationscollection.ThefollowingexampleopensthefileSales.pptasaread-onlypresentation.

Presentations.OpenFileName:="sales.ppt",ReadOnly:=True

Page 91: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThePresentationscollectiondoesn'tincludeopenadd-ins,whichareaspecialkindofhiddenpresentation.Youcan,however,returnasingleopenadd-inifyouknowitsfilename.ForexamplePresentations("oscar.ppa")willreturntheopenadd-innamed"Oscar.ppa"asaPresentationobject.However,itisrecommendedthattheAddInscollectionbeusedtoreturnopenadd-ins.

Page 92: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintRangesCollectionObjectPrintOptions PrintRanges

PrintRange

AcollectionofallthePrintRangeobjectsinthespecifiedpresentation.EachPrintRangeobjectrepresentsarangeofconsecutiveslidesorpagestobeprinted.

Page 93: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePrintRangesCollection

UsetheRangespropertytoreturnthePrintRangescollection.Thefollowingexampleclearsallpreviouslydefinedprintrangesfromthecollectionfortheactivepresentation.

ActivePresentation.PrintOptions.Ranges.ClearAll

UsetheAddmethodtocreateaPrintRangeobjectandaddittothePrintRangescollection.Thefollowingexampledefinesthreeprintrangesthatrepresentslide1,slides3through5,andslides8and9intheactivepresentationandthenprintstheslidesintheseranges.

WithActivePresentation.PrintOptions

.RangeType=ppPrintSlideRange

With.Ranges

.ClearAll

.Add1,1

.Add3,5

.Add8,9

EndWith

EndWith

ActivePresentation.PrintOut

UseRanges(index),whereindexistheprintrangeindexnumber,toreturnasinglePrintRangeobject.Thefollowingexampledisplaysamessagethatindicatesthestartingandendingslidenumbersforprintrangeoneintheactivepresentation.

WithActivePresentation.PrintOptions.Ranges

If.Count>0Then

With.Item(1)

MsgBox"Printrange1startsonslide"&.Start&_

"andendsonslide"&.End

EndWith

EndIf

EndWith

Page 94: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 95: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PublishObjectsCollectionObjectPresentation PublishObjects

PublishObject

AcollectionofPublishObjectobjectsrepresentingthesetofcompleteorpartialloadedpresentationsthatareavailableforpublishingtoHTML.

Page 96: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePublishObjectsCollection

UsethePublishObjectspropertytoreturnthePublishObjectscollection.ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

UseItem(index),whereindexisalways"1",toreturnthesinglePublishObjectobjectforaloadedpresentation.TherecanbeonlyonePublishObjectobjectforeachloadedpresentation.

ThisexampledefinesthePublishObjectobjecttobetheentireactivepresentationbysettingtheSourceTypepropertytoppPublishAll.

ActivePresentation.PublishObjects.Item(1).SourceType=ppPublishAll

Page 97: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucanspecifythecontentandattributesofthepublishedpresentationbysettingvariouspropertiesofthePublishObjectobject.Forexample,theSourceTypepropertydefinestheportionofaloadedpresentationtobepublished.TheRangeStartpropertyandtheRangeEndpropertyspecifytherangeofslidestopublish,andtheSpeakerNotespropertydesignateswhetherornottopublishthespeaker'snotes.

YoucannotaddtothePublishObjectscollection.

Page 98: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RowsCollectionObjectTable Rows

RowCellRange

AcollectionofRowobjectsthatrepresenttherowsinatable.

Page 99: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheRowsCollection

UsetheRowspropertytoreturntheRowscollection.Thisexamplechangestheheightofallrowsinthespecifiedtableto160points.

DimiAsInteger

WithActivePresentation.Slides(2).Shapes(4).Table

Fori=1To.Rows.Count

.Rows.Height=160

Nexti

EndWith

UsetheAddmethodtoaddarowtoatable.Thisexampleinsertsarowbeforethesecondrowinthereferencedtable.

ActivePresentation.Slides(2).Shapes(5).Table.Rows.Add(2)

UseRows(index),whereindexisanumberthatrepresentsthepositionoftherowinthetable,toreturnasingleRowobject.Thisexampledeletesthefirstrowfromthetableinshapefiveonslidetwo.

ActivePresentation.Slides(2).Shapes(5).Table.Rows(1).Delete

Page 100: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RulerLevelsCollectionObjectRuler RulerLevels

RulerLevel

AcollectionofalltheRulerLevelobjectsonthespecifiedruler.EachRulerLevelobjectrepresentsthefirst-lineandleftindentfortextataparticularoutlinelevel.Thiscollectionalwayscontainsfivemembers—oneforeachoftheavailableoutlinelevels.

Page 101: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheRulerLevelsCollection

UsetheLevelspropertytoreturntheRulerLevelscollection.Thefollowingexamplesetsthemarginsforthefiveoutlinelevelsinbodytextintheactivepresentation.

WithActivePresentation.SlideMaster.TextStyles(ppBodyStyle).Ruler

.Levels(1).FirstMargin=0

.Levels(1).LeftMargin=40

.Levels(2).FirstMargin=60

.Levels(2).LeftMargin=100

.Levels(3).FirstMargin=120

.Levels(3).LeftMargin=160

.Levels(4).FirstMargin=180

.Levels(4).LeftMargin=220

.Levels(5).FirstMargin=240

.Levels(5).LeftMargin=280

EndWith

Page 102: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SequenceCollectionTimeLine Sequence

EffectMultipleobjects

RepresentsacollectionofEffectobjectsforaslide'sinteractiveanimationsequences.TheSequencecollectionisamemberoftheSequencescollection.

Page 103: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSequencecollection

UsetheMainSequencepropertyoftheTimeLineobjecttoreturnaSequenceobject.

UsetheAddEffectmethodtoaddanewSequenceobject.Thisexampleaddsashapeandananimationsequencetothefirstshapeonthefirstslideintheactivepresentation.

SubNewEffect()

DimeffNewAsEffect

DimshpFirstAsShape

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect_

(Shape:=shpFirst,effectId:=msoAnimEffectBlinds)

EndSub

Page 104: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SequencesCollectionTimeLine Sequences

Sequence

RepresentsacollectionofSequenceobjects.UseaSequenceobjecttoadd,find,modify,andcloneanimationeffects.

Page 105: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSequencescollection

UsetheInteractiveSequencespropertyoftheTimeLineobjecttoreturnaSequencescollection.UsetheAddmethodtoaddaninteractiveanimationsequence.Thefollowingexampleaddstwoshapesonthefirstslideoftheactivepresentationandsetsinteractiveeffectforthestarshapesothatwhenyouclickonthebevelshape,thestarshapeisbeanimated.

SubAddNewSequence()

Dimshp1AsShape

Dimshp2AsShape

DiminterEffectAsEffect

Setshp1=ActivePresentation.Slides(1).Shapes.AddShape_

(Type:=msoShape32pointStar,Left:=100,_

Top:=100,Width:=200,Height:=200)

Setshp2=ActivePresentation.Slides(1).Shapes.AddShape_

(Type:=msoShapeBevel,Left:=400,_

Top:=200,Width:=150,Height:=100)

WithActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1)

SetinterEffect=.AddEffect(shp2,msoAnimEffectBlinds,_

trigger:=msoAnimTriggerOnShapeClick)

interEffect.Shape=shp1

EndWith

EndSub

Page 106: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapeNodesCollectionObjectMultipleobjects ShapeNodes

ShapeNode

AcollectionofalltheShapeNodeobjectsinthespecifiedfreeform.EachShapeNodeobjectrepresentseitheranodebetweensegmentsinafreeformoracontrolpointforacurvedsegmentofafreeform.YoucancreateafreeformmanuallyorbyusingtheBuildFreeformandConvertToShapemethods.

Page 107: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheShapeNodesCollection

UsetheNodespropertytoreturntheShapeNodescollection.ThefollowingexampledeletesnodefourinshapethreeonmyDocument.Forthisexampletowork,shapethreemustbeafreeformwithatleastfournodes.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).Nodes.Delete4

UsetheInsertmethodtocreateanewnodeandaddittotheShapeNodescollection.ThefollowingexampleaddsasmoothnodewithacurvedsegmentafternodefourinshapethreeonmyDocument.Forthisexampletowork,shapethreemustbeafreeformwithatleastfournodes.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

.Insert4,msoSegmentCurve,msoEditingSmooth,210,100

EndWith

UseNodes(index),whereindexisthenodeindexnumber,toreturnasingleShapeNodeobject.IfnodeoneinshapethreeonmyDocumentisacornerpoint,thefollowingexamplemakesitasmoothpoint.Forthisexampletowork,shapethreemustbeafreeform.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.Nodes(1).EditingType=msoEditingCornerThen

.Nodes.SetEditingType1,msoEditingSmooth

EndIf

EndWith

Page 108: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapesCollectionObjectMultipleobjects Shapes

Multipleobjects

AcollectionofalltheShapeobjectsonthespecifiedslide.EachShapeobjectrepresentsanobjectinthedrawinglayer,suchasanAutoShape,freeform,OLEobject,orpicture.

NoteIfyouwanttoworkwithasubsetoftheshapesonadocument—forexample,todosomethingtoonlytheAutoShapesonthedocumentortoonlytheselectedshapes—youmustconstructaShapeRangecollectionthatcontainstheshapesyouwanttoworkwith.Foranoverviewofhowtoworkeitherwithasingleshapeorwithmorethanoneshapeatatime,seeWorkingwithShapes(DrawingObjects).

Page 109: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheShapesCollection

UsetheShapespropertytoreturntheShapescollection.Thefollowingexampleselectsalltheshapesintheactivepresentation.

ActivePresentation.Slides(1).Shapes.SelectAll

NoteIfyouwanttodosomething(likedeleteorsetaproperty)toalltheshapesonadocumentatthesametime,usetheRangemethodwithnoargumenttocreateaShapeRangeobjectthatcontainsalltheshapesintheShapescollection,andthenapplytheappropriatepropertyormethodtotheShapeRangeobject.

UsetheAddCallout,AddComment,AddConnector,AddCurve,AddLabel,AddLine,AddMediaObject,AddOLEObject,AddPicture,AddPlaceholder,AddPolyline,AddShape,AddTable,AddTextbox,AddTextEffect,orAddTitlemethodtocreateanewshapeandaddittotheShapescollection.UsetheBuildFreeformmethodinconjunctionwiththeConvertToShapemethodtocreateanewfreeformandaddittothecollection.Thefollowingexampleaddsarectangletotheactivepresentation.

ActivePresentation.Slides(1).Shapes.AddShapeType:=msoShapeRectangle,_

Left:=50,Top:=50,Width:=100,Height:=200

UseShapes(index),whereindexistheshape'snameorindexnumber,toreturnasingleShapeobject.Thefollowingexamplesetsthefilltoapresetshadeforshapeoneintheactivepresentation.

ActivePresentation.Slides(1).Shapes(1).Fill_

.PresetGradientStyle:=msoGradientHorizontal,Variant:=1,_

PresetGradientType:=msoGradientBrass

UseShapes.Range(index),whereindexistheshape'snameorindexnumberoranarrayofshapenamesorindexnumbers,toreturnaShapeRangecollectionthatrepresentsasubsetoftheShapescollection.Thefollowingexamplesetsthefillpatternforshapesoneandthreeintheactivepresentation.

Page 110: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActivePresentation.Slides(1).Shapes.Range(Array(1,3)).Fill_

.PatternedPattern:=msoPatternHorizontalBrick

UseShapes.Placeholders(index),whereindexistheplaceholdernumber,toreturnaShapeobjectthatrepresentsaplaceholder.Ifthespecifiedslidehasatitle,useShapes.Placeholders(1)orShapes.Titletoreturnthetitleplaceholder.Thefollowingexampleaddsaslidetotheactivepresentationandthenaddstexttoboththetitleandthesubtitle(thesubtitleisthesecondplaceholderonaslidewiththislayout).

WithActivePresentation.Slides.Add(Index:=1,Layout:=ppLayoutTitle).Shapes

.Title.TextFrame.TextRange="Thisisthetitletext"

.Placeholders(2).TextFrame.TextRange="Thisissubtitletext"

EndWith

Page 111: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideRangeCollectionObjectMultipleobjects SlideRange

Multipleobjects

Acollectionthatrepresentsanotespageorasliderange,whichisasetofslidesthatcancontainaslittleasasingleslideorasmuchasalltheslidesinapresentation.Youcanincludewhicheverslidesyouwant—chosenfromalltheslidesinthepresentationorfromalltheslidesintheselection—toconstructasliderange.Forexample,youcouldconstructaSlideRangecollectionthatcontainsthefirstthreeslidesinapresentation,alltheselectedslidesinthepresentation,orallthetitleslidesinthepresentation.

Page 112: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlideRangeCollection

Thissectiondescribeshowto:

ReturnasetofslidesthatyouspecifybynameorindexnumberReturnallorsomeoftheselectedslidesinapresentationReturnanotespageApplypropertiesandmethodstoasliderange

Page 113: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningasetofslidesthatyouspecifybynameorindexnumber

UseSlides.Range(index),whereindexisthenameorindexnumberoftheslideoranarraythatcontainseithernamesorindexnumbersofslides,toreturnaSlideRangecollectionthatrepresentsasetofslidesinapresentation.YoucanusetheArrayfunctiontoconstructanarrayofnamesorindexnumbers.Thefollowingexamplesetsthebackgroundfillforslidesoneandthreeintheactivepresentation.

WithActivePresentation.Slides.Range(Array(1,3))

.FollowMasterBackground=False

.Background.Fill.PresetGradientmsoGradientHorizontal,_

1,msoGradientLateSunset

EndWith

Thefollowingexamplesetsthebackgroundfillfortheslidesnamed"Intro"and"BigChart"intheactivepresentation.NotethatslidesareassignedautomaticallygeneratednamesoftheformSliden(wherenisaninteger)whenthey'recreated.Toassignamoremeaningfulnametoaslide,usetheNameproperty.

WithActivePresentation.Slides.Range(Array("Intro","BigChart"))

.FollowMasterBackground=False

.Background.Fill.PresetGradientmsoGradientHorizontal,_

1,msoGradientLateSunset

EndWith

AlthoughyoucanusetheRangemethodtoreturnanynumberofslides,it'ssimplertousetheItemmethodifyouonlywanttoreturnasinglememberoftheSlideRangecollection.Forexample,Slides(1)issimplerthanSlides.Range(1).

Page 114: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningallorsomeoftheselectedslidesinapresentation

UsetheSlideRangepropertyoftheSelectionobjecttoreturnalltheslidesintheselection.Thefollowingexamplesetsthebackgroundfillforalltheselectedslidesinwindowone,assumingthatthere'satleastoneslideselected.

WithWindows(1).Selection.SlideRange

.FollowMasterBackground=False

.Background.Fill.PresetGradientmsoGradientHorizontal,_

1,msoGradientLateSunset

EndWith

UseSelection.SlideRange(index),whereindexistheslidenameorindexnumber,toreturnasingleslidefromtheselection.Thefollowingexamplesetsthebackgroundfillforslidetwointhecollectionofselectedslidesinwindowone,assumingthatthereareatleasttwoslidesselected.

WithWindows(1).Selection.SlideRange(2)

.FollowMasterBackground=False

.Background.Fill.PresetGradientmsoGradientHorizontal,_

1,msoGradientLateSunset

EndWith

Page 115: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returninganotespage

UsetheNotesPagepropertytoreturnaSlideRangecollectionthatrepresentsthespecifiednotespage.Thefollowingexampleinsertstextintoplaceholdertwo(thenotesarea)onthenotespageforslideoneintheactivepresentation.

ActivePresentation.Slides(1).NotesPage.Shapes_

.Placeholders(2).TextFrame.TextRange.InsertAfter"AddedText"

Page 116: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Applyingapropertyormethodtoasliderange

Justasyoucanworkwithseveralslidesatthesametimeintheuserinterfacebyselectingthemandapplyingacommand,youcanworkwithseveralslidesatthesametimeprogrammaticallybyconstructingaSlideRangecollectionandapplyingpropertiesormethodstoit.Andjustassomecommandsintheuserinterfacethatworkonsingleslidesaren'tvalidwhenmultipleslidesareselected,somepropertiesandmethodsthatworkonaSlideobjectoronaSlideRangecollectionthatcontainsonlyoneslidewillfailifthey'reappliedtoaSlideRangecollectionthatcontainsmorethanoneslide.Ingeneral,ifyoucan'tdosomethingmanuallywhenmorethanoneslideisselected(suchasreturntheindividualshapesononeoftheslides),youcan'tdoitprogrammaticallybyusingaSlideRangecollectionthatcontainsmorethanoneslide.

Forthoseoperationsthatworkintheuserinterfacewhetheryouhaveasingleslideormultipleslidesselected(suchascopyingtheselectiontotheClipboardorsettingtheslidebackgroundfill),theassociatedpropertiesandmethodswillworkonaSlideRangecollectionthatcontainsmorethanoneslide.Herearesomegeneralguidelinesforhowthesepropertiesandmethodsbehavewhenthey'reappliedtomultipleslides.

ApplyingamethodtoaSlideRangecollectionisequivalenttoapplyingthemethodtoalltheSlideobjectsinthatrangeasagroup.SettingthevalueofapropertyoftheSlideRangecollectionisequivalenttosettingthevalueofthepropertyineachslideinthatrangeindividually(forapropertythattakesanenumeratedtype,settingthevaluetothe"Mixed"valuehasnoeffect).ApropertyoftheSlideRangecollectionthatreturnsanenumeratedtypereturnsthevalueofthepropertyforanindividualslideinthecollectionifallslidesinthecollectionhavethesamevalueforthatproperty.Iftheslidesinthecollectiondon'tallhavethesamevaluefortheproperty,thepropertyreturnsthe"Mixed"value.ApropertyoftheSlideRangecollectionthatreturnsasimpledatatype(suchasLong,Single,orString)returnsthevalueofthepropertyforanindividualslideinthecollectionifallslidesinthecollectionhavethesamevalueforthatproperty.Iftheslidesinthecollectiondon'tallhavethesamevaluefortheproperty,thepropertywillreturn–2orgenerateanerror.For

Page 117: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

example,usingtheNamepropertyonaSlideRangeobjectthatcontainsmultipleslideswillgenerateanerrorbecauseeachslidehasadifferentvalueforitsNameproperty.Someformattingpropertiesofslidesaren'tsetbypropertiesandmethodsthatapplydirectlytotheSlideRangecollection,butbypropertiesandmethodsthatapplytoanobjectcontainedintheSlideRangecollection,suchastheColorSchemeobject.Ifthecontainedobjectrepresentsoperationsthatcanbeperformedonmultipleobjectsintheuserinterface,you'llbeabletoreturntheobjectfromaSlideRangecollectionthatcontainsmorethanoneslide,anditspropertiesandmethodswillfollowtheprecedingrules.Forexample,youcanusetheColorSchemepropertytoreturntheColorSchemeobjectthatrepresentsthecolorschemesusedonalltheslidesinthespecifiedSlideRangecollection.SettingpropertiesforthisColorSchemeobjectwillalsosetthesepropertiesfortheColorSchemeobjectsonalltheindividualslidesintheSlideRangecollection.

Page 118: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlidesCollectionObjectPresentation Slides

SlideMultipleobjects

AcollectionofalltheSlideobjectsinthespecifiedpresentation.

Page 119: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlidesCollection

Thissectiondescribeshowto:

CreateaslideandaddittothecollectionReturnasingleslidethatyouspecifybyname,indexnumber,orslideIDnumberReturnasubsetoftheslidesinthepresentationApplyapropertyormethodtoalltheslidesinthepresentationatthesametime

Page 120: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Creatingaslideandaddingittothecollection

UsetheSlidespropertytoreturnaSlidescollection.UsetheAddmethodtocreateanewslideandaddittothecollection.Thefollowingexampleaddsanewslidetotheactivepresentation.

ActivePresentation.Slides.Add2,ppLayoutBlank

Page 121: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningasingleslidethatyouspecifybyname,indexnumber,orslideIDnumber

UseSlides(index),whereindexistheslidenameorindexnumber,orusetheSlides.FindBySlideID(index),whereindexistheslideIDnumber,toreturnasingleSlideobject.Thefollowingexamplesetsthelayoutforslideoneintheactivepresentation.

ActivePresentation.Slides(1).Layout=ppLayoutTitle

Thefollowingexamplesetsthelayoutfortheslidenamed"BigChart"intheactivepresentation.NotethatslidesareassignedautomaticallygeneratednamesoftheformSliden(wherenisaninteger)whenthey'recreated.Toassignamoremeaningfulnametoaslide,usetheNameproperty.

ActivePresentation.Slides("BigChart").Layout=ppLayoutTitle

Page 122: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningasubsetoftheslidesinthepresentation

UseSlides.Range(index),whereindexistheslideindexnumberornameoranarrayofslideindexnumbersoranarrayofslidenames,toreturnaSlideRangeobjectthatrepresentsasubsetoftheSlidescollection.Thefollowingexamplesetsthebackgroundfillforslidesoneandthreeintheactivepresentation.

WithActivePresentation.Slides.Range(Array(1,3))

.FollowMasterBackground=False

.Background.Fill.PresetGradientmsoGradientHorizontal,_

1,msoGradientLateSunset

EndWith

Page 123: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Applyingapropertyormethodtoalltheslidesinthepresentationatthesametime

Ifyouwanttodosomethingtoalltheslidesinyourpresentationatthesametime(suchasdeleteallofthemorsetapropertyforallofthem),useSlides.RangewithnoargumenttoconstructaSlideRangecollectionthatcontainsalltheslidesintheSlidescollection,andthenapplytheappropriatepropertyormethodtotheSlideRangecollection.Thefollowingexamplesetsthebackgroundfillforalltheslidesintheactivepresentation

WithActivePresentation.Slides.Range

.FollowMasterBackground=False

.Background.Fill.PresetGradientmsoGradientHorizontal,_

1,msoGradientLateSunset

EndWith

Page 124: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowWindowsCollectionObjectApplication SlideShowWindows

SlideShowWindowMultipleobjects

AcollectionofalltheSlideShowWindowobjectsthatrepresenttheopenslideshowsinPowerPoint.

Page 125: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlideShowWindowsCollection

UsetheSlideShowWindowspropertytoreturntheSlideShowWindowscollection.UseSlideShowWindows(index),whereindexisthewindowindexnumber,toreturnasingleSlideShowWindowobject.Thefollowingexamplereducestheheightofslideshowwindowoneifit'safull-screenwindow.

WithSlideShowWindows(1)

If.IsFullScreenThen

.Height=.Height-20

EndIf

EndWith

UsetheRunmethodtocreateanewslideshowwindowandaddittotheSlideShowWindowscollection.Thefollowingexamplerunsaslideshowoftheactivepresentation.

ActivePresentation.SlideShowSettings.Run

Page 126: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TabStopsCollectionObjectRuler TabStops

TabStop

AcollectionofalltheTabStopobjectsononeruler.

Page 127: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTabStopsCollection

UsetheTabStopspropertytoreturntheTabStopscollection.Thefollowingexampleclearsallthetabstopsforthetextinshapetwoonslideoneintheactivepresentation.

WithActivePresentation.Slides(1).Shapes(2)_

.TextFrame.Ruler.TabStops

Fort=.CountTo1Step-1

.Item(t).Clear

Next

EndWith

UsetheAddmethodtocreateatabstopandaddittotheTabStopscollection.Thefollowingexampleaddsatabstoptothebody-textstyleontheslidemasterfortheactivepresentation.Thenewtabstopwillbepositioned2inches(144points)fromtheleftedgeoftherulerandwillbeleftaligned.

ActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).Ruler.TabStops.AddppTabStopLeft,144

Page 128: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextStyleLevelsCollectionObjectTextStyle TextStyleLevels

TextStyleLevelMultipleobjects

Acollectionofalltheoutlinetextlevels.Thiscollectionalwayscontainsfivemembers,eachofwhichisrepresentedbyaTextStyleLevelobject.

Page 129: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTextStyleLevelsCollection

UseLevels(index),whereindexisanumberfrom1through5thatcorrespondstotheoutlinelevel,toreturnasingleTextStyleLevelobject.Thefollowingexamplesetsthefontnameandfontsizeforlevel-onebodytextonalltheslidesintheactivepresentation.

WithActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).Levels(1)

With.Font

.Name="Arial"

.Size=36

EndWith

EndWith

Thefollowingexamplesetsthefontsizefortextateachoutlinelevelforthenotesbodyareaonallthenotespagesintheactivepresentation.

WithActivePresentation.NotesMaster.TextStyles(ppBodyStyle).Levels

.Item(1).Font.Size=34

.Item(2).Font.Size=30

.Item(3).Font.Size=25

.Item(4).Font.Size=20

.Item(5).Font.Size=15

EndWith

Page 130: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextStylesCollectionObjectMaster TextStyles

TextStyleMultipleobjects

Acollectionofthreetextstyles titletext,bodytext,anddefaulttext eachofwhichisrepresentedbyaTextStyleobject.EachtextstylecontainsaTextFrameobjectthatdescribeshowtextisplacedwithinthetextboundingbox,aRulerobjectthatcontainstabstopsandoutlineindentformattinginformation,andaTextStyleLevelscollectionthatcontainsoutlinetextformattinginformation.

Page 131: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTextStylesCollection

UseTextStyles(index),whereindexiseitherppBodyStyle,ppDefaultStyle,orppTitleStyle,toreturnasingleTextStyleobject.Thisexamplesetsthemarginsforthenotesbodyareaonallthenotespagesintheactivepresentation.

WithActivePresentation.NotesMaster_

.TextStyles(ppBodyStyle).TextFrame

.MarginBottom=50

.MarginLeft=50

.MarginRight=50

.MarginTop=50

EndWith

Page 132: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActionSettingObjectActionSettings ActionSetting

Multipleobjects

Containsinformationabouthowthespecifiedshapeortextrangereactstomouseactionsduringaslideshow.TheActionSettingobjectisamemberoftheActionSettingscollection.TheActionSettingscollectioncontainsoneActionSettingobjectthatrepresentshowthespecifiedobjectreactswhentheuserclicksitduringaslideshowandoneActionSettingobjectthatrepresentshowthespecifiedobjectreactswhentheusermovesthemousepointeroveritduringaslideshow.

Page 133: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheActionSettingObject

UseActionSettings(index),whereindexistheeitherppMouseClickorppMouseOver,toreturnasingleActionSettingobject.Thefollowingexamplesetsthemouse-clickactionforthetextinthethirdshapeonslideoneintheactivepresentationtoanInternetlink.

WithActivePresentation.Slides(1).Shapes(3)_

.TextFrame.TextRange.ActionSettings(ppMouseClick)

.Action=ppActionHyperlink

.Hyperlink.Address="http://www.microsoft.com"

EndWith

Page 134: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyou'vesetpropertiesoftheActionSettingobjectthatdon'tseemtobetakingeffect,makesurethatyou'vesettheActionpropertytotheappropriatevalue.

Page 135: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 136: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddInObjectAddIns AddIn

Representsasingleadd-in,eitherloadedornotloaded.TheAddInobjectisamemberoftheAddInscollection.TheAddInscollectioncontainsallofthePowerPoint-specificadd-insavailable,regardlessofwhetherornotthey'reloaded.ThecollectiondoesnotincludeComponentObjectModel(COM)add-ins.

Page 137: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAddInObject

UseAddIns(index),whereindexistheadd-in'stitleorindexnumber,toreturnasingleAddInobject.ThefollowingexampleloadstheMyPptToolsadd-in.

AddIns("myppttools").Loaded=True

Theadd-intitle,shownabove,shouldnotbeconfusedwiththeadd-inname,whichisthefilenameoftheadd-in.Youmustspelltheadd-intitleexactlyasit'sspelledintheAdd-Insdialogbox,butthecapitalizationdoesn'thavetomatch.

Theindexnumberrepresentsthepositionoftheadd-inintheAvailableAdd-InslistintheAdd-Insdialogbox.Thefollowingexampledisplaysthenamesofalltheadd-insthatarecurrentlyloadedinPowerPoint.

Fori=1ToAddIns.Count

IfAddIns(i).LoadedThenMsgBoxAddIns(i).Name

Next

Page 138: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheAddmethodtoaddaPowerPoint-specificadd-intothelistofthoseavailable.Note,however,thatusingthismethoddoesn'tloadtheadd-in.Toloadtheadd-in,settheLoadedpropertyoftheadd-intoTrueafteryouusetheAddmethod.Youcanperformbothoftheseactionsinasinglestep,asshowninthefollowingexample(notethatyouusethenameoftheadd-in,notitstitle,withtheAddmethod).

AddIns.Add("generic.ppa").Loaded=True

UseAddIns(index),whereindexistheadd-in'stitle,toreturnareferencetotheloadedadd-in.ThefollowingexamplesetsthepresAddinvariabletotheadd-intitled"myppttools"andsetsthemyNamevariabletothenameoftheadd-in.

SetpresAddin=AddIns("myppttools")

WithpresAddin

myName=.Name

EndWith

Page 139: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimationBehaviorObjectAnimationBehaviors AnimationBehavior

Multipleobjects

Representsthebehaviorofananimationeffect,themainanimationsequence,oraninteractiveanimationsequence.TheAnimationBehaviorobjectisamemberoftheAnimationBehaviorscollection.

Page 140: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAnimationBehaviorobject

UseBehaviors(index),whereindexisthenumberofthebehaviorinthesequenceofbehaviors,toreturnasingleAnimationBehaviorobject.Thefollowingexamplesetsthepositionsofthearotation'sstartingandendingpoints.ThisexampleassumesthatthefirstbehaviorforthemainanimationsequenceisaRotationEffectobject.

SubChange()

WithActivePresentation.Slides(1).TimeLine.MainSequence(1)_

.Behaviors(1).RotationEffect

.From=1

.To=180

EndWith

EndSub

Page 141: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimationPointObjectAnimationPoints AnimationPoint

Representsanindividualanimationpointforananimationbehavior.TheAnimationPointobjectisamemberoftheAnimationPointscollection.TheAnimationPointscollectioncontainsalltheanimationpointsforananimationbehavior.

Page 142: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAnimationPointobject

ToaddorreferenceanAnimationPointobject,usetheAddorItemmethod,respectively.UsetheTimepropertyofanAnimationPointobjecttosettimingbetweenanimationpoints.UsetheValuepropertytosetotheranimationpointproperties,suchascolor.Thefollowingexampleaddsthreeanimationpointstothefirstbehaviorintheactivepresentation'smainanimationsequence,andthenitchangescolorsateachanimationpoint.

SubAniPoint()

DimsldNewSlideAsSlide

DimshpHeartAsShape

DimeffCustomAsEffect

DimaniBehaviorAsAnimationBehavior

DimaptNewPointAsAnimationPoint

SetsldNewSlide=ActivePresentation.Slides.Add_

(Index:=1,Layout:=ppLayoutBlank)

SetshpHeart=sldNewSlide.Shapes.AddShape_

(Type:=msoShapeHeart,Left:=100,Top:=100,_

Width:=200,Height:=200)

SeteffCustom=sldNewSlide.TimeLine.MainSequence_

.AddEffect(shpHeart,msoAnimEffectCustom)

SetaniBehavior=effCustom.Behaviors.Add(msoAnimTypeProperty)

WithaniBehavior.PropertyEffect

.Property=msoAnimShapeFillColor

SetaptNewPoint=.Points.Add

aptNewPoint.Time=0.2

aptNewPoint.Value=RGB(0,0,0)

SetaptNewPoint=.Points.Add

aptNewPoint.Time=0.5

aptNewPoint.Value=RGB(0,255,0)

SetaptNewPoint=.Points.Add

aptNewPoint.Time=1

aptNewPoint.Value=RGB(0,255,255)

EndWith

EndSub

Page 143: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 144: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimationSettingsObjectMultipleobjects AnimationSettings

Multipleobjects

Representsthespecialeffectsappliedtotheanimationforthespecifiedshapeduringaslideshow.

Page 145: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAnimationSettingsObject

UsetheAnimationSettingspropertyoftheShapeobjecttoreturntheAnimationSettingsobject.Thefollowingexampleaddsaslidethatcontainsbothatitleandathree-itemlisttotheactivepresentation,andthenitsetsthelisttobeanimatedbyfirst-levelparagraphs,toflyinfromtheleftwhenanimated,todimtothespecifiedcolorafterbeinganimated,andtoanimateitsitemsinreverseorder.

SetsObjs=ActivePresentation.Slides.Add(2,ppLayoutText).Shapes

sObjs.Title.TextFrame.TextRange.Text="TopThreeReasons"

WithsObjs.Placeholders(2)

.TextFrame.TextRange.Text=_

"Reason1"&VBNewLine&"Reason2"&VBNewLine&"Reason3"

With.AnimationSettings

.TextLevelEffect=ppAnimateByFirstLevel

.EntryEffect=ppEffectFlyFromLeft

.AfterEffect=ppAfterEffectDim

.DimColor.RGB=RGB(100,120,100)

.AnimateTextInReverse=True

EndWith

EndWith

Page 146: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ApplicationObjectApplication Multipleobjects

RepresentstheentireMicrosoftPowerPointapplication.TheApplicationobjectcontains:

Application-widesettingsandoptions(thenameoftheactiveprinter,forexample).Propertiesthatreturntop-levelobjects,suchasActivePresentation,Windows,andsoon.

Page 147: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheApplicationObject

UsetheApplicationpropertytoreturntheApplicationobject.Thefollowingexamplereturnsthepathtotheapplicationfile.

DimMyPathAsString

MyPath=Application.Path

ThefollowingexamplecreatesaPowerPointApplicationobjectinanotherapplication,startsPowerPoint(ifit'snotalreadyrunning),andopensanexistingpresentationnamed"Ex_a2a.ppt."

Setppt=NewPowerpoint.Application

ppt.Visible=True

ppt.Presentations.Open"c:\MyDocuments\ex_a2a.ppt"

Page 148: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

WhenyouarewritingcodethatwillrunfromPowerPoint,thefollowingpropertiesoftheApplicationobjectcanbeusedwithouttheobjectqualifier:ActivePresentation,ActiveWindow,AddIns,Assistant,CommandBars,Presentations,SlideShowWindows,Windows.Forexample,insteadofwritingApplication.ActiveWindow.Height=200,youcanwriteActiveWindow.Height=200.

Page 149: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoCorrectObjectApplication AutoCorrect

RepresentstheAutoCorrectfunctionalityinMicrosoftPowerPoint.

Page 150: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheAutoCorrectobject

UsetheAutoCorrectpropertytoreturnanAutoCorrectobject.ThefollowingexampledisablesdisplayingtheAutoCorrectoptionsbuttons.

SubHideAutoCorrectOpButton()

WithApplication.AutoCorrect

.DisplayAutoCorrectOptions=msoFalse

.DisplayAutoLayoutOptions=msoFalse

EndWith

EndSub

Page 151: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BulletFormatObjectParagraphFormat BulletFormat

Font

Representsbulletformatting.

Page 152: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheBulletFormatObject

UsetheBulletpropertytoreturntheBulletFormatobject.Thefollowingexamplesetsthebulletsizeandcolorfortheparagraphsinshapetwoonslideoneintheactivepresentation.

WithActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat.Bullet

.Visible=True

.RelativeSize=1.25

.Character=169

With.Font

.Color.RGB=RGB(255,255,0)

.Name="Symbol"

EndWith

EndWith

EndWith

Page 153: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CalloutFormatObjectMultipleobjects CalloutFormat

Containspropertiesandmethodsthatapplytolinecallouts.

Page 154: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheCalloutFormatObject

UsetheCalloutpropertytoreturnaCalloutFormatobject.Thefollowingexamplespecifiesthefollowingattributesofshapethree(alinecallout)onmyDocument:

Thecalloutwillhaveaverticalaccentbarthatseparatesthetextfromthecalloutline.Theanglebetweenthecalloutlineandthesideofthecallouttextboxwillbe30degrees.Therewillbenoborderaroundthecallouttext.Thecalloutlinewillbeattachedtothetopofthecallouttextbox.Thecalloutlinewillcontaintwosegments.

Forthisexampletowork,shapethreemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Callout

.Accent=True

.Angle=msoCalloutAngle30

.Border=False

.PresetDropmsoCalloutDropTop

.Type=msoCalloutThree

EndWith

Page 155: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CellObjectCellRange Cell

Multipleobjects

Representsatablecell.TheCellobjectisamemberoftheCellRangecollection.TheCellRangecollectionrepresentsallthecellsinthespecifiedcolumnorrow.TousetheCellRangecollection,usetheCellskeyword.

Page 156: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheCellObject

UseCell(row,column),whererowistherownumberandcolumnisthecolumnnumber,orCells(index),whereindexisthenumberofthecellinthespecifiedroworcolumn,toreturnasingleCellobject.Cellsarenumberedfromlefttorightinrowsandfromtoptobottomincolumns.Withright-to-leftlanguagesettings,thisschemeisreversed.Thefollowingexamplemergesthefirsttwocellsinrowoneofthetableinshapefiveonslidetwo.

WithActivePresentation.Slides(2).Shapes(5).Table

.Cell(1,1).MergeMergeTo:=.Cell(1,2)

EndWith

Thisexamplesetsthebottomborderforcelloneinthefirstcolumnofthetabletoadashedlinestyle.

WithActivePresentation.Slides(2).Shapes(5).Table.Columns(1)_

.Cells(1)

.Borders(ppBorderBottom).DashStyle=msoLineDash

EndWith

UsetheShapepropertytoaccesstheShapeobjectandtomanipulatethecontentsofeachcell.Thisexampledeletesthetextinthefirstcell(row1,column1),insertsnewtext,andthensetsthewidthoftheentirecolumnto110points.

WithActivePresentation.Slides(2).Shapes(5).Table.Cell(1,1)

.Shape.TextFrame.TextRange.Delete

.Shape.TextFrame.TextRange.Text="Rooster"

.Parent.Columns(1).Width=110

EndWith

Page 157: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucannotprogrammaticallyaddcellstoordeletecellsfromaPowerPointtable.UsetheAddmethodoftheColumnsorRowscollectionstoaddacolumnorrowtoatable.UsetheDeletemethodoftheColumnsorRowscollectionstodeleteacolumnorrowfromatable.

Page 158: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorEffectObjectAnimationBehavior ColorEffect

ColorFormat

Representsacoloreffectforananimationbehavior.

Page 159: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheColorEffectobject

UsetheColorEffectpropertyoftheAnimationBehaviorobjecttoreturnaColorEffectobject.ColoreffectscanbechangedusingtheColorEffectobject'sFromandToproperties,asshownbelow.ColoreffectsareinitiallysetusingtheToproperty,andthencanbechangedbyaspecificnumberusingtheByproperty.Thefollowingexampleaddsashapetothefirstslideoftheactivepresentationandsetsacoloreffectanimationbehaviortochangethefillcolorofthenewshape.

SubChangeColorEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(Type:=msoAnimTypeColor)

WithbhvEffect.ColorEffect

.From.RGB=RGB(Red:=255,Green:=0,Blue:=0)

.To.RGB=RGB(Red:=0,Green:=0,Blue:=255)

EndWith

EndSub

Page 160: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorFormatObject

Multipleobjects ColorFormat

Representsthecolorofaone-colorobject,theforegroundorbackgroundcolorofanobjectwithagradientorpatternedfill,orthepointercolor.Youcansetcolorstoanexplicitred-green-bluevalue(byusingtheRGBproperty)ortoacolorinthecolorscheme(byusingtheSchemeColorproperty).

Page 161: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheColorFormatObject

UseoneofthepropertieslistedinthefollowingtabletoreturnaColorFormatobject.

Usethisproperty Withthisobject

ToreturnaColorFormatobjectthatrepresentsthis

DimColor AnimationSettings Colorusedfordimmedobjects

BackColor FillFormat Backgroundfillcolor(usedinashadedorpatternedfill)

ForeColor FillFormat Foregroundfillcolor(orsimplythefillcolorforasolidfill)

Color Font Bulletorcharactercolor

BackColor LineFormat Backgroundlinecolor(usedinapatternedline)

ForeColor LineFormat Foregroundlinecolor(orjustthelinecolorforasolidline)

ForeColor ShadowFormat ShadowcolorPointerColor SlideShowSettings Defaultpointercolorforapresentation

PointerColor SlideShowView Temporarypointercolorforaviewofaslideshow

ExtrusionColor ThreeDFormat Colorofthesidesofanextrudedobject

UsetheSchemeColorpropertytosetthecolorofaslideelementtooneofthecolorsinthestandardcolorscheme.Thefollowingexamplesetsthetextcolorforshapeoneonslidetwointheactivepresentationtothestandardcolor-schemetitlecolor.

ActivePresentation.Slides(2).Shapes(1).TextFrame_

.TextRange.Font.Color.SchemeColor=ppTitle

UsetheRGBpropertytosetacolortoanexplicitred-green-bluevalue.ThefollowingexampleaddsarectangletomyDocumentandthensetstheforegroundcolor,backgroundcolor,andgradientfortherectangle'sfill.

Page 162: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,90,90,90,50).Fill

.ForeColor.RGB=RGB(128,0,0)

.BackColor.RGB=RGB(170,170,170)

.TwoColorGradientmsoGradientHorizontal,1

EndWith

Page 163: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorSchemeObjectMultipleobjects ColorScheme

Representsacolorscheme,whichisasetofeightcolorsusedforthedifferentelementsofaslide,notespage,orhandout,suchasthetitleorbackground.(Notethatthecolorschemesforslides,notespages,andhandoutsinapresentationcanbesetindependently.)EachcolorisrepresentedbyanRGBColorobject.TheColorSchemeobjectisamemberoftheColorSchemescollection.TheColorSchemescollectioncontainsallthecolorschemesinapresentation.

Page 164: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheColorSchemeObject

Thissectiondescribeshowtodothefollowing:

ReturnaColorSchemeobjectfromthecollectionofallthecolorschemesinthepresentationReturntheColorSchemeobjectattachedtoaspecificslideormasterReturnthecolorofasingleslideelementfromaColorSchemeobject

Page 165: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaColorSchemeobjectfromthecollectionofallthecolorschemesinthepresentation

UseColorSchemes(index),whereindexisthecolorschemeindexnumber,toreturnasingleColorSchemeobject.Thefollowingexampledeletescolorschemetwofromtheactivepresentation.

ActivePresentation.ColorSchemes(2).Delete

Page 166: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningtheColorSchemeobjectattachedtoaspecificslideormaster

SettheColorSchemepropertyofaSlide,SlideRange,orMasterobjecttoreturnthecolorschemeforoneslide,asetofslides,oramaster,respectively.Thefollowingexamplecreatesacolorschemebasedonthecurrentslide,addsthenewcolorschemetothecollectionofstandardcolorschemesforthepresentation,andsetsthecolorschemefortheslidemastertothenewcolorscheme.Allnewslidesbasedonthemasterwillhavethiscolorscheme.

SetnewScheme=ActiveWindow.View.Slide.ColorScheme

newScheme.Colors(ppTitle).RGB=RGB(0,150,250)

SetnewStandardScheme=_

ActivePresentation.ColorSchemes.Add(newScheme)

ActivePresentation.SlideMaster.ColorScheme=newStandardScheme

Page 167: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningthecolorofasingleslideelementfromaColorSchemeobject

UsetheColorsmethodtoreturnanRGBColorobjectthatrepresentsthecolorofasingleslide-elementtype.YoucansetanRGBColorobjecttoanotherRGBColorobject,oryoucanusetheRGBpropertytosetorreturntheexplicitred-green-blue(RGB)valueforanRGBColorobject.Thefollowingexamplesetsthebackgroundcolorincolorschemeonetoredandsetsthetitlecolortothetitlecolorthat'sdefinedforcolorschemetwo.

WithActivePresentation.ColorSchemes

.Item(1).Colors(ppBackground).RGB=RGB(255,0,0)

.Item(1).Colors(ppTitle)=.Item(2).Colors(ppTitle)

EndWith

Page 168: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColumnObjectColumns Column

CellRange

Representsatablecolumn.TheColumnobjectisamemberoftheColumnscollection.TheColumnscollectionincludesallthecolumnsinatable.

Page 169: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheColumnObject

UseColumns(index)toreturnasingleColumnobject.IndexrepresentsthepositionofthecolumnintheColumnscollection(usuallycountingfromlefttoright;althoughtheTableDirectionpropertycanreversethis).Thisexampleselectsthefirstcolumnofthetableinshapefiveonthesecondslide.

ActivePresentation.Slides(2).Shapes(5).Table.Columns(1).Select

UsetheCellobjecttoindirectlyreferencetheColumnobject.Thisexampledeletesthetextinthefirstcell(row1,column1),insertsnewtext,andthensetsthewidthoftheentirecolumnto110points.

WithActivePresentation.Slides(2).Shapes(5).Table.Cell(1,1)

.Shape.TextFrame.TextRange.Delete

.Shape.TextFrame.TextRange.Text="Rooster"

.Parent.Columns(1).Width=110

EndWith

UsetheAddmethodtoaddacolumntoatable.Thisexamplecreatesacolumninanexistingtableandsetsthecolumnwidthto72points(oneinch).

WithActivePresentation.Slides(2).Shapes(5).Table

.Columns.Add.Width=72

EndWith

Page 170: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheCellspropertytomodifytheindividualcellsinaColumnobject.Thisexampleselectsthefirstcolumninthetableandappliesadashedlinestyletothebottomborder.

ActiveWindow.Selection.ShapeRange.Table.Columns(1)_

.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash

Page 171: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CommandEffectObjectAnimationBehavior CommandEffect

Representsacommandeffectforananimationbehavior.Youcansendevents,callfunctions,andsendOLEverbstoembeddedobjectsusingthisobject.

Page 172: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheCommandEffectObject

UsetheCommandEffectpropertyoftheAnimationBehaviorobjecttoreturnaCommandEffectobject.CommandeffectscanbechangedusingtheCommandEffectobject'sCommandandTypeproperties.

Page 173: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleshowshowtosetacommandeffectanimationbehavior.

SetbhvEffect=effectNew.Behaviors.Add(msoAnimTypeCommand)

WithbhvEffect.CommandEffect

.Type=msoAnimCommandTypeVerb

.Command=Play

EndWith

Page 174: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CommentObject

Comments Comment

Representsacommentonagivenslideorsliderange.TheCommentobjectisamemberoftheCommentscollectionobject.

Page 175: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheCommentobject

UseComments(index),whereindexisthenumberofthecomment,ortheItemmethodtoaccessasinglecommentonaslide.Thisexampledisplaystheauthorofthefirstcommentonthefirstslide.Iftherearenocomments,itdisplaysamessagestatingsuch.

SubShowComment()

WithActivePresentation.Slides(1).Comments

If.Count>0Then

MsgBox"Thefirstcommentonthisslideisby"&_

.Item(1).Author

Else

MsgBox"Therearenocommentsonthisslide."

EndIf

EndWith

EndSub

Usethefollowingpropertiestoaccesscommentdata:

Author Theauthor'sfullnameAuthorIndex Theauthor'sindexinthelistofcommentsAuthorInitials Theauthor'sinitialsDateTime ThedateandtimethecommentwascreatedText ThetextofthecommentLeft,Top Thecomment'sscreencoordinates

Thisexampledisplaysamessagecontainingtheauthor,dateandtime,andcontentsofallthemessagesonthefirstslide.

SubSlideComments()

DimcmtExistingAsComment

DimcmtAllAsComments

DimstrCommentsAsString

SetcmtAll=ActivePresentation.Slides(1).Comments

IfcmtAll.Count>0Then

ForEachcmtExistingIncmtAll

strComments=strComments&cmtExisting.Author&vbTab&_

Page 176: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

cmtExisting.DateTime&vbTab&cmtExisting.Text&vbLf

Next

MsgBox"Thecommentsinyourdocumentareasfollows:"&vbLf_

&strComments

Else

MsgBox"Thisslidedoesn'thaveanycomments."

EndIf

EndSub

Page 177: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConnectorFormatObject

Multipleobjects ConnectorFormatShape

Containspropertiesandmethodsthatapplytoconnectors.Aconnectorisalinethatattachestwoothershapesatpointscalledconnectionsites.Ifyourearrangeshapesthatareconnected,thegeometryoftheconnectorwillbeautomaticallyadjustedsothattheshapesremainconnected.

Page 178: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheConnectorFormatObject

UsetheConnectorFormatpropertytoreturnaConnectorFormatobject.UsetheBeginConnectandEndConnectmethodstoattachtheendsoftheconnectortoothershapesinthedocument.UsetheRerouteConnectionsmethodtoautomaticallyfindtheshortestpathbetweenthetwoshapesconnectedbytheconnector.UsetheConnectorpropertytoseewhetherashapeisaconnector.

NotethatyouassignasizeandapositionwhenyouaddaconnectortotheShapescollection,butthesizeandpositionareautomaticallyadjustedwhenyouattachthebeginningandendoftheconnectortoothershapesinthecollection.Therefore,ifyouintendtoattachaconnectortoothershapes,theinitialsizeandpositionyouspecifyareirrelevant.Likewise,youspecifywhichconnectionsitesonashapetoattachtheconnectortowhenyouattachtheconnector,butusingtheRerouteConnectionsmethodaftertheconnectorisattachedmaychangewhichconnectionsitestheconnectorattachesto,makingyouroriginalchoiceofconnectionsitesirrelevant.

ThefollowingexampleaddstworectanglestomyDocumentandconnectsthemwithacurvedconnector.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

Withs.AddConnector(msoConnectorCurve,0,0,0,0).ConnectorFormat

.BeginConnectConnectedShape:=firstRect,ConnectionSite:=1

.EndConnectConnectedShape:=secondRect,ConnectionSite:=1

.Parent.RerouteConnections

EndWith

Page 179: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Connectionsitesaregenerallynumberedaccordingtotherulespresentedinthefollowingtable.

Shapetype ConnectionsitenumberingschemeAutoShapes,WordArt,pictures,andOLEobjects

Theconnectionsitesarenumberedstartingatthetopandproceedingcounterclockwise.

Freeforms Theconnectionsitesarethevertices,andtheycorrespondtothevertexnumbers.

Tofigureoutwhichnumbercorrespondstowhichconnectionsiteonacomplexshape,youcanexperimentwiththeshapewhilethemacrorecorderisturnedonandthenexaminetherecordedcode;oryoucancreateashape,selectit,andthenrunthefollowingexample.Thiscodewillnumbereachconnectionsiteandattachaconnectortoit.

Setmainshape=ActiveWindow.Selection.ShapeRange(1)

Withmainshape

bx=.Left+.Width+50

by=.Top+.Height+50

EndWith

WithActiveWindow.View.Slide

Forj=1Tomainshape.ConnectionSiteCount

With.Shapes.AddConnector(msoConnectorStraight,_

bx,by,bx+50,by+50)

.ConnectorFormat.EndConnectmainshape,j

.ConnectorFormat.Type=msoConnectorElbow

.Line.ForeColor.RGB=RGB(255,0,0)

l=.Left

t=.Top

EndWith

With.Shapes.AddTextbox(msoTextOrientationHorizontal,_

l,t,36,14)

.Fill.Visible=False

.Line.Visible=False

.TextFrame.TextRange.Text=j

EndWith

Nextj

EndWith

Page 180: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 181: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DefaultWebOptionsObjectApplication DefaultWebOptions

Containsglobalapplication-levelattributesusedbyMicrosoftPowerPointwhenyoupublishorsaveacompleteorpartialpresentationasaWebpageorwhenyouopenaWebpage.Youcanreturnorsetattributeseitherattheapplication(global)leveloratthepresentationlevel.(Notethatattributevaluescanbedifferentfromonepresentationtoanother,dependingontheattributevalueatthetimethepresentationwassaved.)Presentation-levelattributesettingsoverrideapplication-levelattributesettings.Presentation-levelattributesarecontainedintheWebOptionsobject.

Page 182: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDefaultWebOptionsObject

UsetheDefaultWebOptionspropertytoreturntheDefaultWebOptionsobject.ThefollowingexamplecheckstoseewhetherPNG(PortableNetworkGraphics)areallowedasanimageformat,andthensetsthestrImageFileTypevariableaccordingly.

SetobjAppWebOptions=Application.DefaultWebOptions

WithobjAppWebOptions

If.AllowPNG=TrueThen

strImageFileType="PNG"

Else

strImageFileType="JPG"

EndIf

EndWith

Page 183: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DesignObjectMultipleobjects Design

Representsanindividualslidedesigntemplate.TheDesignobjectisamemberoftheDesignsandSlideRangecollectionsandtheMasterandSlideobjects.

Page 184: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDesignobject

UsetheDesignpropertyoftheMaster,Slide,orSlideRangeobjectstoaccessaDesignobject,forexample:

ActivePresentation.SlideMaster.Design

ActivePresentation.Slides(1).Design

ActivePresentation.Slides.Range.Design

UsetheAdd,Item,Clone,orLoadmethodsoftheDesignscollectiontoadd,referto,clone,orloadaDesignobject,respectively.Forexample,toaddadesigntemplate,useActivePresentation.Designs.AdddesignName:="MyDesign"

TheDesignobject'sAddTitleMastermethodandHasTitleMasterpropertycanbeusedtoaddand/orquerythestatusofatitleslidemaster.Forexample:

SubAddQueryTitleMaster(dsnAsDesign)

dsn.AddTitleMaster

MsgBoxdsn.HasTitleMaster

EndSub

Page 185: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DiagramObjectMultipleobjects Diagram

DiagramNodes

Representsasinglediagraminadocument.TheDiagramobjectisamemberoftheDiagramNodeandShapeobjectsandtheShapeRangecollection.

Page 186: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDiagramobject

UsetheDiagrampropertyoftheShapeobjectorShapeRangecollectiontoreturnaDiagramobject.

UsetheConvertmethodtochangeadiagramfromonetypetoanother.Thisexampleconvertsthefirstdiagramonthefirstslideoftheactivepresentationintoaradialdiagram.Thisexampleassumesthatthefirstshapeintheactivepresentationisadiagramandnotanothertypeofshape.

SubDiagramConvert()

ActivePresentation.Slides(1).Shapes(1).Diagram_

.ConvertType:=msoDiagramRadial

EndSub

UsetheReversepropertytofliptheorderofthenodesinadiagram,sothatthefirstnodebecomesthelastnode,andviceversa.Thisexamplereversestheorderofthediagramnodesforthesecondshapeonthefirstslideoftheactivepresentation.Thisassumesthatthesecondshapeintheactivepresentationisadiagramandnotanothertypeofshape.

SubDiagramReverse()

ActivePresentation.Slides(1).Shapes(2).Diagram.Reverse=msoTrue

EndSub

ADiagramNodeobjectcanhaveanestedDiagramobject.UsetheDiagrampropertyofaDiagramNodeobjecttoreturnthenestedDiagramobject.

Page 187: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DiagramNodeObjectMultipleobjects DiagramNode

Multipleobjects

Representsanodeinadiagram.

Page 188: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDiagramNodeobject

ToreturnaDiagramNodeobject,useoneofthefollowing:

TheDiagramNodeobject'sAddNode,CloneNode,NextNodeorPrevNodemethods,orRootproperty.TheDiagramNodeChildrencollection'sAddNodeorItemmethods,orFirstChildorLastChildproperties.

TheDiagramNodescollection'sItemmethod.TheShapeobject'sorShapeRangecollection'sDiagramNodeproperty.

Adiagramnodecanterminate,orcontainotherchilddiagrams,childdiagramnodes,orchildshapes:

Torefertoachilddiagram,usetheDiagramproperty.Torefertoanindividualchilddiagramnode,usetheAddNode,CloneNode,NextNodeorPrevNodemethods,orRootproperty.Torefertoacollectionofchilddiagramnodes,usetheChildrenproperty.Torefertoashape,usetheShapeorTextShapeproperties.

UsetheAddNodemethodtoaddanodetoadiagramortoadiagramnode.Thisexampleassumesthethirdshapeintheactivepresentationisadiagramandaddsanodetoit.

SubAddDiagramNode()

ActivePresentation.Shapes(3).DiagramNode.Children.AddNode

EndSub

UsetheDeletemethodtoremoveanodefromadiagramordiagramnode.Thisexampleassumesthesecondshapeinthepresentationisadiagramandremovesthefirstnodefromit.

SubDeleteDiagramNode()

ActivePresentation.Shapes(2).DiagramNode.Children(1).Delete

EndSub

Page 189: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 190: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DiagramNodeChildrenCollectionDiagramNode DiagramNodeChildren

DiagramNode

AcollectionofDiagramNodeobjectsthatrepresentschildnodesinadiagram.

Page 191: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDiagramNodeChildrencollection

UsetheChildrenpropertyoftheDiagramNodeobjecttoreturnaDiagamNodeChildrencollection.Toaddanindividualchilddiagramnodetothecollection,usetheAddNodemethod.Toreturnindividualchilddiagramnodesinthecollection,usetheFirstChildorLastChildpropertiesortheItemmethod.

Thisexampledeletesthefirstchildofthesecondnodeinthefirstdiagraminthedocument.Thisexampleassumesthatthefirstshapeintheactivedocumentisadiagramwithatleasttwonodes,onewithchildnodes.

SubDiagramNodeChild()

ActiveDocument.Shapes(1).Diagram.Nodes.Item(2)_

.Children.FirstChild.Delete

EndSub

Page 192: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DocumentWindowObjectMultipleobjects DocumentWindows

DocumentWindowMultipleobjects

Representsadocumentwindow.TheDocumentWindowobjectisamemberoftheDocumentWindowscollection.TheDocumentWindowscollectioncontainsalltheopendocumentwindows.

Page 193: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheDocumentWindowObject

UseWindows(index),whereindexisthedocumentwindowindexnumber,toreturnasingleDocumentWindowobject.Thefollowingexampleactivatesdocumentwindowtwo.

Windows(2).Activate

ThefirstmemberoftheDocumentWindowscollection,Windows(1),alwaysreturnstheactivedocumentwindow.Alternatively,youcanusetheActiveWindowpropertytoreturntheactivedocumentwindow.Thefollowingexamplemaximizestheactivewindow.

ActiveWindow.WindowState=ppWindowMaximized

UsePanes(index),whereindexisthepaneindexnumber,tomanipulatepaneswithinnormal,slide,outline,ornotespageviewsofthedocumentwindow.Thefollowingexampleactivatespanethree,whichisthenotespane.

ActiveWindow.Panes(3).Activate

UsetheActivePanepropertytoreturntheactivepanewithinthedocumentwindow.Thefollowingexamplecheckstoseeiftheactivepaneistheoutlinepane.Ifnot,itactivatestheoutlinepane.

mypane=ActiveWindow.ActivePane.ViewType

Ifmypane<>1Then

ActiveWindow.Panes(1).Activate

EndIf

UsethePresentationpropertytoreturnthepresentationthat'scurrentlyrunninginthespecifieddocumentwindow.

UsetheSelectionpropertytoreturntheselection.

UsetheSplitHorizontalpropertytoreturnthepercentageofthescreenwidththattheoutlinepaneoccupiesinnormalview.

Page 194: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsetheSplitVerticalpropertytoreturnthepercentageofthescreenheightthattheslidepaneoccupiesinnormalview.

UsetheViewpropertytoreturntheviewinthespecifieddocumentwindow.

Page 195: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EffectObjectSequence Effect

Multipleobjects

Representstiminginformationaboutaslideanimation.

Page 196: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheEffectobject

UsetheAddEffectmethodtoaddaneffect.Thisexampleaddsashapetothefirstslideintheactivepresentationandaddsaneffectandabehaviortotheshape.

SubNewShapeAndEffect()

DimshpStarAsShape

DimsldOneAsSlide

DimeffNewAsEffect

SetsldOne=ActivePresentation.Slides(1)

SetshpStar=sldOne.Shapes.AddShape(Type:=msoShape5pointStar,_

Left:=150,Top:=72,Width:=400,Height:=400)

SeteffNew=sldOne.TimeLine.MainSequence.AddEffect(Shape:=shpStar,_

EffectId:=msoAnimEffectStretchy,Trigger:=msoAnimTriggerAfterPrevious)

WitheffNew

With.Behaviors.Add(msoAnimTypeScale).ScaleEffect

.FromX=75

.FromY=75

.ToX=0

.ToY=0

EndWith

.Timing.AutoReverse=msoTrue

EndWith

EndSub

TorefertoanexistingEffectobject,useMainSequence(index),whereindexisthenumberoftheEffectobjectintheSequencecollection.Thisexamplechangestheeffectforthefirstsequenceandspecifiesthebehaviorforthateffect.

SubChangeEffect()

WithActivePresentation.Slides(1).TimeLine_

.MainSequence(1)

.EffectType=msoAnimEffectSpin

With.Behaviors(1).RotationEffect

.From=100

.To=360

.By=5

EndWith

EndWith

EndSub

Page 197: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ThereisalwaysatleastoneEffectobjectineachslideregardlessofwhethertheslidehasanimationsornot.

Page 198: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EffectInformationObjectEffect EffectInformation

Multipleobjects

RepresentsvariousanimationoptionsforanEffectobject.

Page 199: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheEffectInformationobject

UsethemembersoftheEffectInformationobjecttoreturnthecurrentstateofanEffectobject,suchastheaftereffect,whetherthebackgroundanimatesalongwithitscorrespondingtext,whethertextanimatesinreverse,playsettings,soundeffects,textbuildingbehavior,andsoon.AllofthemembersoftheEffectInformationobjectareread-only.Tochangeanyeffectinformationproperties,youmustusethemethodsofthecorrespondingSequenceobject.

UsetheEffectInformationpropertyoftheEffectobjecttoreturnanEffectInformationobject.ThefollowingexamplesetstheHideWhileNotPlayingpropertyfortheplaysettingsinthemainanimationsequence.

SubHideEffect()

ActiveWindow.Selection.SlideRange(1).TimeLine_

.MainSequence(1).EffectInformation.PlaySettings_

.HideWhileNotPlaying=msoTrue

EndSub

Page 200: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EffectParametersObjectEffect EffectParameters

ColorFormat

RepresentsvariousanimationparametersforanEffectobject,suchascolors,fonts,sizes,anddirections.

Page 201: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheEffectParametersobject

UsetheEffectParameterspropertyoftheEffectobjecttoreturnanEffectParametersobject.Thefollowingexamplecreatesashape,setsafilleffect,andchangesthestartingandendingfillcolors.

SubeffParam()

DimshpNewAsShape

DimeffNewAsEffect

SetshpNew=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeHeart,Left:=100,_

Top:=100,Width:=150,Height:=150)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpNew,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

WitheffNew.EffectParameters

.Color1.RGB=RGB(Red:=0,Green:=0,Blue:=255)

.Color2.RGB=RGB(Red:=255,Green:=0,Blue:=0)

EndWith

EndSub

Page 202: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 203: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ExtraColorsObjectPresentation ExtraColors

Representstheextracolorsinapresentation.Theobjectcancontainuptoeightcolors,eachofwhichisrepresentedbyanred-green-blue(RGB)value.

Page 204: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheExtraColorsObject

UsetheExtraColorspropertytoreturntheExtraColorsobject.UseExtraColors(index),whereindexistheextracolorindexnumber,toreturnthered-green-blue(RGB)valueforasingleextracolor.Thefollowingexampleaddsarectangletoslideoneintheactivepresentationandsetsitsfillforegroundcolortothefirstextracolor.Iftherehasn'tbeenatleastoneextracolordefinedforthepresentation,thisexamplewillfail.

WithActivePresentation

Setrect=.Slides(1).Shapes_

.AddShape(msoShapeRectangle,50,50,100,200)

rect.Fill.ForeColor.RGB=.ExtraColors(1)

EndWith

UsetheAddmethodtoaddanextracolor.Thefollowingexampleaddsanextracolortotheactivepresentation(ifthecolorhasn'talreadybeenadded).

ActivePresentation.ExtraColors.AddRGB(69,32,155)

Page 205: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FillFormatObjectMultipleobjects FillFormat

ColorFormat

Representsfillformattingforashape.Ashapecanhaveasolid,gradient,texture,pattern,picture,orsemi-transparentfill.

Page 206: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheFillFormatObject

UsetheFillpropertytoreturnaFillFormatobject.ThefollowingexampleaddsarectangletomyDocumentandthensetsthegradientandcolorfortherectangle'sfill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeRectangle,90,90,90,80).Fill

.ForeColor.RGB=RGB(0,128,128)

.OneColorGradientmsoGradientHorizontal,1,1

EndWith

Page 207: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ManyofthepropertiesoftheFillFormatobjectareread-only.Tosetoneoftheseproperties,youhavetoapplythecorrespondingmethod.

Page 208: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FilterEffectObjectAnimationBehavior FilterEffect

Representsafiltereffectforananimationbehavior.

Page 209: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheFilterEffectObject

UsetheFilterEffectpropertyoftheAnimationBehaviorobjecttoreturnaFilterEffectobject.FiltereffectscanbechangedusingtheFilterEffectobject'sReveal,SubType,andTypeproperties.

Page 210: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetothefirstslideoftheactivepresentationandsetsafiltereffectanimationbehavior.

SubChangeFilterEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(msoAnimTypeFilter)

WithbhvEffect.FilterEffect

.Type=msoAnimFilterEffectTypeWipe

.Subtype=msoAnimFilterEffectSubtypeUp

.Reveal=msoTrue

EndWith

EndSub

Page 211: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontObjectMultipleobjects Font

ColorFormat

Representscharacterformattingfortextorabullet.TheFontobjectisamemberoftheFontscollection.TheFontscollectioncontainsallthefontsusedinapresentation.

Page 212: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheFontObject

Thissectiondescribeshowtodothefollowing:

ReturntheFontobjectthatrepresentsthefontattributesofaspecifiedbullet,aspecifiedrangeoftext,oralltextataspecifiedoutlinelevelReturnaFontobjectfromthecollectionofallthefontsusedinthepresentation

Page 213: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningtheFontobjectthatrepresentsthefontattributesofaspecifiedbullet,aspecifiedrangeoftext,oralltextataspecifiedoutlinelevel

UsetheFontpropertytoreturntheFontobjectthatrepresentsthefontattributesforaspecificbullet,textrange,oroutlinelevel.Thefollowingexamplesetsthetitletextonslideoneandsetsthefontproperties.

WithActivePresentation.Slides(1).Shapes.Title_

.TextFrame.TextRange

.Text="VolcanoCoffee"

With.Font

.Italic=True

.Name="Palatino"

.Color.RGB=RGB(0,0,255)

EndWith

EndWith

Page 214: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaFontobjectfromthecollectionofallthefontsusedinthepresentation

UseFonts(index),whereindexisthefont'snameorindexnumber,toreturnasingleFontobject.Thefollowingexamplecheckstoseewhetherfontoneintheactivepresentationisembeddedinthepresentation.

IfActivePresentation.Fonts(1).Embedded=_

TrueThenMsgBox"Font1isembedded"

Page 215: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FreeformBuilderObjectFreeformBuilder

Representsthegeometryofafreeformwhileit'sbeingbuilt.

Page 216: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheFreeformBuilderObject

UsetheBuildFreeformmethodtoreturnaFreeformBuilderobject.UsetheAddNodesmethodtoaddnodestothefreefrom.UsetheConvertToShapemethodtocreatetheshapedefinedintheFreeformBuilderobjectandaddittotheShapescollection.ThefollowingexampleaddsafreeformwithfoursegmentstomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.BuildFreeform(msoEditingCorner,360,200)

.AddNodesmsoSegmentCurve,msoEditingCorner,_

380,230,400,250,450,300

.AddNodesmsoSegmentCurve,msoEditingAuto,480,200

.AddNodesmsoSegmentLine,msoEditingAuto,480,400

.AddNodesmsoSegmentLine,msoEditingAuto,360,200

.ConvertToShape

EndWith

Page 217: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GroupShapesCollectionObjectMultipleobjects GroupShapes

Representstheindividualshapeswithinagroupedshape.EachshapeisrepresentedbyaShapeobject.UsingtheItemmethodwiththisobject,youcanworkwithsingleshapeswithinagroupwithouthavingtoungroupthem.

Page 218: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingTheGroupshapesCollection

UsetheGroupItemspropertytoreturntheGroupShapescollection.UseGroupItems(index),whereindexisthenumberoftheindividualshapewithinthegroupedshape,toreturnasingleshapefromtheGroupShapescollection.ThefollowingexampleaddsthreetrianglestomyDocument,groupsthem,setsacolorfortheentiregroup,andthenchangesthecolorforthesecondtriangleonly.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShape(msoShapeIsoscelesTriangle,10,_

10,100,100).Name="shpOne"

.AddShape(msoShapeIsoscelesTriangle,150,_

10,100,100).Name="shpTwo"

.AddShape(msoShapeIsoscelesTriangle,300,_

10,100,100).Name="shpThree"

With.Range(Array("shpOne","shpTwo","shpThree")).Group

.Fill.PresetTexturedmsoTextureBlueTissuePaper

.GroupItems(2).Fill.PresetTexturedmsoTextureGreenMarble

EndWith

EndWith

Page 219: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HeaderFooterObject

HeadersFooters HeaderFooter

Representsaheader,footer,dateandtime,slidenumber,orpagenumberonaslideormaster.AlltheHeaderFooterobjectsforaslideormasterarecontainedinaHeadersFootersobject.

Page 220: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheHeaderFooterObject

UseoneofthepropertieslistedinthefollowingtabletoreturntheHeaderFooterobject.

Usethisproperty Toreturn

DateAndTimeAHeaderFooterobjectthatrepresentsthedateandtimeontheslide.Footer AHeaderFooterobjectthatrepresentsthefooterfortheslide.

Header AHeaderFooterobjectthatrepresentstheheaderfortheslide.Thisworksonlyfornotespagesandhandouts,notforslides.

SlideNumber AHeaderFooterobjectthatrepresenttheslidenumber(onaslide)orpagenumber(onanotespageorahandout).

NoteHeaderFooterobjectsaren'tavailableforSlideobjectsthatrepresentnotespages.TheHeaderFooterobjectthatrepresentsaheaderisavailableonlyforanotesmasterorhandoutmaster.

YoucansetpropertiesofHeaderFooterobjectsforsingleslides.Thefollowingexamplesetsthefootertextforslideoneintheactivepresentation.

ActivePresentation.Slides(1).HeadersFooters.Footer_

.Text="VolcanoCoffee"

YoucanalsosetpropertiesofHeaderFooterobjectsfortheslidemaster,titlemaster,notesmaster,orhandoutmastertoaffectallslides,titleslides,notespages,orhandoutsandoutlinesatthesametime.Thefollowingexamplesetsthetextforthefooterintheslidemasterfortheactivepresentation,setstheformatforthedateandtime,andturnsonthedisplayofslidenumbers.Thesesettingswillapplytoallslidesthatarebasedonthismasterthatdisplaymastergraphicsandthathavenothadtheirfooteranddateandtimesetindividually.

SetmySlidesHF=ActivePresentation.SlideMaster.HeadersFooters

WithmySlidesHF

.Footer.Visible=True

Page 221: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

.Footer.Text="RegionalSales"

.SlideNumber.Visible=True

.DateAndTime.Visible=True

.DateAndTime.UseFormat=True

.DateAndTime.Format=ppDateTimeMdyy

EndWith

Toclearheaderandfooterinformationthathasbeensetforindividualslidesandmakesureallslidesdisplaytheheaderandinformationyoudefinefortheslidemaster,runthefollowingcodebeforerunningthepreviousexample.

ForEachsInActivePresentation.Slides

s.DisplayMasterShapes=True

s.HeadersFooters.Clear

Next

Page 222: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LineFormatObjectMultipleobjects LineFormat

ColorFormat

Representslineandarrowheadformatting.Foraline,theLineFormatobjectcontainsformattinginformationforthelineitself;forashapewithaborder,thisobjectcontainsformattinginformationfortheshape'sborder.

Page 223: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheLineFormatObject

UsetheLinepropertytoreturnaLineFormatobject.Thefollowingexampleaddsablue,dashedlinetomyDocument.There'sashort,narrowovalattheline'sstartingpointandalong,widetriangleatitsendpoint.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(100,100,200,300).Line

.DashStyle=msoLineDashDotDot

.ForeColor.RGB=RGB(50,0,128)

.BeginArrowheadLength=msoArrowheadShort

.BeginArrowheadStyle=msoArrowheadOval

.BeginArrowheadWidth=msoArrowheadNarrow

.EndArrowheadLength=msoArrowheadLong

.EndArrowheadStyle=msoArrowheadTriangle

.EndArrowheadWidth=msoArrowheadWide

EndWith

Page 224: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LinkFormatObjectMultipleobjects LinkFormat

ContainspropertiesandmethodsthatapplytolinkedOLEobjects.TheOLEFormatobjectcontainspropertiesandmethodsthatapplytoOLEobjectswhetherornotthey'relinked.ThePictureFormatobjectcontainspropertiesandmethodsthatapplytopicturesandOLEobjects.

Page 225: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheLinkFormatObject

UsetheLinkFormatpropertytoreturnaLinkFormatobject.ThefollowingexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.

ForEachsldInActivePresentation.Slides

ForEachshInsld.Shapes

Ifsh.Type=msoLinkedOLEObjectThen

Ifsh.OLEFormat.ProgID="Excel.Sheet"Then

sh.LinkFormat.AutoUpdate=ppUpdateOptionManual

EndIf

EndIf

Next

Next

Page 226: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MasterObjectMaster Multipleobjects

Representsaslidemaster,titlemaster,handoutmaster,notesmaster,ordesignmaster.

Page 227: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheMasterObject

ToreturnaMasterobject,usetheMasterpropertyoftheSlideobjectorSlideRangecollection,orusetheHandoutMaster,NotesMaster,SlideMaster,orTitleMasterpropertyofthePresentationobject.NotethatsomeofthesepropertiesarealsoavailablefromtheDesignobjectaswell.Thefollowingexamplesetsthebackgroundfillfortheslidemasterfortheactivepresentation.

ActivePresentation.SlideMaster.Background.Fill_

.PresetGradientmsoGradientHorizontal,1,msoGradientBrass

ToaddatitlemasterordesigntoapresentationandreturnaMasterobjectthatrepresentsthenewtitlemasterordesign,usetheAddTitleMastermethod.Thefollowingexampleaddsatitlemastertotheactivepresentationandplacesthetitleplaceholder10pointsfromthetopofthemaster.

ActivePresentation.AddTitleMaster.Shapes.Title.Top=10

Page 228: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MotionEffectObjectAnimationBehavior MotionEffect

RepresentsamotioneffectforanAnimationBehaviorobject.

Page 229: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheMotionEffectobject

UsetheMotionEffectpropetyoftheAnimationBehaviorobjecttoreturnaMotionEffectobject.Thefollowingexamplereferstothemotioneffectforagivenanimationbehavior.

ActivePresentation.Slides(1).TimeLine.MainSequence.Item.Behaviors(1).MotionEffect

UsetheByX,ByY,FromX,FromY,ToX,andToYpropertiesoftheMotionEffectobjecttoconstructamotionpath.Thefollowingexampleaddsashapetothefirstslideandcreatesamotionpath.

SubAddMotionPath()

DimshpNewAsShape

DimeffNewAsEffect

DimaniMotionAsAnimationBehavior

SetshpNew=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShape5pointStar,Left:=0,_

Top:=0,Width:=100,Height:=100)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpNew,effectId:=msoAnimEffectCustom,_

Trigger:=msoAnimTriggerWithPrevious)

SetaniMotion=effNew.Behaviors.Add(msoAnimTypeMotion)

WithaniMotion.MotionEffect

.FromX=0

.FromY=0

.ToX=500

.ToY=500

EndWith

EndSub

Page 230: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NamedSlideShowObjectNamedSlideShows NamedSlideShow

Representsacustomslideshow,whichisanamedsubsetofslidesinapresentation.TheNamedSlideShowobjectisamemberoftheNamedSlideShowscollection.TheNamedSlideShowscollectioncontainsallthenamedslideshowsinthepresentation.

Page 231: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheNamedSlideShowObject

UseNamedSlideShows(index),whereindexisthecustomslideshownameorindexnumber,toreturnasingleNamedSlideShowobject.Thefollowingexampledeletesthecustomslideshownamed"QuickShow."

ActivePresentation.SlideShowSettings_

.NamedSlideShows("QuickShow").Delete

UsetheSlideIDspropertytoreturnanarraythatcontainstheuniqueslideIDsforalltheslidesinthespecifiedcustomshow.ThefollowingexampledisplaystheslideIDsfortheslidesinthecustomslideshownamed"QuickShow."

idArray=ActivePresentation.SlideShowSettings_

.NamedSlideShows("QuickShow").SlideIDs

Fori=1ToUBound(idArray)

MsgBoxidArray(i)

Next

Page 232: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ObjectVerbsObjectOLEFormat ObjectVerbs

RepresentsthecollectionofOLEverbsforthespecifiedOLEobject.OLEverbsaretheoperationssupportedbyanOLEobject.CommonlyusedOLEverbsare"play"and"edit."

Page 233: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheObjectVerbsObject

UsetheObjectVerbspropertytoreturnanObjectVerbsobject.ThefollowingexampledisplaysalltheavailableverbsfortheOLEobjectcontainedinshapeoneonslidetwointheactivepresentation.Forthisexampletowork,shapeonemustcontainanOLEobject.

WithActivePresentation.Slides(2).Shapes(1).OLEFormat

ForEachvIn.ObjectVerbs

MsgBoxv

Next

EndWith

Page 234: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OLEFormatObjectMultipleobjects OLEFormat

ObjectVerbs

ContainspropertiesandmethodsthatapplytoOLEobjects.TheLinkFormatobjectcontainspropertiesandmethodsthatapplytolinkedOLEobjectsonly.ThePictureFormatobjectcontainspropertiesandmethodsthatapplytopicturesandOLEobjects.

Page 235: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheOLEFormatObject

UsetheOLEFormatpropertytoreturnanOLEFormatobject.ThefollowingexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.

ForEachsldInActivePresentation.Slides

ForEachshInsld.Shapes

Ifsh.Type=msoLinkedOLEObjectThen

Ifsh.OLEFormat.ProgID="Excel.Sheet"Then

sh.LinkFormat.AutoUpdate=ppUpdateOptionManual

EndIf

EndIf

Next

Next

Page 236: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OptionsObjectApplication Options

RepresentsapplicationoptionsinMicrosoftPowerPoint.

Page 237: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheOptionsobject

UsetheOptionspropertytoreturnanOptionsobject.ThefollowingexamplesetsthreeapplicationoptionsforPowerPoint.

SubTogglePasteOptionsButton()

WithApplication.Options

If.DisplayPasteOptions=FalseThen

.DisplayPasteOptions=True

EndIf

EndWith

EndSub

Page 238: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PageSetupObjectPresentation PageSetup

Containsinformationaboutthepagesetupforslides,notespages,handouts,andoutlinesinapresentation.

Page 239: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePageSetupObject

UsethePageSetuppropertytoreturnthePageSetupobject.Thefollowingexamplesetsallslidesintheactivepresentationtobe11incheswideand8.5incheshighandsetstheslidenumberingforthepresentationtostartat17.

WithActivePresentation.PageSetup

.SlideWidth=11*72

.SlideHeight=8.5*72

.FirstSlideNumber=17

EndWith

Page 240: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 241: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PaneObject

DocumentWindow PanesPane

Anobjectrepresentingoneofthethreepanesinnormalvieworthesinglepaneofanyotherviewinthedocumentwindow.

Page 242: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePaneObject

UsePanes(index),whereindexistheindexnumberforapane,toreturnasinglePaneobject.Thefollowingtableliststhenamesofthepanesinnormalviewwiththeircorrespondingindexnumbers.

Pane IndexnumberOutline 1Slide 2Notes 3

Whenusingadocumentwindowviewotherthannormalview,usePanes(1)toreferencethesinglePaneobject.

UsetheActivatemethodtomakethespecifiedpaneactive.

UsetheViewTypepropertytodeterminewhichpaneisactive.ThefollowingexampleusestheViewTypepropertytodeterminewhethertheslidepaneistheactivepane.Ifitis,thentheActivatemethodmakesthenotespanetheactivepane.

WithActiveWindow

If.ActivePane.ViewType=ppViewSlideThen

.Panes(3).Activate

EndIf

EndWith

Page 243: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Normalviewistheonlyviewwithmultiplepanes.Allotherdocumentwindowviewshaveonlyasinglepane,whichisthedocumentwindow.

Page 244: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ParagraphFormatObjectMultipleobjects ParagraphFormat

BulletFormat

Representstheparagraphformattingofatextrange.

Page 245: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheParagraphFormatObject

UsetheParagraphFormatpropertytoreturntheParagraphFormatobject.Thefollowingexampleleftalignstheparagraphsinshapetwoonslideoneintheactivepresentation.

ActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange_

.ParagraphFormat.Alignment=ppAlignLeft

Page 246: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PictureFormatObjectMultipleobjects PictureFormat

ContainspropertiesandmethodsthatapplytopicturesandOLEobjects.TheLinkFormatobjectcontainspropertiesandmethodsthatapplytolinkedOLEobjectsonly.TheOLEFormatobjectcontainspropertiesandmethodsthatapplytoOLEobjectswhetherornotthey'relinked.

Page 247: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePictureFormatObject

UsethePictureFormatpropertytoreturnaPictureFormatobject.Thefollowingexamplesetsthebrightness,contrast,andcolortransformationforshapeoneonmyDocumentandcrops18pointsoffthebottomoftheshape.Forthisexampletowork,shapeonemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).PictureFormat

.Brightness=0.3

.Contrast=0.7

.ColorType=msoPictureGrayScale

.CropBottom=18

EndWith

Page 248: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlaceholderFormatObjectMultipleobjects PlaceholderFormat

Containspropertiesthatapplyspecificallytoplaceholders,suchasplaceholdertype.

Page 249: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePlaceholderFormatObject

UsethePlaceholderFormatpropertytoreturnaPlaceholderFormatobject.Thefollowingexampleaddstexttoplaceholderoneonslideoneintheactivepresentationifthatplaceholderexistsandisahorizontaltitleplaceholder.

WithActivePresentation.Slides(1).Shapes.Placeholders

If.Count>0Then

With.Item(1)

SelectCase.PlaceholderFormat.Type

CaseppPlaceholderTitle

.TextFrame.TextRange="TitleText"

CaseppPlaceholderCenterTitle

.TextFrame.TextRange="CenteredTitleText"

CaseElse

MsgBox"There'snohorizontal"_

"titleonthisslide"

EndSelect

EndWith

EndIf

EndWith

Page 250: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlaySettingsObjectMultipleobjects PlaySettings

Containsinformationabouthowthespecifiedmediaclipwillbeplayedduringaslideshow.

Page 251: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePlaySettingsObject

UsethePlaySettingspropertytoreturnthePlaySettingsobject.Thefollowingexampleinsertsamovienamed"Clock.avi"intoslideoneintheactivepresentation.Itthensetsittobeplayedautomaticallyafterthepreviousanimationorslidetransition,specifiesthattheslideshowcontinuewhilethemovieplays,andspecifiesthatthemovieobjectbehiddenduringaslideshowexceptwhenit'splaying.

SetclockMovie=ActivePresentation.Slides(1).Shapes_

.AddMediaObject(FileName:="C:\WINNT\clock.avi",_

Left:=20,Top:=20)

WithclockMovie.AnimationSettings.PlaySettings

.PlayOnEntry=True

.PauseAnimation=False

.HideWhileNotPlaying=True

EndWith

Page 252: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationObjectMultipleobjects Presentation

Multipleobjects

RepresentsaPowerPointpresentation.ThePresentationobjectisamemberofthePresentationscollection.ThePresentationscollectioncontainsallthePresentationobjectsthatrepresentopenpresentationsinPowerPoint.

Page 253: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePresentationObject

Thissectiondescribeshowto:

ReturnapresentationthatyouspecifybynameorindexnumberReturnthepresentationintheactivewindowReturnthepresentationinanydocumentwindoworslideshowwindowyouspecify

Page 254: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningapresentationthatyouspecifybynameorindexnumber

UsePresentations(index),whereindexisthepresentation'snameorindexnumber,toreturnasinglePresentationobject.Thenameofthepresentationisthefilename,withorwithoutthefilenameextension,andwithoutthepath.ThefollowingexampleaddsaslidetothebeginningofSamplePresentation.

Presentations("SamplePresentation").Slides.Add1,1

Notethatifmultiplepresentationswiththesamenameareopen,thefirstpresentationinthecollectionwiththespecifiednameisreturned.

Page 255: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningthepresentationintheactivewindow

UsetheActivePresentationpropertytoreturnthepresentationintheactivewindow.Thefollowingexamplesavestheactivepresentation.

ActivePresentation.Save

Notethatifanembeddedpresentationisin-placeactive,theActivePresentationpropertyreturnstheembeddedpresentation.

Page 256: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningthepresentationinanydocumentwindoworslideshowwindowyouspecify

UsethePresentationpropertytoreturnthepresentationthat'sinthespecifieddocumentwindoworslideshowwindow.Thefollowingexampledisplaysthenameoftheslideshowrunninginslideshowwindowone.

MsgBoxSlideShowWindows(1).Presentation.Name

Page 257: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintOptionsObjectMultipleobjects PrintOptions

PrintRanges

Containsprintoptionsforapresentation.

NoteSpecifyingtheoptionalargumentsFrom,To,Copies,andCollateforthePrintOutmethodwillsetthecorrespondingpropertiesofthePrintOptionsobject.

Page 258: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePrintOptionsObject

UsethePrintOptionspropertytoreturnthePrintOptionsobject.Thefollowingexampleprintstwouncollatedcolorcopiesofalltheslides(whethervisibleorhidden)intheactivepresentation.Theexamplealsoscaleseachslidetofittheprintedpageandframeseachslidewithathinborder.

WithActivePresentation

With.PrintOptions

.NumberOfCopies=2

.Collate=False

.PrintColorType=ppPrintColor

.PrintHiddenSlides=True

.FitToPage=True

.FrameSlides=True

.OutputType=ppPrintOutputSlides

EndWith

.PrintOut

EndWith

UsetheRangeTypepropertytospecifywhethertoprinttheentirepresentationoronlyaspecifiedpartofit.Ifyouwanttoprintonlycertainslides,settheRangeTypepropertytoppPrintSlideRange,andusetheRangespropertytospecifywhichpagestoprint.Thefollowingexampleprintsslides1,4,5,and6intheactivepresentation

WithActivePresentation

With.PrintOptions

.RangeType=ppPrintSlideRange

With.Ranges

.Add1,1

.Add4,6

EndWith

EndWith

.PrintOut

EndWith

Page 259: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 260: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintRangeObjectPrintRanges PrintRange

Representsasinglerangeofconsecutiveslidesorpagestobeprinted.ThePrintRangeobjectisamemberofthePrintRangescollection.ThePrintRangescollectioncontainsalltheprintrangesthathavebeendefinedforthespecifiedpresentation.

Page 261: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePrintRangeObject

UseRanges(index),whereindexistheprintrangeindexnumber,toreturnasinglePrintRangeobject.Thefollowingexampledisplaysamessagethatindicatesthestartingandendingslidenumbersforprintrangeoneintheactivepresentation.

WithActivePresentation.PrintOptions.Ranges

If.Count>0Then

With.Item(1)

MsgBox"Printrange1startsonslide"&.Start&_

"andendsonslide"&.End

EndWith

EndIf

EndWith

UsetheAddmethodtocreateaPrintRangeobjectandaddittothePrintRangescollection.Thefollowingexampledefinesthreeprintrangesthatrepresentslide1,slides3through5,andslides8and9intheactivepresentationandthenprintstheslidesintheseranges.

WithActivePresentation.PrintOptions

.RangeType=ppPrintSlideRange

With.Ranges

.ClearAll

.Add1,1

.Add3,5

.Add8,9

EndWith

EndWith

ActivePresentation.PrintOut

Page 262: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucansetprintrangesinthePrintRangescollectionindependentoftheRangeTypesetting;theserangesareretainedaslongasthepresentationthey'recontainedinisloaded.TherangesinthePrintRangescollectionareappliedwhentheRangeTypepropertyissettoppPrintSlideRange.

Page 263: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PropertyEffectObjectAnimationBehavior PropertyEffect

AnimationPoints

RepresentsapropertyeffectforanAnimationBehaviorobject.

Page 264: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePropertyEffectobject

UsethePropertyEffectpropertyoftheAnimationBehaviorobjecttoreturnaPropertyEffectobject.Thefollowingexamplereferstothepropertyeffectforaspecifiedanimationbehavior.

ActivePresentation.Slides(1).TimeLine.MainSequence.Item(1)_

.Behaviors(1).PropertyEffect

UsethePointspropertytoaccesstheanimationpointsofaparticularanimationbehavior.Ifyouwanttochangeonlytwostatesofananimationbehavior,usetheFromandToproperties.Thisexampleaddsanewshapetotheandsetsthepropertyeffecttoanimatethefillcolorfrombluetored.

SubAddShapeSetAnimFill()

DimeffBlindsAsEffect

DimshpRectangleAsShape

DimanimPropertyAsAnimationBehavior

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffBlinds=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectBlinds)

effBlinds.Timing.Duration=3

SetanimProperty=effBlinds.Behaviors.Add(msoAnimTypeProperty)

WithanimProperty.PropertyEffect

.Property=msoAnimColor

.From=RGB(Red:=0,Green:=0,Blue:=255)

.To=RGB(Red:=255,Green:=0,Blue:=0)

EndWith

EndSub

Page 265: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 266: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PublishObjectObjectPublishObjects PublishObject

RepresentsacompleteorpartialloadedpresentationthatisavailableforpublishingtoHTML.ThePublishObjectobjectisamemberofthePublishObjectscollection.

Page 267: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingthePublishObjectObject

UsePublishObjects(index),whereindexisalways"1",toreturnthesingleobjectforaloadedpresentation.TherecanbeonlyonePublishObjectobjectforeachloadedpresentation.ThisexamplepublishesslidesthreethroughfiveofpresentationtwotoHTML.ItnamesthepublishedpresentationMallard.htm.

WithPresentations(2).PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

Page 268: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucanspecifythecontentandattributesofthepublishedpresentationbysettingvariouspropertiesofthePublishObjectobject.Forexample,theSourceTypepropertydefinestheportionofaloadedpresentationtobepublished.TheRangeStartpropertyandtheRangeEndpropertyspecifytherangeofslidestopublish,andtheSpeakerNotespropertydesignateswhetherornottopublishthespeaker'snotes.

Page 269: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RGBColorObjectRGBColor

Representsasinglecolorinacolorscheme.

Page 270: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheRGBColorObject

UsetheColorsmethodtoreturnanRGBColorobject.YoucansetanRGBColorobjecttoanotherRGBColorobject.YoucanusetheRGBpropertytosetorreturntheexplicitred-green-bluevalueforanRGBColorobject,withtheexceptionoftheRGBColorobjectsdefinedbytheppNotSchemeColorandppSchemeColorMixedconstants.TheRGBpropertycanbereturned,butnotset,forthesetwoobjects.Thefollowingexamplesetsthebackgroundcolorincolorschemeoneintheactivepresentationtoredandsetsthetitlecolortothetitlecolorthat'sdefinedforcolorschemetwo.

WithActivePresentation.ColorSchemes

.Item(1).Colors(ppBackground).RGB=RGB(255,0,0)

.Item(1).Colors(ppTitle)=.Item(2).Colors(ppTitle)

EndWith

Page 271: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RotationEffectObjectAnimationBehavior RotationEffect

RepresentsarotationeffectforanAnimationBehaviorobject.

Page 272: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheRotationEffectobject

UsetheRotationEffectpropertyoftheAnimationBehaviorobjecttoreturnaRotationEffectobject.Thefollowingexamplereferstotherotationeffectforagivenanimationbehavior.

ActivePresentation.Slides(1).TimeLine.MainSequence.Item.Behaviors(1).RotationEffect

UsetheBy,From,andTopropertiesoftheRotationEffectobjecttoaffectanobject'sanimationrotation.Thefollowingexampleaddsanewshapetothefirstslideandsetstherotationanimationbehavior.

SubAddRotation()

DimshpNewAsShape

DimeffNewAsEffect

DimaniNewAsAnimationBehavior

SetshpNew=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShape5pointStar,Left:=0,_

Top:=0,Width:=100,Height:=100)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpNew,effectId:=msoAnimEffectCustom)

SetaniNew=effNew.Behaviors.Add(msoAnimTypeRotation)

WithaniNew.RotationEffect

'Rotate270degreesfromcurrentposition

.By=270

EndWith

EndSub

Page 273: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RowObjectRows Row

CellRange

Representsarowinatable.TheRowobjectisamemberoftheRowscollection.TheRowscollectionincludesalltherowsinthespecifiedtable.

Page 274: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheRowObject

UseRows(index),whereindexisanumberthatrepresentsthepositionoftherowinthetable,toreturnasingleRowobject.Thisexampledeletesthefirstrowfromthetableinshapefiveonslidetwooftheactivepresentation.

ActivePresentation.Slides(2).Shapes(5).Table.Rows(1).Delete

UsetheSelectmethodtoselectarowinatable.Thisexampleselectsrowoneofthespecifiedtable.

ActivePresentation.Slides(2).Shapes(5).Table.Rows(1).Select

Page 275: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheCellspropertytomodifytheindividualcellsinaRowobject.Thisexampleselectsthesecondrowinthetableandappliesadashedlinestyletothebottomborder.

ActiveWindow.Selection.ShapeRange.Table.Rows(2)_

.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash

Page 276: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RulerObjectMultipleobjects Ruler

Multipleobjects

Representstherulerforthetextinthespecifiedshapeorforalltextinthespecifiedtextstyle.Containstabstopsandtheindentationsettingsfortextoutlinelevels.

Page 277: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheRulerObject

UsetheRulerpropertyoftheTextFrameobjecttoreturntheRulerobjectthatrepresentstherulerforthetextinthespecifiedshape.UsetheTabStopspropertytoreturntheTabStopsobjectthatcontainsthetabstopsontheruler.UsetheLevelspropertytoreturntheRulerLevelsobjectthatcontainstheindentationsettingsfortextoutlinelevels.Thefollowingexamplesetsaleft-alignedtabstopat2inches(144Points)andsetsahangingindentforthetextinobjecttwoonslideoneintheactivepresentation.

WithActivePresentation.Slides(1).Shapes(2).TextFrame.Ruler

.TabStops.AddppTabStopLeft,144

.Levels(1).FirstMargin=0

.Levels(1).LeftMargin=36

EndWith

UsetheRulerpropertyoftheTextStyleobjecttoreturntheRulerobjectthatrepresentstherulerforoneofthefourdefinedtextstyles(titletext,bodytext,notestext,ordefaulttext).Thefollowingexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation.

WithActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).Ruler.Levels(1)

.FirstMargin=9

.LeftMargin=54

EndWith

Page 278: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RulerLevelObjectRulerLevels RulerLevel

Containsfirst-lineindentandhangingindentinformationforanoutlinelevel.TheRulerLevelobjectisamemberoftheRulerLevelscollection.TheRulerLevelscollectioncontainsaRulerLevelobjectforeachofthefiveavailableoutlinelevels.

Page 279: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheRulerLevelObject

UseRulerLevels(index),whereindexistheoutlinelevel,toreturnasingleRulerLevelobject.Thefollowingexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation.

WithActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).Ruler.Levels(1)

.FirstMargin=9

.LeftMargin=54

EndWith

Thefollowingexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinshapetwoonslideoneintheactivepresentation.

WithActivePresentation.SlideMaster.Shapes(2)_

.TextFrame.Ruler.Levels(1)

.FirstMargin=9

.LeftMargin=54

EndWith

Page 280: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SelectionObjectDocumentWindow Selection

Multipleobjects

Representstheselectioninthespecifieddocumentwindow.

Page 281: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSelectionObject

UsetheSelectionpropertytoreturntheSelectionobject.ThefollowingexampleplacesacopyoftheselectionintheactivewindowontheClipboard.

ActiveWindow.Selection.Copy

UsetheShapeRange,SlideRange,orTextRangepropertytoreturnarangeofshapes,slides,ortextfromtheselection.

Thefollowingexamplesetsthefillforegroundcolorfortheselectedshapesinwindowtwo,assumingthatthere'satleastoneshapeselected,andassumingthatallselectedshapeshaveafillwhoseforecolorcanbeset.

WithWindows(2).Selection.ShapeRange.Fill

.Visible=True

.ForeColor.RGB=RGB(255,0,255)

EndWith

Thefollowingexamplesetsthetextinthefirstselectedshapeinwindowtwoifthatshapecontainsatextframe.

WithWindows(2).Selection.ShapeRange(1)

If.HasTextFrameThen

.TextFrame.TextRange="CurrentChoice"

EndIf

EndWith

ThefollowingexamplecutstheselectedtextintheactivewindowandplacesitontheClipboard.

ActiveWindow.Selection.TextRange.Cut

Thefollowingexampleduplicatesalltheslidesintheselection(ifyou'reinslideview,thisduplicatesthecurrentslide).

ActiveWindow.Selection.SlideRange.Duplicate

Page 282: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Ifyoudon'thaveanobjectoftheappropriatetypeselectedwhenyouuseoneoftheseproperties(forinstance,ifyouusetheShapeRangepropertywhentherearenoshapesselected),anerroroccurs.UsetheTypepropertytodeterminewhatkindofobjectorobjectsareselected.Thefollowingexamplecheckstoseewhethertheselectioncontainsslides.Iftheselectiondoescontainslides,theexamplesetsthebackgroundforthefirstslideintheselection.

WithWindows(2).Selection

If.Type=ppSelectionSlidesThen

With.SlideRange(1)

.FollowMasterBackground=False

.Background.Fill.PresetGradient_

msoGradientHorizontal,1,msoGradientLateSunset

EndWith

EndIf

EndWith

Page 283: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheSelectionobjectisdeletedwheneveryouchangeslidesinanactiveslideview(theTypepropertywillreturnppSelectionNone).

Page 284: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetEffectObjectAnimationBehavior SetEffect

Representsaseteffectforananimationbehavior.YoucanusetheSetEffectobjecttosetthevalueofaproperty.

Page 285: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSetEffectObject

UsetheSetEffectpropertyoftheAnimationBehaviorobjecttoreturnaSetEffectobject.SeteffectscanbechangedusingtheSetEffectobject'sPropertyandToproperties.

Page 286: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetothefirstslideoftheactivepresentationandsetsaseteffectanimationbehavior.

SubChangeSetEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(msoAnimTypeSet)

WithbhvEffect.SetEffect

.Property=msoAnimShapeFillColor

.To=RGB(Red:=0,Green:=255,Blue:=255)

EndWith

EndSub

Page 287: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShadowFormatObjectMultipleobjects ShadowFormat

ColorFormat

Representsshadowformattingforashape.

Page 288: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheShadowFormatObject

UsetheShadowpropertytoreturnaShadowFormatobject.ThefollowingexampleaddsashadowedrectangletomyDocument.Thesemitransparent,blueshadowisoffset5pointstotherightoftherectangleand3pointsaboveit.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,_

50,50,100,200).Shadow

.ForeColor.RGB=RGB(0,0,128)

.OffsetX=5

.OffsetY=-3

.Transparency=0.5

.Visible=True

EndWith

Page 289: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 290: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapeObjectMultipleobjects Shape

Multipleobjects

Representsanobjectinthedrawinglayer,suchasanAutoShape,freeform,OLEobject,orpicture.

NoteTherearethreeobjectsthatrepresentshapes:theShapescollection,whichrepresentsalltheshapesonadocument;theShapeRangecollection,whichrepresentsaspecifiedsubsetoftheshapesonadocument(forexample,aShapeRangeobjectcouldrepresentshapesoneandfouronthedocument,oritcouldrepresentalltheselectedshapesonthedocument);theShapeobject,whichrepresentsasingleshapeonadocument.Ifyouwanttoworkwithseveralshapeatthesametimeorwithshapeswithintheselection,useaShapeRangecollection.Foranoverviewofhowtoworkwitheitherasingleshapeorwithmorethanoneshapeatatime,seeWorkingwithShapes(DrawingObjects).

Page 291: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheShapeObject

Thissectiondescribeshowto:

Returnanexistingshapeonaslide,indexedbynameornumber.Returnanewlycreatedshapeonaslide.Returnashapewithintheselection.Returntheslidetitleandotherplaceholdersonaslide.Returntheshapesattachedtotheendsofaconnector.Returnthedefaultshapeforapresentation.Returnanewlycreatedfreeform.Returnasingleshapefromwithinagroup.Returnanewlyformedgroupofshapes.

Page 292: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturninganExistingShapeonaSlide

UseShapes(index),whereindexistheshapenameortheindexnumber,toreturnaShapeobjectthatrepresentsashapeonaslide.ThefollowingexamplehorizontallyflipsshapeoneandtheshapenamedRectangle1onmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).FlipmsoFlipHorizontal

myDocument.Shapes("Rectangle1").FlipmsoFlipHorizontal

EachshapeisassignedadefaultnamewhenyouaddittotheShapescollection.Togivetheshapeamoremeaningfulname,usetheNameproperty.ThefollowingexampleaddsarectangletomyDocument,givesitthenameRedSquare,andthensetsitsforegroundcolorandlinestyle.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(Type:=msoShapeRectangle,_

Top:=144,Left:=144,Width:=72,Height:=72)

.Name="RedSquare"

.Fill.ForeColor.RGB=RGB(255,0,0)

.Line.DashStyle=msoLineDashDot

EndWith

Page 293: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaNewlyCreatedShapeonaSlide

ToaddashapetoaslideandreturnaShapeobjectthatrepresentsthenewlycreatedshape,useoneofthefollowingmethodsoftheShapescollection:AddCallout,AddComment,AddConnector,AddCurve,AddLabel,AddLine,AddMediaObject,AddOLEObject,AddPicture,AddPlaceholder,AddPolyline,AddShape,AddTable,AddTextbox,AddTextEffect,AddTitle.

Page 294: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaShapeWithintheSelection

UseSelection.ShapeRange(index),whereindexistheshapenameortheindexnumber,toreturnaShapeobjectthatrepresentsashapewithintheselection.Thefollowingexamplesetsthefillforthefirstshapeintheselectionintheactivewindow,assumingthatthere'satleastoneshapeintheselection.

ActiveWindow.Selection.ShapeRange(1).Fill_

.ForeColor.RGB=RGB(255,0,0)

Page 295: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningtheSlideTitleandOtherPlaceholdersonaSlide

UseShapes.TitletoreturnaShapeobjectthatrepresentsanexistingslidetitle.UseShapes.AddTitletoaddatitletoaslidethatdoesn'talreadyhaveoneandreturnaShapeobjectthatrepresentsthenewlycreatedtitle.UseShapes.Placeholders(index),whereindexistheplaceholder'sindexnumber,toreturnaShapeobjectthatrepresentsaplaceholder.Ifyouhavenotchangedthelayeringorderoftheshapesonaslide,thefollowingthreestatementsareequivalent,assumingthatslideonehasatitle.

ActivePresentation.Slides(1).Shapes.Title_

.TextFrame.TextRange.Font.Italic=True

ActivePresentation.Slides(1).Shapes.Placeholders(1)_

.TextFrame.TextRange.Font.Italic=True

ActivePresentation.Slides(1).Shapes(1).TextFrame_

.TextRange.Font.Italic=True

Page 296: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningtheShapesAttachedtotheEndsofaConnector

ToreturnaShapeobjectthatrepresentsoneoftheshapesattachedbyaconnector,usetheBeginConnectedShapeorEndConnectedShapeproperty.

Page 297: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningtheDefaultShapeforaPresentation

ToreturnaShapeobjectthatrepresentsthedefaultshapeforapresentation,usetheDefaultShapeproperty.

Page 298: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returninganewlycreatedfreeform

UsetheBuildFreeformandAddNodesmethodstodefinethegeometryofanewfreeform,andusetheConvertToShapemethodtocreatethefreeformandreturntheShapeobjectthatrepresentsit.

Page 299: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaSingleShapefromWithinaGroup

UseGroupItems(index),whereindexistheshapenameortheindexnumberwithinthegroup,toreturnaShapeobjectthatrepresentsasingleshapeinagroupedshape.

Page 300: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaNewlyFormedGroupofShapes

UsetheGrouporRegroupmethodtogrouparangeofshapesandreturnasingleShapeobjectthatrepresentsthenewlyformedgroup.Afteragrouphasbeenformed,youcanworkwiththegroupthesamewayyouworkwithanyothershape.

Page 301: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapeNodeObjectShapeNodes ShapeNode

Representsthegeometryandthegeometry-editingpropertiesofthenodesinauser-definedfreeform.Nodesincludetheverticesbetweenthesegmentsofthefreeformandthecontrolpointsforcurvedsegments.TheShapeNodeobjectisamemberoftheShapeNodescollection.TheShapeNodescollectioncontainsallthenodesinafreeform.

Page 302: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheShapeNodeObject

UseNodes(index),whereindexisthenodeindexnumber,toreturnasingleShapeNodeobject.IfnodeoneinshapethreeonmyDocumentisacornerpoint,thefollowingexamplemakesitasmoothpoint.Forthisexampletowork,shapethreemustbeafreeform.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.Nodes(1).EditingType=msoEditingCornerThen

.Nodes.SetEditingType1,msoEditingSmooth

EndIf

EndWith

Page 303: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapeRangeCollectionObjectMultipleobjects ShapeRange

Multipleobjects

Representsashaperange,whichisasetofshapesonadocument.Ashaperangecancontainasfewasasingleshapeorasmanyasalltheshapesonthedocument.Youcanincludewhichevershapesyouwant—chosenfromamongalltheshapesonthedocumentoralltheshapesintheselection—toconstructashaperange.Forexample,youcouldconstructaShapeRangecollectionthatcontainsthefirstthreeshapesonadocument,alltheselectedshapesonadocument,orallthefreeformsonadocument.

Foranoverviewofhowtoworkwitheitherasingleshapeorwithmorethanoneshapeatatime,seeWorkingwithShapes(DrawingObjects).

Page 304: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheShapeRangeCollection

Thissectiondescribeshowto:

Returnasetofshapesyouspecifybynameorindexnumber.Returnallorsomeoftheselectedshapesonadocument.

Page 305: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaSetofShapesYouSpecifybyNameorIndexNumber

UseShapes.Range(index),whereindexisthenameorindexnumberoftheshapeoranarraythatcontainseithernamesorindexnumbersofshapes,toreturnaShapeRangecollectionthatrepresentsasetofshapesonadocument.YoucanusetheArrayfunctiontoconstructanarrayofnamesorindexnumbers.ThefollowingexamplesetsthefillpatternforshapesoneandthreeonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.Range(Array(1,3)).Fill_

.PatternedmsoPatternHorizontalBrick

Thefollowingexamplesetsthefillpatternfortheshapesnamed"Oval4"and"Rectangle5"onmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

SetmyRange=myDocument.Shapes_

.Range(Array("Oval4","Rectangle5"))

myRange.Fill.PatternedmsoPatternHorizontalBrick

AlthoughyoucanusetheRangemethodtoreturnanynumberofshapesorslides,it'ssimplertousetheItemmethodifyouwanttoreturnonlyasinglememberofthecollection.Forexample,Shapes(1)issimplerthanShapes.Range(1).

Page 306: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningAllorSomeoftheSelectedShapesonaDocument

UsetheShapeRangepropertyoftheSelectionobjecttoreturnalltheshapesintheselection.Thefollowingexamplesetsthefillforegroundcolorforalltheshapesintheselectioninwindowone,assumingthatthere'satleastoneshapeintheselection.

Windows(1).Selection.ShapeRange.Fill.ForeColor_

.RGB=RGB(255,0,255)

UseSelection.ShapeRange(index),whereindexistheshapenameortheindexnumber,toreturnasingleshapewithintheselection.Thefollowingexamplesetsthefillforegroundcolorforshapetwointhecollectionofselectedshapesinwindowone,assumingthatthereareatleasttwoshapesintheselection.

Windows(1).Selection.ShapeRange(2).Fill.ForeColor_

.RGB=RGB(255,0,255)

Page 307: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideObjectMultipleobjects SlideRange

SlideMultipleobjects

Representsaslide.TheSlidescollectioncontainsalltheSlideobjectsinapresentation.

NoteDon'tbeconfusedifyou'retryingtoreturnareferencetoasingleslidebutyouendupwithaSlideRangeobject.AsingleslidecanberepresentedeitherbyaSlideobjectorbyaSlideRangecollectionthatcontainsonlyoneslide,dependingonhowyoureturnareferencetotheslide.Forexample,ifyoucreateandreturnareferencetoaslidebyusingtheAddmethod,theslideisrepresentedbyaSlideobject.However,ifyoucreateandreturnareferencetoaslidebyusingtheDuplicatemethod,theslideisrepresentedbyaSlideRangecollectionthatcontainsasingleslide.BecauseallthepropertiesandmethodsthatapplytoaSlideobjectalsoapplytoaSlideRangecollectionthatcontainsasingleslide,youcanworkwiththereturnedslideinthesameway,regardlessofwhetherit'srepresentedbyaSlideobjectoraSlideRangecollection.

Page 308: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlideObject

Thissectiondescribeshowto:

Returnaslidethatyouspecifybyname,indexnumber,orslideIDnumberReturnaslideintheselectionReturntheslidethat'scurrentlydisplayedinanydocumentwindoworslideshowwindowyouspecifyCreateanewslide

Page 309: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningaslidethatyouspecifybyname,indexnumber,orslideIDnumber

UseSlides(index),whereindexistheslidenameorindexnumber,oruseSlides.FindBySlideID(index),whereindexistheslideIDnumber,toreturnasingleSlideobject.Thefollowingexamplesetsthelayoutforslideoneintheactivepresentation.

ActivePresentation.Slides(1).Layout=ppLayoutTitle

ThefollowingexamplesetsthelayoutfortheslidewiththeIDnumber265.

ActivePresentation.Slides.FindBySlideID(265).Layout=ppLayoutTitle

Page 310: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningaslideintheselection

UseSelection.SlideRange(index),whereindexistheslidenameorindexnumberwithintheselection,toreturnasingleSlideobject.Thefollowingexamplesetsthelayoutforslideoneintheselectionintheactivewindow,assumingthatthere'satleastoneslideselected.

ActiveWindow.Selection.SlideRange(1).Layout=ppLayoutTitle

Ifthere'sonlyoneslideselected,youcanuseSelection.SlideRangetoreturnaSlideRangecollectionthatcontainstheselectedslide.Thefollowingexamplesetsthelayoutforslideoneinthecurrentselectionintheactivewindow,assumingthatthere'sexactlyoneslideselected.

ActiveWindow.Selection.SlideRange.Layout=ppLayoutTitle

Page 311: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returningtheslidethat'scurrentlydisplayedinanydocumentwindoworslideshowwindowyouspecify

UsetheSlidepropertytoreturntheslidethat'scurrentlydisplayedinthespecifieddocumentwindoworslideshowwindowview.Thefollowingexamplecopiestheslidethat'scurrentlydisplayedindocumentwindowtwototheClipboard.

Windows(2).View.Slide.Copy

Page 312: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Creatinganewslide

UsetheAddmethodtocreateanewslideandaddittothepresentation.Thefollowingexampleaddsatitleslidetothebeginningoftheactivepresentation.

ActivePresentation.Slides.Add1,ppLayoutTitleOnly

Page 313: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowSettingsObjectPresentation SlideShowSettings

Multipleobjects

Representstheslideshowsetupforapresentation.

Page 314: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlideShowSettingsObject

UsetheSlideShowSettingspropertytoreturntheSlideShowSettingsobject.Thefirstsectioninthefollowingexamplesetsalltheslidesintheactivepresentationtoadvanceautomaticallyafterfiveseconds.Thesecondsectionsetstheslideshowtostartonslidetwo,endonslidefour,advanceslidesbyusingthetimingssetinthefirstsection,andruninacontinuousloopuntiltheuserpressesESC.Finally,theexamplerunstheslideshow.

ForEachsInActivePresentation.Slides

Withs.SlideShowTransition

.AdvanceOnTime=True

.AdvanceTime=5

EndWith

Next

WithActivePresentation.SlideShowSettings

.RangeType=ppShowSlideRange

.StartingSlide=2

.EndingSlide=4

.AdvanceMode=ppSlideShowUseSlideTimings

.LoopUntilStopped=True

.Run

EndWith

Page 315: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowTransitionObjectMultipleobjects SlideShowTransition

SoundEffect

Containsinformationabouthowthespecifiedslideadvancesduringaslideshow.

Page 316: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlideShowTransitionObject

UsetheSlideShowTransitionpropertytoreturntheSlideShowTransitionobject.ThefollowingexamplespecifiesaFastStripsDown-LefttransitionaccompaniedbytheBass.wavsoundforslideoneintheactivepresentationandspecifiesthattheslideadvanceautomaticallyfivesecondsafterthepreviousanimationorslidetransition.

WithActivePresentation.Slides(1).SlideShowTransition

.Speed=ppTransitionSpeedFast

.EntryEffect=ppEffectStripsDownLeft

.SoundEffect.ImportFromFile"c:\sndsys\bass.wav"

.AdvanceOnTime=True

.AdvanceTime=5

EndWith

ActivePresentation.SlideShowSettings.AdvanceMode=_

ppSlideShowUseSlideTimings

Page 317: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 318: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowViewObjectSlideShowWindow SlideShowView

Multipleobjects

Representstheviewinaslideshowwindow.

Page 319: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlideShowViewObject

UsetheViewpropertyoftheSlideShowWindowobjecttoreturntheSlideShowViewobject.Thefollowingexamplesetsslideshowwindowonetodisplaythefirstslideinthepresentation.

SlideShowWindows(1).View.First

UsetheRunmethodoftheSlideShowSettingsobjecttocreateaSlideShowWindowobject,andthenusetheViewpropertytoreturntheSlideShowViewobjectthewindowcontains.Thefollowingexamplerunsaslideshowoftheactivepresentation,changesthepointertoapen,andsetsthepencolorfortheslideshowtored.

WithActivePresentation.SlideShowSettings.Run.View

.PointerColor.RGB=RGB(255,0,0)

.PointerType=ppSlideShowPointerPen

EndWith

Page 320: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowWindowObjectApplication SlideShowWindows

SlideShowWindowMultipleobjects

Representsawindowinwhichaslideshowruns.

Page 321: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSlideShowWindowObject

UseSlideShowWindows(index),whereindexistheslideshowwindowindexnumber,toreturnasingleSlideShowWindowobject.Thefollowingexampleactivatesslideshowwindowtwo.

SlideShowWindows(2).Activate

UsetheRunmethodtocreateanewslideshowwindowandreturnareferencetothisslideshowwindow.Thefollowingexamplerunsaslideshowoftheactivepresentationandreducestheheightoftheslideshowwindowjustenoughsothatyoucanseethetaskbar(forscreenswitharesolutionof800by600).

WithActivePresentation.SlideShowSettings

.ShowType=ppShowTypeSpeaker

With.Run

.Height=300

.Width=400

EndWith

EndWith

UsetheViewpropertytoreturntheviewinthespecifiedslideshowwindow.Thefollowingexamplesetstheviewinslideshowwindowonetodisplayslidethreeinthepresentation.

SlideShowWindows(1).View.GotoSlide3

UsethePresentationpropertytoreturnthepresentationthat'scurrentlyrunninginthespecifiedslideshowwindow.Thefollowingexampledisplaysthenameofthepresentationthat'scurrentlyrunninginslideshowwindowone.

MsgBoxSlideShowWindows(1).Presentation.Name

Page 322: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 323: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SoundEffectObjectMultipleobjects SoundEffect

Representsthesoundeffectthataccompaniesananimationorslidetransitioninaslideshow.

Page 324: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheSoundEffectObject

UsetheSoundEffectpropertyoftheAnimationSettingsobjecttoreturntheSoundEffectobjectthatrepresentsthesoundeffectthataccompaniesananimation.ThefollowingexamplespecifiesthattheanimationofthetitleonslideoneintheactivepresentationbeaccompaniedbythesoundintheBass.wavfile.

WithActivePresentation.Slides(1).Shapes(1).AnimationSettings

.TextLevelEffect=ppAnimateByAllLevels

.SoundEffect.ImportFromFile"c:\sndsys\bass.wav"

EndWith

UsetheSoundEffectpropertyoftheSlideShowTransitionobjecttoreturntheSoundEffectobjectthatrepresentsthesoundeffectthataccompaniesaslidetransition.

ThefollowingexamplespecifiesthatthetransitiontoslideoneintheactivepresentationbeaccompaniedbythesoundintheBass.wavfile.

ActivePresentation.Slides(1).SlideShowTransition.SoundEffect_

.ImportFromFile"c:\sndsys\bass.wav"

Page 325: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TableObjectMultipleobjects Table

Multipleobjects

Representsatableshapeonaslide.TheTableobjectisamemberoftheShapescollection.TheTableobjectcontainstheColumnscollectionandtheRowscollection.

Page 326: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTableObject

UseShapes(index),whereindexisanumber,toreturnashapecontainingatable.UsetheHasTablepropertytoseeifashapecontainsatable.Thisexamplewalksthroughtheshapesonslideone,checkstoseeifeachshapehasatable,andthensetsthemouseclickactionforeachtableshapetoadvancetothenextslide.

WithActivePresentation.Slides(2).Shapes

Fori=1To.Count

If.Item(i).HasTableThen

.Item(i).ActionSettings(ppMouseClick)_

.Action=ppActionNextSlide

EndIf

Next

EndWith

UsetheCellmethodoftheTableobjecttoaccessthecontentsofeachcell.Thisexampleinsertsthetext"Cell1"inthefirstcellofthetableinshapefiveonslidethree.

ActivePresentation.Slides(3).Shapes(5).Table_

.Cell(1,1).Shape.TextFrame.TextRange_

.Text="Cell1"

UsetheAddTablemethodtoaddatabletoaslide.Thisexampleaddsa3x3tableonslidetwointheactivepresentation.

ActivePresentation.Slides(2).Shapes.AddTable(3,3)

Page 327: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TabStopObjectTabStops TabStop

Representsasingletabstop.TheTabStopobjectisamemberoftheTabStopscollection.TheTabStopscollectionrepresentsallthetabstopsononeruler.

Page 328: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingTheTabstopObject

UseTabStops(index),whereindexisthetabstopindexnumber,toreturnasingleTabStopobject.Thefollowingexampleclearstabstoponeforthetextinshapetwoonslideoneintheactivepresentation.

ActivePresentation.Slides(1).Shapes(2).TextFrame_

.Ruler.TabStops(1).Clear

Page 329: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TagsObjectMultipleobjects Tags

Representsatagoracustompropertythatyoucancreateforashape,slide,orpresentation.EachTagsobjectcontainsthenameofacustompropertyandavalueforthatproperty.

Createtagswhenyouwanttobeabletoselectivelyworkwithspecificmembersofacollection,basedonanattributethatisn'talreadyrepresentedbyabuilt-inproperty.Forexample,ifyouwanttobeabletocategorizeslidesinapresentationbasedonwhatregionofthecountry/regiontheyapplyto,youcouldcreateaRegiontagandassignaRegionvaluetoeachslideinthepresentation.Youcouldthenselectivelyperformanoperationonsomeoftheslides,basedonthevaluesoftheirRegiontags,suchashidingalltheslideswiththeRegionvalue"East."

Page 330: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTagsObject

UsetheAddmethodtoaddatagtoanobject.Thefollowingexampleaddsatagwiththename"Region"andwiththevalue"East"toslideoneintheactivepresentation.

ActivePresentation.Slides(1).Tags.Add"Region","East"

UseTags(index),whereindexisthenameofatag,toreturnathetagvalue.ThefollowingexampleteststhevalueoftheRegiontagforallslidesintheactivepresentationandhidesanyslidesthatdon'tpertaintotheEastCoast(denotedbythevalue"East").

ForEachsInActivePresentation.Slides

Ifs.Tags("region")<>"east"Then

s.SlideShowTransition.Hidden=True

EndIf

Next

Page 331: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextEffectFormatObjectMultipleobjects TextEffectFormat

ContainspropertiesandmethodsthatapplytoWordArtobjects.

Page 332: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTextEffectFormatObject

UsetheTextEffectpropertytoreturnaTextEffectFormatobject.ThefollowingexamplesetsthefontnameandformattingforshapeoneonmyDocument.Forthisexampletowork,shapeonemustbeaWordArtobject.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).TextEffect

.FontName="CourierNew"

.FontBold=True

.FontItalic=True

EndWith

Page 333: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 334: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextFrameObjectMultipleobjects TextFrame

Multipleobjects

RepresentsthetextframeinaShapeobject.Containsthetextinthetextframeaswellasthepropertiesandmethodsthatcontrolthealignmentandanchoringofthetextframe.

Page 335: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTextFrameObject

UsetheTextFramepropertytoreturnaTextFrameobject.ThefollowingexampleaddsarectangletomyDocument,addstexttotherectangle,andthensetsthemarginsforthetextframe.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeRectangle,0,0,250,140).TextFrame

.TextRange.Text="Hereissometesttext"

.MarginBottom=10

.MarginLeft=10

.MarginRight=10

.MarginTop=10

EndWith

UsetheHasTextFramepropertytodeterminewhetherashapehasatextframe,andusetheHasTextpropertytodeterminewhetherthetextframecontainstext,asshowninthefollowingexample.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.HasTextFrameThen

Withs.TextFrame

If.HasTextThenMsgBox.TextRange.Text

EndWith

EndIf

Next

Page 336: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextRangeObjectMultipleobjects TextRange

Multipleobjects

Containsthetextthat'sattachedtoashape,aswellaspropertiesandmethodsformanipulatingthetext.

Page 337: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTextRangeObject

Thissectiondescribeshowto:

Returnthetextrangeinanyshapeyouspecify.Returnatextrangefromtheselection.Returnparticularcharacters,words,lines,sentences,orparagraphsfromatextrange.Findandreplacetextinatextrange.Inserttext,thedateandtime,ortheslidenumberintoatextrange.Positiontheinsertionpointwhereveryouwantinatextrange.

Page 338: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaTextRangefromAnyShapeYouSpecify

UsetheTextRangepropertyoftheTextFrameobjecttoreturnaTextRangeobjectforanyshapeyouspecify.UsetheTextpropertytoreturnthestringoftextintheTextRangeobject.ThefollowingexampleaddsarectangletomyDocumentandsetsthetextitcontains.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddShape(msoShapeRectangle,0,0,250,140)_

.TextFrame.TextRange.Text="Hereissometesttext"

BecausetheTextpropertyisthedefaultpropertyoftheTextRangeobject,thefollowingtwostatementsareequivalent.

ActivePresentation.Slides(1).Shapes(1).TextFrame_

.TextRange.Text="Hereissometesttext"

ActivePresentation.Slides(1).Shapes(1).TextFrame_

.TextRange="Hereissometesttext"

UsetheHasTextFramepropertytodeterminewhetherashapehasatextframe,andusetheHasTextpropertytodeterminewhetherthetextframecontainstext.

Page 339: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningaTextRangefromtheSelection

UsetheTextRangepropertyoftheSelectionobjecttoreturnthecurrentlyselectedtext.ThefollowingexamplecopiestheselectiontotheClipboard.

ActiveWindow.Selection.TextRange.Copy

Page 340: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturningParticularCharacters,Words,Lines,Sentences,orParagraphsfromaTextRange

UseoneofthefollowingmethodstoreturnaportionofthetextofaTextRangeobject:Characters,Lines,Paragraphs,Runs,Sentences,orWords.

Page 341: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FindingandReplacingTextinaTextRange

UsetheFindandReplacemethodstofindandreplacetextinatextrange.

Page 342: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertingText,theDateandTime,ortheSlideNumberintoaTextRange

UseoneofthefollowingmethodstoinsertcharactersintoaTextRangeobject:InsertAfter,InsertBefore,InsertDateTime,InsertSlideNumber,orInsertSymbol.

Page 343: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextStyleObjectTextStyles TextStyle

Multipleobjects

Representsoneofthreetextstyles:titletext,bodytext,ordefaulttext.EachtextstylecontainsaTextFrameobjectthatdescribeshowtextisplacedwithinthetextboundingbox,aRulerobjectthatcontainstabstopsandoutlineindentformattinginformation,andaTextStyleLevelscollectionthatcontainsoutlinetextformattinginformation.TheTextStyleobjectisamemberoftheTextStylescollection.

Page 344: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTextStyleObject

UseTextStyles(index),whereindexiseitherppBodyStyle,ppDefaultStyle,orppTitleStyle,toreturnasingleTextStyleobject.Thefollowingexamplesetsthefontnameandfontsizeforlevel-onebodytextonalltheslidesintheactivepresentation.

WithActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).Levels(1)

With.Font

.Name="Arial"

.Size=36

EndWith

EndWith

Page 345: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextStyleLevelObjectTextStyleLevels TextStyleLevel

Multipleobjects

Containscharacterandparagraphformattinginformationforanoutlinelevel.TheTextStyleLevelobjectisamemberoftheTextStyleLevelscollection.TheTextStyleLevelscollectioncontainsoneTextStyleLevelobjectforeachofthefiveoutlinelevels

Page 346: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTextStyleLevelObject

UseLevels(index),whereindexisanumberfrom1through5thatcorrespondstotheoutlinelevel,toreturnasingleTextStyleLevelobject.Thefollowingexamplesetsthefontnameandfontsize,thespacebeforeparagraphs,andtheparagraphalignmentforlevel-onebodytextonalltheslidesintheactivepresentation.

WithActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).Levels(1)

With.Font

.Name="Arial"

.Size=36

EndWith

With.ParagraphFormat

.LineRuleBefore=False

.SpaceBefore=14

.Alignment=ppAlignJustify

EndWith

EndWith

Page 347: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ThreeDFormatObjectMultipleobjects ThreeDFormat

ColorFormat

Representsashape'sthree-dimensionalformatting.

Page 348: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingTheThreeDFormatObject

UsetheThreeDpropertytoreturnaThreeDFormatobject.ThefollowingexampleaddsanovaltomyDocumentandthenspecifiesthattheovalbeextrudedtoadepthof50pointsandthattheextrusionbepurple.

SetmyDocument=ActivePresentation.Slides(1)

SetmyShape=myDocument.Shapes_

.AddShape(msoShapeOval,90,90,90,40)

WithmyShape.ThreeD

.Visible=True

.Depth=50

'RGBvalueforpurple

.ExtrusionColor.RGB=RGB(255,100,255)

EndWith

Page 349: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcannotapplythree-dimensionalformattingtosomekindsofshapes,suchasbeveledshapesormultiple-disjointpaths.MostofthepropertiesandmethodsoftheThreeDFormatobjectforsuchashapewillfail.

Page 350: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TimeLineObjectMultipleobjects TimeLine

Multipleobjects

StoresanimationinformationforaMaster,SlideorSlideRangeobject.

Page 351: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTimeLineobject

UsetheTimeLinepropertyoftheMaster,Slide,orSlideRangeobjecttoreturnaTimeLineobject.

TheTimeLineobject'sMainSequencepropertygainsaccesstothemainanimationsequence,whiletheInteractiveSequencespropertygainsaccesstothecollectionofinteractiveanimationsequencesofaslideorsliderange.Toreferenceatimelineobject,usesyntaxsimilartothesecodeexamples:

ActivePresentation.Slides(1).TimeLine.MainSequence

ActivePresentation.SlideMaster.TimeLine.InteractiveSequences

ActiveWindow.Selection.SlideRange.TimeLine.InteractiveSequences

Page 352: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TimingObject

Multipleobjects TimingShape

Representstimingpropertiesforananimationeffect.

Page 353: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheTimingobject

ToreturnaTimingobject,usetheTimingpropertyoftheAnimationBehaviororEffectobject.Thefollowingexamplesetstimingdurationinformationforthemainanimation.

ActiveWindow.Selection.SlideRange(1).TimeLine_

.MainSequence(1).Timing.Duration=5

Usethefollowingread/writepropertiesoftheTimingobjecttomanipulateanimationtimingeffects.

Usethis... Tochangethis...

Accelerate Percentageofthedurationoverwhichaccelerationshouldtakeplace

AutoReverse Whetheraneffectshouldplayforwardandthenreverse,therebydoublingtheduration

Decelerate Percentageofthedurationoverwhichaccelerationshouldtakeplace

Duration Lengthofanimation(inseconds)RepeatCount NumberoftimestorepeattheanimationRepeatDuration Howlongshouldtherepeatslast(inseconds)Restart Restartbehaviorofananimationnode

RewindAtEnd Whetheranobjectsreturntoitsbeginningpositionafteraneffecthasended

SmoothStart WhetheraneffectaccelerateswhenitstartsSmoothEnd WhetheraneffectdecelerateswhenitendsTriggerDelayTimeDelaytimefromwhenthetriggerisenabled(inseconds)TriggerShape WhichshapeisassociatedwiththetimingeffectTriggerType Howthetimingeffectistriggered

Page 354: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 355: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 356: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ViewObjectDocumentWindow View

PrintOptions

Representsthecurrenteditingviewinthespecifieddocumentwindow.

Page 357: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheViewObject

UsetheViewpropertyoftheDocumentWindowobjecttoreturntheViewobject.Thefollowingexamplesetsthesizeofwindowoneandthensetsthezoomtofitthenewwindowsize.

WithWindows(1)

.Height=200

.Width=250

.View.ZoomToFit=True

EndWith

NoteTheViewobjectcanrepresentanyofthedocumentwindowviews:normalview,slideview,outlineview,slidesorterview,notespageview,slidemasterview,handoutmasterview,ornotesmasterview.SomepropertiesandmethodsoftheViewobjectworkonlyincertainviews.Ifyoutrytouseapropertyormethodthat'sinappropriateforaViewobject,anerroroccurs.

Page 358: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WebOptionsObjectPresentation WebOptions

Containspresentation-levelattributesusedbyMicrosoftPowerPointwhenyousaveorpublishacompleteorpartialpresentationasaWebpageoropenaWebpage.Youcanreturnorsetattributeseitherattheapplication(global)leveloratthepresentationlevel.(Notethatattributevaluescanbedifferentfromonepresentationtoanother,dependingontheattributevalueatthetimethepresentationwassaved.)Presentation-levelattributesettingsoverrideapplication-levelattributesettings.Application-levelattributesarecontainedintheDefaultWebOptionsobject.

Page 359: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheWebOptionsObject

UsetheWebOptionspropertytoreturntheWebOptionsobject.ThefollowingexamplecheckstoseewhetherPortableNetworkGraphics(PNG)isallowedasanimageformatforpresentationone.IfPNGisallowed,itsetsthetextcolorfortheoutlinepanetowhiteandthebackgroundcolorfortheoutlineandslidepanestoblack.

SetobjAppWebOptions=Presentations(1).WebOptions

WithobjAppWebOptions

If.AllowPNG=TrueThen

.FrameColors=ppFrameColorsWhiteTextOnBlack

EndIf

EndWith

Page 360: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActivateMethodActivatesthespecifiedobject.

expression.Activate

expressionRequired.AnexpressionthatreturnsaDocumentWindow,Pane,OLEFormat,Application,orSlideShowWindowobject.

Page 361: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleactivatesthedocumentwindowimmediatelyfollowingtheactivewindowinthedocumentwindoworder.

Windows(2).Activate

Page 362: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 363: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddMethodAddmethodasitappliestotheAddInsobject.

ReturnsanAddInobjectthatrepresentsanadd-infileaddedtothelistofadd-ins.

expression.Add(Filename)

expressionRequired.AnexpressionthatreturnsanAddInsobject.

FilenameRequiredString.Thefullnameofthefile(includingthepathandfilenameextension)thatcontainstheadd-inyouwanttoaddtothelistofadd-ins.

Page 364: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethoddoesn'tloadthenewadd-in.YoumustsettheLoadedpropertytoloadtheadd-in.

AddmethodasitappliestotheAnimationBehaviorsobject.

ReturnsanAnimationBehaviorobjectthatrepresentsanewanimationbehavior.

expression.Add(Type,Index)

expressionRequired.AnexpressionthatreturnsanAnimationBehaviorsobject.

TypeRequiredMsoAnimType.Thebehavioroftheanimation.

MsoAnimTypecanbeoneoftheseMsoAnimTypeconstants.msoAnimTypeColormsoAnimTypeMixedmsoAnimTypeMotionmsoAnimTypeNonemsoAnimTypePropertymsoAnimTypeRotationmsoAnimTypeScale

IndexOptionalLong.Theplacementoftheanimationinrelationtootheranimationbehaviors.Thedefaultvalueis-1whichmeansthatiftheIndexargumentisomitted,thenewanimationbehaviorisaddedtotheendofexistinganimationbehaviors.

AddmethodasitappliestotheAnimationPointsandSequencesobjects.

ReturnsanAnimationPointorSequenceobjectthatrepresentsanewanimationpointorsequence.

Page 365: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expression.Add(Index)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

IndexOptionalLong.Thepositionoftheanimationpointorsequenceinrelationtootheranimationpointsorsequences.Thedefaultvalueis-1whichmeansthatiftheIndexargumentisomitted,thenewanimationpointorsequenceisaddedtotheendofexistinganimationpointsorsequence.

AddmethodasitappliestotheColorSchemesobject.

Addsacolorschemetothecollectionofavailableschemes.ReturnsaColorSchemeobjectthatrepresentstheaddedcolorscheme.

expression.Add(Scheme)

expressionRequired.AnexpressionthatreturnsaColorSchemesobject.

SchemeOptionalColorSchemeobject.Thecolorschemetoadd.CanbeaColorSchemeobjectfromanyslideormaster,oranitemintheColorSchemescollectionfromanyopenpresentation.Ifthisargumentisomitted,thefirstColorSchemeobject(thefirststandardcolorscheme)inthespecifiedpresentation'sColorSchemescollectionisused.

Page 366: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thenewcolorschemeisbasedonthecolorsusedonthespecifiedslideormasteroronthecolorsinthespecifiedcolorschemefromanopenpresentation.

TheColorSchemescollectioncancontainupto16colorschemes.IfyouneedtoaddanothercolorschemeandtheColorSchemescollectionisalreadyfull,usetheDeletemethodtoremoveanexistingcolorscheme.

NotethatalthoughMicrosoftPowerPointautomaticallycheckswhetheracolorschemeisaduplicatebeforeaddingitthroughtheuserinterface,itdoesn'tcheckbeforeaddingacolorschemethroughaVisualBasicprocedure.Yourproceduremustdoitsowncheckingtoavoidaddingredundantcolorschemes.

AddmethodasitappliestotheColumnsobject.

Addsanewcolumntoanexistingtable.ReturnsaColumnobjectthatrepresentsthenewtablecolumn.

expression.Add(BeforeColumn)

expressionRequired.AnexpressionthatreturnsaColumnsobject.

BeforeColumnOptionalLong.Theindexnumberspecifyingthetablecolumnbeforewhichthenewcolumnwillbeinserted.ThisargumentmustbeaLongfrom1tothenumberofcolumnsinthetable.Thedefaultvalueis-1whichmeansthatiftheBeforeColumnargumentisomitted,thenthenewcolumnisaddedasthelastcolumninthetable.

AddmethodasitappliestotheCommentsobject.

ReturnsaCommentobjectthatrepresentsanewcommentaddedtoaslide.

expression.Add(Left,Top,Author,AuthorInitials,Text)

expressionRequired.AnexpressionthatreturnsaCommentsobject.

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeofthe

Page 367: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

comment,relativetotheleftedgeofthepresentation.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeofthecomment,relativetothetopedgeofthepresentation.

AuthorRequiredString.Theauthorofthecomment.

AuthorInitialsRequiredString.Theauthor'sinitials.

TextRequiredString.Thecomment'stext.

AddmethodasitappliestotheDesignsobject.

ReturnsaDesignobjectthatrepresentsanewslidedesign.

expression.Add(designName,Index)

expressionRequired.AnexpressionthatreturnsaDesignsobject.

designNameRequiredString.Thenameofthedesign.

IndexOptionalInteger.Theindexnumberofthedesign.Thedefaultvalueis-1whichmeansthatiftheIndexargumentisomitted,thenthenewslidedesignisaddedattheendofexistingslidedesigns.

AddmethodasitappliestotheExtraColorsobject.

Addsacolortotheextracolorsavailabletoapresentationifthecolorhasn'talreadybeenadded.

expression.Add(Type)

expressionRequired.AnexpressionthatreturnsanExtraColorsobject.

TypeRequiredMsoRGBType.Thered-green-blue(RGB)valueofthecolortobeadded.

AddmethodasitappliestotheNamedSlideShowsobject.

Createsanewnamedslideshowandaddsittothecollectionofnamedslide

Page 368: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

showsinthespecifiedpresentation.ReturnsaNamedSlideShowobjectthatrepresentsthenewnamedslideshow.

expression.Add(Name,SafeArrayOfSlideIDs)

expressionRequired.AnexpressionthatreturnsaNamedSlideShowsobject.

NameRequiredString.Thenameoftheslideshow.

SafeArrayOfSlideIDsRequiredVariant.ContainstheuniqueslideIDsoftheslidestobedisplayedinaslideshow.

Page 369: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThenameyouspecifywhenyouaddanamedslideshowisthenameyouuseasanargumenttotheRunmethodtorunthenamedslideshow.

AddmethodasitappliestothePresentationsobject.

Createsapresentation.ReturnsaPresentationobjectthatrepresentsthenewpresentation.

expression.Add(WithWindow)

expressionRequired.AnexpressionthatreturnsaPresentationscollection.

WithWindowOptionalMsoTriState.MsoTruecreatesthepresentationinavisiblewindow.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThenewpresentationisn'tvisible.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Createsthepresentationinavisiblewindow.

AddmethodasitappliestothePrintRangesobject.

ReturnsaPrintRangeobjectthatrepresentsaconsecutiverunofslidestobeprinted.

expression.Add(Start,End)

expressionRequired.AnexpressionthatreturnsaPrintRangesobject.

StartRequiredLong.Thefirstslideintherangeofslidestobeprinted.MustbelessthanorequaltothevalueoftheEndargument.

EndRequiredLong.Thelastslideintherangeofslidestobeprinted.Mustbe

Page 370: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

greaterthanorequaltothevalueoftheStartargument.

Page 371: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheRangeTypepropertyofthePrintOptionsobjectmustbesettoppPrintSlideRangefortherangesinthePrintRangescollectiontobeapplied.

Ifyoudon'twanttoprintanentirepresentation,addprintrangestospecifywhichslidesyouwanttoprint.Youmustaddoneprintrangeforeachconsecutiverunofslidestobeprinted.Forexample,ifyouwanttoprintslide1,slides3through5,andslides8and9,youmustaddthreeprintrangeobjects.Formoreinformation,seetheexampleforthismethod.

UsetheClearAllmethodtoclearpreviously-definedprintranges.

AddmethodasitappliestotheRowsobject.

ReturnsaRowobjectthatrepresentsanewrowaddedtoanexistingtable.

expression.Add(BeforeRow)

expressionRequired.AnexpressionthatreturnsaRowsobject.

BeforeRowOptionalLong.Theindexnumberspecifyingthetablerowbeforewhichthenewrowwillbeinserted.Thisargumentmustbeanintegervaluefrom1tothenumberofrowsinthetable.Thedefaultvalueis-1whichmeansthatiftheBeforeRowargumentisomitted,thenthenewrowisaddedasthelastrowinthetable.

AddmethodasitappliestotheSlidesobject.

Createsanewslideandaddsittothecollectionofslidesinthespecifiedpresentation.ReturnsaSlideobjectthatrepresentsthenewslide.

expression.Add(Index,Layout)

expressionRequired.AnexpressionthatreturnsaSlidescollection.

IndexRequiredLong.TheindexnumberthenewslidewillhavewithintheSlidescollection.Thisvaluecannotexceedthenumberofexistingslides+1.If

Page 372: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

setto1,thenewslidebecomesthefirstslideinthepresentation.

LayoutRequiredPpSlideLayout.Thetypeofslidetocreate.

PpSlideLayoutcanbeoneofthesePpSlideLayoutconstants.ppLayoutBlankppLayoutChartppLayoutChartAndTextppLayoutClipartAndTextppLayoutClipArtAndVerticalTextppLayoutFourObjectsppLayoutLargeObjectppLayoutMediaClipAndTextppLayoutMixedppLayoutObjectppLayoutObjectAndTextppLayoutObjectOverTextppLayoutOrgchartppLayoutTableppLayoutTextppLayoutTextAndChartppLayoutTextAndClipartppLayoutTextAndMediaClipppLayoutTextAndObjectppLayoutTextAndTwoObjectsppLayoutTextOverObjectppLayoutTitleppLayoutTitleOnlyppLayoutTwoColumnTextppLayoutTwoObjectsAndTextppLayoutTwoObjectsOverTextppLayoutVerticalTextppLayoutVerticalTitleAndTextppLayoutVerticalTitleAndTextOverChart

Page 373: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Toalterthelayoutofanexistingslide,usetheLayoutproperty.

AddmethodasitappliestotheTabStopsobject.

Addsatabstoptotherulerforthespecifiedtext.ReturnsaTabStopobjectthatrepresentsthenewtabstop.

expression.Add(Type,Position)

expressionRequired.AnexpressionthatreturnsaTabStopscollection.

TypeRequiredPpTabStopType.Specifiesthewaytextwillbealignedwiththenewtabstop.

PpTabStopTypecanbeoneofthesePpTabStopTypeconstants.ppTabStopCenterppTabStopDecimalppTabStopLeftppTabStopMixedppTabStopRight

PositionRequiredSingle.Thepositionofthenewtabstop,inpoints.

AddmethodasitappliestotheTagsobject.

Createsatagforthespecifiedobject.Ifthetagalreadyexists,thismethodreplacestheexistingtagvalue.

expression.Add(Name,Value)

expressionRequired.AnexpressionthatreturnsaTagsobject.

NameRequiredString.Thenewtagname.Use"name"asthestringforthisargumenttosetthevalueofthenametag.

Page 374: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ValueRequiredString.Thenewtagvalue.

Page 375: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheTagsobjectcontainsapairofstrings—thetagnameandthetagvalue—foreachtag.UsetheAddmethodtocreateatag,andusetheNameandValuemethodstoreturnatag'snameandvaluecomponents.

Page 376: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheAddInsobject.

ThisexampleaddsMyTools.ppatothelistofadd-ins.

SetmyAddIn=Application.AddIns.Add(FileName:="c:\mydocuments\mytools.ppa")

MsgBoxmyAddIn.Name&"hasbeenaddedtothelist"

AsitappliestotheColorSchemesobject.

Thisexampleaddsanewcolorschemetothecollectionofstandardcolorschemesfortheactivepresentation.Thenewcolorschemeisbasedonthecolorsusedinslidetwointheactivepresentation.

WithActivePresentation

SetnewClrScheme=.Slides(2).ColorScheme

.ColorSchemes.AddScheme:=newClrScheme

EndWith

AsitappliestotheColumnsobject.

Thisexamplecreatesanewcolumnbeforecolumnoneinthetablerepresentedbyshapefiveonslidetwo.Itthensetsthewidthofthenewcolumnto72points(oneinch).

WithActivePresentation.Slides(2).Shapes(5).Table

.Columns.Add(1).Width=72

EndWith

AsitappliestotheNamedSlideShowsobject.

ThisexampleaddstotheactivepresentationanamedslideshowQuickShowthatcontainsslides2,7,and9.Theexamplethenrunsthisslideshow.

DimqSlides(1To3)AsLong

WithActivePresentation

Page 377: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

With.Slides

qSlides(1)=.Item(2).SlideID

qSlides(2)=.Item(7).SlideID

qSlides(3)=.Item(9).SlideID

EndWith

With.SlideShowSettings

.NamedSlideShows.AddName:="QuickShow",SafeArrayOfSlideIDs:=qSlides

.RangeType=ppShowNamedSlideShow

.SlideShowName="QuickShow"

.Run

EndWith

EndWith

AsitappliestothePresentationsobject.

Thisexamplecreatesapresentation,addsaslidetoit,andthensavesthepresentation.

WithPresentations.Add

.Slides.AddIndex:=1,Layout:=ppLayoutTitle

.SaveAs"Sample"

EndWith

AsitappliestothePrintRangesobject.

Thisexampleclearsanypreviouslydefinedprintrangesandthenprintsslide1,slides3through5,andslides8and9intheactivepresentation.

WithActivePresentation.PrintOptions

.RangeType=ppPrintSlideRange

With.Ranges

.ClearAll

.AddStart:=1,End:=1

.AddStart:=3,End:=5

.AddStart:=8,End:=9

EndWith

EndWith

ActivePresentation.PrintOut

AsitappliestotheRowsobject.

Thisexamplecreatesarowattheendofanexistingtableandsetstheheightof

Page 378: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

thenewrowto54points(.75inches).

WithActivePresentation.Slides(2).Shapes(5).Table

.Rows.Add.Height=54

EndWith

AsitappliestotheSlidesobject.

Thisexampleaddsaslidethatcontainsatitleplaceholderatthebeginningoftheactivepresentation.

ActivePresentation.Slides.AddIndex:=1,Layout:=ppLayoutTitleOnly

Thisexampleaddsablankslideattheendoftheactivepresentation.

WithActivePresentation.Slides

.AddIndex:=.Count+1,Layout:=ppLayoutBlank

EndWith

AsitappliestotheTabStopsobject.

Thisexamplesetsaleft-alignedtabstopat2inches(144points)forthetextinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2).TextFrame_

.Ruler.TabStops.AddType:=ppTabStopLeft,Position:=144

AsitappliestotheTagsobject.

ThisexampleaddsatagnamedPriorityandsetsthevalueofthenametagforslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Tags

'Setsvaluefornametag

.AddName:="Name",Value:="NewFigures"

'Adds"Priority"tagwithvalue"Low"

.AddName:="Priority",Value:="Low"

EndWith

Page 379: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AsitappliestotheExtraColorsobject.

Thisexampleaddsanextracolortotheactivepresentation(ifthecolorhasn'talreadybeenadded).

ActivePresentation.ExtraColors.AddRGB(Red:=69,Green:=32,Blue:=155)

Page 380: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddBaselineMethodAddsabaselinetoapresentationtoallowtrackingofchangesforalatermerge.

expression.AddBaseline(FileName)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

FileNameOptionalString.Thefullpathofafiletouseasthebaselineforthispresentation.IfFileNameisnotspecified,thenthepresentationrepresentedbyexpressionisusedasitsownbaseline.

Page 381: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethodgeneratesanerrorifthepresentationalreadyhasabaseline,orisamergedauthordocument.

Page 382: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowinglineofcodeaddsabaselinetotheactivepresentation.

SubSetBaseline()

ActivePresentation.AddBaseline

EndSub

Page 383: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 384: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddCalloutMethodCreatesaborderlesslinecallout.ReturnsaShapeobjectthatrepresentsthenewcallout.

expression.AddCallout(Type,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TypeRequiredMsoCalloutType.Thetypeofcalloutline.

MsoCalloutTypecanbeoneoftheseMsoCalloutTypeconstants.msoCalloutOneAsingle-segmentcalloutlinethatcanbeeitherhorizontalorvertical.msoCalloutTwoAsingle-segmentcalloutlinethatrotatesfreely.msoCalloutThreeAtwo-segmentline.msoCalloutFourAthree-segmentline.

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeofthecallout'sboundingboxrelativetotheleftedgeoftheslide.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeofthecallout'sboundingboxrelativetothetopedgeoftheslide.

WidthRequiredSingle.Thewidthofthecallout'sboundingbox,measuredinpoints.

HeightRequiredSingle.Theheightofthecallout'sboundingbox,measuredinpoints.

Page 385: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucaninsertagreatervarietyofcalloutsbyusingtheAddShapemethod.

Page 386: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaborderlesscalloutwithafreely-rotatingone-segmentcalloutlinetomyDocumentandthensetsthecalloutangleto30degrees.

SubNewCallout()

DimsldOneAsSlide

SetsldOne=ActivePresentation.Slides(1)

sldOne.Shapes.AddCallout(Type:=msoCalloutTwo,Left:=50,Top:=50,_

Width:=200,Height:=100).Callout.Angle=msoCalloutAngle30

EndSub

Page 387: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddCommentMethodAddsacomment.ReturnsaShapeobjectthatrepresentsthenewcomment.

expression.AddComment(Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsaShapesobject.

Left,TopOptionalSingle.Theposition(inpoints)oftheupper-leftcornerofthecommentboundingboxrelativetotheupper-leftcornerofthedocument.Bydefault,thecommentisplacedintheupper-leftcornerofthedocument.

Width,HeightOptionalSingle.Thewidthandheightofthecomment,inpoints.Bydefault,thecommentis100pointshighand100pointswide.

Page 388: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsacommentthatcontainsthetext"TestComment"tomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddComment(100,100,150,150)

.TextFrame.TextRange.Text=.TextFrame_

.TextRange.Text+"TestComment"

EndWith

Page 389: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 390: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddConnectorMethodCreatesaconnector.ReturnsaShapeobjectthatrepresentsthenewconnector.Whenaconnectorisadded,it'snotconnectedtoanything.UsetheBeginConnectandEndConnectmethodstoattachthebeginningandendofaconnectortoothershapesinthedocument.

expression.AddConnector(Type,BeginX,BeginY,EndX,EndY)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TypeRequiredMsoConnectorType.Thetypeofconnector.

MsoConnectorTypecanbeoneoftheseMsoConnectorTypeconstants.msoConnectorCurvemsoConnectorElbowmsoConnectorStraightmsoConnectorTypeMixed

BeginXRequiredSingle.Thehorizontalposition,measuredinpoints,oftheconnector'sstartingpointrelativetotheleftedgeoftheslide.

BeginYRequiredSingle.Theverticalposition,measuredinpoints,oftheconnector'sstartingpointrelativetothetopedgeoftheslide.

EndXRequiredSingle.Thehorizontalposition,measuredinpoints,oftheconnector'sendingpointrelativetotheleftedgeoftheslide.

EndYRequiredSingle.Theverticalposition,measuredinpoints,oftheconnector'sendingpointrelativetothetopedgeoftheslide.

Page 391: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Whenyouattachaconnectortoashape,thesizeandpositionoftheconnectorareautomaticallyadjusted,ifnecessary.Therefore,ifyou'regoingtoattachaconnectortoothershapes,thepositionanddimensionsyouspecifywhenaddingtheconnectorareirrelevant.

Page 392: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstworectanglestomyDocumentandconnectsthemwithacurvedconnector.Notethatwhenyouattachtheconnectortotherectangles,thesizeandpositionoftheconnectorareautomaticallyadjusted;therefore,thepositionanddimensionsyouspecifywhenaddingthecalloutareirrelevant(dimensionsmustbenonzero).

SubNewConnector()

DimshpShapesAsShapes

DimshpFirstAsShape

DimshpSecondAsShape

SetshpShapes=ActivePresentation.Slides(1).Shapes

SetshpFirst=shpShapes.AddShape(Type:=msoShapeRectangle,_

Left:=100,Top:=50,Width:=200,Height:=100)

SetshpSecond=shpShapes.AddShape(Type:=msoShapeRectangle,_

Left:=300,Top:=300,Width:=200,Height:=100)

WithshpShapes.AddConnector(Type:=msoConnectorCurve,BeginX:=0,_

BeginY:=0,EndX:=100,EndY:=100).ConnectorFormat

.BeginConnectConnectedShape:=shpFirst,ConnectionSite:=1

.EndConnectConnectedShape:=shpSecond,ConnectionSite:=1

.Parent.RerouteConnections

EndWith

EndSub

Page 393: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 394: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddCurveMethodCreatesaBéziercurve.ReturnsaShapeobjectthatrepresentsthenewcurve.

expression.AddCurve(SafeArrayOfPoints)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

SafeArrayOfPointsRequiredVariant.Anarrayofcoordinatepairsthatspecifiestheverticesandcontrolpointsofthecurve.Thefirstpointyouspecifyisthestartingvertex,andthenexttwopointsarecontrolpointsforthefirstBéziersegment.Then,foreachadditionalsegmentofthecurve,youspecifyavertexandtwocontrolpoints.Thelastpointyouspecifyistheendingvertexforthecurve.Notethatyoumustalwaysspecify3n+1points,wherenisthenumberofsegmentsinthecurve.

Page 395: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsatwo-segmentBéziercurvetomyDocument.

Dimpts(1To7,1To2)AsSingle

pts(1,1)=0

pts(1,2)=0

pts(2,1)=72

pts(2,2)=72

pts(3,1)=100

pts(3,2)=40

pts(4,1)=20

pts(4,2)=50

pts(5,1)=90

pts(5,2)=120

pts(6,1)=60

pts(6,2)=30

pts(7,1)=150

pts(7,2)=90

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddCurveSafeArrayOfPoints:=pts

Page 396: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 397: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddDiagramMethodReturnsaShapeobjectthatrepresentsadiagramaddedtoaslide,slidemaster,orsliderange.

expression.AddDiagram(Type,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TypeRequiredMsoDiagramType.Thetypeofdiagram.

MsoDiagramTypecanbeoneoftheseMsoDiagramTypeconstants.msoDiagramCycleShowsaprocesswithacontinuouscycle.msoDiagramMixedNotusedwiththismethod.msoDiagramOrgChartShowshierarchicalrelationships.msoDiagramPyramidShowfoundation-basedrelationships.msoDiagramRadialShowsrelationshipsofacoreelement.msoDiagramTargetShowsstepstowardagoal.msoDiagramVennShowsareasofoverlapbetweenelements.

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeofthediagramcanvas'sboundingbox,relativetotheleftedgeofthepage.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeofthediagramcanvas'sboundingbox,relativetothetopedgeofthepage.

WidthRequiredSingle.Thewidth,measuredinpoints,ofthediagramcanvas'sboundingbox.

HeightRequiredSingle.Theheight,measuredinpoints,ofthediagramcanvas'sboundingbox.

Page 398: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsapyramiddiagramwithfournodestothefirstslideintheactivepresentation.

SubCreatePyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addspyramiddiagramandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreemorechildnodestopyramiddiagram

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

EndSub

Page 399: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 400: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddEffectMethodReturnsanEffectobjectthatrepresentsanewanimationeffectaddedtoasequenceofanimationeffects.

expression.AddEffect(Shape,effectId,Level,trigger,Index)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ShapeRequiredShapeobject.Theshapetowhichtheanimationeffectisadded.

effectIdRequiredMsoAnimEffect.Theanimationeffecttobeapplied.

MsoAnimEffectcanbeoneoftheseMsoAnimEffectconstants.msoAnimEffectAppearmsoAnimEffectArcUpmsoAnimEffectAscendmsoAnimEffectBlastmsoAnimEffectBlindsmsoAnimEffectBoldFlashmsoAnimEffectBoldRevealmsoAnimEffectBoomerangmsoAnimEffectBouncemsoAnimEffectBoxmsoAnimEffectBrushOnColormsoAnimEffectBrushOnUnderlinemsoAnimEffectCenterRevolvemsoAnimEffectChangeFillColormsoAnimEffectChangeFontmsoAnimEffectChangeFontColormsoAnimEffectChangeFontSizemsoAnimEffectChangeFontStyle

Page 401: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectChangeLineColormsoAnimEffectCheckerboardmsoAnimEffectCirclemsoAnimEffectColorBlendmsoAnimEffectColorRevealmsoAnimEffectColorWavemsoAnimEffectComplementaryColormsoAnimEffectComplementaryColor2msoAnimEffectContrastingColormsoAnimEffectCrawlmsoAnimEffectCreditsmsoAnimEffectCustommsoAnimEffectDarkenmsoAnimEffectDesaturatemsoAnimEffectDescendmsoAnimEffectDiamondmsoAnimEffectDissolvemsoAnimEffectEaseInmsoAnimEffectExpandmsoAnimEffectFademsoAnimEffectFadedAscendmsoAnimEffectFadedSwivelmsoAnimEffectFadedZoommsoAnimEffectFlashBulbmsoAnimEffectFlashOncemsoAnimEffectFlickermsoAnimEffectFlipmsoAnimEffectFloatmsoAnimEffectFlymsoAnimEffectFoldmsoAnimEffectGlidemsoAnimEffectGrowAndTurnmsoAnimEffectGrowShrink

Page 402: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectGrowWithColormsoAnimEffectLightenmsoAnimEffectLightSpeedmsoAnimEffectMediaPausemsoAnimEffectMediaPlaymsoAnimEffectMediaStopmsoAnimEffectPath4PointStarmsoAnimEffectPath5PointStarmsoAnimEffectPath6PointStarmsoAnimEffectPath8PointStarmsoAnimEffectPathArcDownmsoAnimEffectPathArcLeftmsoAnimEffectPathArcRightmsoAnimEffectPathArcUpmsoAnimEffectPathBeanmsoAnimEffectPathBounceLeftmsoAnimEffectPathBounceRightmsoAnimEffectPathBuzzsawmsoAnimEffectPathCirclemsoAnimEffectPathCrescentMoonmsoAnimEffectPathCurvedSquaremsoAnimEffectPathCurvedXmsoAnimEffectPathCurvyLeftmsoAnimEffectPathCurvyRightmsoAnimEffectPathCurvyStarmsoAnimEffectPathDecayingWavemsoAnimEffectPathDiagonalDownRightmsoAnimEffectPathDiagonalUpRightmsoAnimEffectPathDiamondmsoAnimEffectPathDownmsoAnimEffectPathEqualTrianglemsoAnimEffectPathFigure8FourmsoAnimEffectPathFootball

Page 403: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectPathFunnelmsoAnimEffectPathHeartmsoAnimEffectPathHeartbeatmsoAnimEffectPathHexagonmsoAnimEffectPathHorizontalFigure8msoAnimEffectPathInvertedSquaremsoAnimEffectPathInvertedTrianglemsoAnimEffectPathLeftmsoAnimEffectPathLoopdeLoopmsoAnimEffectPathNeutronmsoAnimEffectPathOctagonmsoAnimEffectPathParallelogrammsoAnimEffectPathPeanutmsoAnimEffectPathPentagonmsoAnimEffectPathPlusmsoAnimEffectPathPointyStarmsoAnimEffectPathRightTrianglemsoAnimEffectPathSCurve1msoAnimEffectPathSCurve2msoAnimEffectPathSineWavemsoAnimEffectPathSpiralLeftmsoAnimEffectPathSpiralRightmsoAnimEffectPathSpringmsoAnimEffectPathSquaremsoAnimEffectPathStairsDownmsoAnimEffectPathSwooshmsoAnimEffectPathTeardropmsoAnimEffectPathTrapezoidmsoAnimEffectPathTurnDownmsoAnimEffectPathTurnRightmsoAnimEffectPathTurnUpmsoAnimEffectPathTurnUpRightmsoAnimEffectPathVerticalFigure8

Page 404: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectPathWavemsoAnimEffectPathZigzagmsoAnimEffectPeekmsoAnimEffectPinwheelmsoAnimEffectPlusmsoAnimEffectRandomBarsmsoAnimEffectRandomEffectsmsoAnimEffectRiseUpmsoAnimEffectShimmermsoAnimEffectSlingmsoAnimEffectSpinmsoAnimEffectSpinnermsoAnimEffectSpiralmsoAnimEffectSplitmsoAnimEffectStretchmsoAnimEffectStretchymsoAnimEffectStripsmsoAnimEffectStyleEmphasismsoAnimEffectSwishmsoAnimEffectSwivelmsoAnimEffectTeetermsoAnimEffectThinLinemsoAnimEffectTransparencymsoAnimEffectUnfoldmsoAnimEffectVerticalGrowmsoAnimEffectWavemsoAnimEffectWedgemsoAnimEffectWheelmsoAnimEffectWhipmsoAnimEffectWipemsoAnimEffectZipmsoAnimEffectZoom

Page 405: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LevelOptionalMsoAnimateByLevel.Forcharts,diagrams,ortext,theleveltowhichtheanimationeffectwillbeapplied.ThedefaultvalueismsoAnimationLevelNone.

MsoAnimateByLevelcanbeoneoftheseMsoAnimateByLevelconstants.msoAnimateChartAllAtOncemsoAnimateChartByCategorymsoAnimateChartByCategoryElementsmsoAnimateChartBySeriesmsoAnimateChartBySeriesElementsmsoAnimateDiagramAllAtOncemsoAnimateDiagramBreadthByLevelmsoAnimateDiagramBreadthByNodemsoAnimateDiagramClockwisemsoAnimateDiagramClockwiseInmsoAnimateDiagramClockwiseOutmsoAnimateDiagramCounterClockwisemsoAnimateDiagramCounterClockwiseInmsoAnimateDiagramCounterClockwiseOutmsoAnimateDiagramDepthByBranchmsoAnimateDiagramDepthByNodemsoAnimateDiagramDownmsoAnimateDiagramInByRingmsoAnimateDiagramOutByRingmsoAnimateDiagramUpmsoAnimateLevelMixedmsoAnimateTextByAllLevelsmsoAnimateTextByFifthLevelmsoAnimateTextByFirstLevelmsoAnimateTextByFourthLevelmsoAnimateTextBySecondLevelmsoAnimateTextByThirdLevelmsoAnimationLevelNone

Page 406: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

triggerOptionalMsoAnimTriggerType.Theactionthattriggerstheanimationeffect.ThedefaultvalueismsoAnimTriggerOnPageClick.

MsoAnimTriggerTypecanbeoneoftheseMsoAnimTriggerTypeconstants.msoAnimTriggerAfterPreviousmsoAnimTriggerMixedmsoAnimTriggerNonemsoAnimTriggerOnPageClickmsoAnimTriggerOnShapeClickmsoAnimTriggerWithPrevious

IndexOptionalLong.Thepositionatwhichtheeffectwillbeplacedinthecollectionofanimationeffects.Thedefaultvalueis-1(addedtotheend).

Page 407: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsabouncinganimationtothefirstshaperangeonthefirstslide.Thisexampleassumesashaperangecontainingoneormoreshapesisselectedonthefirstslide.

SubAddBouncingAnimation()

DimsldActiveAsSlide

DimshpSelectedAsShape

SetsldActive=ActiveWindow.Selection.SlideRange(1)

SetshpSelected=ActiveWindow.Selection.ShapeRange(1)

'Addabouncinganimation.

sldActive.TimeLine.MainSequence.AddEffect_

Shape:=shpSelected,effectId:=msoAnimEffectBounce

EndSub

Page 408: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 409: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddLabelMethodCreatesalabel.ReturnsaShapeobjectthatrepresentsthenewlabel.

expression.AddLabel(Orientation,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

OrientationRequiredMsoTextOrientation.Thetextorientation.Someoftheseconstantsmaynotbeavailabletoyou,dependingonthelanguagesupport(U.S.English,forexample)thatyou’veselectedorinstalled.

MsoTextOrientationcanbeoneoftheseMsoTextOrientationconstants.msoTextOrientationDownwardmsoTextOrientationHorizontalmsoTextOrientationHorizontalRotatedFarEastmsoTextOrientationMixedmsoTextOrientationUpwardmsoTextOrientationVerticalmsoTextOrientationVerticalFarEast

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeofthelabelrelativetotheleftedgeoftheslide.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeofthelabelrelativetothetopedgeoftheslide.

WidthRequiredSingle.Thewidthofthelabel,measuredinpoints.

HeightRequiredSingle.Theheightofthelabel,measuredinpoints.

Page 410: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaverticallabelthatcontainsthetext"TestLabel"tomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddLabel(Orientation:=msoTextOrientationVerticalFarEast,_

Left:=100,Top:=100,Width:=60,Height:=150).TextFrame_

.TextRange.Text="TestLabel"

Page 411: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddLineMethodCreatesaline.ReturnsaShapeobjectthatrepresentsthenewline.

expression.AddLine(BeginX,BeginY,EndX,EndY)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

BeginXRequiredSingle.Thehorizontalposition,measuredinpoints,oftheline'sstartingpointrelativetotheleftedgeoftheslide.

BeginYRequiredSingle.Theverticalposition,measuredinpoints,oftheline'sstartingpointrelativetothetopedgeoftheslide.

EndXRequiredSingle.Thehorizontalposition,measuredinpoints,oftheline'sendingpointrelativetotheleftedgeoftheslide.

EndYRequiredSingle.Theverticalposition,measuredinpoints,oftheline'sendingpointrelativetothetopedgeoftheslide.

Page 412: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsabluedashedlinetomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(BeginX:=10,BeginY:=10,_

EndX:=250,EndY:=250).Line

.DashStyle=msoLineDashDotDot

.ForeColor.RGB=RGB(50,0,128)

EndWith

Page 413: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddMediaObjectMethodCreatesamediaobject.ReturnsaShapeobjectthatrepresentsthenewmediaobject.

expression.AddMediaObject(FileName,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsaShapesobject.

FileNameRequiredString.Thefilefromwhichthemediaobjectistobecreated.Ifthepathisn'tspecified,thecurrentworkingfolderisused.

Left,TopOptionalSingle.Theposition(inpoints)oftheupper-leftcornerofthemediaobject'sboundingboxrelativetotheupper-leftcornerofthedocument.

Width,HeightOptionalSingle.Thewidthandheightofthemediaobject'sboundingbox,inpoints.

Page 414: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsthemovienamed"Clock.avi"tomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddMediaObjectFileName:="C:\WINNT\clock.avi",_

Left:=5,Top:=5,Width:=100,Height:=100

Page 415: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 416: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddNodeMethodAddNodemethodasitappliestotheDiagramNodeChildrenobject.

AddsaDiagramNodeobjecttoacollectionofchilddiagramnodes.

expression.AddNode(Index)

expressionRequired.AnexpressionthatreturnsaDiagramNodeChildrenobject.

IndexOptionalVariant.Theindexlocationofwheretoaddthenewdiagramnode;0addsbeforeallnodes;-1addsafterallnodes;anyotherIndexwilladdafterthatnodeinthecollection.

AddNodemethodasitappliestotheDiagramNodeobject.

ReturnsaDiagramNodeobjectthatrepresentsanodeaddedtoadiagram.

expression.AddNode(Pos)

expressionRequired.AnexpressionthatreturnsaDiagramNodeobject.

PosOptionalMsoRelativeNodePosition.Specifieswherethenodewillbeadded,relativetothecallingnode.

MsoRelativeNodePositioncanbeoneoftheseMsoRelativeNodePositionconstants.msoAfterLastSiblingmsoAfterNodedefaultmsoBeforeFirstSiblingmsoBeforeNode

Page 417: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsnodestoanewly-createddiagram.

SubCreatePyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addsthepyramiddiagramandfirstnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreemorenodestopyramiddiagram

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

EndSub

Page 418: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 419: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddNodesMethodInsertsanewsegmentattheendofthefreeformthat'sbeingcreated,andaddsthenodesthatdefinethesegment.Youcanusethismethodasmanytimesasyouwanttoaddnodestothefreeformyou'recreating.Whenyoufinishaddingnodes,usetheConvertToShapemethodtocreatethefreeformyou'vejustdefined.Toaddnodestoafreeformafterit'sbeencreated,usetheInsertmethodoftheShapeNodescollection.

expression.AddNodes(SegmentType,EditingType,X1,Y1,X2,Y2,X3,Y3)

expressionRequired.AnexpressionthatreturnsaFreeformBuilderobject.

SegmentTypeRequiredMsoSegmentType.Thetypeofsegmenttobeadded.

MsoSegmentTypecanbeoneoftheseMsoSegmentTypeconstants.msoSegmentCurvemsoSegmentLine

EditingTypeRequiredMsoEditingType.Theeditingpropertyofthevertex.IfSegmentTypeismsoSegmentLine,EditingTypemustbemsoEditingAuto.

MsoEditingTypecanbeoneoftheseMsoEditingTypeconstants(cannotbemsoEditingSmoothormsoEditingSymmetric).msoEditingAutomsoEditingCorner

X1RequiredSingle.IftheEditingTypeofthenewsegmentismsoEditingAuto,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewnodeismsoEditingCorner,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothefirstcontrolpointforthenewsegment.

Y1RequiredSingle.IftheEditingTypeofthenewsegmentismsoEditingAuto,thisargumentspecifiestheverticaldistance(inpoints)from

Page 420: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

theupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewnodeismsoEditingCorner,thisargumentspecifiestheverticaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothefirstcontrolpointforthenewsegment.

X2OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothesecondcontrolpointforthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

Y2OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiestheverticaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothesecondcontrolpointforthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

X3OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

Y3OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiestheverticaldistance(inpoints)fromtheupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

Page 421: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsafreeformwithfiveverticestothefirstslideintheactivepresentation.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.BuildFreeform(msoEditingCorner,360,200)

.AddNodesSegmentType:=msoSegmentCurve,EditingType:=msoEditingCorner,_

X1:=380,Y1:=230,X2:=400,Y2:=250,X3:=450,Y3:=300

.AddNodesSegmentType:=msoSegmentCurve,EditingType:=msoEditingAuto,_

X1:=480,Y1:=200

.AddNodesSegmentType:=msoSegmentLine,EditingType:=msoEditingAuto,_

X1:=480,Y1:=400

.AddNodesSegmentType:=msoSegmentLine,EditingType:=msoEditingAuto,_

X1:=360,Y1:=200

.ConvertToShape

EndWith

Page 422: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddPeriodsMethodAddsaperiodattheendofeachparagraphinthespecifiedtext.

expression.AddPeriods

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

Page 423: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethoddoesn'taddanotherperiodattheendofaparagraphthatalreadyendswithaperiod.

Page 424: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaperiodattheendofeachparagraphinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2).TextFrame_

.TextRange.AddPeriods

Page 425: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 426: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddPictureMethodCreatesapicturefromanexistingfile.ReturnsaShapeobjectthatrepresentsthenewpicture.

expression.AddPicture(FileName,LinkToFile,SaveWithDocument,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

FileNameRequiredString.ThefilefromwhichtheOLEobjectistobecreated.

LinkToFileRequiredMsoTriState.Determineswhetherthepicturewillbelinkedtothefilefromwhichitwascreated.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseMakesthepictureanindependentcopyofthefile.msoTriStateMixedmsoTriStateTogglemsoTrueLinksthepicturetothefilefromwhichitwascreated.

SaveWithDocumentRequiredMsoTriState.Determineswhetherthelinkedpicturewillbesavedwiththedocumentintowhichit'sinserted.ThisargumentmustbemsoTrueifLinkToFileismsoFalse.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseStoresonlythelinkinformationinthedocument.msoTriStateMixedmsoTriStateTogglemsoTrueSavesthelinkedpicturewiththedocumentintowhichit'sinserted.

Page 427: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeofthepicturerelativetotheleftedgeoftheslide.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeofthepicturerelativetothetopedgeoftheslide.

WidthOptionalSingle.Thewidthofthepicture,measuredinpoints.

HeightOptionalSingle.Theheightofthepicture,measuredinpoints.

Page 428: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsapicturecreatedfromthefileMusic.bmptomyDocument.TheinsertedpictureislinkedtothefilefromwhichitwascreatedandissavedwithmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddPictureFileName:="c:\microsoftoffice\"&_

"clipart\music.bmp",LinkToFile:=msoTrue,SaveWithDocument:=msoTrue,_

Left:=100,Top:=100,Width:=70,Height:=70

Page 429: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 430: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddPlaceholderMethodRestoresapreviouslydeletedplaceholderonaslide.ReturnsaShapeobjectthatrepresentstherestoredplaceholder.

NoteIfyouhaven'tpreviouslydeletedthespecifiedplaceholder,thismethodcausesanerror.

expression.AddPlaceholder(Type,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsaShapesobject.

TypeRequiredPpPlaceholderType.Thetypeofplaceholder.PlaceholdersoftypeppPlaceholderVerticalBodyorppPlaceholderVerticalTitlearefoundonlyonslidesoflayouttypeppLayoutVerticalText,ppLayoutClipArtAndVerticalText,ppLayoutVerticalTitleAndText,orppLayoutVerticalTitleAndTextOverChart.Youcannotcreateslideswithanyoftheselayoutsfromtheuserinterface;youmustcreatethemprogrammaticallybyusingtheAddmethodorbysettingtheLayoutpropertyofanexistingslide.

PpPlaceholderTypecanbeoneofthesePpPlaceholderTypeconstants.ppPlaceholderBitmapppPlaceholderBodyppPlaceholderCenterTitleppPlaceholderChartppPlaceholderDateppPlaceholderFooterppPlaceholderHeaderppPlaceholderMediaClipppPlaceholderMixedppPlaceholderObjectppPlaceholderOrgChartppPlaceholderSlideNumberppPlaceholderSubtitle

Page 431: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppPlaceholderTableppPlaceholderTitleppPlaceholderVerticalBodyppPlaceholderVerticalTitle

Left,TopOptionalSingle.Theposition(inpoints)oftheupper-leftcorneroftheplaceholderrelativetotheupper-leftcornerofthedocument.

Width,HeightOptionalSingle.Thewidthandheightoftheplaceholder,inpoints.

Page 432: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifmorethanoneplaceholderofaspecifiedtypehasbeendeletedfromtheslide,theAddPlaceholdermethodwilladdthembacktotheslide,onebyone,startingwiththeplaceholderthathasthelowestoriginalindexnumber.

Page 433: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Supposethatslidetwointheactivepresentationoriginallyhadatitleatthetopoftheslidethat'sbeendeleted,eithermanuallyorwiththefollowinglineofcode.

ActivePresentation.Slides(2).Shapes.Placeholders(1).Delete

Thisexamplerestoresthedeletedplaceholdertoslidetwo.

Application.ActivePresentation.Slides(2)_

.Shapes.AddPlaceholderppPlaceholderTitle

Page 434: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 435: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddPolylineMethodCreatesanopenpolylineoraclosedpolygondrawing.ReturnsaShapeobjectthatrepresentsthenewpolylineorpolygon.

expression.AddPolyline(SafeArrayOfPoints)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

SafeArrayOfPointsRequiredVariant.Anarrayofcoordinatepairsthatspecifiesthepolylinedrawing'svertices.

Page 436: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Toformaclosedpolygon,assignthesamecoordinatestothefirstandlastverticesinthepolylinedrawing.

Page 437: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsatriangletomyDocument.Becausethefirstandlastpointshavethesamecoordinates,thepolygonisclosedandfilled.Thecolorofthetriangle'sinteriorwillbethesameasthedefaultshape'sfillcolor.

DimtriArray(1To4,1To2)AsSingle

triArray(1,1)=25

triArray(1,2)=100

triArray(2,1)=100

triArray(2,2)=150

triArray(3,1)=150

triArray(3,2)=50

triArray(4,1)=25'Lastpointhassamecoordinatesasfirst

triArray(4,2)=100

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddPolylineSafeArrayOfPoints:=triArray

Page 438: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 439: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddShapeMethodCreatesanAutoShape.ReturnsaShapeobjectthatrepresentsthenewAutoShape.

expression.AddShape(Type,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TypeRequiredMsoAutoShapeType.SpecifiesthetypeofAutoShapetocreate.

MsoAutoShapeTypecanbeoneoftheseMsoAutoShapeTypeconstants.msoShapeFlowchartConnectormsoShapeFlowchartDatamsoShapeFlowchartDecisionmsoShapeFlowchartDelaymsoShapeFlowchartDirectAccessStoragemsoShapeFlowchartDisplaymsoShapeFlowchartDocumentmsoShapeFlowchartExtractmsoShapeFlowchartInternalStoragemsoShapeFlowchartMagneticDiskmsoShapeFlowchartManualInputmsoShapeFlowchartManualOperationmsoShapeFlowchartMergemsoShapeFlowchartMultidocumentmsoShapeFlowchartOffpageConnectormsoShapeFlowchartOrmsoShapeFlowchartPredefinedProcessmsoShapeFlowchartPreparationmsoShapeFlowchartProcess

Page 440: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShapeFlowchartPunchedTapemsoShapeFlowchartSequentialAccessStoragemsoShapeFlowchartSortmsoShapeFlowchartStoredDatamsoShapeFlowchartSummingJunctionmsoShapeFlowchartTerminatormsoShapeFoldedCornermsoShapeHeartmsoShapeHexagonmsoShapeHorizontalScrollmsoShapeIsoscelesTrianglemsoShapeLeftArrowmsoShapeLeftArrowCalloutmsoShapeLeftBracemsoShapeLeftBracketmsoShapeLeftRightArrowmsoShapeLeftRightArrowCalloutmsoShapeLeftRightUpArrowmsoShapeLeftUpArrowmsoShapeLightningBoltmsoShapeLineCallout1msoShapeLineCallout1AccentBarmsoShapeLineCallout1BorderandAccentBarmsoShapeLineCallout1NoBordermsoShapeLineCallout2msoShapeLineCallout2AccentBarmsoShapeLineCallout2BorderandAccentBarmsoShapeLineCallout2NoBordermsoShapeLineCallout3msoShapeLineCallout3AccentBarmsoShapeLineCallout3BorderandAccentBarmsoShapeLineCallout3NoBordermsoShapeLineCallout4

Page 441: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShapeLineCallout4AccentBarmsoShapeLineCallout4BorderandAccentBarmsoShapeLineCallout4NoBordermsoShapeMixedmsoShapeMoonmsoShapeNoSymbolmsoShapeNotchedRightArrowmsoShapeNotPrimitivemsoShapeOctagonmsoShapeOvalmsoShapeOvalCalloutmsoShapeParallelogrammsoShapePentagonmsoShapePlaquemsoShapeQuadArrowmsoShapeQuadArrowCalloutmsoShapeRectanglemsoShapeRectangularCalloutmsoShapeRegularPentagonmsoShapeRightArrowmsoShapeRightArrowCalloutmsoShapeRightBracemsoShapeRightBracketmsoShapeRightTrianglemsoShapeRoundedRectanglemsoShapeRoundedRectangularCalloutmsoShapeSmileyFacemsoShapeStripedRightArrowmsoShapeSunmsoShapeTrapezoidmsoShapeUpArrowmsoShapeUpArrowCalloutmsoShapeUpDownArrow

Page 442: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShapeUpDownArrowCalloutmsoShapeUpRibbonmsoShapeUTurnArrowmsoShapeVerticalScrollmsoShapeWavemsoShapeFlowchartCollatemsoShape16pointStarmsoShape24pointStarmsoShape32pointStarmsoShape4pointStarmsoShape5pointStarmsoShape8pointStarmsoShapeActionButtonBackorPreviousmsoShapeActionButtonBeginningmsoShapeActionButtonCustommsoShapeActionButtonDocumentmsoShapeActionButtonEndmsoShapeActionButtonForwardorNextmsoShapeActionButtonHelpmsoShapeActionButtonHomemsoShapeActionButtonInformationmsoShapeActionButtonMoviemsoShapeActionButtonReturnmsoShapeActionButtonSoundmsoShapeArcmsoShapeBalloonmsoShapeBentArrowmsoShapeBentUpArrowmsoShapeBevelmsoShapeBlockArcmsoShapeCanmsoShapeChevronmsoShapeCircularArrow

Page 443: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShapeCloudCalloutmsoShapeCrossmsoShapeCubemsoShapeCurvedDownArrowmsoShapeCurvedDownRibbonmsoShapeCurvedLeftArrowmsoShapeCurvedRightArrowmsoShapeCurvedUpArrowmsoShapeCurvedUpRibbonmsoShapeDiamondmsoShapeDonutmsoShapeDoubleBracemsoShapeDoubleBracketmsoShapeDoubleWavemsoShapeDownArrowmsoShapeDownArrowCalloutmsoShapeDownRibbonmsoShapeExplosion1msoShapeExplosion2msoShapeFlowchartAlternateProcessmsoShapeFlowchartCard

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeoftheAutoShaperelativetotheleftedgeoftheslide.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeoftheAutoShaperelativetothetopedgeoftheslide.

WidthRequiredSingle.ThewidthoftheAutoShape,measuredinpoints.

HeightRequiredSingle.TheheightoftheAutoShape,measuredinpoints.

Page 444: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TochangethetypeofanAutoShapethatyou'veadded,settheAutoShapeTypeproperty.

Page 445: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddShapeType:=msoShapeRectangle,_

Left:=50,Top:=50,Width:=100,Height:=200

Page 446: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddTableMethodAddsatableshapetoaslide.

expression.AddTable(NumRows,NumColumns,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsaShapeobject.

NumRowsRequiredLong.Thenumberofrowsinthetable.

NumColumnsRequiredLong.Thenumberofcolumnsinthetable.

LeftOptionalSingle.Thedistance(inpoints)fromtheleftedgeoftheslidetotheleftedgeofthetable.

TopOptionalSingle.Thedistance(inpoints)fromthetopedgeoftheslidetothetopedgeofthetable.

WidthOptionalSingle.Thewidth(inpoints)ofthenewtable.

HeightOptionalSingle.Theheight(inpoints)ofthenewtable.

Page 447: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanewtableonslidetwooftheactivepresentation.Thetablehasthreerowsandfourcolumns.Itis10pointsfromtheleftedgeoftheslide,and10pointsfromthetopedge.Thewidthofthenewtableis288points,whichmakeseachofthefourcolumnsoneinchwide(thereare72pointsperinch).Theheightissetto216points,whichmakeseachofthethreerowsoneinchtall.

ActivePresentation.Slides(2).Shapes_

.AddTable(3,4,10,10,288,216)

Page 448: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 449: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddTextboxMethodCreatesatextbox.ReturnsaShapeobjectthatrepresentsthenewtextbox.

expression.AddTextbox(Orientation,Left,Top,Width,Height)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

OrientationRequiredMsoTextOrientation.Thetextorientation.Someoftheseconstantsmaynotbeavailabletoyou,dependingonthelanguagesupport(U.S.English,forexample)thatyou’veselectedorinstalled.

MsoTextOrientationcanbeoneoftheseMsoTextOrientationconstants.msoTextOrientationDownwardmsoTextOrientationHorizontalmsoTextOrientationHorizontalRotatedFarEastmsoTextOrientationMixedmsoTextOrientationUpwardmsoTextOrientationVerticalmsoTextOrientationVerticalFarEast

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeofthetextboxrelativetotheleftedgeoftheslide.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeofthetextboxrelativetothetopedgeoftheslide.

WidthRequiredSingle.Thewidthofthetextbox,measuredinpoints.

HeightRequiredSingle.Theheightofthetextbox,measuredinpoints.

Page 450: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsatextboxthatcontainsthetext"TestBox"tomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddTextbox(Type:=msoTextOrientationHorizontal,_

Left:=100,Top:=100,Width:=200,Height:=50).TextFrame_

.TextRange.Text="TestBox"

Page 451: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 452: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddTextEffectMethodCreatesaWordArtobject.ReturnsaShapeobjectthatrepresentsthenewWordArtobject.

expression.AddTextEffect(PresetTextEffect,Text,FontName,FontSize,FontBold,FontItalic,Left,Top)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

PresetTextEffectRequiredMsoPresetTextEffect.Thepresettexteffect.

MsoPresetTextEffectcanbeoneoftheseMsoPresetTextEffectconstants.msoTextEffect1msoTextEffect2msoTextEffect3msoTextEffect4msoTextEffect5msoTextEffect6msoTextEffect7msoTextEffect8msoTextEffect9msoTextEffect10msoTextEffect11msoTextEffect12msoTextEffect13msoTextEffect14msoTextEffect15msoTextEffect16msoTextEffect17msoTextEffect18msoTextEffect19

Page 453: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoTextEffect20msoTextEffect21msoTextEffect22msoTextEffect23msoTextEffect24msoTextEffect25msoTextEffect26msoTextEffect27msoTextEffect28msoTextEffect29msoTextEffect30msoTextEffectMixed

TextRequiredString.ThetextintheWordArt.

FontNameRequiredString.ThenameofthefontusedintheWordArt.

FontSizeRequiredSingle.Thesize(inpoints)ofthefontusedintheWordArt.

FontBoldRequiredMsoTriState.DetermineswhetherthefontusedintheWordArtissettobold.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueSetsthefontusedintheWordArttobold.

FontItalicRequiredMsoTriState.DetermineswhetherthefontusedintheWordArtissettoitalic.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixed

Page 454: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoTriStateTogglemsoTrueSetsthefontusedintheWordArttoitalic.

LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeoftheWordArt'sboundingboxrelativetotheleftedgeoftheslide.

TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeoftheWordArt'sboundingboxrelativetothetopedgeoftheslide.

Page 455: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

WhenyouaddWordArttoadocument,theheightandwidthoftheWordArtareautomaticallysetbasedonthesizeandamountoftextyouspecify.

Page 456: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsWordArtthatcontainsthetext"Test"tomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

SetnewWordArt=myDocument.Shapes_

.AddTextEffect(PresetTextEffect:=msoTextEffect1,_

Text:="Test",FontName:="ArialBlack",FontSize:=36,_

FontBold:=msoFalse,FontItalic:=msoFalse,Left:=10,Top:=10)

Page 457: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddTitleMethodRestoresapreviouslydeletedtitleplaceholdertoaslide.ReturnsaShapeobjectthatrepresentstherestoredtitle.

NoteThismethodwillcauseanerrorifyouhaven'tpreviouslydeletedthetitleplaceholderfromthespecifiedslide.UsetheHasTitlepropertytodeterminewhetherthetitleplaceholderhasbeendeleted.

expression.AddTitle

expressionRequired.AnexpressionthatreturnsaShapesobject.

Page 458: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerestoresthetitleplaceholdertoslideoneintheactivepresentationifthisplaceholderhasbeendeleted.Thetextoftherestoredtitleis"Restoredtitle."

WithActivePresentation.Slides(1)

If.Layout<>ppLayoutBlankThen

With.Shapes

IfNot.HasTitleThen

.AddTitle.TextFrame.TextRange_

.Text="Restoredtitle"

EndIf

EndWith

EndIf

EndWith

Page 459: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddTitleMasterMethodAddsatitlemastertothespecifiedpresentation.ReturnsaMasterobjectthatrepresentsthetitlemaster.Ifthepresentationalreadyhasatitlemaster,anerroroccurs.

expression.AddTitleMaster

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 460: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsatitlemastertotheactivepresentationifitdoesn'talreadyhaveone.

WithApplication.ActivePresentation

IfNot.HasTitleMasterThen.AddTitleMaster

EndWith

Page 461: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddToFavoritesMethodAddsashortcuttotheFavoritesfolderintheWindowsprogramfolderrepresentingeitherthecurrentselectioninthespecifiedpresentation(forthePresentationobject)orthespecifiedhyperlink'stargetdocument(fortheHyperlinkobject).

expression.AddToFavorites

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 462: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Theshortcutnameisthefriendlynameofthedocument,ifthat'savailable;otherwise,theshortcutnameisascalculatedinHLINK.DLL.

Page 463: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsahyperlinktotheactivepresentationtotheFavoritesfolderintheWindowsprogramfolder.

Application.ActivePresentation.AddToFavorites

Page 464: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 465: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AlignMethodAlignstheshapesinthespecifiedrangeofshapes.

expression.Align(AlignCmd,RelativeTo)

expressionRequired.AnexpressionthatreturnsaShapeRangeobject.

AlignCmdRequiredMsoAlignCmd.Specifiesthewaytheshapesinthespecifiedshaperangearetobealigned.

MsoAlignCmdcanbeoneoftheseMsoAlignCmdconstants.msoAlignBottomsmsoAlignCentersmsoAlignLeftsmsoAlignMiddlesmsoAlignRightsmsoAlignTops

RelativeToRequiredMsoTriState.Determineswhethershapesarealignedrelativetotheedgeoftheslide.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseAlignsshapesrelativetooneanother.msoTriStateMixedmsoTriStateTogglemsoTrueAlignsshapesrelativetotheedgeoftheslide.

Page 466: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplealignstheleftedgesofalltheshapesinthespecifiedrangeinmyDocumentwiththeleftedgeoftheleftmostshapeintherange.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.Range.AlignmsoAlignLefts,msoFalse

Page 467: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ApplyMethodAppliestothespecifiedshapeformattingthat'sbeencopiedbyusingthePickUpmethod.

expression.Apply

expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.

Page 468: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecopiestheformattingofshapeoneonmyDocument,andthenappliesthecopiedformattingtoshapetwo.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument

.Shapes(1).PickUp

.Shapes(2).Apply

EndWith

Page 469: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ApplyTemplateMethodAppliesadesigntemplatetothespecifiedpresentation.

expression.ApplyTemplate(FileName)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

FileNameRequiredString.Specifiesthenameofthedesigntemplate.

NoteIfyourefertoanuninstalledpresentationdesigntemplateinastring,arun-timeerrorisgenerated.ThetemplateisnotinstalledautomaticallyregardlessofyourFeatureInstallpropertysetting.TousetheApplyTemplatemethodforatemplatethatisnotcurrentlyinstalled,youfirstmustinstalltheadditionaldesigntemplates.Todoso,installtheAdditionalDesignTemplatesforPowerPointbyrunningtheMicrosoftOfficeinstallationprogram(availablethroughtheAdd/RemoveProgramsiconinWindowsControlPanel).

Page 470: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleappliesthe"Professional"designtemplatetotheactivepresentation.

Application.ActivePresentation.ApplyTemplate_

"c:\programfiles\microsoftoffice\templates"&_

"\presentationdesigns\professional.pot"

Page 471: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 472: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ArrangeMethodArrangesallopendocumentwindowsintheworkspace.

expression.Arrange(arrangeStyle)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

arrangeStyleOptionalPpArrangeStyle.Specifieswhethertocascadeortilethewindows.

PpArrangeStylecanbeoneofthesePpArrangeStyleconstants.ppArrangeCascadeppArrangeTileddefault

Page 473: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanewwindowandthenarrangesallopendocumentwindows.

Application.ActiveWindow.NewWindow

Windows.ArrangeppArrangeCascade

Page 474: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutomaticLengthMethodSpecifiesthatthefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox)bescaledautomaticallywhenthecalloutismoved.UsetheCustomLengthmethodtospecifythatthefirstsegmentofthecalloutlineretainthefixedlengthreturnedbytheLengthpropertywheneverthecalloutismoved.Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).

expression.AutomaticLength

expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.

Page 475: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ApplyingthismethodsetstheAutoLengthpropertytoTrue.

Page 476: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampletogglesbetweenanautomaticallyscalingfirstsegmentandonewithafixedlengthforthecalloutlineforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Callout

If.AutoLengthThen

.CustomLength50

Else

.AutomaticLength

EndIf

EndWith

Page 477: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BackgroundMethodSpecifiesthattheshape'sfillshouldmatchtheslidebackground.Ifyouchangetheslidebackgroundafterapplyingthismethodtoafill,thefillwillalsochange.

Page 478: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

NotethatapplyingtheBackgroundmethodtoashape'sfillisn'tthesameassettingatransparentfillfortheshape,norisitalwaysthesameasapplyingthesamefilltotheshapeasyouapplytothebackground.Thesecondexampledemonstratesthis.

Page 479: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefillofshapeoneonslideoneintheactivepresentationtomatchtheslidebackground.

ActivePresentation.Slides(1).Shapes(1).Fill.Background

Thisexamplesetsthebackgroundforslideoneintheactivepresentationtoapresetgradient,addsarectangletotheslide,andthenplacesthreeovalsinfrontoftherectangle.Thefirstovalhasafillthatmatchestheslidebackground,thesecondhasatransparentfill,andthethirdhasthesamefillappliedtoitaswasappliedtothebackground.Noticethedifferenceintheappearancesofthesethreeovals.

WithActivePresentation.Slides(1)

.FollowMasterBackground=False

.Background.Fill.PresetGradient_

msoGradientHorizontal,1,msoGradientDaybreak

With.Shapes

.AddShapemsoShapeRectangle,50,200,600,100

.AddShape(msoShapeOval,75,150,150,100)_

.Fill.Background

.AddShape(msoShapeOval,275,150,150,100).Fill_

.Transparency=1

.AddShape(msoShapeOval,475,150,150,100)_

.Fill.PresetGradient_

msoGradientHorizontal,1,msoGradientDaybreak

EndWith

EndWith

Page 480: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginConnectMethodAttachesthebeginningofthespecifiedconnectortoaspecifiedshape.Ifthere'salreadyaconnectionbetweenthebeginningoftheconnectorandanothershape,thatconnectionisbroken.Ifthebeginningoftheconnectorisn'talreadypositionedatthespecifiedconnectingsite,thismethodmovesthebeginningoftheconnectortotheconnectingsiteandadjuststhesizeandpositionoftheconnector.UsetheEndConnectmethodtoattachtheendoftheconnectortoashape.

expression.BeginConnect(ConnectedShape,ConnectionSite)

expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.

ConnectedShapeRequiredShapeobject.Theshapetoattachthebeginningoftheconnectorto.ThespecifiedShapeobjectmustbeinthesameShapescollectionastheconnector.

ConnectionSiteRequiredLong.AconnectionsiteontheshapespecifiedbyConnectedShape.Mustbeanintegerbetween1andtheintegerreturnedbytheConnectionSiteCountpropertyofthespecifiedshape.Ifyouwanttheconnectortoautomaticallyfindtheshortestpathbetweenthetwoshapesitconnects,specifyanyvalidintegerforthisargumentandthenusetheRerouteConnectionsmethodaftertheconnectorisattachedtoshapesatbothends.

Page 481: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Whenyouattachaconnectortoanobject,thesizeandpositionoftheconnectorareautomaticallyadjusted,ifnecessary.

Page 482: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstworectanglestothefirstslideintheactivepresentationandconnectsthemwithacurvedconnector.NoticethattheRerouteConnectionsmethodmakesitirrelevantwhatvaluesyousupplyfortheConnectionSiteargumentsusedwiththeBeginConnectandEndConnectmethods.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

Withs.AddConnector(msoConnectorCurve,0,0,100,100)_

.ConnectorFormat

.BeginConnectConnectedShape:=firstRect,ConnectionSite:=1

.EndConnectConnectedShape:=secondRect,ConnectionSite:=1

.Parent.RerouteConnections

EndWith

Page 483: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginDisconnectMethodDetachesthebeginningofthespecifiedconnectorfromtheshapeit'sattachedto.Thismethoddoesn'talterthesizeorpositionoftheconnector:thebeginningoftheconnectorremainspositionedataconnectionsitebutisnolongerconnected.UsetheEndDisconnectmethodtodetachtheendoftheconnectorfromashape.

expression.BeginDisconnect

expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.

Page 484: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstworectanglestothefirstslideintheactivepresentation,attachesthemwithaconnector,automaticallyreroutestheconnectoralongtheshortestpath,andthendetachestheconnectorfromtherectangles.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

Withs.AddConnector(msoConnectorCurve,0,0,0,0).ConnectorFormat

.BeginConnectfirstRect,1

.EndConnectsecondRect,1

.Parent.RerouteConnections

.BeginDisconnect

.EndDisconnect

EndWith

Page 485: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 486: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BuildFreeformMethodBuildsafreeformobject.ReturnsaFreeformBuilderobjectthatrepresentsthefreeformasitisbeingbuilt.UsetheAddNodesmethodtoaddsegmentstothefreeform.Afteryouhaveaddedatleastonesegmenttothefreeform,youcanusetheConvertToShapemethodtoconverttheFreeformBuilderobjectintoaShapeobjectthathasthegeometricdescriptionyou'vedefinedintheFreeformBuilderobject.

expression.BuildFreeform(EditingType,X1,Y1)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

EditingTypeRequiredMsoEditingType.Theeditingpropertyofthefirstnode.

MsoEditingTypecanbeoneofthefollowingMsoEditingTypeconstants(cannotbemsoEditingSmoothormsoEditingSymmetric).msoEditingAutomsoEditingCorner

X1RequiredSingle.Thehorizontalposition,measuredinpoints,ofthefirstnodeinthefreeformdrawingrelativetotheleftedgeoftheslide.

Y1RequiredSingle.Theverticalposition,measuredinpoints,ofthefirstnodeinthefreeformdrawingrelativetothetopedgeoftheslide.

Page 487: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsafreeformwithfoursegmentstomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.BuildFreeform(EditingType:=msoEditingCorner,_

X1=360,Y1=200)

.AddNodesSegmentType:=msoSegmentCurve,EditingType:=msoEditingCorner,_

X1:=380,Y1:=230,X2:=400,Y2:=250,X3:=450,Y3:=300

.AddNodesSegmentType:=msoSegmentCurve,EditingType:=msoEditingAuto,_

X1:=480,Y1:=200

.AddNodesSegmentType:=msoSegmentLine,EditingType:=msoEditingAuto,_

X1:=480,Y1:=400

.AddNodesSegmentType:=msoSegmentLine,EditingType:=msoEditingAuto,_

X1:=360,Y1:=200

.ConvertToShape

EndWith

Page 488: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CanCheckInMethodTrueifMicrosoftPowerPointcancheckinaspecifiedpresentationtoaserver.Read/writeBoolean.

expression.CanCheckIn

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 489: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TotakeadvantageofthecollaborationfeaturesbuiltintoPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.

Page 490: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecheckstheservertoseeifthespecifiedpresentationcanbecheckedinand,ifitcanbe,closesthepresentationandchecksitbackintoserver.

SubCheckInPresentation(strPresentationAsString)

IfPresentations(strPresentation).CanCheckIn=TrueThen

Presentations(strPresentation).CheckIn

MsgBoxstrPresentation&"hasbeencheckedin."

Else

MsgBoxstrPresentation&"cannotbecheckedin"&_

"atthistime.Pleasetryagainlater."

EndIf

EndSub

Tocallthesubroutineabove,usethefollowingsubroutineandreplacethe"http://servername/workspace/report.ppt"filenamewithanactualfilelocatedonaservermentionedintheRemarkssectionabove.

SubCheckPPTIn()

CallCheckInPresentation(strPresentation:=_

"http://servername/workspace/report.ppt")

EndSub

Page 491: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CanCheckOutMethodTrueifMicrosoftPowerPointcancheckoutaspecifiedpresentationfromaserver.Read/writeBoolean.

expression.CanCheckOut(FileName)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

FileNameRequiredString.Theserverpathandnameofthepresentation.

Page 492: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TotakeadvantageofthecollaborationfeaturesbuiltintoPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.

Page 493: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleverifiesthatapresentationisnotcheckedoutbyanotheruserandthatitcanbecheckedout.Ifthepresentationcanbecheckedout,itcopiesthepresentationtothelocalcomputerforediting.

SubCheckOutPresentation(strPresentationAsString)

IfPresentations.CanCheckOut(strPresentation)=TrueThen

Presentations.CheckOutFileName:=strPresentation

Else

MsgBox"Youareunabletocheckoutthis"&_

"presentationatthistime."

EndIf

EndSub

Tocallthesubroutineabove,usethefollowingsubroutineandreplacethe"http://servername/workspace/report.ppt"filenamewithanactualfilelocatedonaservermentionedintheRemarkssectionabove.

SubCheckPPTOut()

CallCheckOutPresentation(strPresentation:=_

"http://servername/workspace/report.doc")

EndSub

Page 494: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CellMethodReturnsaCellobjectthatrepresentsacellinatable.

expression.Cell(Row,Column)

expressionRequired.AnexpressionthatreturnsaTableobject.

RowRequiredLong.Thenumberoftherowinthetabletoreturn.Canbeanintegerbetween1andthenumberofrowsinthetable.

ColumnRequiredLong.Thenumberofthecolumninthetabletoreturn.Canbeanintegerbetween1andthenumberofcolumnsinthetable.

Page 495: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesa3x3tableonanewslideinanewpresentationandinsertstextintothefirstcellofthetable.

WithPresentations.Add

With.Slides.Add(1,ppLayoutBlank)

.Shapes.AddTable(3,3).Select

.Shapes(1).Table.Cell(1,1).Shape.TextFrame_

.TextRange.Text="Cell1"

EndWith

EndWith

Thisexamplesetsthethicknessofthebottomborderofthecellinrow2,column1totwopoints.

ActivePresentation.Slides(2).Shapes(5).Table_

.Cell(2,1).Borders(ppBorderBottom).Weight=2

Page 496: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 497: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ChangeCaseMethodChangesthecaseofthespecifiedtext.

expression.ChangeCase(Type)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

TypeRequiredPpChangeCase.Specifiesthewaythecasewillbechanged.

PpChangeCasecanbeoneofthesePpChangeCaseconstants.ppCaseLowerppCaseSentenceppCaseTitleppCaseToggleppCaseUpper

Page 498: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstitlecasecapitalizationforthetitleonslideoneinthetheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes.Title.TextFrame_

.TextRange.ChangeCaseppCaseTitle

Page 499: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CharactersMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextcharacters.Forinformationaboutcountingorloopingthroughthecharactersinatextrange,seetheTextRangeobject.

expression.Characters(Start,Length)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

StartOptionalLong.Thefirstcharacterinthereturnedrange.

LengthOptionalLong.Thenumberofcharacterstobereturned.

Page 500: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstcharacterandendswiththelastparagraphinthespecifiedrange.

IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsonecharacter.

IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstcharacterinthespecifiedrange.

IfStartisgreaterthanthenumberofcharactersinthespecifiedtext,thereturnedrangestartswiththelastcharacterinthespecifiedrange.

IfLengthisgreaterthanthenumberofcharactersfromthespecifiedstartingcharactertotheendofthetext,thereturnedrangecontainsallthosecharacters.

Page 501: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetextforshapetwoonslideoneintheactivepresentationandthenmakesthesecondcharacterasubscriptcharacterwitha20-percentoffset.

DimcharRangeAsTextRange

WithApplication.ActivePresentation.Slides(1).Shapes(2)

SetcharRange=.TextFrame.TextRange.InsertBefore("H2O")

charRange.Characters(2).Font.BaselineOffset=-0.2

EndWith

Thisexampleformatseverysubscriptcharacterinshapetwoonslideoneasbold.

WithApplication.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange

Fori=1To.Characters.Count

With.Characters(i).Font

If.SubscriptThen.Bold=True

EndWith

Next

EndWith

Page 502: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CheckInMethodReturnsapresentationfromalocalcomputertoaserver,andsetsthelocalfiletoread-onlysothatitcannotbeeditedlocally.

expression.CheckIn(SaveChanges,Comments,MakePublic)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

SaveChangesOptionalBoolean.Truesavesthepresentationtotheserverlocation.ThedefaultvalueisFalse.

CommentsOptionalVariant.Commentsfortherevisionofthepresentationbeingcheckedin(onlyappliesifSaveChangesequalsTrue).

MakePublicOptionalVariant.Trueallowstheusertoperformapublishonthepresentationafterbeingcheckedin.Thissubmitsthedocumentfortheapprovalprocess,whichcaneventuallyresultinaversionofthepresentationbeingpublishedtouserswithread-onlyrightstothepresentation(onlyappliesifSaveChangesequalsTrue).

Page 503: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TotakeadvantageofthecollaborationfeaturesbuiltintoMicrosoftPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.

Page 504: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecheckstheservertoseeifthespecifiedpresentationcanbecheckedinand,ifso,closesthepresentationandchecksitbackintoserver.

SubCheckInPresentation(strPresentationAsString)

IfPresentations(strPresentation).CanCheckIn=TrueThen

Presentations(strPresentation).CheckIn

MsgBoxstrPresentation&"hasbeencheckedin."

Else

MsgBoxstrPresentation&"cannotbecheckedin"&_

"atthistime.Pleasetryagainlater."

EndIf

EndSub

Tocallthesubroutineabove,usethefollowingsubroutineandreplacethe"http://servername/workspace/report.ppt"filenamewithanactualfilelocatedonaservermentionedintheRemarkssectionabove.

SubCheckInPresentation()

CallCheckInPresentation(strPresentation:=_

"http://servername/workspace/report.ppt")

EndSub

Page 505: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CheckOutMethodCopiesaspecifiedpresentationfromaservertoalocalcomputerforediting.ReturnsaStringthatrepresentsthelocalpathandfilenameofthepresentationcheckedout.

expression.CheckOut(FileName)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

FileNameRequiredString.Theserverpathandnameofthepresentation.

Page 506: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TotakeadvantageofthecollaborationfeaturesbuiltintoMicrosoftPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.

Page 507: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleverifiesthatapresentationisnotcheckedoutbyanotheruserandthatitcanbecheckedout.Ifthepresentationcanbecheckedout,itcopiesthepresentationtothelocalcomputerforediting.

SubCheckOutPresentation(strPresentationAsString)

DimstrFileNameAsString

WithPresentations

If.CanCheckOut(strPresentation)=TrueThen

.CheckOutFileName:=strPresentation

.OpenFileName:=strFileName

Else

MsgBox"Youareunabletocheckoutthis"&_

"presentationatthistime."

EndIf

EndSub

Tocallthesubroutineabove,usethefollowingsubroutineandreplacethe"http://servername/workspace/report.ppt"filenameforanactualfilelocatedonaservermentionedintheRemarkssectionabove.

SubCheckPPTOut()

CallCheckOutPresentation(strPresentation:=_

"http://servername/workspace/report.doc")

EndSub

Page 508: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ClearMethodClearsthespecifiedtabstopfromtheruleranddeletesitfromtheTabStopscollection.

Page 509: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleclearsalltabstopsforthetextinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame_

.Ruler.TabStops

Fori=.CountTo1Step-1

.Item(i).Clear

Next

EndWith

Page 510: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ClearAllMethodClearsalltheprintrangesfromthePrintRangescollection.UsetheAddmethodofthePrintRangescollectiontoaddprintrangestothecollection.

expression.ClearAll

expressionRequired.AnexpressionthatreturnsaPrintRangeobject.

Page 511: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleclearsanypreviouslydefinedprintrangesintheactivepresentation;createsnewprintrangesthatcontainslide1,slides3through5,andslides8and9;printsthenewlydefinedslideranges;andthenclearsthenewprintranges.

WithActivePresentation.PrintOptions

.RangeType=ppPrintSlideRange

With.Ranges

.ClearAll

.Add1,1

.Add3,5

.Add8,9

.Parent.Parent.PrintOut

.ClearAll

EndWith

EndWith

Page 512: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 513: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CloneMethodClonemethodasitappliestotheDesignsobject.

CreatesacopyofaDesignobject.

expression.Clone(pOriginal,Index)

expressionRequired.AnexpressionthatreturnsaDesignsobject.

pOriginalRequiredDesignobject.Theoriginaldesign.

IndexOptionalLong.TheindexlocationintheDesignscollectionintowhichthedesignwillbecopied.IfIndexisomitted,thecloneddesignisaddedtotheendoftheDesignscollection.

ClonemethodasitappliestotheSequenceobject.

CreatesacopyofanEffectobject,andaddsittotheSequencescollectionatthespecifiedindex.

expression.Clone(Effect,Index)

expressionRequired.AnexpressionthatreturnsaSequenceobject.

EffectRequiredEffectobject.Theanimationeffecttobecloned.

IndexOptionalLong.ThepositionatwhichtheclonedanimationeffectwillbeaddedtotheSequencescollection.Thedefaultvalueis-1(addedtotheend).

Page 514: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheDesignsobject.

Thisexamplecreatesadesignandclonesthenewlycreateddesign.

SubCloneDesign()

DimdsnDesign1AsDesign

DimdsnDesign2

SetdsnDesign1=ActivePresentation.Designs_

.Add(designName:="Design1")

SetdsnDesign2=ActivePresentation.Designs_

.Clone(pOriginal:=dsnDesign1,Index:=1)

EndSub

AsitappliestotheSequenceobject.

Thisexamplecopiesananimationeffect.Thisexampleassumesananimationeffectnamed"effDiamond"exists.

SubCloneEffect()

ActivePresentation.Slides(1).TimeLine.MainSequence_

.CloneEffect:=effDiamond,Index:=-1

EndSub

Page 515: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 516: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CloneNodeMethodClonesadiagramnode.

expression.CloneNode(CopyChildren,TargetNode,Pos)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

CopyChildrenRequiredBoolean.Truetoincludethediagramnode'schildren.

TargetNodeRequiredDiagramNodeobject.AnexpressionthatreturnsaDiagramNodethatwillbethesourceforthecloneddiagramnode.

PosOptionalMsoRelativeNodePosition.IfTargetNodeisspecified,wherethenodewillbeadded,relativetoTargetNode.

MsoRelativeNodePositioncanbeoneoftheseMsoRelativeNodePositionconstants.msoAfterLastSiblingmsoAfterNodedefaultmsoBeforeFirstSiblingmsoBeforeNode

Page 517: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesadiagramandclonesthenewest-creatednode.

SubCloneANode()

DimdgnNodeAsDiagramNode

DimTdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addscyclediagramandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramCycle,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

SetTdgnNode=newDiagramNode

'Addsthreeadditionalnodestodiagram

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

'Automaticallyformatsthediagram

dgnNode.Diagram.AutoFormat=msoTrue

'Clonesthefirstchildnodewithoutcloningassociatedchildnodes

dgnNode.CloneNodeCopyChildren:=False,TdgnNode

EndSub

Page 518: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CloseMethodClosesthespecifieddocumentwindow,presentation,oropenfreeformdrawing.

CautionWhenyouusethismethod,PowerPointwillcloseanopenpresentationwithoutpromptingtheusertosavetheirwork.Topreventthelossofwork,usetheSavemethodortheSaveAsmethodbeforeyouusetheClosemethod.

expression.Close

expressionRequired.AnexpressionthatreturnsaDocumentWindoworPresentationobject.

Page 519: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleclosesallwindowsexcepttheactivewindow.

WithApplication.Windows

Fori=2To.Count

.Item(i).Close

Next

EndWith

ThisexampleclosesPres1.pptwithoutsavingchanges.

WithApplication.Presentations("pres1.ppt")

.Saved=True

.Close

EndWith

Thisexampleclosesallopenpresentations.

WithApplication.Presentations

Fori=.CountTo1Step-1

.Item(i).Close

Next

EndWith

Page 520: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 521: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorsMethodReturnsanRGBColorobjectthatrepresentsasinglecolorinacolorscheme.

expression.Colors(SchemeColor)

expressionRequired.AnexpressionthatreturnsaColorSchemeobject.

SchemeColorRequiredPpColorSchemeIndex.Theindividualcolorinthespecifiedcolorscheme.

PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppNotSchemeColorppSchemeColorMixedppShadowppTitle

Page 522: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetitlecolorforslidesoneandthreeintheactivepresentation.

SetmySlides=ActivePresentation.Slides.Range(Array(1,3))

mySlides.ColorScheme.Colors(ppTitle).RGB=RGB(0,255,0)

Page 523: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 524: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConvertMethodConvertsadiagramtoadifferentdiagramtype.

expression.Convert(Type)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TypeRequiredMsoDiagramType.Thetypeofdiagramtoconvertto.

MsoDiagramTypecanbeoneoftheseMsoDiagramTypeconstants.msoDiagramCyclemsoDiagramMixedmsoDiagramOrgChartmsoDiagramPyramidmsoDiagramRadialmsoDiagramTargetmsoDiagramVenn

Page 525: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethodgeneratesanerrorifthevalueofthetargetdiagram'sTypepropertyisanorganizationchart(msoDiagramTypeOrgChart).

Page 526: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsapyramiddiagramtoaslideandconvertsittoaradialdiagram.

SubConvertPyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addspryamiddiagraandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramPyramid,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreeadditionalchildnodes

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

'Automaticallyformatsthediagramandconvertsittoaradialdiagram

WithdgnNode.Diagram

.AutoFormat=msoTrue

.ConvertType:=msoDiagramRadial

EndWith

EndSub

Page 527: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 528: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConvertToAfterEffectMethodSpecifieswhataneffectshoulddoafteritisfinished.ReturnsanEffectobjectthatrepresentsanaftereffect.

expression.ConvertToAfterEffect(Effect,After,DimColor,DimSchemeColor)

expressionRequired.AnexpressionthatreturnsaSequenceobject.

EffectRequiredEffectobject.Theeffecttowhichtheaftereffectwillbeadded.

AfterRequiredMsoAnimAfterEffect.Thebehavioroftheaftereffect.

MsoAnimAfterEffectcanbeoneoftheseMsoAnimAfterEffectconstants.msoAnimAfterEffectDimmsoAnimAfterEffectHidemsoAnimAfterEffectHideOnNextClickmsoAnimAfterEffectMixedmsoAnimAfterEffectNone

DimColorOptionalMsoRGBType.Asinglecolortoapplytheaftereffect.

DimSchemeColorOptionalPpColorSchemeIndex.Apredefinedcolorschemetoapplytotheaftereffect.

PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppNotSchemeColordefaultppSchemeColorMixed

Page 529: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppShadowppTitle

Page 530: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

DonotuseboththeDimColorandDimSchemeColorargumentsinthesamecalltothismethod.Anaftereffectmayhaveonecolor,oruseapredefinedcolorscheme,butnotboth.

Page 531: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetsadimcolorforanaftereffectonthefirstshapeonthefirstslideintheactivepresentation.Thisexampleassumethereisashapeonthefirstslide.

SubConvertToDim()

DimshpSelectedAsShape

DimsldActiveAsSlide

DimeffConvertAsEffect

SetsldActive=ActivePresentation.Slides(1)

SetshpSelected=sldActive.Shapes(1)

'Addananimationeffect.

SeteffConvert=sldActive.TimeLine.MainSequence.AddEffect_

(Shape:=shpSelected,effectId:=msoAnimEffectBounce)

'Addadimaftereffect.

SeteffConvert=sldActive.TimeLine.MainSequence.ConvertToAfterEffect

(Effect:=effConvert,After:=msoAnimAfterEffectDim,_

DimColor:=RGB(Red:=255,Green:=255,Blue:=255))

EndSub

Page 532: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 533: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConvertToAnimateBackgroundMethodDetermineswhetherthebackgroundwillanimateseparatelyfrom,orinadditionto,itsaccompanyingtext.ReturnsanEffectobjectrepresentingthenewly-modifiedanimationeffect.

expression.ConvertToAnimateBackground(Effect,AnimateBackground)

expressionRequired.AnexpressionthatreturnsaSequenceobject.

EffectRequiredEffectobject.Theanimationeffecttobeappliedtothebackground.

AnimateBackgroundRequiredMsoTriState.Determineswhetherthetextwillanimateseparatelyfromthebackground.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseAnimatestextseparatelyfromthebackground.msoTriStateMixedmsoTriStateTogglemsoTrueAnimatestextalongwiththebackground.

Page 534: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesatexteffectforthefirstshapeonthefirstslideintheactivepresentation,andanimatesthetextintheshapeseparatelyfromthebackground.Thisexampleassumesthereisashapeonthefirstslide,andthattheshapehastextinsideofit.

SubAnimateText()

DimtimeMainAsTimeLine

DimshpActiveAsShape

SetshpActive=ActivePresentation.Slides(1).Shapes(1)

SettimeMain=ActivePresentation.Slides(1).TimeLine

'Addablasteffecttothetext,andanimatethetextseparately

'fromthebackground.

timeMain.MainSequence.ConvertToAnimateBackground_

Effect:=timeMain.MainSequence.AddEffect(Shape:=shpActive,_

effectid:=msoAnimEffectBlast),_

AnimateBackGround:=msoFalse

EndSub

Page 535: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 536: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConvertToAnimateInReverseMethodDetermineswhethertextwillbeanimatedinreverseorder.ReturnsanEffectobjectrepresentingthetextanimation.

expression.ConvertToAnimateInReverse(Effect,animateInReverse)

expressionRequired.AnexpressionthatreturnsaSequenceobject.

EffectRequiredEffectobject.Theanimationeffecttowhichthereversalwillapply.

animateInReverseRequiredMsoTriState.Determinesthetextanimationorder.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThetextanimatesinnormalorder.msoTriStateMixedmsoTriStateTogglemsoTrueThetextanimatesinreverseorder.

Page 537: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesashapewithtextonaslideandaddsarandomanimationtotheshape,ensuringtheshape'stextanimatesinreverse.

SubAnimateInReverse()

DimsldActiveAsSlide

DimtimeMainAsTimeLine

DimshpRectAsShape

'Createaslide,addarectangularshapetotheslide,and

'accesstheslide'sanimationtimeline.

WithActivePresentation

SetsldActive=.Slides.Add(Index:=1,Layout:=ppLayoutBlank)

SetshpRect=sldActive.Shapes.AddShape(Type:=msoShapeRectangle,_

Left:=100,Top:=100,Width:=300,Height:=150)

SettimeMain=sldActive.TimeLine

EndWith

shpRect.TextFrame.TextRange.Text="Thisisarectangle."

'Addarandomanimationeffecttotherectangle,

'andanimatethetextinreverse.

WithtimeMain.MainSequence

.ConvertToAnimateInReverse_

Effect:=.AddEffect(Shape:=shpRect,effectId:=msoAnimEffectRandom),_

AnimateInReverse:=msoTrue

EndWith

EndSub

Page 538: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 539: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConvertToBuildLevelMethodChangesthebuildlevelinformationforaspecifiedanimationeffect.ReturnsanEffectobjectthatrepresentsthebuildlevelinformation.

expression.ConvertToBuildLevel(Effect,Level)

expressionRequired.AnexpressionthatreturnsaSequenceobject.

EffectRequiredEffectobject.Thespecifiedanimationeffect.

LevelRequiredMsoAnimateByLevel.Theanimationbuildlevel.

MsoAnimateByLevelcanbeoneoftheseMsoAnimateByLevelconstants.msoAnimateChartAllAtOncemsoAnimateChartByCategorymsoAnimateChartByCategoryElementsmsoAnimateChartBySeriesmsoAnimateChartBySeriesElementsmsoAnimateDiagramAllAtOncemsoAnimateDiagramBreadthByLevelmsoAnimateDiagramBreadthByNodemsoAnimateDiagramClockwisemsoAnimateDiagramClockwiseInmsoAnimateDiagramClockwiseOutmsoAnimateDiagramCounterClockwisemsoAnimateDiagramCounterClockwiseInmsoAnimateDiagramCounterClockwiseOutmsoAnimateDiagramDepthByBranchmsoAnimateDiagramDepthByNodemsoAnimateDiagramDownmsoAnimateDiagramInByRingmsoAnimateDiagramOutByRing

Page 540: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimateDiagramUpmsoAnimateLevelMixedmsoAnimateTextByAllLevelsmsoAnimateTextByFifthLevelmsoAnimateTextByFirstLevelmsoAnimateTextByFourthLevelmsoAnimateTextBySecondLevelmsoAnimateTextByThirdLevelmsoAnimationLevelNone

Page 541: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Changingbuildlevelinformationforaneffectinvalidatesanyexistingeffects.

Page 542: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplechangesthebuildlevelinformationforananimationeffect,makingtheoriginaleffectinvalid.

SubConvertBuildLevel()

DimsldFirstAsSlide

DimshpFirstAsShape

DimeffFirstAsEffect

DimeffConvertAsEffect

SetsldFirst=ActiveWindow.Selection.SlideRange(1)

SetshpFirst=sldFirst.Shapes(1)

SeteffFirst=sldFirst.TimeLine.MainSequence_

.AddEffect(Shape:=shpFirst,EffectID:=msoAnimEffectAscend)

SeteffConvert=sldFirst.TimeLine.MainSequence_

.ConvertToBuildLevel(Effect:=effFirst,_

Level:=msoAnimateTextByFirstLevel)

EndSub

Page 543: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConvertToShapeMethodCreatesashapethathasthegeometriccharacteristicsofthespecifiedFreeformBuilderobject.ReturnsaShapeobjectthatrepresentsthenewshape.

NoteYoumustapplytheAddNodesmethodtoaFreeformBuilderobjectatleastoncebeforeyouusetheConvertToShapemethod.

expression.ConvertToShape

expressionRequired.AnexpressionthatreturnsaFreeformBuilderobject.

Page 544: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsafreeformwithfiveverticestothefirstslideintheactivepresentation.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.BuildFreeform(msoEditingCorner,360,200)

.AddNodesmsoSegmentCurve,_

msoEditingCorner,380,230,400,250,450,300

.AddNodesmsoSegmentCurve,msoEditingAuto,480,200

.AddNodesmsoSegmentLine,msoEditingAuto,480,400

.AddNodesmsoSegmentLine,msoEditingAuto,360,200

.ConvertToShape

EndWith

Page 545: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 546: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConvertToTextUnitEffectMethodReturnsanEffectobjectthatrepresentshowtextshouldanimate.

expression.ConvertToTextUnitEffect(Effect,unitEffect)

expressionRequired.AnexpressionthatreturnsaSequenceobject.

EffectRequiredEffectobject.Theanimationeffecttowhichthetextuniteffectapplies.

unitEffectRequiredMsoAnimTextUnitEffect.Howthetextshouldanimate.

MsoAnimTextUnitEffectcanbeoneoftheseMsoAnimTextUnitEffectconstants.msoAnimTextUnitEffectByCharactermsoAnimTextUnitEffectByParagraphmsoAnimTextUnitEffectByWordmsoAnimTextUnitEffectMixed

Page 547: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsananimationtoagivenshapeandanimatesitsaccompanyingtextbycharacter.

SubNewTextUnitEffect()

DimshpFirstAsShape

DimtmlMainAsTimeLine

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SettmlMain=ActivePresentation.Slides(1).TimeLine

tmlMain.MainSequence.ConvertToTextUnitEffect_

Effect:=tmlMain.MainSequence.AddEffect(Shape:=shpFirst,_

EffectID:=msoAnimEffectRandomEffects),_

unitEffect:=msoAnimTextUnitEffectByCharacter

EndSub

Page 548: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CopyMethodCopiesthespecifiedobjecttotheClipboard.

expression.Copy

expressionRequired.AnexpressionthatreturnsaSelection,Shape,ShapeRange,Slide,SlideRange,orTextRangeobject.

Page 549: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsethePastemethodtopastethecontentsoftheClipboard.

Page 550: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecopiestheselectioninwindowonetotheClipboardandthenpastesitintotheviewinwindowtwo.IftheClipboardcontentscannotbepastedintotheviewinwindowtwo—forexample,ifyoutrytopasteashapeintoslidesorterview—thisexamplefails.

Windows(1).Selection.Copy

Windows(2).View.Paste

ThisexamplecopiesshapesoneandtwoonslideoneintheactivepresentationtotheClipboardandthenpastesthecopiesontoslidetwo.

WithActivePresentation

.Slides(1).Shapes.Range(Array(1,2)).Copy

.Slides(2).Shapes.Paste

EndWith

ThisexamplecopiesslideoneintheactivepresentationtotheClipboard.

ActivePresentation.Slides(1).Copy

ThisexamplecopiesthetextinshapeoneonslideoneintheactivepresentationtotheClipboard.

ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Copy

Page 551: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 552: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CreateNewDocumentMethodCreatesanewWebpresentationassociatedwiththespecifiedhyperlink.

expression.CreateNewDocument(FileName,EditNow,Overwrite)

expressionRequired.AnexpressionthatreturnsaHyperlinkobject.

FileNameRequiredString.Thepathandfilenameofthedocument.

EditNowRequiredMsoTriState.Determineswhetherthedocumentisopenedimmediatelyinitsassociatededitor.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDonotopenthedocumentimmediately.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Openthedocumentimmediatelyinitsassociatededitortomodifyit.

OverwriteRequiredMsoTriState.Determineswhetheranyexistingfileofthesamenameinthesamefolderisoverwritten.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Preserveanyexistingfileofthesamenameinthesamefolder,requiringanewfilenametobespecifiedintheFileNameargument.msoTriStateMixedmsoTriStateTogglemsoTrueOverwriteanyexistingfileofthesamenameinthesamefolder.

Page 553: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecreatesanewWebpresentationtobeassociatedwithhyperlinkoneonslideone.ThenewpresentationiscalledBrittany.ppt,anditoverwritesanyfileofthesamenameintheHTMLPresfolder.ThenewpresentationdocumentisloadedintoMicrosoftPowerPointimmediatelyforediting.

ActivePresentation.Slides(1).Hyperlinks(1).CreateNewDocument_

FileName:="C:\HTMLPres\Brittany.ppt",_

EditNow:=msoTrue,_

Overwrite:=msoTrue

Page 554: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CustomDropMethodSetstheverticaldistance(inpoints)fromtheedgeofthetextboundingboxtotheplacewherethecalloutlineattachestothetextbox.ThisdistanceismeasuredfromthetopofthetextboxunlesstheAutoAttachpropertyissettoTrueandthetextboxistotheleftoftheoriginofthecalloutline(theplacethatthecalloutpointsto).Inthiscasethedropdistanceismeasuredfromthebottomofthetextbox.

expression.CustomDrop(Drop)

expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.

DropRequiredSingle.Thedropdistance,inpoints.

Page 555: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthecustomdropdistanceto14points,andspecifiesthatthedropdistancealwaysbemeasuredfromthetop.Fortheexampletowork,shapethreemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Callout

.CustomDrop14

.AutoAttach=False

EndWith

Page 556: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CustomLengthMethodSpecifiesthatthefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox)retainafixedlengthwheneverthecalloutismoved.UsetheAutomaticLengthmethodtospecifythatthefirstsegmentofthecalloutlinebescaledautomaticallywheneverthecalloutismoved.Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).

expression.CustomLength(Length)

expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.

LengthRequiredSingle.Thelengthofthefirstsegmentofthecallout,inpoints.

Page 557: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ApplyingthismethodsetstheAutoLengthpropertytoFalseandsetstheLengthpropertytothevaluespecifiedfortheLengthargument.

Page 558: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampletogglesbetweenanautomaticallyscalingfirstsegmentandonewithafixedlengthforthecalloutlineforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Callout

If.AutoLengthThen

.CustomLength50

Else

.AutomaticLength

EndIf

EndWith

Page 559: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CutMethodDeletesthespecifiedobjectandplacesitontheClipboard.

expression.Cut

expressionRequired.AnexpressionthatreturnsaSelection,Shape,ShapeRange,Slide,SlideRange,orTextRangeobject.

Page 560: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledeletestheselectioninwindowoneandplacesacopyofitontheClipboard.

Windows(1).Selection.Cut

Thisexampledeletesshapesoneandtwofromslideoneintheactivepresentation,placescopiesofthemontheClipboard,andthenpastesthecopiesontoslidetwo.

WithActivePresentation

.Slides(1).Shapes.Range(Array(1,2)).Cut

.Slides(2).Shapes.Paste

EndWith

ThisexampledeletesslideonefromtheactivepresentationandplacesacopyofitontheClipboard.

ActivePresentation.Slides(1).Cut

ThisexampledeletesthetextinshapeoneonslideoneintheactivepresentationandplacesacopyofitontheClipboard.

ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Cut

Page 561: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 562: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DeleteMethodDeletemethodasitappliestotheShapeNodesobject.

Deletesashapenode.

expression.Delete(Index)

expressionRequired.AnexpressionthatreturnsaShapeNodesobject.

IndexRequiredLong.Specifiesthenodetobedeleted.Thesegmentfollowingthatnodewillalsobedeleted.Ifthenodeisacontrolpointofacurve,thecurveandallofitsnodeswillbedeleted.

DeletemethodasitappliestotheTagsobject.

Deletesatag.

expression.Delete(Name)

expressionRequired.AnexpressionthatreturnsaTagsobject.

NameRequiredString.Specifiesthenameofthetagtobedeleted.

DeletemethodasitappliestotheallotherobjectsintheAppliesTolist.

Deletesthespecifiedobject.

expression.Delete

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolistexceptfortheShapeNodesandTagsobjects.

Page 563: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Attemptingtodeletetheonlyexistingroworcolumninatablewillresultinarun-timeerror.

Page 564: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheShapeobject.

Thisexampledeletesallfreeformshapesfromslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes

ForintShape=.CountTo1Step-1

With.Item(intShape)

If.Type=msoFreeformThen.Delete

EndWith

Next

EndWith

Page 565: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DeleteTextMethodDeletesthetextassociatedwiththespecifiedshape.

expression.DeleteText

expressionRequired.AnexpressionthatreturnsaTextFrameobject.

Page 566: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

IfshapetwoonmyDocumentcontainstext,thisexampledeletesthetext.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(2).TextFrame.DeleteText

Page 567: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 568: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DistributeMethodEvenlydistributestheshapesinthespecifiedrangeofshapes.Youcanspecifywhetheryouwanttodistributetheshapeshorizontallyorverticallyandwhetheryouwanttodistributethemovertheentireslideorjustoverthespacetheyoriginallyoccupy.

expression.Distribute(DistributeCmd,RelativeTo)

expressionRequired.AnexpressionthatreturnsaShapeRangeobject.

DistributeCmdRequiredMsoDistributeCmd.Specifieswhethershapesintherangearetobedistributedhorizontallyorvertically.

MsoDistributeCmdcanbeoneoftheseMsoDistributeCmdconstants.msoDistributeHorizontallymsoDistributeVertically

RelativeToRequiredMsoTriState.Determineswhethershapesaredistributedevenlyovertheentirehorizontalorverticalspaceontheslide.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDistributestheshapeswithinthehorizontalorverticalspacethattherangeofshapesoriginallyoccupies.msoTriStateMixedmsoTriStateTogglemsoTrueDistributestheshapesevenlyovertheentirehorizontalorverticalspaceontheslide.

Page 569: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledefinesashaperangethatcontainsalltheAutoShapesonthemyDocumentandthenhorizontallydistributestheshapesinthisrange.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

numShapes=.Count

IfnumShapes>1Then

numAutoShapes=0

ReDimautoShpArray(1TonumShapes)

Fori=1TonumShapes

If.Item(i).Type=msoAutoShapeThen

numAutoShapes=numAutoShapes+1

autoShpArray(numAutoShapes)=.Item(i).Name

EndIf

Next

IfnumAutoShapes>1Then

ReDimPreserveautoShpArray(1TonumAutoShapes)

SetasRange=.Range(autoShpArray)

asRange.DistributemsoDistributeHorizontally,msoFalse

EndIf

EndIf

EndWith

Page 570: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 571: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DoVerbMethodRequeststhatanOLEobjectperformoneofitsverbs.UsetheObjectVerbspropertytodeterminetheavailableverbsforanOLEobject.

expression.DoVerb(Index)

expressionRequired.AnexpressionthatreturnsanOLEFormatobject.

IndexOptionalInteger.Theverbtoperform.Ifthisargumentisomitted,thedefaultverbisperformed.

Page 572: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleperformsthedefaultverbforshapethreeonslideoneintheactivepresentationifshapethreeisalinkedorembeddedOLEobject.

WithActivePresentation.Slides(1).Shapes(3)

If.Type=msoEmbeddedOLEObjectOr_

.Type=msoLinkedOLEObjectThen

.OLEFormat.DoVerb

EndIf

EndWith

Thisexampleperformstheverb"Open"forshapethreeonslideoneintheactivepresentationifshapethreeisanOLEobjectthatsupportstheverb"Open."

WithActivePresentation.Slides(1).Shapes(3)

If.Type=msoEmbeddedOLEObjectOr_

.Type=msoLinkedOLEObjectThen

ForEachsVerbIn.OLEFormat.ObjectVerbs

nCount=nCount+1

IfsVerb="Open"Then

.OLEFormat.DoVerbnCount

ExitFor

EndIf

Next

EndIf

EndWith

Page 573: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DrawLineMethodDrawsalineinthespecifiedslideshowview.

expression.DrawLine(BeginX,BeginY,EndX,Height)

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

BeginX,BeginYRequiredSingle.Theposition(inpoints)oftheline'sstartingpointrelativetotheupper-leftcorneroftheslide.

EndX,EndYRequiredSingle.Theposition(inpoints)oftheline'sendingpointrelativetotheupper-leftcorneroftheslide.

Page 574: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledrawsalineinslideshowwindowone.

SlideShowWindows(1).View.DrawLine5,5,250,250

Page 575: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 576: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DuplicateMethodDuplicatemethodasitappliestotheShapeandShapeRangeobjects.

CreatesaduplicateofthespecifiedShapeorShapeRangeobject,addsthenewshapeorrangeofshapestotheShapescollectionimmediatelyaftertheshapeorrangeofshapesspecifiedoriginally,andthenreturnsthenewShapeorShapeRangeobject.

expression.Duplicate

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

DuplicatemethodasitappliestotheSlideandSlideRangeobjects.

CreatesaduplicateofthespecifiedSlideorSlideRangeobject,addsthenewslideorrangeofslidestotheSlidescollectionimmediatelyaftertheslideorsliderangespecifiedoriginally,andthenreturnsaSlideorSlideRangeobjectthatrepresentstheduplicateslideorslides.

expression.Duplicate

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 577: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheShapeandShapeRangeobjects.

Thisexampleaddsanew,blankslideattheendoftheactivepresentation,addsadiamondshapetothenewslide,duplicatesthediamond,andthensetspropertiesfortheduplicate.Thefirstdiamondwillhavethedefaultfillcolorfortheactivecolorscheme;theseconddiamondwillbeoffsetfromthefirstoneandwillhavethedefaultshadowcolor.

SetmySlides=ActivePresentation.Slides

SetnewSlide=mySlides.Add(mySlides.Count+1,ppLayoutBlank)

SetfirstObj=newSlide.Shapes_

.AddShape(msoShapeDiamond,10,10,250,350)

WithfirstObj.Duplicate

.Left=150

.Fill.ForeColor.SchemeColor=ppShadow

EndWith

AsitappliestotheSlideandSlideRangeobjects.

Thisexamplecreatesaduplicateofslideoneintheactivepresentationandthensetsthebackgroundshadingandthetitletextofthenewslide.Thenewslidewillbeslidetwointhepresentation.

SetnewSlide=ActivePresentation.Slides(1).Duplicate

WithnewSlide

.Background.Fill.PresetGradientmsoGradientVertical,_

1,msoGradientGold

.Shapes.Title.TextFrame.TextRange_

.Text="SecondQuarterEarnings"

EndWith

Page 578: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndConnectMethodAttachestheendofthespecifiedconnectortoaspecifiedshape.Ifthere'salreadyaconnectionbetweentheendoftheconnectorandanothershape,thatconnectionisbroken.Iftheendoftheconnectorisn'talreadypositionedatthespecifiedconnectingsite,thismethodmovestheendoftheconnectortotheconnectingsiteandadjuststhesizeandpositionoftheconnector.UsetheBeginConnectmethodtoattachthebeginningoftheconnectortoashape.

expression.EndConnect(ConnectedShape,ConnectionSite)

expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.

ConnectedShapeRequiredShapeobject.Theshapetoattachtheendoftheconnectorto.ThespecifiedShapeobjectmustbeinthesameShapescollectionastheconnector.

ConnectionSiteRequiredLong.AconnectionsiteontheshapespecifiedbyConnectedShape.Mustbeanintegerbetween1andtheintegerreturnedbytheConnectionSiteCountpropertyofthespecifiedshape.Ifyouwanttheconnectortoautomaticallyfindtheshortestpathbetweenthetwoshapesitconnects,specifyanyvalidintegerforthisargumentandthenusetheRerouteConnectionsmethodaftertheconnectorisattachedtoshapesatbothends.

Page 579: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Whenyouattachaconnectortoanobject,thesizeandpositionoftheconnectorareautomaticallyadjusted,ifnecessary.

Page 580: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstworectanglestothefirstslideintheactivepresentationandconnectsthemwithacurvedconnector.NoticethattheRerouteConnectionsmethodmakesitirrelevantwhatvaluesyousupplyfortheConnectionSiteargumentsusedwiththeBeginConnectandEndConnectmethods.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

Withs.AddConnector(msoConnectorCurve,0,0,100,100)_

.ConnectorFormat

.BeginConnectConnectedShape:=firstRect,ConnectionSite:=1

.EndConnectConnectedShape:=secondRect,ConnectionSite:=1

.Parent.RerouteConnections

EndWith

Page 581: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndDisconnectMethodDetachestheendofthespecifiedconnectorfromtheshapeit'sattachedto.Thismethoddoesn'talterthesizeorpositionoftheconnector:theendoftheconnectorremainspositionedataconnectionsitebutisnolongerconnected.UsetheBeginDisconnectmethodtodetachthebeginningoftheconnectorfromashape.

expression.EndDisconnect

expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.

Page 582: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstworectanglestothefirstslideintheactivepresentation,attachesthemwithaconnector,automaticallyreroutestheconnectoralongtheshortestpath,andthendetachestheconnectorfromtherectangles.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

Withs.AddConnector(msoConnectorCurve,0,0,0,0).ConnectorFormat

.BeginConnectfirstRect,1

.EndConnectsecondRect,1

.Parent.RerouteConnections

.BeginDisconnect

.EndDisconnect

EndWith

Page 583: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndNamedShowMethodSwitchesfromrunningacustom,ornamed,slideshowtorunningtheentirepresentationofwhichthecustomshowisasubset.Whentheslideshowadvancesfromthecurrentslide,thenextslidedisplayedwillbethenextoneintheentirepresentation,notthenextoneinthecustomslideshow.

expression.EndNamedShow

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

Page 584: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Ifacustomslideshowiscurrentlyrunninginslideshowwindowone,thisexampleredefinestheslideshowtoincludealltheslidesinthepresentationfromwhichtheslidesinthecustomshowwereselected.

SlideShowWindows(1).View.EndNamedShow

Page 585: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndReviewMethodTerminatesareviewofafilethathasbeensentforreviewusingtheSendForReviewmethodorthathasbeenautomaticallyplacedinareviewcycle.

expression.EndReview

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 586: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleterminatesthereviewoftheactivepresentation.Whenexecuted,thisproceduredisplaysamessageaskingifyouwanttoendthereview.Thisexampleassumestheactivepresentationisinareviewcycle.

SubEndPPTRev()

ActivePresentation.EndReview

EndSub

Page 587: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EraseDrawingMethodRemoveslinesdrawnduringaslideshowusingeithertheDrawLinemethodorthepentool.

expression.EraseDrawing

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

Page 588: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleerasesanylinesthathavebeendrawninslideshowwindowoneusingeithertheDrawLinemethodorthepentool.

SlideShowWindows(1).View.EraseDrawing

Page 589: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ExitMethodEndsthespecifiedslideshow.

expression.Exit

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

Page 590: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleendstheslideshowthat'srunninginslideshowwindowone.

SlideShowWindows(1).View.Exit

Page 591: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 592: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ExportMethodExportmethodasitappliestotheSlideandSlideRangeobjects.

Exportsaslideorrangeofslidesusingthespecifiedgraphicsfilter,andsavestheexportedfileunderthespecifiedfilename.

expression.Export(FileName,FilterName,ScaleWidth,ScaleHeight)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

FileNameRequiredString.Thenameofthefiletobeexportedandsavedtodisk.Youcanincludeafullpath;ifyoudon't,MicrosoftPowerPointcreatesafileinthecurrentfolder.

FilterNameRequiredString.Thegraphicsformatinwhichyouwanttoexportslides.ThespecifiedgraphicsformatmusthaveanexportfilterregisteredintheWindowsregistry.Youcanspecifyeithertheregisteredextensionortheregisteredfiltername.PowerPointwillfirstsearchforamatchingextensionintheregistry.Ifnoextensionthatmatchesthespecifiedstringisfound,PowerPointwilllookforafilternamethatmatches.

ScaleWidthOptionalLong.Thewidthinpixelsofanexportedslide.

ScaleHeightOptionalLong.Theheightinpixelsofanexportedslide.

Page 593: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Exportingapresentationdoesn'tsettheSavedpropertyofapresentationtoTrue.

PowerPointusesthespecifiedgraphicsfiltertosaveeachindividualslide.ThenamesoftheslidesexportedandsavedtodiskaredeterminedbyPowerPoint.They'retypicallysavedasSlide1.wmf,Slide2.wmf,andsoon.ThepathofthesavedfilesisspecifiedintheFileNameargument.

ExportmethodasitappliestothePresentationobject.

Exportseachslideinthepresentation,usingthespecifiedgraphicsfilter,andsavestheexportedfilesinthespecifiedfolder.

expression.Export(Path,FilterName,ScaleWidth,ScaleHeight)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

PathRequiredString.Thepathofthefolderwhereyouwanttosavetheexportedslides.Youcanincludeafullpath;ifyoudon'tdothis,MicrosoftPowerPointcreatesasubfolderinthecurrentfolderfortheexportedslides.

FilterNameRequiredString.Thegraphicsformatinwhichyouwanttoexportslides.ThespecifiedgraphicsformatmusthaveanexportfilterregisteredintheWindowsregistry.Youcanspecifyeithertheregisteredextensionortheregisteredfiltername.PowerPointwillfirstsearchforamatchingextensionintheregistry.Ifnoextensionthatmatchesthespecifiedstringisfound,PowerPointwilllookforafilternamethatmatches.

ScaleWidthOptionalLong.Thewidthinpixelsofanexportedslide.

ScaleHeightOptionalLong.Theheightinpixelsofanexportedslide.

Page 594: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Exportingapresentationdoesn'tsettheSavedpropertyofapresentationtoTrue.

PowerPointusesthespecifiedgraphicsfiltertosaveeachindividualslideinthepresentation.ThenamesoftheslidesexportedandsavedtodiskaredeterminedbyPowerPoint.They'retypicallysavedasSlide1.wmf,Slide2.wmf,andsoon.ThepathofthesavedfilesisspecifiedinthePathargument.

Page 595: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestothePresentationobject.

ThisexamplesavestheactivepresentationasaMicrosoftPowerPointpresentationandthenexportseachslideinthepresentationasaPortableNetworkGraphics(PNG)filethatwillbesavedintheCurrentWorkfolder.Theexamplealsoexportseachslidewithaheightof100pixelsandawidthof100pixels.

WithActivePresentation

.SaveAsFileName:="c:\CurrentWork\AnnualSales",_

FileFormat:=ppSaveAsPresentation

.ExportPath:="c:\CurrentWork",FilterName:="png",_

ScaleWidth:=100,ScaleHeight:=100

EndWith

AsitappliestotheSlideobject.

ThisexampleexportsslidethreeintheactivepresentationtodiskintheJPEGgraphicformat.TheslideissavedasSlide3ofAnnualSales.jpg.

WithApplication.ActivePresentation.Slides(3)

.Export"c:\mydocuments\GraphicFormat\"&_

"Slide3ofAnnualSales","JPG"

EndWith

Page 596: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 597: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FindMethodFindsthespecifiedtextinatextrange,andreturnsaTextRangeobjectthatrepresentsthefirsttextrangewherethetextisfound.ReturnsNothingifnomatchisfound.

expression.Find(FindWhat,After,MatchCase,WholeWords)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

FindWhatRequiredString.Thetexttosearchfor.

AfterOptionalLong.Thepositionofthecharacter(inthespecifiedtextrange)afterwhichyouwanttosearchforthenextoccurrenceofFindWhat.Forexample,ifyouwanttosearchfromthefifthcharacterofthetextrange,specify4forAfter.Ifthisargumentisomitted,thefirstcharacterofthetextrangeisusedasthestartingpointforthesearch.

MatchCaseOptionalMsoTriState.MsoTrueforthesearchtodistinguishbetweenuppercaseandlowercasecharacters.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueSearchmatchesthecaseofthelettersintheFindWhatargument.

WholeWordsOptionalMsoTriState.MsoTrueforthesearchtofindonlywholewordsandnotpartsoflargerwordsaswell.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixed

Page 598: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoTriStateTogglemsoTrueSearchfindsonlywholewords,notpartsoflargerwords.

Page 599: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplefindseveryoccurrenceof"CompanyX"intheactivepresentationandformatsitasbold.

ForEachsldInApplication.ActivePresentation.Slides

ForEachshpInsld.Shapes

Ifshp.HasTextFrameThen

SettxtRng=shp.TextFrame.TextRange

SetfoundText=txtRng.Find(FindWhat:="CompanyX")

DoWhileNot(foundTextIsNothing)

WithfoundText

.Font.Bold=True

SetfoundText=_

txtRng.Find(FindWhat:="CompanyX",_

After:=.Start+.Length-1)

EndWith

Loop

EndIf

Next

Next

Page 600: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FindBySlideIDMethodReturnsaSlideobjectthatrepresentstheslidewiththespecifiedslideIDnumber.EachslideisautomaticallyassignedauniqueslideIDnumberwhenit'screated.UsetheSlideIDpropertytoreturnaslide'sIDnumber.

expression.FindBySlideID(SlideID)

expressionRequired.AnexpressionthatreturnsaSlidescollection.

SlideIDRequiredLong.SpecifiestheIDnumberoftheslideyouwanttoreturn.PowerPointassignsthisnumberwhentheslideiscreated.

Page 601: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UnliketheSlideIndexproperty,theSlideIDpropertyofaSlideobjectwon'tchangewhenyouaddslidestothepresentationorrearrangetheslidesinthepresentation.Therefore,usingtheFindBySlideIDmethodwiththeslideIDnumbercanbeamorereliablewaytoreturnaspecificSlideobjectfromaSlidescollectionthanusingtheItemmethodwiththeslide'sindexnumber.

Page 602: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledemonstrateshowtoretrievetheuniqueIDnumberforaSlideobjectandthenusethisnumbertoreturnthatSlideobjectfromtheSlidescollection.

Setgslides=ActivePresentation.Slides

'GetslideID

graphSlideID=gslides.Add(2,ppLayoutChart).SlideID

gslides.FindBySlideID(graphSlideID)_

.SlideShowTransition.EntryEffect=_

ppEffectCoverLeft'UseIDtoreturnspecificslide

Page 603: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FindFirstAnimationForMethodReturnsanEffectobjectthatrepresentsthefirstanimationforagivenshape.

expression.FindFirstAnimationFor(Shape)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ShapeRequiredShapeobject.Theshapeforwhichtofindthefirstanimation.

Page 604: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplefindsanddeletesthefirstanimationforathefirstshapeonthefirstslide.Thisexampleassumesthatatleastoneanimationeffectexistsforthespecifiedshape.

SubFindFirstAnimation()

DimsldFirstAsSlide

DimshpFirstAsShape

DimeffFirstAsEffect

SetsldFirst=ActivePresentation.Slides(1)

SetshpFirst=sldFirst.Shapes(1)

SeteffFirst=sldFirst.TimeLine.MainSequence_

.FindFirstAnimationFor(Shape:=shpFirst)

effFirst.Delete

EndSub

Page 605: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FindFirstAnimationForClickMethodReturnsanEffectobjectthatrepresentsthefirstanimationstartedbythespecifiedclicknumber.

expression.FindFirstAnimationForClick(Click)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ClickRequiredLong.Thespecifiedclicknumber.

Page 606: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplefindsthefirstanimationforthefirstclickonthefirstslideandchangestheeffecttoabounce.

SubFindFirstAnimationClick()

DimsldFirstAsSlide

DimeffClickAsEffect

SetsldFirst=ActivePresentation.Slides(1)

SeteffClick=sldFirst.TimeLine.MainSequence_

.FindFirstAnimationForClick(Click:=1)

effClick.EffectType=msoAnimEffectBounce

EndSub

Page 607: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FirstMethodSetsthespecifiedslideshowviewtodisplaythefirstslideinthepresentation.

expression.First

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

Page 608: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfyouusetheFirstmethodtoswitchfromoneslidetoanotherduringaslideshow,whenyoureturntotheoriginalslide,itsanimationpicksupwhereitleftoff.

Page 609: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsslideshowwindowonetodisplaythefirstslideinthepresentation.

SlideShowWindows(1).View.First

Page 610: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FitToPageMethodAdjuststhesizeofthespecifieddocumentwindowtoaccommodatetheinformationthat'scurrentlydisplayed.

expression.FitToPage

expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.

Page 611: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleexitsthecurrentslideshow,setstheviewintheactivewindowtoslideview,setsthezoomto25percent,andadjuststhesizeofthewindowtofittheslidedisplayedthere.

Application.SlideShowWindows(1).View.Exit

WithApplication.ActiveWindow

.ViewType=ppViewSlide

.View.Zoom=25

.FitToPage

EndWith

Page 612: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 613: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FlipMethodFlipsthespecifiedshapearoundit'shorizontalorverticalaxis.

expression.Flip(FlipCmd)

expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.

FlipCmdRequiredMsoFlipCmd.Specifieswhethertheshapeistobeflippedhorizontallyorvertically.

MsoFlipCmdcanbeoneoftheseMsoFlipCmdconstants.msoFlipHorizontalmsoFlipVertical

Page 614: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsatriangletomyDocument,duplicatesthetriangle,andthenflipstheduplicatetriangleverticallyandmakesitred.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeRightTriangle,10,10,50,50).Duplicate

.Fill.ForeColor.RGB=RGB(255,0,0)

.FlipmsoFlipVertical

EndWith

Page 615: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FollowMethodDisplaystheHTMLdocumentassociatedwiththespecifiedhyperlinkinanewWebbrowserwindow.

expression.Follow

expressionRequired.AnexpressionthatreturnsaHyperlinkobject.

Page 616: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleloadsthedocumentassociatedwiththefirsthyperlinkonslideoneinanewinstanceoftheWebbrowser.

ActivePresentation.Slides(1).Hyperlinks(1).Follow

Page 617: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 618: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FollowHyperlinkMethodDisplaysacacheddocument,ifithasalreadybeendownloaded.Otherwise,thismethodresolvesthehyperlink,downloadsthetargetdocumentanddisplaysitintheappropriateapplication.

expression.FollowHyperlink(Address,SubAddress,NewWindow,AddHistory,ExtraInfo,Method,HeaderInfo)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

AddressRequiredString.Theaddressofthetargetdocument.

SubAddressOptionalString.Thelocationinthetargetdocument.Bydefault,thisargumentisanemptystring.

NewWindowOptionalBoolean.Truetohavethetargetapplicationopenedinanewwindow.ThedefaultvalueisFalse.

AddHistoryOptionalBoolean.Truetoaddthelinktothecurrentday'shistoryfolder.

ExtraInfoOptionalString.StringorbytearraythatspecifiesinformationforHTTP.Thisargumentcanbeused,forexample,tospecifythecoordinatesofanimagemaporthecontentsofaform.ItcanalsoindicateaFATfilename.TheMethodargumentdetermineshowthisextrainformationishandled.

MethodOptionalMsoExtraInfoMethod.SpecifieshowExtraInfoispostedorappended.

MsoExtraInfoMethodcanbeoneoftheseMsoExtraInfoMethodconstants.msoMethodGetDefault.ExtraInfoisaStringthatisappendedtotheaddress.msoMethodPostExtraInfoispostedasaStringorbytearray.

HeaderInfoOptionalString.AstringthatspecifiesheaderinformationfortheHTTPrequest.Thedefaultvalueisanemptystring.Youcancombineseveralheaderlinesintoasinglestringbyusingthefollowingsyntax:"string1"&vbCr

Page 619: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

&"string2".ThespecifiedstringisautomaticallyconvertedintoANSIcharacters.NotethattheHeaderInfoargumentmayoverwritedefaultHTTPheaderfields.

Page 620: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleloadsthedocumentatexample.microsoft.cominanewwindowandaddsittothehistoryfolder.

ActivePresentation.FollowHyperlink_

Address:="http://example.microsoft.com",_

NewWindow:=True,AddHistory:=True

Page 621: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GotoNamedShowMethodSwitchestothespecifiedcustom,ornamed,slideshowduringanotherslideshow.Whentheslideshowadvancesfromthecurrentslide,thenextslidedisplayedwillbethenextoneinthespecifiedcustomslideshow,notthenextoneincurrentslideshow.

expression.GotoNamedShow(SlideShowName)

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

SlideShowNameRequiredString.Thenameofthecustomslideshowtobeswitchedto.

Page 622: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleredefinestheslideshowrunninginslideshowwindowonetoincludeonlytheslidesinthecustomslideshownamed"QuickShow."

SlideShowWindows(1).View.GotoNamedShow"QuickShow"

Page 623: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 624: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GotoSlideMethodGotoSlidemethodasitappliestotheViewobject.

Switchestothespecifiedslide.

expression.GotoSlide(Index)

expressionRequired.AnexpressionthatreturnsaViewobject.

IndexRequiredInteger.Thenumberoftheslidetoswitchto.

GotoSlidemethodasitappliestotheSlideShowViewobject.

Switchestothespecifiedslideduringaslideshow.Youcanspecifywhetheryouwanttheanimationeffectstobererun.

expression.GotoSlide(Index,ResetSlide)

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

IndexRequiredInteger.Thenumberoftheslidetoswitchto.

ResetSlideOptionalMsoTriState.IfyouswitchfromoneslidetoanotherduringaslideshowwithResetSlidesettomsoFalse,whenyoureturntothefirstslide,itsanimationpicksupwhereitleftoff.IfyouswitchfromoneslidetoanotherwithResetSlidesettomsoTrue,whenyoureturntothefirstslide,itsentireanimationstartsover.ThedefaultvalueismsoTrue.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.

Page 625: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleswitchesfromthecurrentslidetotheslidethreeinslideshowwindowone.Ifyouswitchbacktothecurrentslideduringtheslideshow,itsentireanimationwillstartover.

WithSlideShowWindows(1).View

.GotoSlide3

EndWith

Thisexampleswitchesfromthecurrentslidetotheslidethreeinslideshowwindowone.Ifyouswitchbacktothecurrentslideduringtheslideshow,itsanimationwillpickupwhereitleftoff.

WithSlideShowWindows(1).View

.GotoSlide3,msoFalse

EndWith

Page 626: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GroupMethodGroupstheshapesinthespecifiedrange.ReturnsthegroupedshapesasasingleShapeobject.

expression.Group

expressionRequired.AnexpressionthatreturnsaShapeRangeobject.

Page 627: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Becauseagroupofshapesistreatedasasingleshape,groupingandungroupingshapeschangesthenumberofitemsintheShapescollectionandchangestheindexnumbersofitemsthatcomeaftertheaffecteditemsinthecollection.

Page 628: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstwoshapestomyDocument,groupsthetwonewshapes,setsthefillforthegroup,rotatesthegroup,andsendsthegrouptothebackofthedrawinglayer.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShape(msoShapeCan,50,10,100,200).Name="shpOne"

.AddShape(msoShapeCube,150,250,100,200).Name="shpTwo"

With.Range(Array("shpOne","shpTwo")).Group

.Fill.PresetTexturedmsoTextureBlueTissuePaper

.Rotation=45

.ZOrdermsoSendToBack

EndWith

EndWith

Page 629: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HelpMethodDisplaysaHelptopic.

expression.Help(HelpFile,ContextID)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

HelpFileOptionalString.ThenameoftheHelpfileyouwanttodisplay.Canbeeithera.chmoran.hlpfile.Ifthisargumentisn'tspecified,MicrosoftPowerPointHelpisused.

ContextIDOptionalLong.ThecontextIDnumberfortheHelptopic.Ifthisargumentisn'tspecifiedorifitspecifiesacontextIDnumberthatisnotassociatedwithaHelptopic,theHelpTopicsdialogboxisdisplayed.

Page 630: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaystopicnumber65527intheHelpfileMyHelpFile.chm.

Application.Help"MyHelpFile.chm",65527

Page 631: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ImportFromFileMethodSpecifiesthesoundthatwillbeplayedwheneverthespecifiedshapeisclickedoranimatedorwheneverthespecifiedslidetransitionoccurs.

expression.ImportFromFile(FullName)

expressionRequired.AnexpressionthatreturnsaSoundEffectobject.

FullNameRequiredString.Thenameofthespecifiedsoundfile.

Page 632: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatthefileDudududu.wavwillstarttoplayatthetransitiontoslidetwointheactivepresentationandwillcontinuetoplayuntilthenextsoundstarts.

WithActivePresentation.Slides(2).SlideShowTransition

.SoundEffect.ImportFromFile"c:\sndsys\dudududu.wav"

.LoopSoundUntilNext=True

EndWith

Page 633: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementBrightnessMethodChangesthebrightnessofthepicturebythespecifiedamount.UsetheBrightnesspropertytosettheabsolutebrightnessofthepicture.

expression.IncrementBrightness(Increment)

expressionRequired.AnexpressionthatreturnsaPictureFormatobject.

IncrementRequiredSingle.SpecifieshowmuchtochangethevalueoftheBrightnesspropertyforthepicture.Apositivevaluemakesthepicturebrighter;anegativevaluemakesthepicturedarker.

Page 634: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucannotadjustthebrightnessofapicturepasttheupperorlowerlimitfortheBrightnessproperty.Forexample,iftheBrightnesspropertyisinitiallysetto0.9andyouspecify0.3fortheIncrementargument,theresultingbrightnesslevelwillbe1.0,whichistheupperlimitfortheBrightnessproperty,insteadof1.2.

Page 635: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecreatesaduplicateofshapeoneonmyDocumentandthenmovesanddarkenstheduplicate.Fortheexampletowork,shapeonemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Duplicate

.PictureFormat.IncrementBrightness-0.2

.IncrementLeft50

.IncrementTop50

EndWith

Page 636: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementContrastMethodChangesthecontrastofthepicturebythespecifiedamount.UsetheContrastpropertytosettheabsolutecontrastforthepicture.

expression.IncrementContrast(Increment)

expressionRequired.AnexpressionthatreturnsaPictureFormatobject.

IncrementRequiredSingle.SpecifieshowmuchtochangethevalueoftheContrastpropertyforthepicture.Apositivevalueincreasesthecontrast;anegativevaluedecreasesthecontrast.

Page 637: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucannotadjustthecontrastofapicturepasttheupperorlowerlimitfortheContrastproperty.Forexample,iftheContrastpropertyisinitiallysetto0.9andyouspecify0.3fortheIncrementargument,theresultingcontrastlevelwillbe1.0,whichistheupperlimitfortheContrastproperty,insteadof1.2.

Page 638: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleincreasesthecontrastforallpicturesonmyDocumentthataren'talreadysettomaximumcontrast.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.Type=msoPictureThen

s.PictureFormat.IncrementContrast0.1

EndIf

Next

Page 639: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementLeftMethodMovesthespecifiedshapehorizontallybythespecifiednumberofpoints.

expression.IncrementLeft(Increment)

expressionRequired.AnexpressionthatreturnsaShapeobject.

IncrementRequiredSingle.Specifieshowfartheshapeistobemovedhorizontally,inpoints.Apositivevaluemovestheshapetotheright;anegativevaluemovesittotheleft.

Page 640: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleduplicatesshapeoneonmyDocument,setsthefillfortheduplicate,movesit70pointstotherightand50pointsup,androtatesit30degreesclockwise.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Duplicate

.Fill.PresetTexturedmsoTextureGranite

.IncrementLeft70

.IncrementTop-50

.IncrementRotation30

EndWith

Page 641: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementOffsetXMethodChangesthehorizontaloffsetoftheshadowbythespecifiednumberofpoints.UsetheOffsetXpropertytosettheabsolutehorizontalshadowoffset.

expression.IncrementOffsetX(Increment)

expressionRequired.AnexpressionthatreturnsaShadowFormatobject.

IncrementRequiredSingle.Specifieshowfartheshadowoffsetistobemovedhorizontally,inpoints.Apositivevaluemovestheshadowtotheright;anegativevaluemovesittotheleft.

Page 642: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplemovestheshadowforshapethreeonmyDocumenttotheleftby3points.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).Shadow.IncrementOffsetX-3

Page 643: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementOffsetYMethodChangestheverticaloffsetoftheshadowbythespecifiednumberofpoints.UsetheOffsetYpropertytosettheabsoluteverticalshadowoffset.

expression.IncrementOffsetY(Increment)

expressionRequired.AnexpressionthatreturnsaShadowFormatobject.

IncrementRequiredSingle.Specifieshowfartheshadowoffsetistobemovedvertically,inpoints.Apositivevaluemovestheshadowdown;anegativevaluemovesitup.

Page 644: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplemovestheshadowforshapethreeonmyDocumentupby3points.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).Shadow.IncrementOffsetY-3

Page 645: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 646: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementRotationMethodChangestherotationofthespecifiedshapearoundthez-axis.bythespecifiednumberofdegrees.UsetheRotationpropertytosettheabsoluterotationoftheshape.

expression.IncrementRotation(Increment)

expressionRequired.AnexpressionthatreturnsaShapeobject.

IncrementRequiredSingle.Specifieshowfartheshapeistoberotatedhorizontally,indegrees.Apositivevaluerotatestheshapeclockwise;anegativevaluerotatesitcounterclockwise.

Page 647: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Torotateathree-dimensionalshapearoundthex-axisorthey-axis,usetheIncrementRotationXmethodortheIncrementRotationYmethod.

Page 648: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleduplicatesshapeoneonmyDocument,setsthefillfortheduplicate,movesit70pointstotherightand50pointsup,androtatesit30degreesclockwise.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Duplicate

.Fill.PresetTexturedmsoTextureGranite

.IncrementLeft70

.IncrementTop-50

.IncrementRotation30

EndWith

Page 649: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 650: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementRotationXMethodChangestherotationofthespecifiedshapearoundthex-axisbythespecifiednumberofdegrees.UsetheRotationXpropertytosettheabsoluterotationoftheshapearoundthex-axis.

expression.IncrementRotationX(Increment)

expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.

IncrementRequiredSingle.Specifieshowmuch(indegrees)therotationoftheshapearoundthex-axisistobechanged.Canbeavaluefrom–90through90.Apositivevaluetiltstheshapeup;anegativevaluetiltsitdown.

Page 651: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcannotadjusttherotationaroundthex-axisofthespecifiedshapepasttheupperorlowerlimitfortheRotationXproperty(90degreesto–90degrees).Forexample,iftheRotationXpropertyisinitiallysetto80andyouspecify40fortheIncrementargument,theresultingrotationwillbe90(theupperlimitfortheRotationXproperty)insteadof120.

Tochangetherotationofashapearoundthey-axis,usetheIncrementRotationYmethod.Tochangetherotationaroundthez-axis,usetheIncrementRotationmethod.

Page 652: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampletiltsshapeoneonmyDocumentup10degrees.Shapeonemustbeanextrudedshapeforyoutoseetheeffectofthiscode.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).ThreeD.IncrementRotationX10

Page 653: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 654: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementRotationYMethodChangestherotationofthespecifiedshapearoundthey-axisbythespecifiednumberofdegrees.UsetheRotationYpropertytosettheabsoluterotationoftheshapearoundthey-axis.

expression.IncrementRotationY(Increment)

expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.

IncrementRequiredSingle.Specifieshowmuch(indegrees)therotationoftheshapearoundthey-axisistobechanged.Canbeavaluefrom–90through90.Apositivevaluetiltstheshapetotheleft;anegativevaluetiltsittotheright.

Page 655: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Tochangetherotationofashapearoundthex-axis,usetheIncrementRotationXmethod.Tochangetherotationaroundthez-axis,usetheIncrementRotationmethod.

Youcannotadjusttherotationaroundthey-axisofthespecifiedshapepasttheupperorlowerlimitfortheRotationYproperty(90degreesto–90degrees).Forexample,iftheRotationYpropertyisinitiallysetto80andyouspecify40fortheIncrementargument,theresultingrotationwillbe90(theupperlimitfortheRotationYproperty)insteadof120.

Page 656: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampletiltsshapeoneonmyDocument10degreestotheright.Shapeonemustbeanextrudedshapeforyoutoseetheeffectofthiscode.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).ThreeD.IncrementRotationY-10

Page 657: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncrementTopMethodMovesthespecifiedshapeverticallybythespecifiednumberofpoints.

expression.IncrementTop(Increment)

expressionRequired.AnexpressionthatreturnsaShapeobject.

IncrementRequiredSingle.Specifieshowfartheshapeobjectistobemovedvertically,inpoints.Apositivevaluemovestheshapedown;anegativevaluemovesitup.

Page 658: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleduplicatesshapeoneonmyDocument,setsthefillfortheduplicate,movesit70pointstotherightand50pointsup,androtatesit30degreesclockwise.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Duplicate

.Fill.PresetTexturedmsoTextureGranite

.IncrementLeft70

.IncrementTop-50

.IncrementRotation30

EndWith

Page 659: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 660: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertMethodInsertsanewsegmentafterthespecifiednodeofthefreeform.

expression.Insert(Index,SegmentType,EditingType,X1,Y1,X2,Y2,X3,Y3)

expressionRequired.AnexpressionthatreturnsaShapeNodesobject.

IndexRequiredLong.Thenodethatthenewnodeistobeinsertedafter.

SegmentTypeRequiredMsoSegmentType.Thetypeofsegmenttobeadded.

MsoSegmentTypecanbeoneoftheseMsoSegmentTypeconstants.msoSegmentCurvemsoSegmentLine

EditingTypeRequiredMsoEditingType.Theeditingpropertyofthevertex.

MsoEditingTypecanbeoneoftheseMsoEditingTypeconstants(cannotbemsoEditingSmoothormsoEditingSymmetric).msoEditingAutomsoEditingCorner

X1RequiredSingle.IftheEditingTypeofthenewsegmentismsoEditingAuto,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewnodeismsoEditingCorner,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothefirstcontrolpointforthenewsegment.

Y1RequiredSingle.IftheEditingTypeofthenewsegmentismsoEditingAuto,thisargumentspecifiestheverticaldistance(inpoints)fromtheupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewnodeismsoEditingCorner,thisargumentspecifiestheverticaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothefirstcontrolpointforthenewsegment.

Page 661: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

X2OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothesecondcontrolpointforthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

Y2OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiestheverticaldistance(inpoints)fromtheupper-leftcornerofthedocumenttothesecondcontrolpointforthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

X3OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiesthehorizontaldistance(inpoints)fromtheupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

Y3OptionalSingle.IftheEditingTypeofthenewsegmentismsoEditingCorner,thisargumentspecifiestheverticaldistance(inpoints)fromtheupper-leftcornerofthedocumenttotheendpointofthenewsegment.IftheEditingTypeofthenewsegmentismsoEditingAuto,don'tspecifyavalueforthisargument.

Page 662: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsasmoothnodewithacurvedsegmentafternodefourinshapethreeonmyDocument.Shapethreemustbeafreeformdrawingwithatleastfournodes.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

.InsertIndex:=4,SegmentType:=msoSegmentCurve,_

EditingType:=msoEditingSmooth,X1:=210,Y1:=100

EndWith

Page 663: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertAfterMethodAppendsastringtotheendofthespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheappendedtext.Whenusedwithoutanargument,thismethodreturnsazero-lengthstringattheendofthespecifiedrange.

expression.InsertAfter(NewText)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

NewTextOptionalString.Thetexttobeinserted.Thedefaultvalueisanemptystring.

Page 664: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleappendsthestring":Testversion"totheendofthetitleonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(1)

.TextFrame.TextRange.InsertAfter":Testversion"

EndWith

ThisexampleappendsthecontentsoftheClipboardtotheendofthetitleonslideone.

Application.ActivePresentation.Slides(1).Shapes(1).TextFrame_

.TextRange.InsertAfter.Paste

Page 665: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertBeforeMethodAppendsastringtothebeginningofthespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheappendedtext.Whenusedwithoutanargument,thismethodreturnsazero-lengthstringattheendofthespecifiedrange.

expression.InsertBefore(NewText)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

NewTextOptionalString.Thetexttobeappended.Thedefaultvalueisanemptystring.

Page 666: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleappendsthestring"Testversion:"tothebeginningofthetitleonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(1)

.TextFrame.TextRange.InsertBefore"Testversion:"

EndWith

ThisexampleappendsthecontentsoftheClipboardtothebeginningofthetitleonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(1).TextFrame_

.TextRange.InsertBefore.Paste

Page 667: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 668: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertDateTimeMethodInsertsthedateandtimeinthespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheinsertedtext.

expression.InsertDateTime(DateTimeFormat,InsertAsField)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

DateTimeFormatRequiredPpDateTimeFormat.Aformatforthedateandtime.

PpDateTimeFormatcanbeoneofthesePpDateTimeFormatconstants.ppDateTimeddddMMMMddyyyyppDateTimedMMMMyyyyppDateTimedMMMyyppDateTimeFormatMixedppDateTimeHmmppDateTimehmmAMPMppDateTimeHmmssppDateTimehmmssAMPMppDateTimeMdyyppDateTimeMMddyyHmmppDateTimeMMddyyhmmAMPMppDateTimeMMMMdyyyyppDateTimeMMMMyyppDateTimeMMyy

InsertAsFieldOptionalMsoTriState.Determineswhethertheinserteddateandtimewillbeupdatedeachtimethepresentationisopened.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.

Page 669: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoTriStateMixedmsoTriStateTogglemsoTrueUpdatestheinserteddateandtimeeachtimethepresentationisopened.

Page 670: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleinsertsthedateandtimeafterthefirstsentenceofthefirstparagraphinshapetwoonslideoneintheactivepresentation.

Setsh=Application.ActivePresentation.Slides(1).Shapes(2)

SetsentOne=sh.TextFrame.TextRange.Paragraphs(1).Sentences(1)

sentOne.InsertAfter.InsertDateTimeppDateTimeMdyy

Page 671: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertFromFileMethodInsertsslidesfromafileintoapresentation,atthespecifiedlocation.Returnsanintegerthatrepresentsthenumberofslidesinserted.

expression.InsertFromFile(FileName,Index,SlideStart,SlideEnd)

expressionRequired.AnexpressionthatreturnsaSlidescollection.

FileNameRequiredString.Thenameofthefilethatcontainstheslidesyouwanttoinsert.

IndexRequiredLong.TheindexnumberoftheSlideobjectinthespecifiedSlidescollectionyouwanttoinsertthenewslidesafter.

SlideStartOptionalLong.TheindexnumberofthefirstSlideobjectintheSlidescollectioninthefiledenotedbyFileName.

SlideEndOptionalLong.TheindexnumberofthelastSlideobjectintheSlidescollectioninthefiledenotedbyFileName.

Page 672: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleinsertsslidesthreethroughsixfromC:\Ppt\Sales.pptafterslidetwointheactivepresentation.

ActivePresentation.Slides.InsertFromFile_

"c:\ppt\sales.ppt",2,3,6

Page 673: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertSlideNumberMethodInsertstheslidenumberofthecurrentslideintothespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheslidenumber.

expression.InsertSlideNumber

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

Page 674: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Theinsertedslidenumberisautomaticallyupdatedwhentheslidenumberofthecurrentslidechanges.

Page 675: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleinsertstheslidenumberofthecurrentslideafterthefirstsentenceofthefirstparagraphinshapetwoonslideoneintheactivepresentation.

Setsh=Application.ActivePresentation.Slides(1).Shapes(2)

SetsentOne=sh.TextFrame.TextRange.Paragraphs(1).Sentences(1)

sentOne.InsertAfter.InsertSlideNumber

Page 676: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 677: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsertSymbolMethodReturnsaTextRangeobjectthatrepresentsasymbolinsertedintothespecifiedtextrange.

expression.InsertSymbol(FontName,CharNumber,UniCode)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

FontNameRequiredString.Thefontname.

CharNumberRequiredLong.TheUnicodeorASCIIcharacternumber.

UnicodeOptionalMsoTriState.SpecifieswhethertheCharNumberargumentrepresentsanASCIIorUnicodecharacter.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothismethod.msoFalseDefault.TheCharNumberargumentrepresentsanASCIIcharacternumber.msoTriStateMixedDoesn'tapplytothismethod.msoTriStateToggleDoesn'tapplytothismethod.msoTrueTheCharNumberargumentrepresentsaUnicodecharacter.

Page 678: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleinsertstheRegisteredTrademarksymbolafterthefirstsentenceofthefirstparagraphinanewtextboxonthefirstslideintheactivepresentation.

SubSymbol()

DimtxtBoxAsShape

'Addtextbox

SettxtBox=Application.ActivePresentation.Slides(1)_

.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal,_

Left:=100,Top:=100,Width:=100,Height:=100)

'Addsymboltotextbox

txtBox.TextFrame.TextRange.InsertSymbol_

FontName:="Symbol",CharNumber:=226

EndSub

Page 679: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 680: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ItemMethodItemmethodasitappliestotheActionSettingsobject.

ReturnsasingleactionsettingfromthespecifiedActionSettingscollection.

expression.Item(Index)

expressionRequired.AnexpressionthatreturnsanActionSettingscollection.

IndexRequiredPpMouseActivation.TheactionsettingforaMouseClickorMouseOverevent.

PpMouseActivationcanbeoneofthesePpMouseActivationconstants.ppMouseClickTheactionsettingforwhentheuserclickstheshape.ppMouseOverTheactionsettingforwhenthemousepointerispositionedoverthespecifiedshape.

ItemmethodasitappliestotheAddIns,CanvasShapes,Designs,DiagramNodeChildren,DiagramNodes,Fonts,GroupShapes,NamedSlideShows,Presentations,ShapeNodes,ShapeRange,Shapes,SlideRange,andSlidesobjects.

Returnsasingleobjectfromthespecifiedcollection.

expression.Item(Index)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

IndexRequiredVariant.Thenameorindexnumberofthesingleobjectinthecollectiontobereturned.

ItemmethodasitappliestotheAnimationBehaviors,AnimationPoints,CellRange,ColorSchemes,Columns,Comments,DocumentWindows,ExtraColors,Hyperlinks,ObjectVerbs,Panes,Placeholders,PrintRanges,PublishObjects,Rows,RulerLevels,Sequence,Sequences,

Page 681: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowWindows,TabStops,andTextStyleLevelsobjects.

Returnsasingleobjectfromthespecifiedcollection.

expression.Item(Index)

expressionRequired.AnexpressionthatreturnsanAnimationBehaviorscollection.

IndexRequiredLong.Theindexnumberofthesingleobjectinthecollectiontobereturned.

ItemmethodasitappliestotheBordersobject.

ReturnsaLineFormatobjectforthespecifiedborder.

expression.Item(BorderType)

expressionRequired.AnexpressionthatreturnsaBorderscollection.

BorderTypeRequiredPpBorderType.Specifieswhichborderofacellorcellrangeistobereturned.

PpBorderTypecanbeoneofthesePpBorderTypeconstants.ppBorderBottomppBorderDiagonalDownppBorderDiagonalUpppBorderLeftppBorderRightppBorderTop

ItemmethodasitappliestotheTagsobject.

ReturnsasingletagfromthespecifiedTagscollection.

expression.Item(Name)

expressionRequired.AnexpressionthatreturnsaTagsobject.

Page 682: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NameRequiredString.Thenameofthesingletaginthecollectiontobereturned.

ItemmethodasitappliestotheTextStylesobject.

ReturnsasingletextstylefromthespecifiedTextStylescollection.

expression.Item(Type)

expressionRequired.AnexpressionthatreturnsaTextStylescollection.

TypeRequiredPpTextStyleType.Thetextstyletype.

PpTextStyleTypecanbeoneofthesePpTextStyleTypeconstants.ppBodyStyleppDefaultStyleppTitleStyle

Page 683: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheItemmethodisthedefaultmemberforacollection.Forexample,thefollowingtwolinesofcodeareequivalent:

ActivePresentation.Slides.Item(1)

ActivePresentation.Slides(1)

Formoreinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 684: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheActionSettingsobject.

ThisexamplesetsshapethreeonslideonetoplaythesoundofapplauseandusestheAnimateActionpropertytospecifythattheshape'scoloristobemomentarilyinvertedwhentheshapeisclickedduringaslideshow.

WithActivePresentation.Slides.Item(1).Shapes_

.Item(3).ActionSettings.Item(ppMouseClick)

.SoundEffect.Name="applause"

.AnimateAction=True

EndWith

AsitappliestotheRulerLevelsobject.

Thisexamplesetsthefirst-lineindentandthehangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation.

WithActivePresentation.SlideMaster.TextStyles.Item(ppBodyStyle)

With.Ruler.Levels.Item(1)'setsindentsforlevel1

.FirstMargin=9

.LeftMargin=54

EndWith

EndWith

AsitappliestotheShapesobject.

Thisexamplesetstheforegroundcolortoredfortheshapenamed"Rectangle1"onslideoneintheactivepresentation.

ActivePresentation.Slides.Item(1).Shapes.Item("rectangle1").Fill_

.ForeColor.RGB=RGB(128,0,0)

AsitappliestotheTagsobject.

Thisexamplehidesallslidesintheactivepresentationthatdon'thavethevalue"east"forthe"region"tag.

Page 685: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ForEachsInActivePresentation.Slides

Ifs.Tags.Item("region")<>"east"Then

s.SlideShowTransition.Hidden=True

EndIf

Next

Page 686: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LargeScrollMethodScrollsthroughthespecifieddocumentwindowbypages.

expression.LargeScroll(Down,Up,ToRight,ToLeft)

expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.

DownOptionalLong.Specifiesthenumberofpagestoscrolldown.

UpOptionalLong.Specifiesthenumberofpagestoscrollup.

ToRightOptionalLong.Specifiesthenumberofpagestoscrollright.

ToLeftOptionalLong.Specifiesthenumberofpagestoscrollleft.

Page 687: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifnoargumentsarespecified,thismethodscrollsdownonepage.IfDownandUparebothspecified,theireffectsarecombined.Forexample,ifDownis2andUpis4,thismethodscrollsuptwopages.Similarly,ifRightandLeftarebothspecified,theireffectsarecombined.

Anyoftheargumentscanbeanegativenumber.

Page 688: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplescrollstheactivewindowdownthreepages.

Application.ActiveWindow.LargeScrollDown:=3

Page 689: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LastMethodSetsthespecifiedslideshowviewtodisplaythelastslideinthepresentation.

expression.Last

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

Page 690: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfyouusetheLastmethodtoswitchfromoneslidetoanotherduringaslideshow,whenyoureturntotheoriginalslide,itsanimationpicksupwhereitleftoff.

Page 691: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsslideshowwindowonetodisplaythelastslideinthepresentation.

SlideShowWindows(1).View.Last

Page 692: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LinesMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextlines.Forinformationaboutcountingorloopingthroughthelinesinatextrange,seetheTextRangeobject.

expression.Lines(Start,Length)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

StartOptionalLong.Thefirstlineinthereturnedrange.

LengthOptionalLong.Thenumberoflinestobereturned.

Page 693: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstlineandendswiththelastparagraphinthespecifiedrange.

IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsoneline.

IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstlineinthespecifiedrange.

IfStartisgreaterthanthenumberoflinesinthespecifiedtext,thereturnedrangestartswiththelastlineinthespecifiedrange.

IfLengthisgreaterthanthenumberoflinesfromthespecifiedstartinglinetotheendofthetext,thereturnedrangecontainsallthoselines.

Page 694: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleformatsasitalicthefirsttwolinesofthesecondparagraphinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange.Paragraphs(2)_

.Lines(1,2).Font.Italic=True

Page 695: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LoadMethodReturnsaDesignobjectthatrepresentsadesignloadedintothemasterlistofthespecifiedpresentation.

expression.Load(TemplateName,Index)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TemplateNameRequiredString.Thepathtothedesigntemplate.

IndexOptionalLong.Theindexnumberofthedesigntemplateinthecollectionofdesigntemplates.Thedefaultis-1,whichmeansthedesigntemplateisaddedtotheendofthelistofdesignsinthepresentation.

Page 696: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddadesigntemplatetothebeginningofthecollectionofdesigntemplatesintheactivepresentation.Thisexampleassumesthe"artsy.pot"templateislocatedatthespecifiedpath.

SubLoadDesign()

ActivePresentation.Designs.LoadTemplateName:="C:\ProgramFiles\"&_

"MicrosoftOffice\Templates\PresentationDesigns\Balance.pot",Index:=1

EndSub

Page 697: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LtrRunMethodSetsthedirectionoftextinatextrangetoreadfromlefttoright.

expression.LtrRun

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

Page 698: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethodmakesitpossibletousetextfrombothleft-to-rightandright-to-leftlanguagesinthesamepresentation.

Page 699: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplefindsalloftheshapesonslideonethatcontaintextandchangesthetexttoreadfromlefttoright.

ActiveWindow.ViewType=ppViewSlide

ForEachshInActivePresentation.Slides(1).Shapes

Ifsh.HasTextFrameThen

sh.TextFrame.TextRange.LtrRun

EndIf

Next

Page 700: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 701: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MergeMethodMergemethodasitappliestotheCellobject.

Mergesonetablecellwithanother.Theresultisasingletablecell.

expression.Merge(MergeTo)

expressionRequired.AnexpressionthatreturnsaCellobject.

MergeToRequiredCellobject.Cellobjecttobemergedwith.Usethesyntax.Cell(row,column).

MergemethodasitappliestothePresentationobject.

Mergesonepresentationintoanotherpresentation.

expression.Merge(Path)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

PathRequiredString.Thefullpathofafiletomergewiththispresentation.

Page 702: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethodreturnsanerrorifthefilenamecannotbeopened,orthepresentationhasabaseline.

Page 703: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemergesthefirsttwocellsofrowoneinthespecifiedtable.

WithActivePresentation.Slides(2).Shapes(5).Table

.Cell(1,1).MergeMergeTo:=.Cell(1,2)

EndWith

Page 704: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MoveAfterMethodMovesoneanimationeffecttoafteranotheranimationeffect.

expression.MoveAfter(Effect)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

EffectRequiredEffectobject.Theeffectafterwhichtheeffectinexpressionwillbemoved.

Page 705: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplemovesoneeffecttoafteranother.

SubMoveEffect()

DimeffOneAsEffect

DimeffTwoAsEffect

DimshpFirstAsShape

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SeteffOne=ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect_

(Shape:=shpFirst,effectId:=msoAnimEffectBlinds)

SeteffTwo=ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect_

(Shape:=shpFirst,effectId:=msoAnimEffectBlast)

effOne.MoveAfterEffect:=effTwo

EndSub

Page 706: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MoveBeforeMethodMovesoneanimationeffecttobeforeanotheranimationeffect.

expression.MoveBefore(Effect)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

EffectRequiredEffectobject.Theeffectbeforewhichtheeffectinexpressionwillbemoved.

Page 707: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplemovesoneeffectinfrontofanotherone.

SubMoveEffect()

DimeffOneAsEffect

DimeffTwoAsEffect

DimshpFirstAsShape

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SeteffOne=ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect_

(Shape:=shpFirst,effectId:=msoAnimEffectBlinds)

SeteffTwo=ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect_

(Shape:=shpFirst,effectId:=msoAnimEffectBlast)

effTwo.MoveBeforeEffect:=effOne

EndSub

Page 708: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 709: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MoveNodeMethodMovesadiagramnode,andanyofitschildnodes,withinadiagram.

expression.MoveNode(TargetNode,Pos)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TargetNodeRequiredDiagramNodeobject.Thesourcediagramnodeforthemove.

PosRequiredMsoRelativeNodePosition.Specifieswherethenodewillbeadded,relativetoTargetNode.

MsoRelativeNodePositioncanbeoneoftheseMsoRelativeNodePositionconstants.msoAfterLastSiblingmsoAfterNodemsoBeforeFirstSiblingmsoBeforeNode

Page 710: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplemovestheseconddiagramnodeofanewly-createddiagramtoafterthefourthnode.

SubMoveDiagramNode()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintCountAsInteger

'Addpyramiddiagramtothecurrentdocument

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

'Addfourchildnodestothepyramiddiagram

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

ForintCount=1To3

dgnNode.AddNode

NextintCount

'Movethesecondnodetoafterwherethe

'fourthnodeiscurrentlylocated.

dgnNode.Diagram.Nodes(2).MoveNode_

TargetNode:=dgnNode.Diagram.Nodes(4),_

Pos:=msoAfterLastSibling

EndSub

Page 711: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MoveToMethodMovesthespecifiedobjecttoaspecificlocationwithinthesamecollection,renumberingallotheritemsinthecollectionappropriately.

expression.MoveTo(toPos)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

toPosRequiredLong.Theindextowhichtomovetheanimationeffect.

Page 712: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemovesananimationeffecttothesecondintheanimationeffectscollectionforthespecifiedshape.

SubMoveEffect()

DimsldFirstasSlide

DimshpFirstAsShape

DimeffAddAsEffect

SetsldFirst=ActivePresentation.Slides(1)

SetshpFirst=sldFirst.Shapes(1)

SeteffAdd=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpFirst,effectId:=msoAnimEffectBlinds)

effAdd.MoveTotoPos:=2

EndSub

Thisexamplemovesthesecondslideintheactivepresentationtothefirstslide.

SubMoveSlideToNewLocation()

ActivePresentation.Slides(2).MoveTotoPos:=1

EndSub

Page 713: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NameMethodReturnsthenameofthespecifiedtagasaString.

expression.Name(Index)

expressionRequired.AnexpressionthatreturnsaTagscollection.

IndexRequiredLong.Thetagnumber.

Page 714: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthenameandvalueforeachtagassociatedwithslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Tags

Fori=1To.Count

MsgBox"Tag#"&i&":Name="&.Name(i)

MsgBox"Tag#"&i&":Value="&.Value(i)

Next

EndWith

Thisexamplesearchesthroughthetagsforeachslideintheactivepresentation.Ifthere'satagnamed"PRIORITY,"amessageboxdisplaysthetagvalue.Ifthereisn'tatagnamed"PRIORITY,"theexampleaddsthistagwiththevalue"Unknown."

ForEachsInApplication.ActivePresentation.Slides

Withs.Tags

found=False

Fori=1To.Count

If.Name(i)="PRIORITY"Then

found=True

slNum=.Parent.SlideIndex

MsgBox"Slide"&slNum&_

"priority:"&.Value(i)

EndIf

Next

IfNotfoundThen

slNum=.Parent.SlideIndex

.Add"Name","NewFigures"

.Add"Priority","Unknown"

MsgBox"Slide"&slNum&_

"prioritytagadded:Unknown"

EndIf

EndWith

Next

Page 715: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 716: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewWindowMethodPresentationobject:Opensanewwindowthatcontainsthespecifiedpresentation.ReturnsaDocumentWindowobjectthatrepresentsthenewwindow.

DocumentWindowobject:Opensanewwindowthatcontainsthesamedocumentthat'sdisplayedinthespecifiedwindow.ReturnsaDocumentWindowobjectthatrepresentsthenewwindow.

expression.NewWindow

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 717: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanewwindowwiththecontentsoftheactivewindow(thisactivatesthenewwindow)andthenswitchesbacktothefirstwindow.

SetoldW=Application.ActiveWindow

SetnewW=oldW.NewWindow

oldW.Activate

Page 718: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NextMethodDisplaystheslideimmediatelyfollowingtheslidethat'scurrentlydisplayed.Ifthelastslideisdisplayed,theNextmethodclosestheslideshowinspeakermodeandreturnstothefirstslideinkioskmode.UsetheViewpropertyoftheSlideShowWindowobjecttoreturntheSlideShowViewobject.

expression.Next

expressionRequired.AnexpressionthatreturnsoneoftheitemsintheAppliesTolist.

Page 719: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleshowstheslideimmediatelyfollowingthecurrentlydisplayedslideonslideshowwindowone.

SlideShowWindows(1).View.Next

Page 720: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NextNodeMethodReturnsaDiagramNodeobjectthatrepresentsthenextdiagramnodeinacollectionofdiagramnodes.

expression.NextNode

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 721: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesanorganizationchart,andaddschildnodestothemiddlediagramnode.

SubAddChildrenToMiddle()

DimdgnNodeAsDiagramNode

DimdgnNextAsDiagramNode

DimshpOrgChartAsShape

DimintNodesAsInteger

'Addorganizationchartandfirstchildnode

SetshpOrgChart=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramOrgChart,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpOrgChart.DiagramNode.Children.AddNode

'Addthreeadditionalnodestorootnode

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

'SetdgnNodevariabletothemiddlenode

SetdgnNext=dgnNode.Children.Item(1).NextNode

'Addthreechildnodestomiddlenode

ForintNodes=1To3

dgnNext.Children.AddNode

NextintNodes

EndSub

Page 722: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 723: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OneColorGradientMethodSetsthespecifiedfilltoaone-colorgradient.

expression.OneColorGradient(Style,Variant,Degree)

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

StyleRequiredMsoGradientStyle.Thegradientstyle.

MsoGradientStylecanbeoneoftheseMsoGradientStyleconstants.msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVertical

VariantRequiredLong.Thegradientvariant.Canbeavaluefrom1to4,correspondingtothefourvariantsontheGradienttabintheFillEffectsdialogbox.IfStyleismsoGradientFromTitleormsoGradientFromCenter,thisargumentcanbeeither1or2.

DegreeRequiredSingle.Thegradientdegree.Canbeavaluefrom0.0(dark)to1.0(light).

Page 724: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsarectanglewithaone-colorgradientfilltomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeRectangle,90,90,90,80).Fill

.ForeColor.RGB=RGB(0,128,128)

.OneColorGradientmsoGradientHorizontal,1,1

EndWith

Page 725: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 726: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OpenMethodOpensthespecifiedpresentation.ReturnsaPresentationobjectthatrepresentstheopenedpresentation.

expression.Open(FileName,ReadOnly,Untitled,WithWindow,OpenConflictDocument)

expressionRequired.AnexpressionthatreturnsaPresentationscollection.

FileNameRequiredString.Thenameofthefiletoopen.

ReadOnlyOptionalMsoTriState.Specifieswhetherthefileisopenedwithread/writeorread-onlystatus.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Opensthefilewithread/writestatus.msoTriStateMixedmsoTriStateTogglemsoTrueOpensthefilewithread-onlystatus.

UntitledOptionalMsoTriState.Specifieswhetherthefilehasatitle.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Thefilenameautomaticallybecomesthetitleoftheopenedpresentation.msoTriStateMixedmsoTriStateTogglemsoTrueOpensthefilewithoutatitle.Thisisequivalenttocreatingacopyofthefile.

WithWindowOptionalMsoTriState.Specifieswhetherthefileisvisible.

Page 727: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseHidestheopenedpresentation.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Opensthefileinavisiblewindow.

OpenConflictDocumentOptionalMsoTriState.Specifieswhethertoopentheconflictfileforapresentationwithanofflineconflict.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Openstheserverfileandignorestheconflictdocument.msoTriStateMixedmsoTriStateTogglemsoTrueOpenstheconflictfileandoverwritestheserverfile.

Page 728: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Withtheproperfileconvertersinstalled,MicrosoftPowerPointopensfileswiththefollowingMS-DOSfileextensions:.ch3,.cht,.doc,.htm,.html,.mcw,.pot,.ppa,.pps,.ppt,.pre,.rtf,.sh3,.shw,.txt,.wk1,.wk3,.wk4,.wpd,.wpf,.wps,and.xls.

Page 729: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleopensapresentationwithread-onlystatus.

Presentations.OpenFileName:="c:\MyDocuments\pres1.ppt",_

ReadOnly:=msoTrue

Page 730: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ParagraphsMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextparagraphs.Forinformationaboutcountingorloopingthroughtheparagraphsinatextrange,seetheTextRangeobject.

expression.Paragraphs(Start,Length)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

StartOptionalLong.Thefirstparagraphinthereturnedrange.

LengthOptionalLong.Thenumberofparagraphstobereturned.

Page 731: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstparagraphandendswiththelastparagraphinthespecifiedrange.

IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsoneparagraph.

IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstparagraphinthespecifiedrange.

IfStartisgreaterthanthenumberofparagraphsinthespecifiedtext,thereturnedrangestartswiththelastparagraphinthespecifiedrange.

IfLengthisgreaterthanthenumberofparagraphsfromthespecifiedstartingparagraphtotheendofthetext,thereturnedrangecontainsallthoseparagraphs.

Page 732: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleformatsasitalicthefirsttwolinesofthesecondparagraphinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange.Paragraphs(2)_

.Lines(1,2).Font.Italic=True

Page 733: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 734: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PasteMethodPastemethodasitappliestotheShapesobject.

Pastestheshapes,slides,ortextontheClipboardintothespecifiedShapescollection,atthetopofthez-order.EachpastedobjectbecomesamemberofthespecifiedShapescollection.IftheClipboardcontainsentireslides,theslideswillbepastedasshapesthatcontaintheimagesoftheslides.IftheClipboardcontainsatextrange,thetextwillbepastedintoanewlycreatedTextFrameshape.ReturnsaShapeRangeobjectthatrepresentsthepastedobjects.

expression.Paste

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

PastemethodasitappliestotheSlidesobject.

PastestheslidesontheClipboardintotheSlidescollectionforthepresentation.SpecifywhereyouwanttoinserttheslideswiththeIndexargument.ReturnsaSlideRangeobjectthatrepresentsthepastedobjects.EachpastedslidebecomesamemberofthespecifiedSlidescollection.

expression.Paste(Index)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

IndexOptionalInteger.TheindexnumberoftheslidethattheslidesontheClipboardaretobepastedbefore.Ifthisargumentisomitted,theslidesontheClipboardarepastedafterthelastslideinthepresentation.

PastemethodasitappliestotheTextRangeobject.

PastesthetextontheClipboardintothespecifiedtextrange,andreturnsaTextRangeobjectthatrepresentsthepastedtext.

expression.Paste

Page 735: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

PastemethodasitappliestotheViewobject.

PastesthecontentsoftheClipboardintotheactiveview.Attemptingtopasteanobjectintoaviewthatwon'tacceptitcausesanerror.Forinformationaboutviewsandtheobjectsyoucanpasteintothem,seethe"Remarks"section.

expression.Paste

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 736: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheViewTypepropertytosettheviewforawindowbeforepastingtheClipboardcontentsintoit.Thefollowingtableshowswhatyoucanpasteintoeachview.

Intothisview

YoucanpastethefollowingfromtheClipboard

Slideviewornotespageview

Shapes,text,orentireslides.IfyoupasteaslidefromtheClipboard,animageoftheslidewillbeinsertedontotheslide,master,ornotespageasanembeddedobject.Ifoneshapeisselected,thepastedtextwillbeappendedtotheshape'stext;iftextisselected,thepastedtextwillreplacetheselection;ifanythingelseisselected,thepastedtextwillbeplacedinit'sowntextframe.Pastedshapeswillbeaddedtothetopofthez-orderandwon'treplaceselectedshapes.

Outlineview

Textorentireslides.Youcannotpasteshapesintooutlineview.Apastedslidewillbeinsertedbeforetheslidethatcontainstheinsertionpoint.

Slidesorterview

Entireslides.Youcannotpasteshapesortextintoslidesorterview.Apastedslidewillbeinsertedattheinsertionpointorafterthelastslideselectedinthepresentation.

Page 737: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheShapesobject.

ThisexamplecopiesshapeoneonslideoneintheactivepresentationtotheClipboardandthenpastesitintoslidetwo.

WithActivePresentation

.Slides(1).Shapes(1).Copy

.Slides(2).Shapes.Paste

EndWith

Thisexamplecutsthetextinshapeoneonslideoneintheactivepresentation,placesitontheClipboard,andthenpastesitafterthefirstwordinshapetwoonthesameslide.

WithActivePresentation.Slides(1)

.Shapes(1).TextFrame.TextRange.Cut

.Shapes(2).TextFrame.TextRange.Words(1).InsertAfter.Paste

EndWith

AsitappliestotheSlidesobject.

ThisexamplecutsslidesthreeandfivefromtheOldSalespresentationandtheninsertsthembeforeslidefourintheactivepresentation.

Presentations("OldSales").Slides.Range(Array(3,5)).Cut

ActivePresentation.Slides.Paste4

AsitappliestotheViewobject.

Page 738: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ThisexamplecopiestheselectioninwindowonetotheClipboardandcopiesitintotheviewinwindowtwo.IftheClipboardcontentscannotbepastedintotheviewinwindowtwo—forexample,ifyoutrytopasteashapeintoslidesorterview—thisexamplefails.

Windows(1).Selection.Copy

Windows(2).View.Paste

ThisexamplecopiestheselectioninwindowonetotheClipboard,makessurethatwindowoneisinslideview,andthencopiestheClipboardcontentsintotheviewinwindowtwo.

Windows(1).Selection.Copy

WithWindows(2)

.ViewType=ppViewSlide

.View.Paste

EndWith

Page 739: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 740: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PasteSpecialMethodPastesthecontentsoftheClipboardusingaspecialformat.AlthoughthesyntaxforusingthismethodisthesameforallobjectsintheAppliesTolist,thebehaviorisslightlydifferent,dependingontheobjectcallingthePasteSpecialmethod.

Object Behavior

Shapes

Addstheshapetothecollectionofshapesinthespecifiedformat.Ifthespecifieddatatypeisatextdatatype,thenanewtextboxiscreatedwiththetext.Ifthepastesucceeds,thePasteSpecialmethodreturnsaShapeRangeobjectrepresentingtheshaperangethatwaspasted.

TextRange

ReplacesthetextrangewiththecontentsoftheClipboardintheformatspecified.ValiddatatypesforthisobjectareppPasteText,ppPasteHTML,andppPasteRTF(anyotherformatgeneratesanerror).Ifthepastesucceeds,thismethodreturnsaTextRangeobjectrepresentingthetextrangethatwaspasted.

View

PastesthecurrentcontentsoftheClipboardintotheviewrepresentedbytheViewobject.ValidviewsforthePasteSpecialmethodarethesameasthoseforthePastemethod.Ifthedatatypecan’tbepastedintotheview(forexample,tryingtopasteapictureintoSlideSorterView),thenanerroroccurs.

expression.PasteSpecial(DataType,DisplayAsIcon,IconFileName,IconIndex,IconLabel,Link)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

DataTypeOptionalPpPasteDataType.AformatfortheClipboardcontentswhenthey'reinsertedintothedocument.Thedefaultvaluevaries,dependingonthecontentsintheClipboard.AnerroroccursifthespecifieddatatypeintheDataTypeargumentisnotsupportedbytheclipboardcontents.

PpPasteDataTypecanbeoneofthesePpPasteDataTypeconstants.ppPasteBitmap

Page 741: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppPasteDefaultdefaultppPasteEnhancedMetafileppPasteGIFppPasteHTMLppPasteJPGppPasteMetafilePictureppPasteOLEObjectppPastePNGppPasteRTFppPasteShapeppPasteText

DisplayAsIconOptionalMsoTriState.MsoTruetodisplaytheembeddedobject(orlink)asanicon.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesnotapplytothismethod.msoFalsedefaultDoesnotdisplaytheembeddedobject(orlink)asanicon.msoTriStateMixedDoesnotapplytothismethod.msoTriStateToggleDoesnotapplytothismethod.msoTrueDisplaystheembeddedobject(orlink)asanicon.

IconFileNameOptionalString.IfDisplayAsIconissettomsoTrue,thisargumentisthepathandfilenameforthefileinwhichtheicontobedisplayedisstored.IfDisplayAsIconissettomsoFalse,thisargumentisignored.

IconIndexOptionalLong.IfDisplayAsIconissettomsoTrue,thisargumentisanumberthatcorrespondstotheiconyouwanttouseintheprogramfilespecifiedbyIconFilename.IconsappearintheChangeIcondialogbox,accessedfromtheStandardtoolbar(Insertmenu,Objectcommand,CreateNewoption):0(zero)correspondstothefirsticon,1correspondstothesecondicon,andsoon.Ifthisargumentisomitted,thefirst(default)iconisused.IfDisplayAsIconissettomsoFalse,thenthisargumentisignored.IfIconIndexisoutsidethevalidrange,thenthedefaulticon(index0)isused.

IconLabelOptionalString.IfDisplayAsIconissettomsoTrue,this

Page 742: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

argumentisthetextthatappearsbelowtheicon.Ifthislabelismissing,MicrosoftPowerPointgeneratesaniconlabelbasedontheClipboardcontents.IfDisplayAsIconissettomsoFalse,thenthisargumentisignored.

LinkOptionalMsoTriState.DetermineswhethertocreatealinktothesourcefileoftheClipboardcontents.AnerroroccursiftheClipboardcontentsdonotsupportalink.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesnotapplytothismethod.msoFalsedefaultDoesnotcreatealinktothesourcefileoftheClipboardcontents.msoTriStateMixedDoesnotapplytothismethod.msoTriStateToggleDoesnotapplytothismethod.msoTrueCreatesalinktothesourcefileoftheClipboardcontents.

Page 743: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

AnerroroccursifthereisnodataontheClipboardwhenthePasteSpecialmethodiscalled.

Page 744: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplepastesabitmapimageasaniconintoanotherwindow.Thisexampleassumestherearetwoopenwindows,andabitmapimageinthefirstwindowiscurrentlyselected.

SubPasteOLEObject()

Windows(1).Selection.Copy

Windows(2).View.PasteSpecialDataType:=ppPasteOLEObject,_

DisplayAsIcon:=msoTrue,IconLabel:="NewBitmapImage"

EndSub

Page 745: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 746: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PatternedMethodSetsthespecifiedfilltoapattern.

expression.Patterned(Pattern)

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

PatternRequiredMsoPatternType.Thepatterntobeusedforthespecifiedfill.

MsoPatternTypecanbeoneoftheseMsoPatternTypeconstants.msoPattern10PercentmsoPattern20PercentmsoPattern25PercentmsoPattern30PercentmsoPattern40PercentmsoPattern50PercentmsoPattern5PercentmsoPattern60PercentmsoPattern70PercentmsoPattern75PercentmsoPattern80PercentmsoPattern90PercentmsoPatternDarkDownwardDiagonalmsoPatternDarkHorizontalmsoPatternDarkUpwardDiagonalmsoPatternDashedDownwardDiagonalmsoPatternDashedHorizontalmsoPatternDashedUpwardDiagonalmsoPatternDashedVerticalmsoPatternDiagonalBrickmsoPatternDivot

Page 747: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoPatternDottedDiamondmsoPatternDottedGridmsoPatternHorizontalBrickmsoPatternLargeCheckerBoardmsoPatternLargeConfettimsoPatternLargeGridmsoPatternLightDownwardDiagonalmsoPatternLightHorizontalmsoPatternLightUpwardDiagonalmsoPatternLightVerticalmsoPatternMixedmsoPatternNarrowHorizontalmsoPatternNarrowVerticalmsoPatternOutlinedDiamondmsoPatternPlaidmsoPatternShinglemsoPatternSmallCheckerBoardmsoPatternSmallConfettimsoPatternSmallGridmsoPatternSolidDiamondmsoPatternSpheremsoPatternTrellismsoPatternWavemsoPatternWeavemsoPatternWideDownwardDiagonalmsoPatternWideUpwardDiagonalmsoPatternZigZagmsoPatternDarkVertical

Page 748: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheBackColorandForeColorpropertiestosetthecolorsusedinthepattern.

Page 749: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsanovalwithapatternedfilltomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeOval,60,60,80,40).Fill

.ForeColor.RGB=RGB(128,0,0)

.BackColor.RGB=RGB(0,0,255)

.PatternedmsoPatternDarkVertical

EndWith

Page 750: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PickUpMethodCopiestheformattingofthespecifiedshape.UsetheApplymethodtoapplythecopiedformattingtoanothershape.

expression.PickUp

expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.

Page 751: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecopiestheformattingofshapeoneonmyDocument,andthenappliesthecopiedformattingtoshapetwo.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument

.Shapes(1).PickUp

.Shapes(2).Apply

EndWith

Page 752: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PictureMethodSetsthegraphicsfiletobeusedforbulletsinabulletedlistwhentheTypepropertyoftheBulletFormatobjectissettoppBulletPicture.

expression.Picture(Picture)

expressionRequired.AnexpressionthatreturnsaBulletFormatobjectoftypeppBulletPicture.

PictureRequiredString.Thepathandfilenameofavalidgraphicsfile.

Page 753: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Validgraphicsfilesincludefileswiththefollowingextensions:.bmp,.cdr,.cgm,.drw,.dxf,.emf,.eps,.gif,.jpg,.jpeg,.pcd,.pct,.pcx,.pict,.png,.tga,.tiff,.wmf,and.wpg.

Page 754: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebulletsinthetextboxspecifiedbyshapetwoonslideonetoabitmappictureofabluerivet.

WithActivePresentation.Slides(1).Shapes(2).TextFrame

With.TextRange.ParagraphFormat.Bullet

.Type=ppBulletPicture

.Picture("C:\Windows\BlueRivets.bmp")

EndWith

EndWith

Page 755: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlayMethodPlaysthespecifiedsoundeffect.

expression.Play

expressionRequired.AnexpressionthatreturnsaSoundEffectobject.

Page 756: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleplaysthesoundeffectthat'sbeensetforthetransitiontoslidetwointheactivepresentation.

ActivePresentation.Slides(2).SlideShowTransition.SoundEffect.Play

Page 757: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PointsToScreenPixelsXMethodConvertsahorizontalmeasurementfrompointstopixels.Usedtoreturnahorizontalscreenlocationforatextframeorshape.ReturnstheconvertedmeasurementasaSingle.

expression.PointsToScreenPixelsX(Points)

expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.

PointsRequiredSingle.Thehorizontalmeasurement(inpoints)tobeconvertedtopixels.

Page 758: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleconvertsthewidthandheightoftheselectedtextframeboundingboxfrompointstopixels,andreturnsthevaluestomyXparmandmyYparm.

WithActiveWindow

myXparm=.PointsToScreenPixelsX_

(.Selection.TextRange.BoundWidth)

myYparm=.PointsToScreenPixelsY_

(.Selection.TextRange.BoundHeight)

EndWith

Page 759: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PointsToScreenPixelsYMethodConvertsaverticalmeasurementfrompointstopixels.Usedtoreturnaverticalscreenlocationforatextframeorshape.ReturnstheconvertedmeasurementasaSingle.

expression.PointsToScreenPixelsY(Points)

expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.

PointsRequiredSingle.Theverticalmeasurement(inpoints)tobeconvertedtopixels.

Page 760: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleconvertsthewidthandheightoftheselectedtextframeboundingboxfrompointstopixels,andreturnsthevaluestomyXparmandmyYparm.

WithActiveWindow

myXparm=.PointsToScreenPixelsX_

(.Selection.TextRange.BoundWidth)

myYparm=.PointsToScreenPixelsY_

(.Selection.TextRange.BoundHeight)

EndWith

Page 761: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 762: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetDropMethodSpecifieswhetherthecalloutlineattachestothetop,bottom,orcenterofthecallouttextboxorwhetheritattachesatapointthat'saspecifieddistancefromthetoporbottomofthetextbox.

expression.PresetDrop(DropType)

expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.

DropTypeRequiredMsoCalloutDropType.Thestartingpositionofthecalloutlinerelativetothetextboundingbox.

MsoCalloutDropTypecanbeoneoftheseMsoCalloutDropTypeconstants.msoCalloutDropBottommsoCalloutDropCentermsoCalloutDropCustomSpecifyingthisconstantwillcauseyourcodetofail.msoCalloutDropMixedmsoCalloutDropTop

Page 763: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatthecalloutlineattachtothetopofthetextboundingboxforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).Callout.PresetDropmsoCalloutDropTop

ThisexampletogglesbetweentwopresetdropsforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Callout

If.DropType=msoCalloutDropTopThen

.PresetDropmsoCalloutDropBottom

ElseIf.DropType=msoCalloutDropBottomThen

.PresetDropmsoCalloutDropTop

EndIf

EndWith

Page 764: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 765: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetGradientMethodSetsthespecifiedfilltoapresetgradient.

expression.PresetGradient(Style,Variant,PresetGradientType)

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

StyleRequiredMsoGradientStyle.Thegradientstyle.

MsoGradientStylecanbeoneoftheseMsoGradientStyleconstants.msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVertical

VariantRequiredInteger.Thegradientvariant.Canbeavaluefrom1to4,correspondingtothefourvariantsontheGradienttabintheFillEffectsdialogbox.IfStyleismsoGradientFromTitleormsoGradientFromCenter,thisargumentcanbeeither1or2.

PresetGradientTypeRequiredMsoPresetGradientType.Thegradienttype.

MsoPresetGradientTypecanbeoneoftheseMsoPresetGradientTypeconstants.msoGradientBrassmsoGradientCalmWatermsoGradientChromemsoGradientChromeIImsoGradientDaybreakmsoGradientDesert

Page 766: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoGradientEarlySunsetmsoGradientFiremsoGradientFogmsoGradientGoldmsoGradientGoldIImsoGradientHorizonmsoGradientLateSunsetmsoGradientMahoganymsoGradientMossmsoGradientNightfallmsoGradientOceanmsoGradientParchmentmsoGradientPeacockmsoGradientRainbowmsoGradientRainbowIImsoGradientSapphiremsoGradientSilvermsoGradientWheatmsoPresetGradientMixed

Page 767: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectanglewithapresetgradientfilltomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddShape(msoShapeRectangle,90,90,140,80)_

.Fill.PresetGradientmsoGradientHorizontal,1,msoGradientBrass

Page 768: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 769: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetTexturedMethodSetsthespecifiedfilltoapresettexture.

expression.PresetTextured(PresetTexture)

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

PresetTextureRequiredMsoPresetTexture.Thepresettexture.

MsoPresetTexturecanbeoneoftheseMsoPresetTextureconstants.msoPresetTextureMixedmsoTextureBlueTissuePapermsoTextureBouquetmsoTextureBrownMarblemsoTextureCanvasmsoTextureCorkmsoTextureDenimmsoTextureFishFossilmsoTextureGranitemsoTextureGreenMarblemsoTextureMediumWoodmsoTextureNewsprintmsoTextureOakmsoTexturePaperBagmsoTexturePapyrusmsoTextureParchmentmsoTexturePinkTissuePapermsoTexturePurpleMeshmsoTextureRecycledPapermsoTextureSandmsoTextureStationerymsoTextureWalnut

Page 770: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoTextureWaterDropletsmsoTextureWhiteMarblemsoTextureWovenMat

Page 771: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsarectanglewithagreen-marbletexturedfilltomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddShape(msoShapeCan,90,90,40,80)_

.Fill.PresetTexturedmsoTextureGreenMarble

Page 772: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PreviousMethodShowtheslideimmediatelyprecedingtheslidethat'scurrentlydisplayed.Ifyouarecurrentlyonthefirstslideinakioskslideshow,thePreviousmethodtakesyoutothelastslideinaslideshow;otherwise,ithasnoeffectifthefirstslideinthepresentationiscurrentlydisplayed.UsetheViewpropertyoftheSlideShowWindowobjecttoreturntheSlideShowViewobject.

expression.Previous

expressionRequired.AnexpressionthatreturnsoneoftheitemsintheAppliesTolist.

Page 773: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleshowstheslideimmediatelyprecedingthecurrentlydisplayedslideonslideshowwindowone.

SlideShowWindows(1).View.Previous

Page 774: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrevNodeMethodReturnsaDiagramNodeobjectthatrepresentsthepreviousdiagramnodeinacollectionofdiagramnodes.

expression.PrevNode

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 775: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsadditionalchildnodestothefirstchildnode,whichisthenodeprevioustothesecondnode,inanewly-createddiagram.

SubAddNodeToFirstChild()

DimdgnNodeAsDiagramNode

DimdgnPrevAsDiagramNode

DimshpOrgChartAsShape

DimintNodesAsInteger

'Addsorgchartandrootnode

SetshpOrgChart=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramOrgChart,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpOrgChart.DiagramNode.Children.AddNode

'Addsthreechildnodestorootnode

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

'SetsdgnPrevequaltofirstchildnode(thenode

'previoustothesecondchildnode)

SetdgnPrev=dgnNode.Children.Item(2).PrevNode

'Addsthreechildnodestofirstchildnode

ForintNodes=1To3

dgnPrev.Children.AddNode

NextintNodes

EndSub

Page 776: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 777: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintOutMethodPrintsthespecifiedpresentation.

expression.PrintOut(From,To,PrintToFile,Copies,Collate)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

FromOptionalInteger.Thenumberofthefirstpagetobeprinted.Ifthisargumentisomitted,printingstartsatthebeginningofthepresentation.SpecifyingtheToandFromargumentssetsthecontentsofthePrintRangesobjectandsetsthevalueoftheRangeTypepropertyforthepresentation.

ToOptionalInteger.Thenumberofthelastpagetobeprinted.Ifthisargumentisomitted,printingcontinuestotheendofthepresentation.SpecifyingtheToandFromargumentssetsthecontentsofthePrintRangesobjectandsetsthevalueoftheRangeTypepropertyforthepresentation.

PrintToFileOptionalString.Thenameofthefiletoprintto.Ifyouspecifythisargument,thefileisprintedtoafileratherthansenttoaprinter.Ifthisargumentisomitted,thefileissenttoaprinter.

CopiesOptionalInteger.Thenumberofcopiestobeprinted.Ifthisargumentisomitted,onlyonecopyisprinted.SpecifyingthisargumentsetsthevalueoftheNumberOfCopiesproperty.

CollateOptionalMsoTriState.Ifthisargumentisomitted,multiplecopiesarecollated.SpecifyingthisargumentsetsthevalueoftheCollateproperty.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTruePrintsacompletecopyofthepresentationbeforethefirstpageofthenextcopyisprinted.

Page 778: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintstwouncollatedcopiesofeachslide—whethervisibleorhidden—fromslidetwotoslidefiveintheactivepresentation.

WithApplication.ActivePresentation

.PrintOptions.PrintHiddenSlides=True

.PrintOutFrom:=2,To:=5,Copies:=2,Collate:=msoFalse

EndWith

ThisexampleprintsasinglecopyofallslidesintheactivepresentationtothefileTestprnt.prn.

Application.ActivePresentation.PrintOut_

PrintToFile:="TestPrnt"

Page 779: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PublishMethodCreatesaWebpresentation(HTMLformat)fromanyloadedpresentation.YoucanviewthepublishedpresentationinaWebbrowser.

expression.Publish

expressionRequired.AnexpressionthatreturnsaPublishObjectobject.

Page 780: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucanspecifythecontentandattributesofthepublishedpresentationbysettingvariouspropertiesofthePublishObjectobject.Forexample,theSourceTypepropertydefinestheportionofaloadedpresentationtobepublished.TheRangeStartpropertyandtheRangeEndpropertyspecifytherangeofslidestopublish,andtheSpeakerNotespropertydesignateswhetherornottopublishthespeaker'snotes.

Page 781: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

Page 782: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

QuitMethodQuitsPowerPoint.ThisisequivalenttoclickingExitontheFilemenu.

expression.Quit

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Page 783: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Toavoidbeingpromptedtosavechanges,useeithertheSaveorSaveAsmethodtosaveallopenpresentationsbeforecallingtheQuitmethod.

Page 784: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesavesallopenpresentationsandthenquitsPowerPoint.

WithApplication

ForEachwIn.Presentations

w.Save

Nextw

.Quit

EndWith

Page 785: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 786: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RangeMethodRangemethodasitappliestotheShapesobject.

ReturnsaShapeRangeobjectthatrepresentsasubsetoftheshapesinaShapescollection.

expression.Range(Index)

expressionRequired.AnexpressionthatreturnsaShapescollectionobject.

IndexOptionalVariant.Theindividualshapesthataretobeincludedintherange.CanbeanIntegerthatspecifiestheindexnumberoftheshape,aStringthatspecifiesthenameoftheshape,oranarraythatcontainseitherintegersorstrings.Ifthisargumentisomitted,theRangemethodreturnsalltheobjectsinthespecifiedcollection.

RangemethodasitappliestotheGroupShapesobject.

ReturnsaShapeRangeobject.

expression.Range(Index)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

IndexRequiredVariant.Theindividualshapesthataretobeincludedintherange.CanbeanIntegerthatspecifiestheindexnumberoftheshape,aStringthatspecifiesthenameoftheshape,oranarraythatcontainseitherintegersorstrings.Ifthisargumentisomitted,theRangemethodreturnsalltheobjectsinthespecifiedcollection.

RangemethodasitappliestotheSlidesobject.

ReturnsaSlideRangeobjectthatrepresentsasubsetoftheslidesinaSlidescollection.

expression.Range(Index)

Page 787: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expressionRequired.AnexpressionthatreturnsaSlidescollectionobject.

IndexOptionalVariant.Theindividualslidesthataretobeincludedintherange.CanbeanIntegerthatspecifiestheindexnumberoftheslide,aStringthatspecifiesthenameoftheslide,oranarraythatcontainseitherintegersorstrings.Ifthisargumentisomitted,theRangemethodreturnsalltheobjectsinthespecifiedcollection.

Page 788: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

AlthoughyoucanusetheRangemethodtoreturnanynumberofshapesorslides,it'ssimplertousetheItemmethodifyouonlywanttoreturnasinglememberofthecollection.Forexample,Shapes(1)issimplerthanShapes.Range(1),andSlides(2)issimplerthanSlides.Range(2).

TospecifyanarrayofintegersorstringsforIndex,youcanusetheArrayfunction.Forexample,thefollowinginstructionreturnstwoshapesspecifiedbyname.

DimmyArray()AsVariant,myRangeAsObject

myArray=Array("Oval4","Rectangle5")

SetmyRange=ActivePresentation.Slides(1).Shapes.Range(myArray)

Page 789: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheShapesobject.

ThisexamplesetsthefillpatternforshapesoneandthreeonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.Range(Array(1,3)).Fill_

.PatternedmsoPatternHorizontalBrick

ThisexamplesetsthefillpatternfortheshapesnamedOval4andRectangle5onthefirstslide.

DimmyArray()AsVariant,myRangeAsObject

myArray=Array("Oval4","Rectangle5")

SetmyRange=ActivePresentation.Slides(1).Shapes.Range(myArray)

myRange.Fill.PatternedmsoPatternHorizontalBrick

Thisexamplesetsthefillpatternforallshapesonthefirstslide.

ActivePresentation.Slides(1).Shapes.Range.Fill_

.PatternedPattern:=msoPatternHorizontalBrick

Thisexamplesetsthefillpatternforshapeoneonthefirstslide.

SetmyDocument=ActivePresentation.Slides(1)

SetmyRange=myDocument.Shapes.Range(1)

myRange.Fill.PatternedmsoPatternHorizontalBrick

ThisexamplecreatesanarraythatcontainsalltheAutoShapesonthefirstslide,usesthatarraytodefineashaperange,andthendistributesalltheshapesinthatrangehorizontally.

WithmyDocument.Shapes

numShapes=.Count

'Continuesifthereareshapesontheslide

IfnumShapes>1Then

numAutoShapes=0

Page 790: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReDimautoShpArray(1TonumShapes)

Fori=1TonumShapes

'CountsthenumberofAutoShapesontheSlide

If.Item(i).Type=msoAutoShapeThen

numAutoShapes=numAutoShapes+1

autoShpArray(numAutoShapes)=.Item(i).Name

EndIf

Next

'AddsAutoShapestoShapeRange

IfnumAutoShapes>1Then

ReDimPreserveautoShpArray(1TonumAutoShapes)

SetasRange=.Range(autoShpArray)

asRange.DistributemsoDistributeHorizontally,False

EndIf

EndIf

EndWith

AsitappliestotheSlidesobject.

Thisexamplesetsthetitlecolorforslidesoneandthree.

SetmySlides=ActivePresentation.Slides.Range(Array(1,3))

mySlides.ColorScheme.Colors(ppTitle).RGB=RGB(0,255,0)

ThisexamplesetsthetitlecolorfortheslidesnamedSlide6andSlide8.

SetmySlides=ActivePresentation.Slides_

.Range(Array("Slide6","Slide8"))

mySlides.ColorScheme.Colors(ppTitle).RGB=RGB(0,255,0)

Thisexamplesetsthetitlecolorforalltheslidesintheactivepresentation.

SetmySlides=ActivePresentation.Slides.Range

mySlides.ColorScheme.Colors(ppTitle).RGB=RGB(255,0,0)

Thisexamplecreatesanarraythatcontainsallthetitleslidesintheactivepresentation,usesthatarraytodefineasliderange,andthensetsthetitlecolorforallslidesinthatrange.

Page 791: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DimMyTitleArray()AsLong

SetpSlides=ActivePresentation.Slides

ReDimMyTitleArray(1TopSlides.Count)

ForEachpSlideInpSlides

IfpSlide.Layout=ppLayoutTitleThen

nCounter=nCounter+1

MyTitleArray(nCounter)=pSlide.SlideIndex

EndIf

NextpSlide

ReDimPreserveMyTitleArray(1TonCounter)

SetrngTitleSlides=ActivePresentation.Slides.Range(MyTitleArray)

rngTitleSlides.ColorScheme.Colors(ppTitle).RGB=RGB(255,123,99)

Page 792: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RangeFromPointMethodReturnstheShapeobjectthatislocatedatthepointspecifiedbythescreenpositioncoordinatepair.Ifnoshapeislocatedatthecoordinatepairspecified,thenthemethodreturnsNothing.

expression.RangeFromPoint(x,y)

expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.

xRequiredLong.Thehorizontaldistance(inpixels)fromtheleftedgeofthescreentothepoint.

yRequiredLong.Theverticaldistance(inpixels)fromthetopofthescreentothepoint.

Page 793: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsanewfive-pointstartoslideoneusingthecoordinates(288,100).Itthenconvertsthosecoordinatesfrompointstopixels,usestheRangeFromPointmethodtoreturnareferencetothenewobject,andchangesthefillcolorofthestar.

DimmyPointXAsInteger,myPointYAsInteger

DimmyShapeAsObject

ActivePresentation.Slides(1).Shapes_

.AddShape(msoShape5pointStar,288,100,100,72).Select

myPointX=ActiveWindow.PointsToScreenPixelsX(288)

myPointY=ActiveWindow.PointsToScreenPixelsY(100)

SetmyShape=ActiveWindow.RangeFromPoint(myPointX,myPointY)

myShape.Fill.ForeColor.RGB=RGB(80,160,130)

Page 794: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RegroupMethodRegroupsthegroupthatthespecifiedshaperangebelongedtopreviously.ReturnstheregroupedshapesasasingleShapeobject.

expression.Regroup

expressionRequired.AnexpressionthatreturnsaShapeRangeobject.

Page 795: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheRegroupmethodonlyrestoresthegroupforthefirstpreviouslygroupedshapeitfindsinthespecifiedShapeRangecollection.Therefore,ifthespecifiedshaperangecontainsshapesthatpreviouslybelongedtodifferentgroups,onlyoneofthegroupswillberestored.

Notethatbecauseagroupofshapesistreatedasasingleshape,groupingandungroupingshapeschangesthenumberofitemsintheShapescollectionandchangestheindexnumbersofitemsthatcomeaftertheaffecteditemsinthecollection.

Page 796: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleregroupstheshapesintheselectionintheactivewindow.Iftheshapeshaven'tbeenpreviouslygroupedandungrouped,thisexamplewillfail.

ActiveWindow.Selection.ShapeRange.Regroup

Page 797: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 798: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReloadAsMethodReloadsapresentationbasedonaspecifiedHTMLdocumentencoding.

expression.ReloadAs(cp)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

cpRequiredMsoEncoding.ThedocumentencodingtousewhenreloadingtheWebpage.

MsoEncodingcanbeoneoftheseMsoEncodingconstants.msoEncodingArabicAutoDetectmsoEncodingAutoDetectmsoEncodingCyrillicAutoDetectmsoEncodingGreekAutoDetectmsoEncodingJapaneseAutoDetectmsoEncodingKoreanAutoDetectmsoEncodingSimplifiedChineseAutoDetectmsoEncodingTraditionalChineseAutoDetect

Page 799: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplereloadstheactivepresentationusingWesternencoding.

ActivePresentation.ReloadAs(msoEncodingWestern)

Page 800: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RemoveMethodRemovesanadd-infromthecollectionofadd-ins.

expression.Remove(Index)

expressionRequired.AnexpressionthatreturnsanAddInsobject.

IndexRequiredVariant.Thenameoftheadd-intoberemovedfromthecollection.

Page 801: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleremovestheadd-innamed"MyTools"fromthelistofavailableadd-ins.

AddIns.Remove"mytools"

Page 802: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RemoveBaselineMethodRemovesthebaselinefromthepresentation.

expression.RemoveBaseline

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 803: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethodgeneratesanerrorifthepresentationisanauthorpresentationorifthereisnobaseline.

Page 804: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowinglineofcoderemovesthebaselinefromtheactivepresentation.

SubRmvBaseline()

ActivePresentation.RemoveBaseline

EndSub

Page 805: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RemovePeriodsMethodRemovestheperiodattheendofeachparagraphinthespecifiedtext.

expression.RemovePeriods

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

Page 806: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleremovestheperiodattheendofeachparagraphinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1)_

.Shapes(2).TextFrame.TextRange_

.RemovePeriods

Page 807: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 808: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReplaceMethodReplacemethodasitappliestotheTextRangeobject.

Findsspecifictextinatextrange,replacesthefoundtextwithaspecifiedstring,andreturnsaTextRangeobjectthatrepresentsthefirstoccurrenceofthefoundtext.ReturnsNothingifnomatchisfound.

expression.Replace(FindWhat,ReplaceWhat,After,MatchCase,WholeWords)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

FindWhatRequiredString.Thetexttosearchfor.

ReplaceWhatRequiredString.Thetextyouwanttoreplacethefoundtextwith.

AfterOptionalInteger.Thepositionofthecharacter(inthespecifiedtextrange)afterwhichyouwanttosearchforthenextoccurrenceofFindWhat.Forexample,ifyouwanttosearchfromthefifthcharacterofthetextrange,specify4forAfter.Ifthisargumentisomitted,thefirstcharacterofthetextrangeisusedasthestartingpointforthesearch.

MatchCaseOptionalMsoTriState.Determineswhetheradistinctionismadeonthebasisofcase.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueDistinguishbetweenuppercaseandlowercasecharacters.

WholeWordsOptionalMsoTriState.Determineswhetheronlywholewordsarefound.

Page 809: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueFindonlywholewords,andnotpartsoflargerwords.

ReplacemethodasitappliestotheFontsobject.

ReplacesafontintheFontscollection.

expression.Replace(Original,Replacement)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

OriginalRequiredString.Thenameofthefonttoreplace.

ReplacementRequiredString.Thethenameofthereplacementfont.

Page 810: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheTextRangeobject.

Thisexamplereplaceseverywhole-wordoccurrenceof"like"inalloftheshapesintheactivepresentationwith"NOTLIKE".

SubReplaceText()

DimoSldAsSlide

DimoShpAsShape

DimoTxtRngAsTextRange

DimoTmpRngAsTextRange

SetoSld=Application.ActivePresentation.Slides(1)

ForEachoShpInoSld.Shapes

SetoTxtRng=oShp.TextFrame.TextRange

SetoTmpRng=oTxtRng.Replace(FindWhat:="like",_

Replacewhat:="NOTLIKE",WholeWords:=True)

DoWhileNotoTmpRngIsNothing

SetoTxtRng=oTxtRng.Characters(oTmpRng.Start+oTmpRng.Length,_

oTxtRng.Length)

SetoTmpRng=oTxtRng.Replace(FindWhat:="like",_

Replacewhat:="NOTLIKE",WholeWords:=True)

Loop

NextoShp

EndSub

AsitappliestotheFontsobject.

ThisexamplereplacestheTimesNewRomanfontwiththeCourierfontintheactivepresentation.

Application.ActivePresentation.Fonts_

.ReplaceOriginal:="TimesNewRoman",Replacement:="Courier"

Page 811: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 812: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReplaceNodeMethodReplacesatargetdiagramnodewiththesourcediagramnode.Thetargetdiagramnodeisdeleted,andthesourcediagramnode,includinganyofitschildnodes,aremovedtowherethetargetdiagramnodewas.

expression.ReplaceNode(TargetNode)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TargetNodeRequiredDiagramNodeobject.Thediagramnodetobereplaced.

Page 813: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplereplacesthelastdiagramnodeofanewly-createddiagramwiththesecondnode.

SubReplaceLastNode()

DimdgnNodeAsDiagramNode

DimshpRadialAsShape

DimintNodesAsInteger

'Addsradialdiagramandrootnode

SetshpRadial=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramRadial,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpRadial.DiagramNode.Children.AddNode

'Addsthreeadditionalchildnodes

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

'Displaysthenumberofnodesinthediagram

MsgBox"Thenumberofnodesinthediagram:"&_

dgnNode.Diagram.Nodes.Count

'Secondnodereplacesthelastnode.

dgnNode.Diagram.Nodes(2).ReplaceNode_

TargetNode:=dgnNode.Diagram.Nodes(4)

'Nodecountisthreebecausethereplacednodewasdeleted

MsgBox"Thenumberofnodesinthediagram:"&_

dgnNode.Diagram.Nodes.Count

EndSub

Page 814: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReplyWithChangesMethodSendsane-mailmessagetotheauthorofapresentationthathasbeensentoutforreview,notifyingthemthatareviewerhascompletedreviewofthepresentation.

expression.ReplyWithChanges(ShowMessage)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ShowMessageOptionalBoolean.Truetodisplaythemessagepriortosending.Falsetoautomaticallysendthemessagewithoutdisplayingitfirst.ThedefaultisTrue.

Page 815: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheSendForReviewmethodtostartacollaborativereviewofapresentation.IftheReplyWithChangesmethodisexecutedonapresentationthatisnotpartofacollaborativereviewcycle,theuserwillreceiveanerrormessage.

Page 816: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesendsamessagetotheauthorofareviewdocumentthatareviewerhascompletedareview,withoutfirstdisplayingthee-mailmessagetothereviewer.Thisexampleassumesthattheactivepresentationispartofacollaborativereviewcycle.

SubReplyMsg()

ActivePresentation.ReplyWithChangesShowMessage:=False

EndSub

Page 817: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RerouteConnectionsMethodReroutesconnectorssothattheytaketheshortestpossiblepathbetweentheshapestheyconnect.Todothis,theRerouteConnectionsmethodmaydetachtheendsofaconnectorandreattachthemtodifferentconnectingsitesontheconnectedshapes.

Thismethodreroutesallconnectorsattachedtothespecifiedshape;ifthespecifiedshapeisaconnector,it'srerouted.

expression.RerouteConnections

expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.

Page 818: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifthismethodisappliedtoaconnector,onlythatconnectorwillbererouted.Ifthismethodisappliedtoaconnectedshape,allconnectorstothatshapewillbererouted.

Page 819: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstworectanglestomyDocument,connectsthemwithacurvedconnector,andthenreroutestheconnectorsothatittakestheshortestpossiblepathbetweenthetworectangles.NotethattheRerouteConnectionsmethodadjuststhesizeandpositionoftheconnectoranddetermineswhichconnectingsitesitattachesto,sothevaluesyouinitiallyspecifyfortheConnectionSiteargumentsusedwiththeBeginConnectandEndConnectmethodsareirrelevant.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

SetnewConnector=s_

.AddConnector(msoConnectorCurve,0,0,100,100)

WithnewConnector.ConnectorFormat

.BeginConnectfirstRect,1

.EndConnectsecondRect,1

EndWith

newConnector.RerouteConnections

Page 820: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ResetRotationMethodResetstheextrusionrotationaroundthex-axisandthey-axisto0(zero)sothatthefrontoftheextrusionfacesforward.Thismethoddoesn'tresettherotationaroundthez-axis.

expression.ResetRotation

expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.

Page 821: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Tosettheextrusionrotationaroundthex-axisandthey-axistoanythingotherthan0(zero),usetheRotationXandRotationYpropertiesoftheThreeDFormatobject.Tosettheextrusionrotationaroundthez-axis,usetheRotationpropertyoftheShapeobjectthatrepresentstheextrudedshape.

Page 822: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleresetstherotationaroundthex-axisandthey-axisto0(zero)fortheextrusionofshapeoneonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).ThreeD.ResetRotation

Page 823: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ResetSlideTimeMethodResetstheelapsedtime(representedbytheSlideElapsedTimeproperty)fortheslidethat'scurrentlydisplayedto0(zero).

expression.ResetSlideTime

expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.

Page 824: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleresetstheelapsedtimefortheslidethat'scurrentlydisplayedinslideshowwindowoneto0(zero).

SlideShowWindows(1).View.ResetSlideTime

Page 825: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RotatedBoundsMethodReturnsthecoordinatesoftheverticesofthetextboundingboxforthespecifiedtextrange.

expression.RotatedBounds(X1,Y1,X2,Y2,X3,Y3,X4,Y4)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

X1,Y1RequiredSingle.Returnstheposition(inpoints)ofthefirstvertexoftheboundingboxforthetextwithinthespecifiedtextrange.

X2,Y2RequiredSingle.Returnstheposition(inpoints)ofthesecondvertexoftheboundingboxforthetextwithinthespecifiedtextrange.

X3,Y3RequiredSingle.Returnstheposition(inpoints)ofthethirdvertexoftheboundingboxforthetextwithinthespecifiedtextrange.

X4,Y4RequiredSingle.Returnstheposition(inpoints)ofthefourthvertexoftheboundingboxforthetextwithinthespecifiedtextrange.

Page 826: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleusesthevaluesreturnedbytheargumentsoftheRotatedBoundsmethodtodrawafreeformthathasthedimensionsofthetextboundingboxforthethirdwordinthetextrangeinshapeoneonslideoneintheactivepresentation.

Dimx1AsSingle,y1AsSingle

Dimx2AsSingle,y2AsSingle

Dimx3AsSingle,y3AsSingle

Dimx4AsSingle,y4AsSingle

DimmyDocumentAsSlide

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).TextFrame.TextRange.Words(3).RotatedBounds_

x1,y1,x2,y2,x3,y3,x4,y4

WithmyDocument.Shapes.BuildFreeform(msoEditingCorner,x1,y1)

.AddNodesmsoSegmentLine,msoEditingAuto,x2,y2

.AddNodesmsoSegmentLine,msoEditingAuto,x3,y3

.AddNodesmsoSegmentLine,msoEditingAuto,x4,y4

.AddNodesmsoSegmentLine,msoEditingAuto,x1,y1

.ConvertToShape.ZOrdermsoSendToBack

EndWith

Page 827: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RtlRunMethodSetsthedirectionoftextinatextrangetoreadfromrighttoleft.

expression.RtlRun

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

Page 828: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethodmakesitpossibletousetextfrombothleft-to-rightandright-to-leftlanguagesinthesamepresentation.

Page 829: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplefindsalloftheshapesonslideonethatcontaintextandchangesthetexttoreadfromrighttoleft.

ActiveWindow.ViewType=ppViewSlide

ForEachshInActivePresentation.Slides(1).Shapes

Ifsh.HasTextFrameThen

sh.TextFrame.TextRange.RtlRun

EndIf

Next

Page 830: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 831: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RunMethodRunmethodasitappliestotheSlideShowSettingsobject.

Runsaslideshowofthespecifiedpresentation.ReturnsaSlideShowWindowobject.

expression.Run

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 832: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Torunacustomslideshow,settheRangeTypepropertytoppShowNamedSlideShow,andsettheSlideShowNamepropertytothenameofthecustomshowyouwanttorun.

RunmethodasitappliestotheApplicationobject.

RunsaVisualBasicprocedure.

NoteBecausemacroscancontainviruses,becarefulaboutrunningthem.Takethefollowingprecautions:runup-to-dateantivirussoftwareonyourcomputer;setyourmacrosecurityleveltohigh;cleartheTrustallinstalledadd-insandtemplatescheckbox;usedigitalsignatures;maintainalistoftrustedpublishers.

expression.Run(MacroName,safeArrayOfParams)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

MacroNameRequiredString.Thenameoftheproceduretoberun.Thestringcancontainthefollowing:aloadedpresentationoradd-infilenamefollowedbyanexclamationpoint(!),avalidmodulenamefollowedbyaperiod(.),andtheprocedurename.Forexample,thefollowingisavalidMacroNamevalue:"MyPres.ppt!Module1.Test."

safeArrayOfParamsRequiredVariant.Theargumenttobepassedtotheprocedure.Youcannotspecifyanobjectforthisargument,andyoucannotusenamedargumentswiththismethod.Argumentsmustbepassedbyposition.

Page 833: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheSlideShowSettingsobject.

Thisexamplestartsafull-screenslideshowoftheactivepresentation,withshortcutkeysdisabled.

WithActivePresentation.SlideShowSettings

.ShowType=ppShowSpeaker

.Run.View.AcceleratorsEnabled=False

EndWith

Thisexamplerunsthenamedslideshow"QuickShow."

WithActivePresentation.SlideShowSettings

.RangeType=ppShowNamedSlideShow

.SlideShowName="QuickShow"

.Run

EndWith

AsitappliestotheApplicationobject.

Inthisexample,theMainproceduredefinesanarrayandthenrunsthemacroTestPass,passingthearrayasanargument.

SubMain()

Dimx(1To2)

x(1)="hi"

x(2)=7

Application.Run"TestPass",x

EndSub

SubTestPass(x)

MsgBoxx(1)

MsgBoxx(2)

EndSub

Page 834: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 835: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RunsMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextruns.Atextrunconsistsofarangeofcharactersthatsharethesamefontattributes.Forinformationaboutcountingorloopingthroughtherunsinatextrange,seetheTextRangeobject.

expression.Runs(Start,Length)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

StartOptionalLong.Thefirstruninthereturnedrange.

LengthOptionalLong.Thenumberofrunstobereturned.

Page 836: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstrunandendswiththelastparagraphinthespecifiedrange.

IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsonerun.

IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstruninthespecifiedrange.

IfStartisgreaterthanthenumberofrunsinthespecifiedtext,thereturnedrangestartswiththelastruninthespecifiedrange.

IfLengthisgreaterthanthenumberofrunsfromthespecifiedstartingruntotheendofthetext,thereturnedrangecontainsallthoseruns.

Arunconsistsofallcharactersfromthefirstcharacterafterafontchangetothesecond-to-lastcharacterwiththesamefontattributes.Forexample,considerthefollowingsentence:

Thisitalicwordisnotbold.

Intheprecedingsentence,thefirstrunconsistsoftheword"This"onlyifthespaceaftertheword"This"isn'tformattedasitalic(ifthespaceisitalic,thefirstrunisonlythefirstthreecharacters,or"Thi").Likewise,thesecondruncontainstheword"italic"onlyifthespaceafterthewordisformattedasitalic.

Page 837: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleformatsthesecondruninshapetwoonslideoneintheactivepresentationasbolditalicifit'salreadyitalic.

WithApplication.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange

With.Runs(2).Font

If.ItalicThen

.Bold=True

EndIf

EndWith

EndWith

Page 838: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SaveMethodSavesthespecifiedpresentation.

expression.Save

expressionRequired.AnexpressionthatreturnsaPresentationobject.

Page 839: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheSaveAsmethodtosaveapresentationthathasn'tbeenpreviouslysaved.Todeterminewhetherapresentationhasbeensaved,testforanonemptyvaluefortheFullNameorPathproperty.Ifadocumentwiththesamenameasthespecifiedpresentationalreadyexistsondisk,thatdocumentwillbeoverwritten.Nowarningmessagewillbedisplayed.

Tomarkthepresentationassavedwithoutwritingittodisk,settheSavedpropertytoTrue.

Page 840: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesavestheactivepresentationifit'sbeenchangedsincethelasttimeitwassaved.

WithApplication.ActivePresentation

IfNot.SavedAnd.Path<>""Then.Save

EndWith

Page 841: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 842: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SaveAsMethodSavesapresentationthat'sneverbeensaved,orsavesapreviouslysavedpresentationunderadifferentname.

expression.SaveAs(Filename,FileFormat,EmbedFonts)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

FilenameRequiredString.Specifiesthenametosavethefileunder.Ifyoudon'tincludeafullpath,PowerPointsavesthefileinthecurrentfolder.

FileFormatOptionalPpSaveAsFileType.Specifiesthesavedfileformat.Ifthisargumentisomitted,thefileissavedintheformatofapresentationinthecurrentversionofPowerPoint(ppSaveAsPresentation).

PpSaveAsFileTypecanbeoneofthesePpSaveAsFileTypeconstants.ppSaveAsHTMLv3ppSaveAsAddInppSaveAsBMPppSaveAsDefaultppSaveAsGIFppSaveAsHTMLppSaveAsHTMLDualppSaveAsJPGppSaveAsMetaFileppSaveAsPNGppSaveAsPowerPoint3ppSaveAsPowerPoint4ppSaveAsPowerPoint4FarEastppSaveAsPowerPoint7ppSaveAsPresentationDefault.ppSaveAsRTFppSaveAsShow

Page 843: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppSaveAsTemplateppSaveAsTIFppSaveAsWebArchive

EmbedFontsOptionalMsoTriState.SpecifieswhetherPowerPointembedsTrueTypefontsinthesavedpresentation.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedDefault.msoTriStateTogglemsoTruePowerPointembedsTrueTypefontsinthesavedpresentation.

Page 844: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesavesacopyoftheactivepresentationunderthename"NewFormatCopy.ppt."Bydefault,thiscopyissavedintheformatofapresentationinthecurrentversionofPowerPoint.ThepresentationisthensavedasaPowerPoint4.0filenamed"OldFormatCopy."

WithApplication.ActivePresentation

.SaveCopyAs"NewFormatCopy"

.SaveAs"OldFormatCopy",ppSaveAsPowerPoint4

EndWith

Page 845: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 846: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SaveCopyAsMethodSavesacopyofthespecifiedpresentationtoafilewithoutmodifyingtheoriginal.

expression.SaveCopyAs(FileName,FileFormat,EmbedTrueTypeFonts)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

FileNameRequiredString.Specifiesthenametosavethefileunder.Ifyoudon'tincludeafullpath,PowerPointsavesthefileinthecurrentfolder.

FileFormatOptionalPpSaveAsFileType.Thefileformat.

PpSaveAsFileTypecanbeoneofthesePpSaveAsFileTypeconstants.ppSaveAsHTMLv3ppSaveAsAddInppSaveAsBMPppSaveAsDefaultdefaultppSaveAsGIFppSaveAsHTMLppSaveAsHTMLDualppSaveAsJPGppSaveAsMetaFileppSaveAsPNGppSaveAsPowerPoint3ppSaveAsPowerPoint4ppSaveAsPowerPoint4FarEastppSaveAsPowerPoint7ppSaveAsPresentationppSaveAsRTFppSaveAsShowppSaveAsTemplate

Page 847: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppSaveAsTIFppSaveAsWebArchive

EmbedTrueTypeFontsOptionalMsoTriState.SpecifieswhetherTrueTypefontsareembedded.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixeddefaultmsoTriStateTogglemsoTrue

Page 848: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesavesacopyoftheactivepresentationunderthename"NewFormatCopy.ppt."Bydefault,thiscopyissavedintheformatofapresentationinthecurrentversionofPowerPoint.ThepresentationisthensavedasaPowerPoint4.0filenamed"OldFormatCopy."

WithApplication.ActivePresentation

.SaveCopyAs"NewFormatCopy"

.SaveAs"OldFormatCopy",ppSaveAsPowerPoint4

EndWith

Page 849: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 850: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScaleHeightMethodScalestheheightoftheshapebyaspecifiedfactor.ForpicturesandOLEobjects,youcanindicatewhetheryouwanttoscaletheshaperelativetotheoriginalsizeorrelativetothecurrentsize.ShapesotherthanpicturesandOLEobjectsarealwaysscaledrelativetotheircurrentheight.

expression.ScaleHeight(Factor,RelativeToOriginalSize,fScale)

expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.

FactorRequiredSingle.Specifiestheratiobetweentheheightoftheshapeafteryouresizeitandthecurrentororiginalheight.Forexample,tomakearectangle50percentlarger,specify1.5forthisargument.

RelativeToOriginalSizeRequiredMsoTriState.Specifieswhethertheshapeisscaledrelativetoitscurrentororiginalsize.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseScalestheshaperelativetoitscurrentsize.msoTriStateMixedmsoTriStateTogglemsoTrueScalestheshaperelativetoitsoriginalsize.YoucanspecifymsoTrueforthisargumentonlyifthespecifiedshapeisapictureoranOLEobject.

fScaleOptionalMsoScaleFrom.Thepartoftheshapethatretainsitspositionwhentheshapeisscaled.

MsoScaleFromcanbeoneoftheseMsoScaleFromconstants.msoScaleFromBottomRightmsoScaleFromMiddlemsoScaleFromTopLeftDefault.

Page 851: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplescalesallpicturesandOLEobjectsonmyDocumentto175percentoftheiroriginalheightandwidth,anditscalesallothershapesto175percentoftheircurrentheightandwidth.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

SelectCases.Type

CasemsoEmbeddedOLEObject,msoLinkedOLEObject,_

msoOLEControlObject,msoLinkedPicture,msoPicture

s.ScaleHeight1.75,msoTrue

s.ScaleWidth1.75,msoTrue

CaseElse

s.ScaleHeight1.75,msoFalse

s.ScaleWidth1.75,msoFalse

EndSelect

Next

Page 852: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 853: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScaleWidthMethodScalesthewidthoftheshapebyaspecifiedfactor.ForpicturesandOLEobjects,youcanindicatewhetheryouwanttoscaletheshaperelativetotheoriginalsizeorrelativetothecurrentsize.ShapesotherthanpicturesandOLEobjectsarealwaysscaledrelativetotheircurrentwidth.

expression.ScaleWidth(Factor,RelativeToOriginalSize,fScale)

expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.

FactorRequiredSingle.Specifiestheratiobetweenthewidthoftheshapeafteryouresizeitandthecurrentororiginalwidth.Forexample,tomakearectangle50percentlarger,specify1.5forthisargument.

RelativeToOriginalSizeRequiredMsoTriState.Specifieswhetherashapeisscaledrelativetoitscurrentororiginalsize.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseScalestheshaperelativetoitscurrentsize.msoTriStateMixedmsoTriStateTogglemsoTrueScalestheshaperelativetoitsoriginalsize.YoucanspecifymsoTrueforthisargumentonlyifthespecifiedshapeisapictureoranOLEobject.

fScaleOptionalMsoScaleFrom.Thepartoftheshapethatretainsitspositionwhentheshapeisscaled.

MsoScaleFromcanbeoneoftheseMsoScaleFromconstants.msoScaleFromBottomRightmsoScaleFromMiddlemsoScaleFromTopLeftDefault.

Page 854: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplescalesallpicturesandOLEobjectsonmyDocumentto175percentoftheiroriginalheightandwidth,anditscalesallothershapesto175percentoftheircurrentheightandwidth.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

SelectCases.Type

CasemsoEmbeddedOLEObject,msoLinkedOLEObject,_

msoOLEControlObject,msoLinkedPicture,msoPicture

s.ScaleHeight1.75,msoTrue

s.ScaleWidth1.75,msoTrue

CaseElse

s.ScaleHeight1.75,msoFalse

s.ScaleWidth1.75,msoFalse

EndSelect

Page 855: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 856: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScrollIntoViewMethodScrollsthedocumentwindowsothatitemswithinaspecifiedrectangularareaaredisplayedinthedocumentwindoworpane.

expression.ScrollIntoView(Left,Top,Width,Height,Start)

expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.

LeftRequiredLong.Thehorizontaldistance(inpoints)fromtheleftedgeofthedocumentwindowtotherectangle.

TopRequiredLong.Theverticaldistance(inpoints)fromthetopofthedocumentwindowtotherectangle.

WidthRequiredLong.Thewidthoftherectangle(inpoints).

HeightRequiredLong.Theheightoftherectangle(inpoints).

StartOptionalMsoTriState.Determinesthestartingpositionoftherectangleinrelationtothedocumentwindow.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThebottomrightoftherectangleistoappearatthebottomrightofthedocumentwindow.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Thetopleftoftherectangleistoappearatthetopleftofthedocumentwindow.

Page 857: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Iftheboundingrectangleislargerthanthedocumentwindow,theStartargumentspecifieswhichendoftherectangledisplaysorgetsinitialfocus.Thismethodcannotbeusedwithoutlineorslidesorterviews.

Page 858: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplebringsintoviewa100x200pointareabeginning50pointsfromtheleftedgeoftheslide,and20pointsfromthetopoftheslide.Thetopleftcorneroftherectangleispositionedatthetopleftcorneroftheactivedocumentwindow.

ActiveWindow.ScrollIntoViewLeft:=50,Top:=20,_

Width:=100,Height:=200

Page 859: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 860: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SelectMethodSelectmethodasitappliestotheCell,Column,Row,Slide,SlideRange,

andTextRangeobjects.

Selectsthespecifiedobject.

expression.Select

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

SelectmethodasitappliestotheShapeandShapeRangeobjects.

Selectsthespecifiedobject.

expression.Select(Replace)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

ReplaceOptionalMsoTriState.Specifieswhethertheselectionreplacesanypreviousselection.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheselectionisaddedtothepreviousselection.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Theselectionreplacesanypreviousselection.

Page 861: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyoutrytomakeaselectionthatisn'tappropriatefortheview,yourcodewillfail.Forexample,youcanselectaslideinslidesorterviewbutnotinslideview.

Page 862: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheCell,Column,Row,Slide,SlideRange,andTextRangeobjects

Thisexampleselectsthefirstfivecharactersinthetitleofslideoneintheactivepresentation.

ActivePresentation.Slides(1).Shapes.Title.TextFrame_

.TextRange.Characters(1,5).Select

Thisexampleselectsslideoneintheactivepresentation.

ActivePresentation.Slides(1).Select

Thisexampleselectsatablethathasbeenaddedtoanewslideinanewpresentation.Thetablehasthreerowsandthreecolumns.

WithPresentations.Add.Slides

.Add(1,ppLayoutBlank).Shapes.AddTable(3,3).Select

EndWith

AsitappliestotheShapeandShapeRangeobjects.

Thisexampleselectsshapesoneandthreeonslideoneintheactivepresentation.

ActivePresentation.Slides(1).Shapes.Range(Array(1,3)).Select

Thisexampleaddsshapestwoandfouronslideoneintheactivepresentationto

Page 863: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

thepreviousselection.

ActivePresentation.Slides(1).Shapes.Range(Array(2,4)).SelectFalse

Page 864: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SelectAllMethodSelectsallshapes(inaShapescollection)oralldiagramnodes(inaDiagramNodesorDiagramNodeChildrencollection).

expression.SelectAll

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 865: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleselectsalltheshapesonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.SelectAll

Page 866: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SendFaxOverInternetMethodSendsapresentationasafaxtothespecifiedrecipients.

expression.SendFaxOverInternet(Recipients,Subject,ShowMessage)

expressionRequired.AnexpressionthatreturnsaPresentationobject.

RecipientsOptionalVariant.AStringthatrepresentsthefaxnumbersande-mailaddressesofthepeopletowhomtosendthefax.Separatemultiplerecipientswithasemicolon.

SubjectOptionalVariant.AStringthatrepresentsthesubjectlineforthefaxedpresentation.

ShowMessageOptionalVariant.Truedisplaysthefaxmessagebeforesendingit.Falsesendsthefaxwithoutdisplayingthefaxmessage.

Page 867: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsingtheSendFaxOverInternetmethodrequiresthatthefaxservicebeenabledonauser'scomputer.

TheformatusedforspecifyingfaxnumbersintheRecipientsparameteriseitherrecipientsfaxnumber@usersfaxproviderorrecipientsname@recipientsfaxnumber.Youcanaccesstheuser'sfaxproviderinformationusingthefollowingregistrypath:

HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Services\Fax

UsetheFaxAddresskeyvalueundertheaboveregistrypathtodeterminetheformattouseforauser.

Page 868: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesendsafaxtothefaxserviceprovider,whowillfaxthemessagetotherecipient.

ActivePresentation.SendFaxOverInternet_

"[email protected]",_

"Foryourreview",True

Page 869: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SendForReviewMethodSendsapresentationinane-mailmessageforreviewtothespecifiedrecipients.

expression.SendForReview(Recipients,Subject,ShowMessage,IncludeAttachment)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

RecipientsOptionalString.Astringthatliststhepeopletowhomtosendthemessage.Thesecanbeunresolvednamesandaliasesinane-mailphonebookorfulle-mailaddresses.Separatemultiplerecipientswithasemicolon(;).IfleftblankandShowMessageisFalse,youwillreceiveanerrormessage,andthemessagewillnotbesent.

SubjectOptionalString.Astringforthesubjectofthemessage.Ifleftblank,thesubjectwillbe:Pleasereview"filename".

ShowMessageOptionalBoolean.ABooleanvaluethatindicateswhetherthemessageshouldbedisplayedwhenthemethodisexecuted.ThedefaultvalueisTrue.IfsettoFalse,themessageisautomaticallysenttotherecipientswithoutfirstshowingthemessagetothesender.

IncludeAttachmentOptionalVariant.ABooleanvaluethatindicateswhetherthemessageshouldincludeanattachmentoralinktoaserverlocation.ThedefaultvalueisTrue.IfsettoFalse,thedocumentmustbestoredatasharedlocation.

Page 870: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheSendForReviewmethodstartsacollaborativereviewcycle.UsetheEndReviewmethodtoendareviewcycle.

Page 871: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleautomaticallysendstheactivepresentationasanattachmentinane-mailmessagetothespecifiedrecipients.

SubWebReview()

ActivePresentation.SendForReview_

Recipients:="[email protected];DanWilson",_

Subject:="Pleasereviewthisdocument.",_

ShowMessage:=False,_

IncludeAttachment:=True

EndSub

Page 872: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SentencesMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextsentences.Forinformationaboutcountingorloopingthroughthesentencesinatextrange,seetheTextRangeobject.

expression.Sentences(Start,Length)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

StartOptionalLong.Thefirstsentenceinthereturnedrange.

LengthOptionalLong.Thenumberofsentencestobereturned.

Page 873: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstsentenceandendswiththelastparagraphinthespecifiedrange.

IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsonesentence.

IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstsentenceinthespecifiedrange.

IfStartisgreaterthanthenumberofsentencesinthespecifiedtext,thereturnedrangestartswiththelastsentenceinthespecifiedrange.

IfLengthisgreaterthanthenumberofsentencesfromthespecifiedstartingsentencetotheendofthetext,thereturnedrangecontainsallthosesentences.

Page 874: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleformatsasboldthesecondsentenceinthesecondparagraphinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange.Paragraphs(2).Sentences(2).Font_

.Bold=True

Page 875: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 876: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetEditingTypeMethodSetstheeditingtypeofthenodespecifiedbyIndex.Ifthenodeisacontrolpointforacurvedsegment,thismethodsetstheeditingtypeofthenodeadjacenttoitthatjoinstwosegments.Notethat,dependingontheeditingtype,thismethodmayaffectthepositionofadjacentnodes.

expression.SetEditingType(Index,EditingType)

expressionRequired.AnexpressionthatreturnsaShapeNodesobject.

IndexRequiredLong.Thenodewhoseeditingtypeistobeset.

EditingTypeRequiredMsoEditingType.Theeditingtype.

MsoEditingTypecanbeoneoftheseMsoEditingTypeconstants.msoEditingAutomsoEditingCornermsoEditingSmoothmsoEditingSymmetric

Page 877: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesallcornernodestosmoothnodesinshapethreeonmyDocument.Shapethreemustbeafreeformdrawing.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

Forn=1to.Count

If.Item(n).EditingType=msoEditingCornerThen

.SetEditingTypen,msoEditingSmooth

EndIf

Next

EndWith

Page 878: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 879: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetExtrusionDirectionMethodSetsthedirectionthattheextrusion'ssweeppathtakesawayfromtheextrudedshape.

expression.SetExtrusionDirection(PresetExtrusionDirection)

expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.

PresetExtrusionDirectionRequiredMsoPresetExtrusionDirection.Specifiestheextrusiondirection.

MsoPresetExtrusionDirectioncanbeoneoftheseMsoPresetExtrusionDirectionconstants.msoExtrusionBottommsoExtrusionBottomLeftmsoExtrusionBottomRightmsoExtrusionLeftmsoExtrusionNonemsoExtrusionRightmsoExtrusionTopmsoExtrusionTopLeftmsoExtrusionTopRightmsoPresetExtrusionDirectionMixed

Page 880: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThismethodsetsthePresetExtrusionDirectionpropertytothedirectionspecifiedbythePresetExtrusionDirectionargument.

Page 881: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthattheextrusionforshapeoneonmyDocumentextendtowardthetopoftheshapeandthatthelightingfortheextrusioncomefromtheleft.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

.Visible=True

.SetExtrusionDirectionmsoExtrusionTop

.PresetLightingDirection=msoLightingLeft

EndWith

Page 882: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 883: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetPasswordEncryptionOptionsMethodSetstheoptionsMicrosoftPowerPointusesforencryptingpresentationswithpasswords.

expression.SetPasswordEncryptionOptions(PasswordEncryptionProvider,PasswordEncryptionFileProperties,PasswordEncryptionKeyLength,PasswordEncryptionAlgorithm)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

PasswordEncryptionProviderRequiredString.Thenameoftheencryptionprovider.

PasswordEncryptionAlgorithmRequiredString.Thenameoftheencryptionalgorithm.PowerPointsupportsstream-encryptedalgorithms.

PasswordEncryptionKeyLengthRequiredLong.Theencryptionkeylength.Mustbeamultipleof8,startingat40.

PasswordEncryptionFilePropertiesRequiredMsoTriState.MsoTrueforPowerPointtoencryptfileproperties.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueNotusedwiththismethod.msoFalsemsoTriStateMixedNotusedwiththismethod.msoTriStateToggleNotusedwiththismethod.msoTrue

Page 884: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthepasswordencryptionoptionsifthefilepropertiesarenotencryptedforpassword-protecteddocuments.

SubPasswordSettings()

WithActivePresentation

If.PasswordEncryptionFileProperties=msoFalseThen

.SetPasswordEncryptionOptions_

PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_

PasswordEncryptionAlgorithm:="RC4",_

PasswordEncryptionKeyLength:=56,_

PasswordEncryptionFileProperties:=True

EndIf

EndWith

EndSub

Page 885: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetPositionMethodSetsthelocationofthenodespecifiedbyIndex.Notethat,dependingontheeditingtypeofthenode,thismethodmayaffectthepositionofadjacentnodes.

expression.SetPosition(Index,X1,Y1)

expressionRequired.AnexpressionthatreturnsaShapeNodesobject.

IndexRequiredLong.Thenodewhosepositionistobeset.

X1,Y1RequiredSingle.Theposition(inpoints)ofthenewnoderelativetotheupper-leftcornerofthedocument.

Page 886: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplemovesnodetwoinshapethreeonmyDocumenttotheright200pointsanddown300points.Shapethreemustbeafreeformdrawing.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

pointsArray=.Item(2).Points

currXvalue=pointsArray(1,1)

currYvalue=pointsArray(1,2)

.SetPosition2,currXvalue+200,currYvalue+300

EndWith

Page 887: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 888: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetSegmentTypeMethodSetsthesegmenttypeofthesegmentthatfollowsthenodespecifiedbyIndex.Ifthenodeisacontrolpointforacurvedsegment,thismethodsetsthesegmenttypeforthatcurve.Notethatthismayaffectthetotalnumberofnodesbyinsertingordeletingadjacentnodes.

expression.SetSegmentType(Index,SegmentType)

expressionRequired.AnexpressionthatreturnsaShapeNodesobject.

IndexRequiredLong.Thenodewhosesegmenttypeistobeset.

SegmentTypeRequiredMsoSegmentType.Specifiesifthesegmentisstraightorcurved.

MsoSegmentTypecanbeoneoftheseMsoSegmentTypeconstants.msoSegmentCurvemsoSegmentLine

Page 889: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesallstraightsegmentstocurvedsegmentsinshapethreeonmyDocument.Shapethreemustbeafreeformdrawing.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

n=1

Whilen<=.Count

If.Item(n).SegmentType=msoSegmentLineThen

.SetSegmentTypen,msoSegmentCurve

EndIf

n=n+1

Wend

EndWith

Page 890: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 891: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetShapesDefaultPropertiesMethodAppliestheformattingforthespecifiedshapetothedefaultshape.Shapescreatedafterthismethodhasbeenusedwillhavethisformattingappliedtothembydefault.

expression.SetShapesDefaultProperties

expressionRequired.AnexpressionthatreturnsaShapeobject.

Page 892: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocument,formatstherectangle'sfill,appliestherectangle'sformattingtothedefaultshape,andthenaddsanothersmallerrectangletothedocument.Thesecondrectanglehasthesamefillasthefirstone.

Setmydocument=ActivePresentation.Slides(1)

Withmydocument.Shapes

With.AddShape(msoShapeRectangle,5,5,80,60)

With.Fill

.ForeColor.RGB=RGB(0,0,255)

.BackColor.RGB=RGB(0,204,255)

.PatternedmsoPatternHorizontalBrick

EndWith

'Setsformattingfordefaultshapes

.SetShapesDefaultProperties

EndWith

'Newshapehasdefaultformatting

.AddShapemsoShapeRectangle,90,90,40,30

EndWith

Page 893: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 894: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetThreeDFormatMethodSetsthepresetextrusionformat.Eachpresetextrusionformatcontainsasetofpresetvaluesforthevariouspropertiesoftheextrusion.

expression.SetThreeDFormat(PresetThreeDFormat)

expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.

PresetThreeDFormatRequiredMsoPresetThreeDFormat.Specifiesapresetextrusionformatthatcorrespondstooneoftheoptions(numberedfromlefttoright,fromtoptobottom)displayedwhenyouclickthe3-DbuttonontheDrawingtoolbar.

MsoPresetThreeDFormatcanbeoneoftheseMsoPresetThreeDFormatconstants.msoPresetThreeDFormatMixedSpecifyingthisconstantcausesanerror.msoThreeD1msoThreeD2msoThreeD3msoThreeD4msoThreeD5msoThreeD6msoThreeD7msoThreeD8msoThreeD9msoThreeD10msoThreeD11msoThreeD12msoThreeD13msoThreeD14msoThreeD15msoThreeD16

Page 895: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoThreeD17msoThreeD18msoThreeD19msoThreeD20

Page 896: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThismethodsetsthePresetThreeDFormatpropertytotheformatspecifiedbythePresetThreeDFormatargument.

Page 897: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsanovaltomyDocumentandsetsitsextrusionformatto3DStyle12.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeOval,30,30,50,25).ThreeD

.Visible=True

.SetThreeDFormatmsoThreeD12

EndWith

Page 898: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SmallScrollMethodScrollsthroughthespecifieddocumentwindowbylinesandcolumns.

expression.SmallScroll(Down,Up,ToRight,ToLeft)

expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.

DownOptionalLong.Specifiesthenumberoflinestoscrolldown.

UpOptionalLong.Specifiesthenumberoflinestoscrollup.

ToRightOptionalLong.Specifiesthenumberofcolumnstoscrollright.

ToLeftOptionalLong.Specifiesthenumberofcolumnstoscrollleft.

Page 899: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifnoargumentsarespecified,thismethodscrollsdownoneline.IfDownandUparebothspecified,theireffectsarecombined.Forexample,ifDownis2andUpis4,thismethodscrollsuptwolines.Similarly,ifRightandLeftarebothspecified,theireffectsarecombined.

Anyoftheargumentscanbeanegativenumber.

Page 900: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplescrollsdownthreelinesintheactivewindow.

Application.ActiveWindow.SmallScrollDown:=3

Page 901: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SolidMethodSetsthespecifiedfilltoauniformcolor.Usethismethodtoconvertagradient,textured,patterned,orbackgroundfillbacktoasolidfill.

expression.Solid

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

Page 902: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleconvertsallfillsonmyDocumenttouniformredfills.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Withs.Fill

.Solid

.ForeColor.RGB=RGB(255,0,0)

EndWith

Next

Page 903: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SplitMethodSplitsasingletablecellintomultiplecells.

expression.SplitNumRows,NumColumns

expressionRequired.AnexpressionthatreturnsaCellobject.

NumRowsRequiredLong.Numberofrowsthatthecellisbeingsplitinto.

NumColumnsRequiredLong.Numberofcolumnsthatthecellisbeingsplitinto.

Page 904: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesplitsthefirstcellinthereferencedtableintotwocells,onedirectlyabovetheother.

ActivePresentation.Slides(2).Shapes(5).Table.Cell(1,1).Split2,1

Page 905: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SwapNodeMethodSwapsthesourcediagramnodewiththetargetdiagramnode.Anychilddiagramnodesaremovedalongwiththeircorrespondingrootnodesunlessspecifiedotherwise.

expression.SwapNode(TargetNode,SwapChildren)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TargetNodeRequiredDiagramNodeobject.Thetargetdiagramnode.

SwapChildrenOptionalBoolean.True(default)ifallchilddiagramnodesaremovedalongwiththeircorrespondingtargetorsourcediagramnodes.Falsetoswapjustthetargetandsourcediagramnodes,inheritingtheother'schilddiagramnodes.

Page 906: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleswapsthefirstandthirdnodesinanewly-createddiagram.

SubSwapTwoNodes()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addsradialdiagramandfirstnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramRadial,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreeadditionalnodes

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

'Swapsthefirstandthethirdnodes

dgnNode.Children.Item(1).SwapNode_

TargetNode:=dgnNode.Children.Item(3)

EndSub

Page 907: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ToggleVerticalTextMethodSwitchesthetextflowinthespecifiedWordArtfromhorizontaltovertical,orviceversa.

expression.ToggleVerticalText

expressionRequired.AnexpressionthatreturnsaTextEffectFormatobject.

Page 908: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsingtheToggleVerticalTextmethodswapsthevaluesoftheWidthandHeightpropertiesoftheShapeobjectthatrepresentstheWordArtandleavestheLeftandToppropertiesunchanged.

TheFlipmethodandRotationpropertyoftheShapeobjectandtheRotatedCharspropertyandToggleVerticalTextmethodoftheTextEffectFormatobjectallaffectthecharacterorientationandthedirectionoftextflowinaShapeobjectthatrepresentsWordArt.Youmayhavetoexperimenttofindouthowtocombinetheeffectsofthesepropertiesandmethodstogettheresultyouwant.

Page 909: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsWordArtthatcontainsthetext"Test"tomyDocument,andswitchesfromhorizontaltextflow(thedefaultforthespecifiedWordArtstyle,msoTextEffect1)toverticaltextflow.

SetmyDocument=ActivePresentation.Slides(1)

SetnewWordArt=myDocument.Shapes.AddTextEffect_

(PresetTextEffect:=msoTextEffect1,Text:="Test",_

FontName:="ArialBlack",FontSize:=36,_

FontBold:=False,FontItalic:=False,Left:=100,Top:=100)

newWordArt.TextEffect.ToggleVerticalText

Page 910: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TransferChildrenMethodMovesthechildnodesofonediagramnodetoanotherdiagramnode.

expression.TransferChildren(ReceivingNode)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ReceivingNodeRequiredDiagramNodeobject.Thetarget(receiving)diagramnode.

Page 911: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampletransfersthechildnodesfromthefirstnodetothethirdnodeofanewly-createddiagram.

SubTransferChildNodes()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addsorgchartandrootnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramOrgChart,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreechildnodestorootnode

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

'Addsthreechildnodestofirstchildnode

ForintNodes=1To3

dgnNode.Children.Item(1).Children.AddNode

NextintNodes

'Transferschildrenofthefirstnodetothethirdnode

dgnNode.Children.Item(1).TransferChildren_

ReceivingNode:=dgnNode.Children.Item(3)

EndSub

Page 912: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TrimTextMethodReturnsaTextRangeobjectthatrepresentsthespecifiedtextminusanytrailingspaces.

expression.TrimText

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

Page 913: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleinsertsthestring"Texttotrim"atthebeginningofthetextinshapetwoonslideoneintheactivepresentationandthendisplaysmessageboxesshowingthestringbeforeandafterit'strimmed.

WithApplication.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange

With.InsertBefore("Texttotrim")

MsgBox"Untrimmed:"&""""&.Text&""""

MsgBox"Trimmed:"&""""&.TrimText.Text&""""

EndWith

EndWith

Page 914: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 915: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TwoColorGradientMethodSetsthespecifiedfilltoatwo-colorgradient.

expression.TwoColorGradient(Style,Variant)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

StyleRequiredMsoGradientStyle.Thegradientstyle.

MsoGradientStylecanbeoneoftheseMsoGradientStyleconstants.msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVertical

VariantRequiredLong.Thegradientvariant.Canbeavaluefrom1to4,correspondingtothefourvariantsontheGradienttabintheFillEffectsdialogbox.IfStyleismsoGradientFromTitleormsoGradientFromCenter,thisargumentcanbeeither1or2.

Page 916: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsarectanglewithatwo-colorgradientfilltomyDocument,andsetsthebackgroundandforegroundcolorforthefill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(Type:=msoShapeRectangle,Left:=0,_

Top:=0,Width:=40,Height:=80).Fill

.ForeColor.RGB=RGB(Red:=128,Green:=0,Blue:=0)

.BackColor.RGB=RGB(Red:=0,Green:=170,Blue:=170)

.TwoColorGradientStyle:=msoGradientHorizontal,Variant:=1

EndWith

Page 917: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UngroupMethodUngroupsanygroupedshapesinthespecifiedshapeorrangeofshapes.DisassemblespicturesandOLEobjectswithinthespecifiedshapeorrangeofshapes.ReturnstheungroupedshapesasasingleShapeRangeobject.

expression.Ungroup

expressionRequired.AnexpressionthatreturnsaShapeRangeobject.

Page 918: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Becauseagroupofshapesistreatedasasingleobject,groupingandungroupingshapeschangesthenumberofitemsintheShapescollectionandchangestheindexnumbersofitemsthatcomeaftertheaffecteditemsinthecollection.

Page 919: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleungroupsanygroupedshapesanddisassemblesanypicturesorOLEobjectsonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

s.Ungroup

Next

ThisexampleungroupsanygroupedshapesonmyDocumentwithoutdisassemblingpicturesorOLEobjectsontheslide.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.Type=msoGroupThens.Ungroup

Next

Page 920: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UnselectMethodCancelsthecurrentselection.

expression.Unselect

expressionRequired.AnexpressionthatreturnsaSelectionobject.

Page 921: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecancelsthecurrentselectioninwindowone.

Windows(1).Selection.Unselect

Page 922: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UpdateMethodUpdatesthespecifiedlinkedOLEobject.Toupdateallthelinksinapresentationatonce,usetheUpdateLinksmethod.

expression.Update

expressionRequired.AnexpressionthatreturnsaLinkFormatobject.

Page 923: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleupdatesalllinkedOLEobjectsintheactivepresentation.

ForEachsldInActivePresentation.Slides

ForEachshInsld.Shapes

Ifsh.Type=msoLinkedOLEObjectThen

sh.LinkFormat.Update

EndIf

Next

Next

Page 924: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UpdateLinksMethodUpdateslinkedOLEobjectsinthespecifiedpresentation.

expression.UpdateLinks

expressionRequired.AnexpressionthatreturnsaPresentationobject.

Page 925: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleupdatesallOLElinksintheactivepresentation.

ActivePresentation.UpdateLinks

Page 926: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UseDefaultFolderSuffixMethodSetsthefoldersuffixforthespecifiedpresentationtothedefaultsuffixforthelanguagesupportyouhaveselectedorinstalled.

expression.UseDefaultFolderSuffix

expressionAnexpressionthatreturnsaWebOptionsobject.

Page 927: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

MicrosoftPowerPointusesthefoldersuffixwhenyousaveorpublishacompleteorpartialpresentationasaWebpage,uselongfilenames,andchoosetosavesupportingfilesinaseparatefolder(thatis,iftheUseLongFileNamesandOrganizeInFolderpropertiesaresettoTrue).

Thesuffixappearsinthefoldernameafterthepresentationname.Forexample,ifthepresentationiscalled"Pres1"andthelanguageisEnglish,thefoldernameisPres1_files.ThefoldersuffixesforeachlanguagearelistedintheFolderSuffixpropertytopic.

Page 928: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefoldersuffixfortheactivepresentationtothedefaultsuffix.

ActivePresentation.WebOptions.UseDefaultFolderSuffix

Page 929: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UserPictureMethodFillsthespecifiedshapewithonelargeimage.Ifyouwanttofilltheshapewithsmalltilesofanimage,usetheUserTexturedmethod.

expression.UserPicture(PictureFile)

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

PictureFileRequiredString.Thenameofthepicturefile.

Page 930: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstworectanglestomyDocument.TherectangleontheleftisfilledwithonelargeimageofthepictureinTiles.bmp;therectangleontherightisfilledwithmanysmalltilesofthepictureinTiles.bmp

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShape(msoShapeRectangle,0,0,200,100).Fill_

.UserPicture"c:\windows\tiles.bmp"

.AddShape(msoShapeRectangle,300,0,200,100).Fill_

.UserTextured"c:\windows\tiles.bmp"

EndWith

Page 931: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UserTexturedMethodFillsthespecifiedshapewithsmalltilesofanimage.Ifyouwanttofilltheshapewithonelargeimage,usetheUserPicturemethod.

expression.UserTextured(TextureFile)

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

TextureFileRequiredString.Thenameofthepicturefile.

Page 932: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstworectanglestomyDocument.TherectangleontheleftisfilledwithonelargeimageofthepictureinTiles.bmp;therectangleontherightisfilledwithmanysmalltilesofthepictureinTiles.bmp

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShape(msoShapeRectangle,0,0,200,100).Fill_

.UserPicture"c:\windows\tiles.bmp"

.AddShape(msoShapeRectangle,300,0,200,100).Fill_

.UserTextured"c:\windows\tiles.bmp"

EndWith

Page 933: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ValueMethodReturnsthevalueofthespecifiedtagasaString.

expression.Value(Index)

expressionRequired.AnexpressionthatreturnsaTagscollection.

IndexRequiredLong.Thetagnumber.

Page 934: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthenameandvalueforeachtagassociatedwithslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Tags

Fori=1To.Count

MsgBox"Tag#"&i&":Name="&.Name(i)

MsgBox"Tag#"&i&":Value="&.Value(i)

Next

EndWith

Thisexamplesearchesthroughthetagsforeachslideintheactivepresentation.Ifthere'satagnamed"PRIORITY,"amessageboxdisplaysthetagvalue.Ifthereisn'tatagnamed"PRIORITY,"theexampleaddsthistagwiththevalue"Unknown."

ForEachsInApplication.ActivePresentation.Slides

Withs.Tags

found=False

Fori=1To.Count

If.Name(i)="PRIORITY"Then

found=True

slNum=.Parent.SlideIndex

MsgBox"Slide"&slNum&"priority:"&.Value(i)

EndIf

Next

IfNotfoundThen

slNum=.Parent.SlideIndex

.Add"Name","NewFigures"

.Add"Priority","Unknown"

MsgBox"Slide"&slNum&_

"prioritytagadded:Unknown"

EndIf

EndWith

Next

Page 935: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 936: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WebPagePreviewMethodShowsapreviewofthepresentationintheactiveWebbrowser.

expression.WebPagePreview

expressionRequired.AnexpressionthatreturnsaPresentationobject.

Page 937: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepreviewspresentationtwoasaWebpage.

Presentations(2).WebPagePreview

Page 938: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WordsMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextwords.Forinformationaboutcountingorloopingthroughthewordsinatextrange,seetheTextRangeobject.

expression.Words(Start,Length)

expressionRequired.AnexpressionthatreturnsaTextRangeobject.

StartOptionalLong.Thefirstwordinthereturnedrange.

LengthOptionalLong.Thenumberofwordstobereturned.

Page 939: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstwordandendswiththelastparagraphinthespecifiedrange.

IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsoneword.

IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstwordinthespecifiedrange.

IfStartisgreaterthanthenumberofwordsinthespecifiedtext,thereturnedrangestartswiththelastwordinthespecifiedrange.

IfLengthisgreaterthanthenumberofwordsfromthespecifiedstartingwordtotheendofthetext,thereturnedrangecontainsallthosewords.

Page 940: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleformatsasboldthesecond,third,andfourthwordsinthefirstparagraphinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange.Paragraphs(1).Words(2,3).Font_

.Bold=True

Page 941: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 942: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ZOrderMethodMovesthespecifiedshapeinfrontoforbehindothershapesinthecollection(thatis,changestheshape'spositioninthez-order).

expression.ZOrder(ZOrderCmd)

expressionRequired.AnexpressionthatreturnsaShapeobject.

ZOrderCmdRequiredMsoZOrderCmd.Specifieswheretomovethespecifiedshaperelativetotheothershapes.

MsoZOrderCmdcanbeoneoftheseMsoZOrderCmdconstants.msoBringForwardmsoBringInFrontOfTextForuseinMicrosoftWordonly.msoBringToFrontmsoSendBackwardmsoSendBehindTextForuseinMicrosoftWordonly.msoSendToBack

Page 943: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheZOrderPositionpropertytodetermineashape'scurrentpositioninthez-order.

Page 944: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsanovaltomyDocumentandthenplacestheovalsecondfromthebackinthez-orderifthereisatleastoneothershapeontheslide.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeOval,100,100,100,300)

While.ZOrderPosition>2

.ZOrdermsoSendBackward

Wend

EndWith

Page 945: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AcceleratePropertyReturnsorsetsaSinglethatrepresentsthepercentofthedurationoverwhichatimingaccelerationshouldtakeplace.Forexample,avalueof0.9meansthatanaccelerationshouldstartslowerthanthedefaultspeedfor90%ofthetotalanimationtime,withthelast10%oftheanimationatthedefaultspeed.Read/write.

expression.Accelerate

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 946: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Toslowdownananimationattheend,usetheDecelerateproperty.

Page 947: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsashapeandaddsananimation,startingoutslowandmatchingthedefaultspeedafter30%oftheanimationsequence.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsrectangleandspecifieseffecttouseforrectangle

SetshpRectangle=ActivePresentation.Slides(1)_

.Shapes.AddShape(Type:=msoShapeRectangle,_

Left:=100,Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1)_

.TimeLine.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectPathDiamond)

'Specifiestheaccelerationfortheeffect

WitheffDiamond.Timing

.Accelerate=0.3

EndWith

EndSub

Page 948: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 949: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AcceleratorsEnabledPropertyDetermineswhethershortcutkeyareenabledduringaslideshow.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.(Ifshortcutkeysaredisabledduringaslideshow,youcanneitherusekeystonavigateintheslideshownorpressF1togetalistofshortcutkeys.YoucanstillusetheESCkeytoexittheslideshow.)msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.Shortcutkeysareenabledduringaslideshow.

expression.AcceleratorsEnabled

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 950: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowoftheactivepresentationwithshortcutkeysdisabled.

ActivePresentation.SlideShowSettings.Run_

.View.AcceleratorsEnabled=False

Page 951: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 952: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AccentPropertyDetermineswhetheraverticalaccentbarseparatesthecallouttextfromthecalloutline.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueAverticalaccentbarseparatesthecallouttextfromthecalloutline.

expression.Accent

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 953: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstomyDocumentanovalandacalloutthatpointstotheoval.Thecallouttextwon'thaveaborder,butitwillhaveaverticalaccentbarthatseparatesthetextfromthecalloutline.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShapemsoShapeOval,180,200,280,130

With.AddCallout(msoCalloutTwo,420,170,170,40)

.TextFrame.TextRange.Text="Myoval"

With.Callout

.Accent=msoTrue

.Border=msoFalse

EndWith

EndWith

EndWith

Page 954: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 955: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AccumulatePropertySetsorreturnsanMsoAnimAccumulateconstantthatrepresentswhetheranimationbehaviorsaccumulate.Read/write.

MsoAnimAccumulatecanbeoneoftheseMsoAnimAccumulateconstants.msoAnimAccumulateAlwaysRepetitionsstartwiththecurrentvalue.msoAnimAccumulateNoneDefault.

expression.Accumulate

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 956: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsethispropertyinconjunctionwiththeAdditivepropertytocombineanimationeffects.

Page 957: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleallowsaspecifiedanimationbehaviortoaccumulatewithotheranimationbehaviors.

SubSetAccumulate()

DimanimBehaviorAsAnimationBehavior

SetanimBehavior=ActiveWindow.Selection.SlideRange(1).TimeLine._

MainSequence(1).Behaviors(1)

animBehavior.Accumulate=msoAnimAccumulateAlways

EndSub

Page 958: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 959: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActionPropertyReturnsorsetsthetypeofactionthatwilloccurwhenthespecifiedshapeisclickedorthemousepointerispositionedovertheshapeduringaslideshow.CanbeoneofthefollowingPpActionTypeconstants.Read/writeLong.

ppActionEndShowppActionFirstSlideppActionHyperlinkppActionLastSlideppActionLastSlideViewedppActionMixedppActionNamedSlideShowppActionNextSlideppActionNoneppActionOLEVerbppActionPlayppActionPreviousSlideppActionRunMacroppActionRunProgram

YoucanusetheActionpropertyinconjunctionwithotherpropertiesoftheActionSettingobject,asshowninthefollowingtable.

IfyousettheActionpropertytothis

value

Usethisproperty Todothis

ppActionHyperlink Hyperlink

Setpropertiesforthehyperlinkthatwillbefollowedinresponsetoamouseactionontheshapeduringaslideshow.Returnorsetthenameoftheprogramtoruninresponsetoa

Page 960: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppActionRunProgram Run mouseactionontheshapeduringaslideshow.

ppActionRunMacro Run

Returnorsetthenameofthemacrotoruninresponsetoamouseactionontheshapeduringaslideshow.

ppActionOLEVerb ActionVerb

SettheOLEverbthatwillbeinvokedinresponsetoamouseactionontheshapeduringaslideshow.

ppActionNamedSlideShow SlideShowName

Setthenameofthecustomslideshowthatwillruninresponsetoamouseactionontheshapeduringaslideshow.

Page 961: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsshapethree(anOLEobject)onslideoneintheactivepresentationtobeplayedwhenthemousepassesoveritduringaslideshow.

WithActivePresentation.Slides(1)_

.Shapes(3).ActionSettings(ppMouseOver)

.ActionVerb="Play"

.Action=ppActionOLEVerb

EndWith

Page 962: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActionSettingsPropertyReturnsanActionSettingsobjectthatcontainsinformationaboutwhatactionoccurswhentheuserclicksormovesthemouseoverthespecifiedshapeortextrangeduringaslideshow.Read-only.

Page 963: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetstheactionsforclickingandmovingthemouseovershapeoneonslidetwointheactivepresentation.

SetmyShape=ActivePresentation.Slides(2).Shapes(1)

myShape.ActionSettings(ppMouseClick).Action=ppActionLastSlide

myShape.ActionSettings(ppMouseOver).SoundEffect.Name="applause"

Page 964: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 965: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActionVerbPropertyActionVerbpropertyasitappliestothePlaySettingsobject.

ReturnsorsetsastringthatcontainstheOLEverbthatwillberunwhenthespecifiedOLEobjectisanimatedduringaslideshow.ThedefaultverbspecifiestheactionthattheOLEobjectruns—suchasplayingawavefileordisplayingdatasothattheusercanmodifyit—afterthepreviousanimationorslidetransition.Read/writeString.

ActionVerbpropertyasitappliestotheActionSettingobject.

ReturnsorsetsastringthatcontainstheOLEverbthatwillberunwhentheuserclicksthespecifiedshapeorpassesthemousepointeroveritduringaslideshow.TheActionpropertymustbesettoppActionOLEVerbfirstforthispropertytoaffecttheslideshowaction.Read/writeString.

Page 966: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestothePlaySettingsobject.

Thisexamplespecifiesthatshapethreeonslideoneintheactivepresentationwillautomaticallyopenforeditingwhenit'sanimated.ShapethreemustbeanOLEobjectthatcontainsasoundormovieobjectandthatsupportsthe"Edit"verb.

SetOLEobj=ActivePresentation.Slides(1).Shapes(3)

WithOLEobj.AnimationSettings.PlaySettings

.PlayOnEntry=True

.ActionVerb="Edit"

EndWith

AsitappliestotheActionSettingobject.

Thisexamplesetsshapethreeonslideonetobeplayedwheneverthemousepointerpassesoveritduringaslideshow.ShapethreemustrepresentanOLEobjectthatsupportsthe"Play"verb.

WithActivePresentation.Slides(1).Shapes(3)_

.ActionSettings(ppMouseOver)

.ActionVerb="Play"

.Action=ppActionOLEVerb

EndWith

Page 967: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 968: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActivePropertyReturnswhetherthespecifiedpaneorwindowisactive.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedpaneorwindowisactive.

expression.Active

expressionRequired.AnexpressionthatreturnsoftheobjectsintheAppliesTolist.

Page 969: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecheckstoseeifthepresentationfile"test.ppt"isintheactivewindow.Ifnot,itsavesthenameofthepresentationthatiscurrentlyactiveinthevariableoldWinandactivatesthe"test.ppt"presentation.

WithApplication.Presentations("test.ppt").Windows(1)

IfNot.ActiveThen

SetoldWin=Application.ActiveWindow

.Activate

EndIf

EndWith

Page 970: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActivePanePropertyReturnsaPaneobjectthatrepresentstheactivepaneinthedocumentwindow.Read-only.

Page 971: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Iftheactivepaneistheslidepane,thisexamplemakesthenotespanetheactivepane.ThenotespaneisthethirdmemberofthePanescollection.

WithActiveWindow

If.ActivePane.ViewType=ppViewSlideThen

.Panes(3).Activate

EndIf

EndWith

Page 972: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActivePresentationPropertyReturnsaPresentationobjectthatrepresentsthepresentationopenintheactivewindow.Read-only.

Notethatifanembeddedpresentationisin-placeactive,theActivePresentationpropertyreturnstheembeddedpresentation.

Page 973: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesavestheloadedpresentationtotheapplicationfolderinafilenamed"TestFile."

MyPath=Application.Path&"\TestFile"

Application.ActivePresentation.SaveAsMyPath

Page 974: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActivePrinterPropertyReturnsthenameoftheactiveprinter.Read-onlyString.

Page 975: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthenameoftheactiveprinter.

MsgBox"Thenameoftheactiveprinteris"_

&Application.ActivePrinter

Page 976: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ActiveWindowPropertyReturnsaDocumentWindowobjectthatrepresentstheactivedocumentwindow.Read-only.

Page 977: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleminimizestheactivewindow.

Application.ActiveWindow.WindowState=ppWindowMinimized

Page 978: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 979: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddInsPropertyReturnstheprogram-specificAddInscollectionthatrepresentsalltheadd-inslistedintheAdd-Insdialogbox(Toolsmenu).Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 980: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

MicrosoftPowerPoint-specificadd-insareidentifiedbya.ppafilenameextension.ComponentObjectModel(COM)add-inscanbeuseduniversallyacrossMicrosoftprogrammingproductsandhavea.dllor.exefilenameextension.

Page 981: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstheadd-innamed"Myaddin.ppa"tothelistintheAdd-Insdialogboxandloadstheadd-inautomatically.

SetmyAddIn=Application.AddIns.Add(FileName:="c:\myaddin.ppa")

myAddIn.Loaded=True

MsgBoxmyAddIn.Name&"hasbeenaddedtothelist"

Page 982: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 983: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AdditivePropertySetsorreturnsanMsoAnimAdditiveconstantthatrepresentswhetherthecurrentanimationbehavioriscombinedwithotherrunninganimations.Read/write.

MsoAnimAdditivecanbeoneoftheseMsoAnimAdditiveconstants.msoAnimAdditiveAddBaseDoesnotcombinecurrentanimationwithotheranimations.Default.msoAnimAdditiveAddSumCombinesthecurrentanimationwithotherrunninganimations.

expression.Additive

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 984: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Combininganimationbehaviorsparticularlyusefulforrotationeffects.Forexample,ifthecurrentanimationchangesrotationandanotheranimationisalsochangingrotation,thenifthispropertyissettomsoAnimAdditiveAddSum,MicrosoftPowerPointwilladdtogethertherotationsfromboththeanimations.

Page 985: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleallowsthecurrentanimationbehaviortobeaddedtoanotheranimationbehavior.

SubSetAdditive()

DimanimBehaviorAsAnimationBehavior

SetanimBehavior=ActiveWindow.Selection.SlideRange(1)_

.TimeLine.MainSequence(1).Behaviors(1)

animBehavior.Additive=msoAnimAdditiveAddSum

EndSub

Page 986: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddressPropertyReturnsorsetstheInternetaddress(URL)tothetargetdocument.Read/writeString.

Page 987: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplescansallshapesonthefirstslidefortheURLtotheMicrosoftWebsite.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Hyperlinks

Ifs.Address="http://www.microsoft.com/"Then

MsgBox"YouhavealinktotheMicrosoftHomePage"

EndIf

Next

Page 988: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AdjustmentsPropertyReturnsanAdjustmentsobjectthatcontainsadjustmentvaluesforalltheadjustmentsinthespecifiedshape.AppliestoanyShapeorShapeRangeobjectthatrepresentsanAutoShape,WordArt,oraconnector.Read-only.

Page 989: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsto0.25thevalueofadjustmentoneforshapethreeonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).Adjustments(1)=0.25

Page 990: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 991: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AdvanceModePropertyAdvanceModepropertyasitappliestotheAnimationSettingsobject.

Returnsorsetsavaluethatindicateswhetherthespecifiedshapeanimationadvancesonlywhenclickedorautomaticallyafteraspecifiedamountoftime.Read/writePpAdvanceMode.Ifyourshapedoesn'tbecomeanimated,makesurethattheTextLevelEffectpropertyissettoavalueotherthanppAnimateLevelNoneandthattheAnimatepropertyissettoTrue.

PpAdvanceModecanbeoneofthesePpAdvanceModeconstants.ppAdvanceModeMixedppAdvanceOnClickppAdvanceOnTime

expression.AdvanceMode

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

AdvanceModepropertyasitappliestotheSlideShowSettingsobject.

Returnsorsetsavaluethatindicateshowtheslideshowadvances.Read/writePpSlideShowAdvanceMode.

PpSlideShowAdvanceModecanbeoneofthesePpSlideShowAdvanceModeconstants.ppSlideShowManualAdvanceppSlideShowRehearseNewTimingsppSlideShowUseSlideTimings

expression.AdvanceMode

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

AdvanceModepropertyasitappliestotheSlideShowViewobject.

Page 992: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Returnsavaluethatindicateshowtheslideshowinthespecifiedviewadvances.Read-onlyPpSlideShowAdvanceMode.

PpSlideShowAdvanceModecanbeoneofthesePpSlideShowAdvanceModeconstants.ppSlideShowManualAdvanceppSlideShowRehearseNewTimingsppSlideShowUseSlideTimings

expression.AdvanceMode

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 993: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheAnimationSettingsobject.

Thisexamplesetsshapetwoonslideoneintheactivepresentationtobecomeanimatedautomaticallyafterfiveseconds.

WithActivePresentation.Slides(1).Shapes(2).AnimationSettings

.AdvanceMode=ppAdvanceOnTime

.AdvanceTime=5

.TextLevelEffect=ppAnimateByAllLevels

.Animate=True

EndWith

Page 994: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 995: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AdvanceOnClickPropertyDetermineswhetherthespecifiedslideadvanceswhenit'sclickedduringaslideshow.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideadvanceswhenit'sclickedduringaslideshow.

expression.AdvanceOnClick

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 996: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Tosettheslidetoadvanceautomaticallyafteracertainamountoftimeelapses,settheAdvanceOnTimepropertytoTrueandsettheAdvanceTimepropertytotheamountoftimeyouwanttheslidetobeshown.IfyousetboththeAdvanceOnClickandtheAdvanceOnTimepropertiestoTrue,theslidewilladvanceeitherwhenit'sclickedorwhenthespecifiedamountoftimehaselapsed—whichevercomesfirst.

Page 997: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsslideoneintheactivepresentationtoadvanceafterfivesecondshavepassedorwhenthemouseisclicked—whicheveroccursfirst.

WithActivePresentation.Slides(1).SlideShowTransition

.AdvanceOnClick=msoTrue

.AdvanceOnTime=msoTrue

.AdvanceTime=5

EndWith

Page 998: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 999: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AdvanceOnTimePropertyDetermineswhetherthespecifiedslideadvancesautomaticallyafteraspecifiedamountoftimehaselapsed.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideadvancesautomaticallyafteraspecifiedamountoftimehaselapsed.

expression.AdvanceOnTime

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1000: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheAdvanceTimepropertytospecifythenumberofsecondsafterwhichtheslidewillautomaticallyadvance.SettheAdvanceModepropertyoftheSlideShowSettingsobjecttoppSlideShowUseSlideTimingstoputtheslideintervalsettingsintoeffectfortheentireslideshow.

Page 1001: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsslideoneintheactivepresentationtoadvanceafterfivesecondshavepassedorwhenthemouseisclicked—whicheveroccursfirst.

WithActivePresentation.Slides(1).SlideShowTransition

.AdvanceOnClick=msoTrue

.AdvanceOnTime=msoTrue

.AdvanceTime=5

EndWith

Page 1002: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1003: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AdvanceTimePropertyAsitappliestotheAnimationSettingsobject.

Returnsorsetstheamountoftime,inseconds,afterwhichthespecifiedshapewillbecomeanimated.Read/writeSingle.

AsitappliestotheSlideShowTransitionobject.

Returnsorsetstheamountoftime,inseconds,afterwhichthespecifiedslidetransitionwilloccur.Read/writeSingle.

Page 1004: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thespecifiedslideanimationwon'tstartautomaticallyaftertheamountoftimeyou'vespecifiedunlesstheAdvanceModepropertyoftheanimationissettoppAdvanceOnTime.Thespecifiedslidetransitionwon'tadvanceautomaticallyunlesstheAdvanceModepropertyoftheslideshowsettingsissettoppSlideShowUseSlideTimings.

Page 1005: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheAnimationSettingsobject.

Thisexamplesetsshapetwoonslideoneintheactivepresentationtobecomeanimatedautomaticallyafterfiveseconds.

WithActivePresentation.Slides(1).Shapes(2).AnimationSettings

.AdvanceMode=ppAdvanceOnTime

.AdvanceTime=5

.TextLevelEffect=ppAnimateByAllLevels

.Animate=True

EndWith

Page 1006: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1007: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AfterEffectPropertyAfterEffectpropertyasitappliestotheEffectInformationobject.

ReturnsanMsoAnimAfterEffectconstantthatindicateswhetheranaftereffectisdimmed,hidden,orunchangedafteritruns.Read-only.

MsoAnimAfterEffectcanbeoneoftheseMsoAnimAfterEffectconstants.msoAnimAfterEffectDimmsoAnimAfterEffectHidemsoAnimAfterEffectHideOnNextClickmsoAnimAfterEffectMixedmsoAnimAfterEffectNone

expression.AfterEffect

expressionRequired.AnexpressionthatanEffectInformationobject.

AfterEffectpropertyasitappliestotheAnimationSettingsobject.

ReturnsorsetsaPpAfterEffectconstantthatindicateswhetherthespecifiedshapeappearsdimmed,hidden,orunchangedafterit'sbeenbuilt.Read/write.

PpAfterEffectcanbeoneofthesePpAfterEffectconstants.ppAfterEffectDimppAfterEffectHideppAfterEffectHideOnClickppAfterEffectMixedppAfterEffectNothing

expression.AfterEffect

expressionRequired.AnexpressionthatreturnsanAnimationSettingsobject.

Page 1008: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youwon'tseetheaftereffectyousetforashapeunlesstheshapegetsanimatedandatleastoneothershapeontheslidegetsanimatedafterit.Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNone,ortheEntryEffectpropertymustbesettoaconstantotherthanppEffectNone.Inaddition,theAnimatepropertymustbesettoTrue.Tochangethebuildorderoftheshapesonaslide,usetheAnimationOrderproperty.

Page 1009: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatthetitleonslideoneintheactivepresentationistoappeardimmedafterthetitleisbuilt.Ifthetitleisthelastoronlyshapetobebuiltonslideone,thetextwon'tbedimmed.

WithActivePresentation.Slides(1).Shapes.Title.AnimationSettings

.Animate=True

.TextLevelEffect=ppAnimateByAllLevels

.AfterEffect=ppAfterEffectDim

EndWith

Page 1010: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1011: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AlignmentPropertyAlignmentpropertyasitappliestotheTextEffectFormatobject.

ReturnsorsetsthealignmentforthespecifiedWordArt.Read/writeMsoTextEffectAlignment.

MsoTextEffectAlignmentcanbeoneoftheseMsoTextEffectAlignmentconstants.msoTextEffectAlignmentCenteredmsoTextEffectAlignmentLeftmsoTextEffectAlignmentMixedmsoTextEffectAlignmentRightmsoTextEffectAlignmentStretchJustifymsoTextEffectAlignmentWordJustifymsoTextEffectAlignmentLetterJustify

expression.Alignment

expressionRequired.AnexpressionthatreturnsaTextEffectFormatobject.

AlignmentpropertyasitappliestotheParagraphFormatobject.

Returnsorsetsthealignmentforeachparagraphinthespecifiedparagraphformat.Read/writePpParagraphAlignment.

PpParagraphAlignmentcanbeoneofthesePpParagraphAlignmentconstants.ppAlignCenterppAlignDistributeppAlignJustifyppAlignJustifyLowppAlignLeftppAlignmentMixedppAlignRight

Page 1012: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppAlignThaiDistribute

expression.Alignment

expressionRequired.AnexpressionthatreturnsaParagraphFormatobject.

Page 1013: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheTextEffectFormatobject.

ThisexampleaddsaWordArtobjecttoslideoneintheactivepresentationandthenrightalignstheWordArt.

SetmySh=Application.ActivePresentation.Slides(1).Shapes

SetmyTE=mySh.AddTextEffect(PresetTextEffect:=msoTextEffect1,_

Text:="TestText",FontName:="Palatino",FontSize:=54,_

FontBold:=True,FontItalic:=False,Left:=100,Top:=50)

myTE.TextEffect.Alignment=msoTextEffectAlignmentRight

AsitappliestotheParagraphFormatobject.

Thisexampleleftalignstheparagraphsinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange.ParagraphFormat.Alignment=ppAlignLeft

Page 1014: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1015: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AllowPNGPropertyDetermineswhetherPNG(PortableNetworkGraphics)isallowedasanoutputformatwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.PNGisnotallowedasanoutputformatwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.msoTriStateMixedmsoTriStateTogglemsoTruePNGisallowedasanimageformatwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.

expression.AllowPNG

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1016: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfyousaveimagesinthePNGformatasopposedtoanyotherfileformat,youmightimprovetheimagequalityorreducethesizeofthoseimagefiles,andthereforedecreasethedownloadtime,assumingthattheWebbrowsersyouaretargetingsupportthePNGformat.

Page 1017: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleenablesPNGasanoutputformatfortheactivepresentation.

ActivePresentation.WebOptions.AllowPNG=msoTrue

Alternatively,PNGcanbeenabledastheglobaldefaultfortheapplicationfornewlycreatedpresentations.

Application.DefaultWebOptions.AllowPNG=msoTrue

Page 1018: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AlternativeTextPropertyReturnsorsetsthealternativetextassociatedwithashapeinaWebpresentation.Read/writeString.

Page 1019: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetsthealternativetextfortheselectedshapeintheactivewindow.Theselectedshapeisapictureofamallardduck.

ActiveWindow.Selection.ShapeRange_

.AlternativeText="Thisisamallardduck."

Page 1020: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1021: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AlwaysSaveInDefaultEncodingPropertyDetermineswhetherthedefaultencodingisusedwhenyousaveaWebpageorplaintextdocument,independentofthefile'soriginalencodingwhenopened.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.TheoriginalencodingofthefileisusedwhenyousaveaWebpageorplaintextdocument,independentofthefile'soriginalencodingwhenopened.msoTriStateMixedmsoTriStateTogglemsoTrueThedefaultencodingisusedwhenyousaveaWebpageorplaintextdocument,independentofthefile'soriginalencodingwhenopened.

expression.AlwaysSaveInDefaultEncoding

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1022: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheEncodingpropertycanbeusedtosetthedefaultencoding.

Page 1023: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheencodingtothedefaultencoding.TheencodingisusedwhenyousavethedocumentasaWebpage.

Application.DefaultWebOptions.AlwaysSaveInDefaultEncoding=msoTrue

Page 1024: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AmountPropertyReturnsorsetsaSinglethatrepresentsthenumberofdegreesananimatedshapeisrotatedaroundthez-axis.Apositivevalueindicatesclockwiserotation;anegativevalueindicatescounterclockwiserotation.Read/write.

expression.Amount

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1025: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashape,anda90-degreespinanimationtotheshape.

SubSetAnimEffect()

DimeffSpinAsEffect

DimshpCubeAsShape

SetshpCube=ActivePresentation.Slides(1).Shapes.AddShape_

(Type:=msoShapeCube,Left:=100,Top:=100,_

Width:=50,Height:=50)

SeteffSpin=ActivePresentation.Slides(1).TimeLine_

.MainSequence.AddEffect(Shape:=shpCube,_

effectId:=msoAnimEffectSpin)

effSpin.Timing.Duration=3

effSpin.EffectParameters.Amount=-90

EndSub

Page 1026: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1027: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnglePropertyReturnsorsetstheangleofthecalloutline.Ifthecalloutlinecontainsmorethanonelinesegment,thispropertyreturnsorsetstheangleofthesegmentthatisfarthestfromthecallouttextbox.Read/writeMsoCalloutAngleType.

MsoCalloutAngleTypecanbeoneoftheseMsoCalloutAngleTypeconstants.msoCalloutAngle30msoCalloutAngle45msoCalloutAngle60msoCalloutAngle90msoCalloutAngleAutomaticCalloutlinemaintainsafixedangleasyoudragthecallout.msoCalloutAngleMixed

expression.Angle

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1028: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsto90degreesthecalloutangleforacalloutnamed"co1"onmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes("co1").Callout.Angle=msoCalloutAngle90

Page 1029: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1030: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimatePropertyDetermineswhetherthespecifiedshapeisanimatedduringaslideshow.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisanimatedduringaslideshow.

expression.Animate

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1031: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNone,andeithertheAnimatepropertymustbesettoTrue,ortheEntryEffectpropertymustbesettoaconstantotherthanppEffectNone.

Page 1032: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatthetitleonslidetwointheactivepresentationappeardimmedafterthetitleisbuilt.Ifthetitleisthelastoronlyshapetobebuiltonslidetwo,thetextwon'tbedimmed.

WithActivePresentation.Slides(2).Shapes.Title.AnimationSettings

.TextLevelEffect=ppAnimateByAllLevels

.AfterEffect=ppAfterEffectDim

.Animate=msoTrue

EndWith

Page 1033: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1034: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimateActionPropertyMsoTrueifthecolorofthespecifiedshapeismomentarilyinvertedwhenthespecifiedmouseactionoccurs.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.AnimateAction

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1035: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsshapethreeonslideoneintheactivepresentationtoplaythesoundofapplauseandtomomentarilyinvertitscolorwhenit'sclickedduringaslideshow.

WithActivePresentation.Slides(1)_

.Shapes(3).ActionSettings(ppMouseClick)

.SoundEffect.Name="applause"

.AnimateAction=msoTrue

EndWith

Page 1036: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1037: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimateBackgroundPropertyAnimateBackgroundpropertyasitappliestotheAnimationSettings

object.

IfthespecifiedobjectisanAutoShape,msoTrueiftheshapeisanimatedseparatelyfromthetextitcontains.Ifthespecifiedshapeisagraphobject,msoTrueifthebackground(theaxesandgridlines)ofthespecifiedgraphobjectisanimated.AppliesonlytoAutoShapeswithtextthatcanbebuiltinmorethanonesteportographobjects.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.AnimateBackground

expressionRequired.AnexpressionthatreturnsanAnimationSettingsobject.

AnimateBackgroundpropertyasitappliestotheEffectInformationobject.

ReturnsMsoTrueifthespecifiedeffectisabackgroundanimation.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

Page 1038: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expression.AnimateBackground

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1039: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheTextLevelEffectandTextUnitEffectpropertiestocontroltheanimationoftextattachedtothespecifiedshape.

IfthispropertyissettoMsoTrueandtheTextLevelEffectpropertyissettoppAnimateByAllLevels,theshapeanditstextwillbeanimatedsimultaneously.IfthispropertyissettoMsoTrueandtheTextLevelEffectpropertyissettoanythingotherthanppAnimateByAllLevels,theshapewillbeanimatedimmediatelybeforethetextisanimated.

Youwon'tseeeffectsofsettingthispropertyunlessthespecifiedshapeisanimated.Forashapetobeanimated,theTextLevelEffectpropertyfortheshapemustbesettosomethingotherthanppAnimateLevelNone,andeithertheAnimatepropertymustbesettoMsoTrue,ortheEntryEffectpropertymustbesettoaconstantotherthanppEffectNone.

Page 1040: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheAnimationSettingsobject.

Thisexamplecreatesarectanglethatcontainstext.Theexamplethenspecifiesthattheshapeshouldflyinfromthelowerright,thatthetextshouldbebuiltfromfirst-levelparagraphs,andthattheshapeshouldbeanimatedseparatelyfromthetextitcontains.Inthisexample,theEntryEffectpropertyturnsonanimation.

SubAnimateTextBox()

WithActivePresentation.Slides(1).Shapes.AddShape_

(Type:=msoShapeRectangle,Left:=50,Top:=200,_

Width:=200,Height:=200)

.TextFrame.TextRange="Reason1"&Chr(13)&_

"Reason2"&Chr(13)&"Reason3"

With.AnimationSettings

.EntryEffect=ppEffectFlyFromBottomRight

.TextLevelEffect=ppAnimateByFirstLevel

.TextUnitEffect=ppAnimateByParagraph

.AnimateBackground=msoTrue

EndWith

EndWith

EndSub

AsitappliestotheEffectInformationobject.

Thisexamplechangesthedirectionoftheanimationifthebackgroundiscurrentlyanimated.

SubChangeAnimationDirection()

WithActivePresentation.Slides(1).TimeLine.MainSequence(1)

If.EffectInformation.AnimateBackground=msoTrueThen

.EffectParameters.Direction=msoAnimDirectionTopLeft

EndIf

EndWith

EndSub

Page 1041: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 1042: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1043: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimateTextInReversePropertyDetermineswhetherthespecifiedshapeisbuiltinreverseorder.Appliesonlytoshapes(suchasshapescontaininglists)thatcanbebuiltinmorethanonestep.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisbuiltinreverseorder.

expression.AnimateTextInReverse

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1044: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youwon'tseeeffectsofsettingthispropertyunlessthespecifiedshapegetsanimated.Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNoneandtheAnimatepropertymustbesettoTrue.

Page 1045: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaslideafterslideoneintheactivepresentation,setsthetitletext,addsathree-itemlisttothetextplaceholder,andsetsthelisttobebuiltinreverseorder.

WithActivePresentation.Slides.Add(2,ppLayoutText).Shapes

.Item(1).TextFrame.TextRange.Text="TopThreeReasons"

With.Item(2)

.TextFrame.TextRange="Reason1"&Chr(13)_

&"Reason2"&Chr(13)&"Reason3"

With.AnimationSettings

.Animate=msoTrue

.TextLevelEffect=ppAnimateByFirstLevel

.AnimateTextInReverse=msoTrue

EndWith

EndWith

EndWith

Page 1046: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimationOrderPropertyReturnsorsetsanintegerthatrepresentsthepositionofthespecifiedshapewithinthecollectionofshapestobeanimated.Read/writeLong.

Page 1047: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youwon'tseeeffectsofsettingthispropertyunlessthespecifiedshapegetsanimated.Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNoneandtheAnimatepropertymustbesettoTrue.

NoteSettingtheAnimationOrderpropertytoavaluethatislessthanthegreatestexistingAnimationOrderpropertyvaluecanshifttheanimationorder.

Page 1048: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatshapetwoonslidetwointheactivepresentationbeanimatedsecond.

ActivePresentation.Slides(2).Shapes(2)_

.AnimationSettings.AnimationOrder=2

Page 1049: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnimationSettingsPropertyReturnsanAnimationSettingsobjectthatrepresentsallthespecialeffectsyoucanapplytotheanimationofthespecifiedshape.

expression.AnimationSettings

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1050: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsshapeoneonslidetwointheactivepresentationtoflyinfromtheleftwhentheslideisbuilt.

WithActivePresentation.Slides(2).Shapes(1).AnimationSettings

.EntryEffect=ppEffectFlyFromLeft

.TextLevelEffect=ppAnimateByAllLevels

EndWith

Page 1051: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AnswerWizardPropertyReturnstheAnswerWizardobjectthatcontainsthefilesusedbytheonlineHelpsearchengine.Read-only.

Page 1052: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ApplicationPropertyReturnsanApplicationobjectthatrepresentsthecreatorofthespecifiedobject.

expression.Application

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1053: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Inthisexample,aPresentationobjectispassedtotheprocedure.TheprocedureaddsaslidetothepresentationandthensavesthepresentationinthefolderwhereMicrosoftPowerPointisrunning.

SubAddAndSave(pptPresAsPresentation)

pptPres.Slides.Add1,1

pptPres.SaveAspptPres.Application.Path&"\AddedSlide"

EndSub

ThisexampledisplaysthenameoftheapplicationthatcreatedeachlinkedOLEobjectonslideoneintheactivepresentation.

ForEachshpOleInActivePresentation.Slides(1).Shapes

IfshpOle.Type=msoLinkedOLEObjectThen

MsgBoxshpOle.OLEFormat.Application.Name

EndIf

Next

Page 1054: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AssistantPropertySomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

ReturnsanAssistantobjectthatrepresentstheOfficeAssistant.Read-only.

Page 1055: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaystheOfficeAssistant.

Application.Assistant.Visible=True

ThisexamplemovestheOfficeAssistanttotheupper-leftregionofthescreen.

Application.Assistant.MovexLeft:=100,yTop:=100

Page 1056: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AuthorPropertyReturnsaStringthatrepresentstheauthorasforaspecifiedCommentobject.Read-only.

expression.Author

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1057: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyonlyreturnstheauthor'sname.Toreturntheauthor'sinitials,usetheAuthorInitialsproperty.SpecifytheAuthorofacommentwhenyouaddanewcommenttothepresentation.

Page 1058: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsacommenttothefirstslideoftheactivepresentationandthendisplaystheauthor'snameandinitialsinamessage.

SubGetAuthorName()

WithActivePresentation.Slides(1)

.Comments.AddLeft:=100,Top:=100,Author:="JeffSmith",_

AuthorInitials:="JS",_

Text:="Thisisanewcommentaddedtothefirstslide."

MsgBox"Thiscommentwascreatedby"&_

.Comments(1).Author&"("&.Comments(1).AuthorInitials&")."

EndWith

EndSub

Page 1059: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AuthorIndexPropertyReturnsaLongrepresentingtheindexnumberofacommentforagivenauthor.Thefirstcommentforagivenauthorhasanindexnumberof1,theirsecondcommenthasanindexnumberof2,andsoon.Read-only.

expression.AuthorIndex

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1060: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleprovideinformationabouttheauthorsandtheircommentindexesforagivenslide.

SubGetCommentAuthorInfo()

DimcmtCommentAsComment

DimstrAuthorInfoAsString

WithActivePresentation.Slides(1)

If.Comments.Count>0Then

ForEachcmtCommentIn.Comments

strAuthorInfo=strAuthorInfo&"CommentNumber:"&_

cmtComment.AuthorIndex&vbLf&_

"Madeby:"&cmtComment.Author&vbLf&_

"Says:"&cmtComment.Text&vbLf&vbLf

NextcmtComment

EndIf

EndWith

MsgBox"Thecommentsforthisslideareasfollows:"&_

vbLf&vbLf&strAuthorInfo

EndSub

Page 1061: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AuthorInitialsPropertyReturnstheauthor'sinitialsasaread-onlyStringforaspecifiedCommentobject.Read-only.

expression.AuthorInitials

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1062: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyonlyreturnstheauthor'sinitials.Toreturntheauthor'snameusetheAuthorproperty.Specifytheauthor'sinitialswhenyouaddanewcommenttothepresentation.

Page 1063: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplereturnstheauthor'sinitialsforaspecifiedcomment.

SubGetAuthorName()

WithActivePresentation.Slides(1)

.Comments.AddLeft:=100,Top:=100,Author:="JeffSmith",_

AuthorInitials:="JS",_

Text:="Thisisanewcommentaddedtothefirstslide."

MsgBox.Comments(1).Author&.Comments(1).AuthorInitials

EndWith

EndSub

Page 1064: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1065: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoAttachPropertyDetermineswhethertheplacewherethecalloutlineattachestothecallouttextboxchangesdependingonwhethertheoriginofthecalloutline(wherethecalloutpointsto)istotheleftorrightofthecallouttextbox.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheplacewherethecalloutlineattachestothecallouttextboxchangesdependingonwhethertheoriginofthecalloutline(wherethecalloutpointsto)istotheleftorrightofthecallouttextbox.

Page 1066: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

WhenthevalueofthispropertyismsoTrue,thedropvalue(theverticaldistancefromtheedgeofthecallouttextboxtotheplacewherethecalloutlineattaches)ismeasuredfromthetopofthetextboxwhenthetextboxistotherightoftheorigin,andit'smeasuredfromthebottomofthetextboxwhenthetextboxistotheleftoftheorigin.WhenthevalueofthispropertyismsoFalse,thedropvalueisalwaysmeasuredfromthetopofthetextbox,regardlessoftherelativepositionsofthetextboxandtheorigin.UsetheCustomDropmethodtosetthedropvalue,andusetheDroppropertytoreturnthedropvalue.

Settingthispropertyaffectsacalloutonlyifithasanexplicitlysetdropvalue—thatis,ifthevalueoftheDropTypepropertyismsoCalloutDropCustom.Bydefault,calloutshaveexplicitlysetdropvalueswhenthey'recreated.

Page 1067: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstwocalloutstothefirstslide.Oneofthecalloutsisautomaticallyattachedandtheotherisnot.Ifyouchangethecalloutlineoriginfortheautomaticallyattachedcallouttotherightoftheattachedtextbox,thepositionofthetextboxchanges.Thecalloutthatisnotautomaticallyattacheddoesnotdisplaythisbehavior.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

With.AddCallout(msoCalloutTwo,420,170,200,50)

.TextFrame.TextRange.Text="auto-attached"

.Callout.AutoAttach=msoTrue

EndWith

With.AddCallout(msoCalloutTwo,420,350,200,50)

.TextFrame.TextRange.Text="notauto-attached"

.Callout.AutoAttach=msoFalse

EndWith

EndWith

Page 1068: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoCorrectPropertyReturnsanAutoCorrectobjectthatrepresentstheAutoCorrectfunctionalityinMicrosoftPowerPoint.

expression.AutoCorrect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1069: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowingexampledisablesdisplayoftheAutoCorrectOptionsandAutoLayoutOptionsbuttons.

SubHideAutoCorrectOpButton()

WithApplication.AutoCorrect

.DisplayAutoCorrectOptions=msoFalse

.DisplayAutoLayoutOptions=msoFalse

EndWith

EndSub

Page 1070: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1071: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoFormatPropertySetsorreturnsanMsoTriStateconstantthatrepresentsadiagram'sautomaticformattingstate.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseAutomaticformattingisnotenabled.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueAutomaticformattingisenabled.

expression.AutoFormat

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1072: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesadiagram,andenablesautomaticformatting.

SubConvertPyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addspyramiddiagramandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreeadditionalnodes

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

'Automaticallyformatsthediagramnodesand

'convertspyramiddiagramtoradialdiagram

WithdgnNode.Diagram

.AutoFormat=msoTrue

.ConvertType:=msoDiagramRadial

EndWith

EndSub

Page 1073: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1074: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoLayoutPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetheradiagram'scomponentsareautomaticallylaidout.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseThediagram'scomponentsarenotautomaticallylaidout.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThediagram'scomponentsareautomaticallylaidout.

expression.AutoLayout

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1075: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsadiagramtoaslide,convertsittoaradialdiagram,andarrangesthediagram'snodesautomatically.

SubConvertPyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addspyramiddiagramandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreeadditionalnodes

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

'Automaticallyplacesthediagramnodesand

'convertspyramiddiagramtoradialdiagram

WithdgnNode.Diagram

.AutoLayout=msoTrue

.ConvertType:=msoDiagramRadial

EndWith

EndSub

Page 1076: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1077: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoLengthPropertyDetermineswhetherthefirstsegmentofthecalloutretainsthefixedlengthspecifiedbytheLengthproperty,orisscaledautomatically,wheneverthecalloutismoved.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).msoCTruemsoFalseThefirstsegmentofthecalloutretainsthefixedlengthspecifiedbytheLengthpropertywheneverthecalloutismoved.msoTriStateMixedmsoTriStateTogglemsoTrueThefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox)isscaledautomaticallywheneverthecalloutismoved.

Page 1078: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyisread-only.UsetheAutomaticLengthmethodtosetthispropertytomsoTrue,andusetheCustomLengthmethodtosetthispropertytomsoFalse.

Page 1079: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampletogglesbetweenanautomaticallyscalingfirstsegmentandonewithafixedlengthforthecalloutlineforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Callout

If.AutoLengthThen

.CustomLength50

Else

.AutomaticLength

EndIf

EndWith

Page 1080: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1081: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoLoadPropertyDetermineswhetherthespecifiedadd-inisautomaticallyloadedeachtimePowerPointisstarted.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedadd-inisautomaticallyloadedeachtimePowerPointisstarted.

Page 1082: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingthispropertytomsoTrueautomaticallysetstheRegisteredpropertytomsoTrue.

Page 1083: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthenameofeachadd-inthat'sautomaticallyloadedeachtimePowerPointisstarted.

ForEachmyAddInInAddIns

IfmyAddIn.AutoLoadThen

MsgBoxmyAddIn.Name

afound=True

EndIf

NextmyAddIn

Ifafound<>TrueThen

MsgBox"Noadd-inswereloadedautomatically."

EndIf

Thisexamplespecifiesthattheadd-innamed"MyTools"beloadedautomaticallyeachtimePowerPointisstarted.

Application.AddIns("mytools").AutoLoad=msoTrue

Page 1084: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1085: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutomationSecurityPropertyReturnsorsetsanMsoAutomationSecurityconstantthatrepresentsthesecuritymodeMicrosoftPowerPointuseswhenprogrammaticallyopeningfiles.ThispropertyisautomaticallysettomsoAutomationSecurityLowwhentheapplicationisstarted.Therefore,toavoidbreakingsolutionsthatrelyonthedefaultsetting,youshouldbecarefultoresetthispropertytomsoAutomationSecurityLowafterprogrammaticallyopeningafile.Also,thispropertyshouldbesetimmediatelybeforeandafteropeningafileprogrammaticallytoavoidmalicioussubversion.Read/write.

MsoAutomationSecuritycanbeoneoftheseMsoAutomationSecurityconstants.msoAutomationSecurityByUIUsesthesecuritysettingspecifiedintheSecuritydialogbox.msoAutomationSecurityForceDisableDisablesallmacrosinallfilesopenedprogrammaticallywithoutshowinganysecurityalerts.msoAutomationSecurityLowEnablesallmacros.Thisisthedefaultvaluewhentheapplicationisstarted.

expression.AutomationSecurity

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1086: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThevalueoftheDisplayAlertspropertywillnotapplytosecuritywarnings.Forexample,iftheusersetstheDisplayAlertspropertyequaltoFalseandtheAutomationSecuritypropertytomsoAutomationSecurityByUI,whiletheuserisonMediumsecuritylevel,thentherewillbesecuritywarningswhilethemacroisrunning.Thisallowsthemacrototrapfileopenerrors,whilestillshowingthesecuritywarningifthefileopensucceeds.

Page 1087: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecapturesthecurrentautomationsecuritysetting,changesthesettingtodisablemacros,displaystheOpendialogbox,andafteropeningtheselectedpresentation,setstheautomationsecuritybacktoitsoriginalsetting.

SubSecurity()

DimsecAutomationAsMsoAutomationSecurity

secAutomation=Application.AutomationSecurity

Application.AutomationSecurity=msoAutomationSecurityForceDisable

Application.FileDialog(msoFileDialogOpen).Show

Application.AutomationSecurity=secAutomation

EndSub

Page 1088: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1089: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoReversePropertySetsorreturnsanMsoTriStatethatrepresentswhetheraneffectshouldplayforwardandthenreverse,therebydoublingtheduration.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Theeffectdoesnotplayforwardandthenreverse.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueTheeffectplaysforwardandthenreverse.

expression.AutoReverse

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1090: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapeandananimationeffecttoit;thensetstheanimationtoreversedirectionafterfinishingforwardmovement.

SubSetEffectTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsrectangleandappliesdiamondeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes.AddShape_

(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine_

.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectPathDiamond)

'Setsthedurationofandreversestheeffect

WitheffDiamond.Timing

.Duration=5'Lengthofeffect.

.AutoReverse=msoTrue

EndWith

EndSub

Page 1091: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1092: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoRotateNumbersPropertyReturnsorsetslateralcompression.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseHalf-widthnumberswillnotbecompressedinlateralcolumns.msoTriStateMixedmsoTriStateTogglemsoTrueDisplayshalf-widthnumberswithinverticaltextintwo-characterlateralcolumns.

Page 1093: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetextdirectionofshapethreeonthefirstslidetoverticaltext,andsetslateralcolumncompression.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).TextFrame

.Orientation=msoTextOrientationVerticalFarEast

.TextRange.Font.AutoRotateNumbers=msoTrue

EndWith

Page 1094: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1095: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoShapeTypePropertyReturnsorsetstheshapetypeforthespecifiedShapeorShapeRangeobject,whichmustrepresentanAutoShapeotherthanaline,freeformdrawing,orconnector.Read/writeMsoAutoShapeType.

MsoAutoShapeTypecanbeoneoftheseMsoAutoShapeTypeconstants.msoShapeFlowchartConnectormsoShapeFlowchartDatamsoShapeFlowchartDecisionmsoShapeFlowchartDelaymsoShapeFlowchartDirectAccessStoragemsoShapeFlowchartDisplaymsoShapeFlowchartDocumentmsoShapeFlowchartExtractmsoShapeFlowchartInternalStoragemsoShapeFlowchartMagneticDiskmsoShapeFlowchartManualInputmsoShapeFlowchartManualOperationmsoShapeFlowchartMergemsoShapeFlowchartMultidocumentmsoShapeFlowchartOffpageConnectormsoShapeFlowchartOrmsoShapeFlowchartPredefinedProcessmsoShapeFlowchartPreparationmsoShapeFlowchartProcessmsoShapeFlowchartPunchedTapemsoShapeFlowchartSequentialAccessStoragemsoShapeFlowchartSortmsoShapeFlowchartStoredDatamsoShapeFlowchartSummingJunctionmsoShapeFlowchartTerminator

Page 1096: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShapeFoldedCornermsoShapeHeartmsoShapeHexagonmsoShapeHorizontalScrollmsoShapeIsoscelesTrianglemsoShapeLeftArrowmsoShapeLeftArrowCalloutmsoShapeLeftBracemsoShapeLeftBracketmsoShapeLeftRightArrowmsoShapeLeftRightArrowCalloutmsoShapeLeftRightUpArrowmsoShapeLeftUpArrowmsoShapeLightningBoltmsoShapeLineCallout1msoShapeLineCallout1AccentBarmsoShapeLineCallout1BorderandAccentBarmsoShapeLineCallout1NoBordermsoShapeLineCallout2msoShapeLineCallout2AccentBarmsoShapeLineCallout2BorderandAccentBarmsoShapeLineCallout2NoBordermsoShapeLineCallout3msoShapeLineCallout3AccentBarmsoShapeLineCallout3BorderandAccentBarmsoShapeLineCallout3NoBordermsoShapeLineCallout4msoShapeLineCallout4AccentBarmsoShapeLineCallout4BorderandAccentBarmsoShapeLineCallout4NoBordermsoShapeMixedmsoShapeMoonmsoShapeNoSymbol

Page 1097: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShapeNotchedRightArrowmsoShapeNotPrimitivemsoShapeOctagonmsoShapeOvalmsoShapeOvalCalloutmsoShapeParallelogrammsoShapePentagonmsoShapePlaquemsoShapeQuadArrowmsoShapeQuadArrowCalloutmsoShapeRectanglemsoShapeRectangularCalloutmsoShapeRegularPentagonmsoShapeRightArrowmsoShapeRightArrowCalloutmsoShapeRightBracemsoShapeRightBracketmsoShapeRightTrianglemsoShapeRoundedRectanglemsoShapeRoundedRectangularCalloutmsoShapeSmileyFacemsoShapeStripedRightArrowmsoShapeSunmsoShapeTrapezoidmsoShapeUpArrowmsoShapeUpArrowCalloutmsoShapeUpDownArrowmsoShapeUpDownArrowCalloutmsoShapeUpRibbonmsoShapeUTurnArrowmsoShapeVerticalScrollmsoShapeWavemsoShapeFlowchartCollate

Page 1098: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShape16pointStarmsoShape24pointStarmsoShape32pointStarmsoShape4pointStarmsoShape5pointStarmsoShape8pointStarmsoShapeActionButtonBackorPreviousmsoShapeActionButtonBeginningmsoShapeActionButtonCustommsoShapeActionButtonDocumentmsoShapeActionButtonEndmsoShapeActionButtonForwardorNextmsoShapeActionButtonHelpmsoShapeActionButtonHomemsoShapeActionButtonInformationmsoShapeActionButtonMoviemsoShapeActionButtonReturnmsoShapeActionButtonSoundmsoShapeArcmsoShapeBalloonmsoShapeBentArrowmsoShapeBentUpArrowmsoShapeBevelmsoShapeBlockArcmsoShapeCanmsoShapeChevronmsoShapeCircularArrowmsoShapeCloudCalloutmsoShapeCrossmsoShapeCubemsoShapeCurvedDownArrowmsoShapeCurvedDownRibbonmsoShapeCurvedLeftArrow

Page 1099: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoShapeCurvedRightArrowmsoShapeCurvedUpArrowmsoShapeCurvedUpRibbonmsoShapeDiamondmsoShapeDonutmsoShapeDoubleBracemsoShapeDoubleBracketmsoShapeDoubleWavemsoShapeDownArrowmsoShapeDownArrowCalloutmsoShapeDownRibbonmsoShapeExplosion1msoShapeExplosion2msoShapeFlowchartAlternateProcessmsoShapeFlowchartCard

expression.AutoShapeType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.Read/writeLong.

NoteWhenyouchangethetypeofashape,theshaperetainsitssize,color,andotherattributes.

Page 1100: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheTypepropertyoftheConnectorFormatobjecttosetorreturntheconnectortype.

Page 1101: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplereplacesall16-pointstarswith32-pointstarsinmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.AutoShapeType=msoShape16pointStarThen

s.AutoShapeType=msoShape32pointStar

EndIf

Next

Page 1102: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1103: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoSizePropertyReturnsorsetsavaluethatindicateswhetherthesizeofthespecifiedshapeischangedautomaticallytofittextwithinitsboundaries.Read/writePpAutoSize.

PpAutoSizecanbeoneofthesePpAutoSizeconstants.ppAutoSizeMixedppAutoSizeNoneppAutoSizeShapeToFitText

expression.AutoSize

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1104: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleadjuststhesizeofthetitleboundingboxonslideonetofitthetitletext.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1)

If.TextFrame.TextRange.Characters.Count<50Then

.TextFrame.AutoSize=ppAutoSizeShapeToFitText

EndIf

EndWith

Page 1105: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1106: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AutoUpdatePropertyReturnsorsetsthewaythelinkwillbeupdated.Read/writePpUpdateOption.

PpUpdateOptioncanbeoneofthesePpUpdateOptionconstants.ppUpdateOptionAutomaticLinkwillbeupdatedeachtimethepresentationisopenedorthesourcefilechanges.ppUpdateOptionManualLinkwillbeupdatedonlywhentheuserspecificallyaskstoupdatethepresentation.ppUpdateOptionMixed

expression.AutoUpdate

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1107: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.

ForEachsldInActivePresentation.Slides

ForEachshInsld.Shapes

Ifsh.Type=msoLinkedOLEObjectThen

Ifsh.OLEFormat.ProgID="Excel.Sheet"Then

sh.LinkFormat.AutoUpdate=ppUpdateOptionManual

EndIf

EndIf

Next

Next

Page 1108: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BackColorPropertyReturnsorsetsaColorFormatobjectthatrepresentsthebackgroundcolorforthespecifiedfillorpatternedline.Read/write.

Page 1109: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocumentandthensetstheforegroundcolor,backgroundcolor,andgradientfortherectangle'sfill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,_

90,90,90,50).Fill

.ForeColor.RGB=RGB(128,0,0)

.BackColor.RGB=RGB(170,170,170)

.TwoColorGradientmsoGradientHorizontal,1

EndWith

ThisexampleaddsapatternedlinetomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(10,100,250,0).Line

.Weight=6

.ForeColor.RGB=RGB(0,0,255)

.BackColor.RGB=RGB(128,0,0)

.Pattern=msoPatternDarkDownwardDiagonal

EndWith

Page 1110: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BackgroundPropertyReturnsaShapeRangeobjectthatrepresentstheslidebackground.

expression.Background

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1111: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfyouusetheBackgroundpropertytosetthebackgroundforanindividualslidewithoutchangingtheslidemaster,theFollowMasterBackgroundpropertyforthatslidemustbesettoFalse.

Page 1112: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebackgroundoftheslidemasterintheactivepresentationtoapresetshade.

ActivePresentation.SlideMaster.Background.Fill.PresetGradient_

Style:=msoGradientHorizontal,Variant:=1,_

PresetGradientType:=msoGradientLateSunset

Thisexamplesetsthebackgroundofslideoneintheactivepresentationtoapresetshade.

WithActivePresentation.Slides(1)

.FollowMasterBackground=False

.Background.Fill.PresetGradientStyle:=msoGradientHorizontal,_

Variant:=1,PresetGradientType:=msoGradientLateSunset

EndWith

Page 1113: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1114: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BaseLineAlignmentPropertyReturnsorsetsthebaselinealignmentforthespecifiedparagraph.Read/writePpBaselineAlignment.

PpBaselineAlignmentcanbeoneofthesePpBaselineAlignmentconstants.ppBaselineAlignBaselineppBaselineAlignCenterppBaselineAlignFarEast50ppBaselineAlignMixedppBaselineAlignTop

expression.BaseLineAlignment

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1115: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthebaselinealignmentfortheparagraphsinshapetwoonslideoneintheactivepresentation.

MsgBoxActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange_

.ParagraphFormat.BaseLineAlignment

Page 1116: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BaselineOffsetPropertyReturnsorsetsthebaselineoffsetforthespecifiedsuperscriptorsubscriptcharacters.Canbeafloating-pointvaluefrom–1through1.Avalueof–1representsanoffsetof–100percent,andavalueof1representsanoffsetof100percent.Read/writeSingle.

Page 1117: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingtheBaselineOffsetpropertytoanegativevalueautomaticallysetstheSubscriptpropertytoTrueandtheSuperscriptpropertytoFalse.

SettingtheBaselineOffsetpropertytoapositivevalueautomaticallysetstheSubscriptpropertytoFalseandtheSuperscriptpropertytoTrue.

SettingtheSubscriptpropertytoTrueautomaticallysetstheBaselineOffsetpropertyto0.3(30percent).

SettingtheSuperscriptpropertytoTrueautomaticallysetstheBaselineOffsetpropertyto–0.25(–25percent).

Page 1118: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetextforshapetwoonslideoneandthenmakesthesecondcharactersubscriptwitha20-percentoffset.

WithApplication.ActivePresentation.Slides(1)_

.Shapes(2).TextFrame.TextRange

.Text="H2O"

.Characters(2,1).Font.BaselineOffset=-0.2

EndWith

Page 1119: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1120: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginArrowheadLengthPropertyReturnsorsetsthelengthofthearrowheadatthebeginningofthespecifiedline.Read/writeMsoArrowheadLength.

MsoArrowheadLengthcanbeoneoftheseMsoArrowheadLengthconstants.msoArrowheadLengthMediummsoArrowheadLengthMixedmsoArrowheadLongmsoArrowheadShort

expression.BeginArrowheadLength

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1121: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsalinetomyDocument.There'sashort,narrowovalontheline'sstartingpointandalong,widetriangleonitsendpoint.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(100,100,200,300).Line

.BeginArrowheadLength=msoArrowheadShort

.BeginArrowheadStyle=msoArrowheadOval

.BeginArrowheadWidth=msoArrowheadNarrow

.EndArrowheadLength=msoArrowheadLong

.EndArrowheadStyle=msoArrowheadTriangle

.EndArrowheadWidth=msoArrowheadWide

EndWith

Page 1122: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1123: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginArrowheadStylePropertyReturnsorsetsthestyleofthearrowheadatthebeginningofthespecifiedline.Read/writeMsoArrowheadStyle.

MsoArrowheadStylecanbeoneoftheseMsoArrowheadStyleconstants.msoArrowheadDiamondmsoArrowheadNonemsoArrowheadOpenmsoArrowheadOvalmsoArrowheadStealthmsoArrowheadStyleMixedmsoArrowheadTriangle

expression.BeginArrowheadStyle

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1124: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsalinetomyDocument.There'sashort,narrowovalontheline'sstartingpointandalong,widetriangleonitsendpoint.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(100,100,200,300).Line

.BeginArrowheadLength=msoArrowheadShort

.BeginArrowheadStyle=msoArrowheadOval

.BeginArrowheadWidth=msoArrowheadNarrow

.EndArrowheadLength=msoArrowheadLong

.EndArrowheadStyle=msoArrowheadTriangle

.EndArrowheadWidth=msoArrowheadWide

EndWith

Page 1125: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1126: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginArrowheadWidthPropertyReturnsorsetsthewidthofthearrowheadatthebeginningofthespecifiedline.Read/writeMsoArrowheadWidth.

MsoArrowheadWidthcanbeoneoftheseMsoArrowheadWidthconstants.msoArrowheadNarrowmsoArrowheadWidemsoArrowheadWidthMediummsoArrowheadWidthMixed

expression.BeginArrowheadWidth

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1127: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsalinetomyDocument.There'sashort,narrowovalontheline'sstartingpointandalong,widetriangleonitsendpoint.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(100,100,200,300).Line

.BeginArrowheadLength=msoArrowheadShort

.BeginArrowheadStyle=msoArrowheadOval

.BeginArrowheadWidth=msoArrowheadNarrow

.EndArrowheadLength=msoArrowheadLong

.EndArrowheadStyle=msoArrowheadTriangle

.EndArrowheadWidth=msoArrowheadWide

EndWith

Page 1128: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1129: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginConnectedPropertyDetermineswhetherthebeginningofthespecifiedconnectorisconnectedtoashape.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThebeginningofthespecifiedconnectorisconnectedtoashape.

Page 1130: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Ifshapethreeonthefirstslideintheactivepresentationisaconnectorwhosebeginningisconnectedtoashape,thisexamplestorestheconnectionsitenumberinthevariableoldBeginConnSite,storesareferencetotheconnectedshapeintheobjectvariableoldBeginConnShape,andthendisconnectsthebeginningoftheconnectorfromtheshape.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.ConnectorThen

With.ConnectorFormat

If.BeginConnectedThen

oldBeginConnSite=.BeginConnectionSite

SetoldBeginConnShape=.BeginConnectedShape

.BeginDisconnect

EndIf

EndWith

EndIf

EndWith

Page 1131: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginConnectedShapePropertyReturnsaShapeobjectthatrepresentstheshapethatthebeginningofthespecifiedconnectorisattachedto.Read-only.

NoteIfthebeginningofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.

Page 1132: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleassumesthatthefirstslideintheactivepresentationalreadycontainstwoshapesattachedbyaconnectornamed"Conn1To2."Thecodeaddsarectangleandaconnectortothefirstslide.Thebeginningofthenewconnectorwillbeattachedtothesameconnectionsiteasthebeginningoftheconnectornamed"Conn1To2,"andtheendofthenewconnectorwillbeattachedtoconnectionsiteoneonthenewrectangle.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

Setr3=.AddShape(msoShapeRectangle,450,190,200,100)

.AddConnector(msoConnectorCurve,0,0,10,10)_

.Name="Conn1To3"

With.Item("Conn1To2").ConnectorFormat

beginConnSite1=.BeginConnectionSite

SetbeginConnShape1=.BeginConnectedShape

EndWith

With.Item("Conn1To3").ConnectorFormat

.BeginConnectbeginConnShape1,beginConnSite1

.EndConnectr3,1

EndWith

EndWith

Page 1133: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BeginConnectionSitePropertyReturnsanintegerthatspecifiestheconnectionsitethatthebeginningofaconnectorisconnectedto.Read-onlyLong.

NoteIfthebeginningofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.

Page 1134: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleassumesthatthefirstslideintheactivepresentationalreadycontainstwoshapesattachedbyaconnectornamed"Conn1To2."Thecodeaddsarectangleandaconnectortothefirstslide.Thebeginningofthenewconnectorwillbeattachedtothesameconnectionsiteasthebeginningoftheconnectornamed"Conn1To2,"andtheendofthenewconnectorwillbeattachedtoconnectionsiteoneonthenewrectangle.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

Setr3=.AddShape(msoShapeRectangle,450,190,200,100)

.AddConnector(msoConnectorCurve,_

0,0,10,10).Name="Conn1To3"

With.Item("Conn1To2").ConnectorFormat

beginConnSite1=.BeginConnectionSite

SetbeginConnShape1=.BeginConnectedShape

EndWith

With.Item("Conn1To3").ConnectorFormat

.BeginConnectbeginConnShape1,beginConnSite1

.EndConnectr3,1

EndWith

EndWith

Page 1135: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BehaviorsPropertyReturnsaspecifiedslideanimationbehaviorasanAnimationBehaviorscollection.

expression.Behaviors

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1136: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ToreturnasingleAnimationBehaviorobjectintheAnimationBehaviorscollection,usetheItemmethodorBehaviors(index),whereindexistheindexnumberoftheAnimationBehaviorobjectintheAnimationBehaviorscollection.

Page 1137: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplereturnsaspecificanimationbehaviortypeintheactivepresentation.

SubReturnTypeValue

MsgBoxActiveWindow.Selection.SlideRange(1).TimeLine_

.MainSequence(1).Behaviors.Item(1).Type

EndSub

Page 1138: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1139: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BlackAndWhitePropertyDetermineswhetherthedocumentwindowdisplayisblackandwhite.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueThedocumentwindowdisplayisblackandwhite.

Page 1140: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplechangesthedisplayinwindowonetoblackandwhite.

Application.Windows(1).BlackAndWhite=msoTrue

Page 1141: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1142: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BlackWhiteModePropertyReturnsorsetsavaluethatindicateshowthespecifiedshapeappearswhenthepresentationisviewedinblack-and-whitemode.Read/writeMsoBlackWhiteMode.

MsoBlackWhiteModecanbeoneoftheseMsoBlackWhiteModeconstants.msoBlackWhiteAutomaticmsoBlackWhiteBlackmsoBlackWhiteBlackTextAndLinemsoBlackWhiteDontShowmsoBlackWhiteGrayOutlinemsoBlackWhiteGrayScalemsoBlackWhiteHighContrastmsoBlackWhiteInverseGrayScalemsoBlackWhiteLightGrayScalemsoBlackWhiteMixedmsoBlackWhiteWhite

expression.BlackWhiteMode

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1143: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsshapeoneonmyDocumenttoappearinblack-and-whitemode.Whenyouviewthepresentationinblack-and-whitemode,shapeonewillappearblack,regardlessofwhatcoloritisincolormode.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).BlackWhiteMode=msoBlackWhiteBlack

Page 1144: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1145: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BoldPropertyDetermineswhetherthecharacterformatisbold.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThecharacterformatisnotbold.msoTriStateMixedThespecifiedtextrangecontainsbothboldandnonboldcharacters.msoTriStateTogglemsoTrueThecharacterformatisbold.

Page 1146: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetscharactersonethroughfiveinthetitleonslideonetobold.

SetmyT=Application.ActivePresentation.Slides(1).Shapes.Title

myT.TextFrame.TextRange.Characters(1,5).Font.Bold=msoTrue

Page 1147: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1148: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BorderPropertyDetermineswhetherthetextinthespecifiedcalloutissurroundedbyaborder.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThetextinthespecifiedcalloutissurroundedbyaborder.

Page 1149: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstomyDocumentanovalandacalloutthatpointstotheoval.Thecallouttextwon'thaveaborder,butitwillhaveaverticalaccentbarthatseparatesthetextfromthecalloutline.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShapemsoShapeOval,180,200,280,130

With.AddCallout(msoCalloutTwo,420,170,170,40)

.TextFrame.TextRange.Text="Myoval"

With.Callout

.Accent=msoTrue

.Border=msoFalse

EndWith

EndWith

EndWith

Page 1150: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BordersPropertyReturnsaBorderscollectionthatrepresentsthebordersanddiagonallinesforthespecifiedCellobjectorCellRangecollection.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1151: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthethicknessoftheleftborderforthefirstcellinthesecondrowoftheselectedtabletothreepoints.

ActiveWindow.Selection.ShapeRange.Table.Rows(2)_

.Cells(1).Borders.Item(ppBorderLeft).Weight=3

Page 1152: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1153: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BoundHeightPropertyReturnstheheight(inpoints)ofthetextboundingboxforthespecifiedtextframe.Read-onlySingle.

Page 1154: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaroundedrectangletoslideoneintheactivepresentation.Therectanglehasthesamedimensionsasthetextboundingboxforshapeone.

WithApplication.ActivePresentation.Slides(1).Shapes

Settr=.Item(1).TextFrame.TextRange

SetroundRect=.AddShape(msoShapeRoundedRectangle,_

tr.BoundLeft,tr.BoundTop,tr.BoundWidth,tr.BoundHeight)

EndWith

WithroundRect.Fill

.ForeColor.RGB=RGB(255,0,128)

.Transparency=0.75

EndWith

Page 1155: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1156: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BoundLeftPropertyReturnsthedistance(inpoints)fromtheleftedgeofthetextboundingboxforthespecifiedtextframetotheleftedgeoftheslide.Read-onlySingle.

Page 1157: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaroundedrectangletoslideoneintheactivepresentation.Therectanglehasthesamedimensionsasthetextboundingboxforshapeone.

WithApplication.ActivePresentation.Slides(1).Shapes

Settr=.Item(1).TextFrame.TextRange

SetroundRect=.AddShape(msoShapeRoundedRectangle,_

tr.BoundLeft,tr.BoundTop,tr.BoundWidth,tr.BoundHeight)

EndWith

WithroundRect.Fill

.ForeColor.RGB=RGB(255,0,128)

.Transparency=0.75

EndWith

Page 1158: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1159: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BoundTopPropertyReturnsthedistance(inpoints)fromthetopoftheofthetextboundingboxforthespecifiedtextframetothetopoftheslide.Read-onlySingle.

Page 1160: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaroundedrectangletoslideoneintheactivepresentation.Therectanglehasthesamedimensionsasthetextboundingboxforshapeone.

WithApplication.ActivePresentation.Slides(1).Shapes

Settr=.Item(1).TextFrame.TextRange

SetroundRect=.AddShape(msoShapeRoundedRectangle,_

tr.BoundLeft,tr.BoundTop,tr.BoundWidth,tr.BoundHeight)

EndWith

WithroundRect.Fill

.ForeColor.RGB=RGB(255,0,128)

.Transparency=0.75

EndWith

Page 1161: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1162: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BoundWidthPropertyReturnsthewidth(inpoints)ofthetextboundingboxforthespecifiedtextframe.Read-onlySingle.

Page 1163: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaroundedrectangletoslideoneintheactivepresentation.Therectanglehasthesamedimensionsasthetextboundingboxforshapeone.

WithApplication.ActivePresentation.Slides(1).Shapes

Settr=.Item(1).TextFrame.TextRange

SetroundRect=.AddShape(msoShapeRoundedRectangle,_

tr.BoundLeft,tr.BoundTop,tr.BoundWidth,tr.BoundHeight)

EndWith

WithroundRect.Fill

.ForeColor.RGB=RGB(255,0,128)

.Transparency=0.75

EndWith

Page 1164: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BrightnessPropertyReturnsorsetsthebrightnessofthespecifiedpictureorOLEobject.Thevalueforthispropertymustbeanumberfrom0.0(dimmest)to1.0(brightest).Read/writeSingle.

Page 1165: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthebrightnessforshapeoneonmyDocument.ShapeonemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).PictureFormat.Brightness=0.3

Page 1166: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BuildPropertyReturnsthePowerPointbuildnumber.Read-onlyString.

Page 1167: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaysthePowerPointbuildnumber.

MsgBoxPrompt:=Application.Build,Title:="PowerPointBuild"

Page 1168: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1169: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BuildByLevelEffectPropertyReturnsanMsoAnimateByLevelconstantthatrepresentstheleveloftheanimationbuildeffect.Read-only.

MsoAnimateByLevelcanbeoneoftheseMsoAnimateByLevelconstants.msoAnimateChartAllAtOncemsoAnimateChartByCategorymsoAnimateChartByCategoryElementsmsoAnimateChartBySeriesmsoAnimateChartBySeriesElementsmsoAnimateDiagramAllAtOncemsoAnimateDiagramBreadthByLevelmsoAnimateDiagramBreadthByNodemsoAnimateDiagramClockwisemsoAnimateDiagramClockwiseInmsoAnimateDiagramClockwiseOutmsoAnimateDiagramCounterClockwisemsoAnimateDiagramCounterClockwiseInmsoAnimateDiagramCounterClockwiseOutmsoAnimateDiagramDepthByBranchmsoAnimateDiagramDepthByNodemsoAnimateDiagramDownmsoAnimateDiagramInByRingmsoAnimateDiagramOutByRingmsoAnimateDiagramUpmsoAnimateLevelMixedmsoAnimateTextByAllLevelsmsoAnimateTextByFifthLevelmsoAnimateTextByFirstLevelmsoAnimateTextByFourthLevelmsoAnimateTextBySecondLevel

Page 1170: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimateTextByThirdLevelmsoAnimationLevelNone

expression.BuildByLevelEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1171: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplereturnsabuild-by-leveleffect.

SubQueryBuildByLevelEffect()

DimeffMainAsEffect

SeteffMain=ActivePresentation.Slides(1).TimeLine_

.MainSequence(1)

IfeffMain.EffectInformation.BuildByLevelEffect<>msoAnimateLevelNoneThen

ActivePresentation.Slides(1).TimeLine.MainSequence_

.ConvertToTextUnitEffectEffect:=effMain,_

UnitEffect:=msoAnimTextUnitEffectByWord

EndIf

EndSub

Page 1172: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BuiltInDocumentPropertiesPropertyReturnsaDocumentPropertiescollectionthatrepresentsallthebuilt-indocumentpropertiesforthespecifiedpresentation.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1173: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheCustomDocumentPropertiespropertytoreturnthecollectionofcustomdocumentproperties.

Page 1174: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthenamesofallthebuilt-indocumentpropertiesfortheactivepresentation.

ForEachpInApplication.ActivePresentation_

.BuiltInDocumentProperties

bidpList=bidpList&p.Name&Chr$(13)

Next

MsgBoxbidpList

Thisexamplesetsthe"Category"built-inpropertyfortheactivepresentationiftheauthorofthepresentationisJakeJarmel.

WithApplication.ActivePresentation.BuiltInDocumentProperties

If.Item("author").Value="JakeJarmel"Then

.Item("category").Value="CreativeWriting"

EndIf

EndWith

Page 1175: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

BulletPropertyReturnsaBulletFormatobjectthatrepresentsbulletformattingforthespecifiedparagraphformat.Read-only.

Page 1176: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebulletsizeandbulletcolorfortheparagraphsinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame

With.TextRange.ParagraphFormat.Bullet

.Visible=True

.RelativeSize=1.25

.Font.Color=RGB(255,0,255)

EndWith

EndWith

Page 1177: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1178: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ByPropertyBypropertyasitappliestotheColorEffectobject.

ReturnsaColorFormatobjectthatrepresentsachangetothecoloroftheobjectbythespecifiednumber,expressedinRGBformat.

expression.By

expressionRequired.AnexpressionthatreturnsaColorEffectobject.

BypropertyasitappliestotheRotationEffectobject.

SetsorreturnsaSinglethatrepresentstherotationofanobjectbythespecifiednumberofdegrees;forexample,avalueof180meanstorotatetheobjectby180degrees.Read/write.

expression.By

expressionRequired.AnexpressionthatreturnsaRotationEffectobject.

Page 1179: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thespecifiedobjectwillberotatedwiththecenteroftheobjectremaininginthesamepositiononthescreen.

IfboththeByandTopropertiesaresetforarotationeffect,thenthevalueoftheBypropertyisignored.

Floatingpointnumbers(forexample,55.5)arevalid,butnegativenumbersarenot.

Page 1180: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

DonotconfusethispropertywiththeByXorByYpropertiesoftheScaleEffectandMotionEffectobjects,whichareonlyusedforscalingormotioneffects.

Page 1181: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheColorEffectobject.

Thisexampleaddsacoloreffectandchangesitscolor.Thisexampleassumesthereisatleastoneshapeonthefirstslideoftheactivepresentation.

SubAddAndChangeColorEffect()

DimeffBlindsAsEffect

DimtmlnShapeAsTimeLine

DimshpShapeAsShape

DimanimBehaviorAsAnimationBehavior

DimclrEffectAsColorEffect

'Setsshape,timing,andeffect

SetshpShape=ActivePresentation.Slides(1).Shapes(1)

SettmlnShape=ActivePresentation.Slides(1).TimeLine

SeteffBlinds=tmlnShape.MainSequence.AddEffect_

(Shape:=shpShape,effectId:=msoAnimEffectBlinds)

'Addsanimationbehaviorandcoloreffect

SetanimBehavior=tmlnShape.MainSequence(1).Behaviors_

.Add(Type:=msoAnimTypeColor)

SetclrEffect=animBehavior.ColorEffect

'Specifiescolor

clrEffect.By.RGB=RGB(Red:=255,Green:=0,Blue:=0)

EndSub

AsitappliestotheRotationEffectobject.

Thisexampleaddsarotationeffectandchangesitsrotation.

SubAddAndChangeRotationEffect()

DimeffBlindsAsEffect

DimtmlnShapeAsTimeLine

DimshpShapeAsShape

DimanimBehaviorAsAnimationBehavior

DimrtnEffectAsRotationEffect

'Setsshape,timing,andeffect

SetshpShape=ActivePresentation.Slides(1).Shapes(1)

SettmlnShape=ActivePresentation.Slides(1).TimeLine

Page 1182: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SeteffBlinds=tmlnShape.MainSequence.AddEffect_

(Shape:=shpShape,effectId:=msoAnimEffectBlinds)

'Addsanimationbehaviorandsetsrotationeffect

SetanimBehavior=tmlnShape.MainSequence(1).Behaviors_

.Add(Type:=msoAnimTypeRotation)

SetrtnEffect=animBehavior.RotationEffect

rtnEffect.By=270

EndSub

Page 1183: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ByXPropertySetsorreturnsaSinglethatrepresentsscalingormovinganobjecthorizontallybyaspecifiedpercentageofthescreenwidth,dependingonwhetheritusedinconjunctionwithaScaleEffectorMotionEffectobject,respectively.Forexample,avalueof50foramotioneffectmeanstomovetheobjecthalfthescreenwidthtotheright.Read/write.

expression.ByX

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1184: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Negativenumbersmovetheobjecthorizontallytotheleft.Floatingpointnumbers(forexample,55.5)areallowed.

Toscaleormoveanobjectvertically,usetheByYproperty.

IfboththeByXandByYpropertiesareset,thentheobjectisscaledormovesbothhorizontallyandvertically.

DonotconfusethispropertywiththeBypropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetcolors,rotations,orotherpropertiesofananimationbehavior,respectively.

Page 1185: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsananimationpath;thensetsthehorizontalandverticalmovementoftheshape.

SubAddMotionPath()

DimeffCustomAsEffect

DimanimBehaviorAsAnimationBehavior

DimshpRectangleAsShape

'Addsrectangleandsetseffectandanimation

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=300,_

Top:=300,Width:=300,Height:=150)

SeteffCustom=ActivePresentation.Slides(1).TimeLine_

.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectCustom)

SetanimBehavior=effCustom.Behaviors.Add(msoAnimTypeMotion)

'Specifiesanimationmotion

WithanimBehavior.MotionEffect

.ByX=50

.ByY=50

EndWith

EndSub

Page 1186: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ByYPropertySetsorreturnsaSinglethatrepresentsscalingormovinganobjectverticallybyaspecifiedpercentageofthescreenwidth,dependingonwhetheritisusedinconjunctionwithaScaleEffectorMotionEffectobject,respectively.Read/write.

expression.ByY

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1187: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Negativenumbersmovetheobjecthorizontallytotheleft.Floatingpointnumbers(forexample,55.5)areallowed.

Toscaleormoveanobjecthorizontally,usetheByXproperty.

IfboththeByXandByYpropertiesareset,thentheobjectisscaledormovesbothhorizontallyandvertically.

DonotconfusethispropertywiththeBypropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetcolors,rotations,orotherpropertiesofananimationbehavior,respectively.

Page 1188: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsananimationpath;thensetsthehorizontalandverticalmovementoftheshape.

SubAddMotionPath()

DimeffCustomAsEffect

DimanimBehaviorAsAnimationBehavior

DimshpRectangleAsShape

'Addsrectangleandsetseffectandanimation

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=300,_

Top:=300,Width:=300,Height:=150)

SeteffCustom=ActivePresentation.Slides(1).TimeLine_

.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectCustom)

SetanimBehavior=effCustom.Behaviors.Add(msoAnimTypeMotion)

'Specifiesanimationmotion

WithanimBehavior.MotionEffect

.ByX=50

.ByY=50

EndWith

EndSub

Page 1189: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CalloutPropertyReturnsaCalloutFormatobjectthatcontainscalloutformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentlinecallouts.Read-only.

Page 1190: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstomyDocumentanovalandacalloutthatpointstotheoval.Thecallouttextwon'thaveaborder,butitwillhaveaverticalaccentbarthatseparatesthetextfromthecalloutline.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShapemsoShapeOval,180,200,280,130

With.AddCallout(msoCalloutTwo,420,170,170,40)

.TextFrame.TextRange.Text="Myoval"

With.Callout

.Accent=True

.Border=False

EndWith

EndWith

EndWith

Page 1191: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1192: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CaptionPropertyCaptionpropertyasitappliestotheApplicationobject.

Returnsthetextthatappearsinthetitlebaroftheapplicationwindow.Read/writeString.

expression.Caption

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

CaptionpropertyasitappliestotheDocumentWindowobject.

Returnsthetextthatappearsinthetitlebarofthedocumentwindow.Read-onlyString.

expression.Caption

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1193: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthecaptionforeachopendocumentwindow.

WithApplication.Windows

Forw=1To.Count

MsgBox"Window"&w&"contains"&.Item(1).Caption

Next

EndWith

Page 1194: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CellsPropertyReturnsaCellRangecollectionthatrepresentsthecellsinatablecolumnorrow.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1195: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanewpresentation,addsaslide,insertsa3x3tableontheslide,andassignsthecolumnandrownumbertoeachcellinthetable.

DimiAsInteger

DimjAsInteger

WithPresentations.Add

.Slides.Add(1,ppLayoutBlank).Shapes.AddTable(3,3).Select

SetmyTable=.Slides(1).Shapes(1).Table

Fori=1TomyTable.Columns.Count

Forj=1TomyTable.Columns(i).Cells.Count

myTable.Columns(i).Cells(j).Shape.TextFrame_

.TextRange.Text="col."&i&"row"&j

Nextj

Nexti

EndWith

Page 1196: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CharacterPropertyReturnsorsetstheUnicodecharactervaluethatisusedforbulletsinthespecifiedtext.Read/writeLong.

Page 1197: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebulletcharacterforshapetwoonslideoneintheactivepresentation.

Setframe2=ActivePresentation.Slides(1).Shapes(2).TextFrame

Withframe2.TextRange.ParagraphFormat.Bullet

.Character=8226

.Visible=True

EndWith

Page 1198: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1199: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ChartUnitEffectPropertyReturnsorsetsavaluethatindicateswhetherthegraphrangeisanimatedbyseries,category,orelement.Read/writePpChartUnitEffect.

PpChartUnitEffectcanbeoneofthesePpChartUnitEffectconstants.ppAnimateByCategoryppAnimateByCategoryElementsppAnimateBySeriesppAnimateBySeriesElementsppAnimateChartAllAtOnceppAnimateChartMixed

expression.ChartUnitEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1200: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyourgraphdoesn'tbecomeanimated,makesurethattheAnimatepropertyissettoTrue

Page 1201: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsshapetwoonslidethreeintheactivepresentationtobeanimatedbyseries.Shapetwomustbeagraphforthistowork.

WithActivePresentation.Slides(3).Shapes(2)

With.AnimationSettings

.ChartUnitEffect=ppAnimateBySeries

.EntryEffect=ppEffectFlyFromLeft

.Animate=True

EndWith

EndWith

Page 1202: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1203: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CheckIfOfficeIsHTMLEditorPropertyDetermineswhetherMicrosoftPowerPointcheckstoseewhetheranOfficeapplicationisthedefaultHTMLeditorwhenyoustartPowerPoint.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsePowerPointdoesnotchecktoseewhetheranOfficeapplicationisthedefaultHTMLeditorwhenyoustartPowerPoint.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.PowerPointcheckstoseewhetheranOfficeapplicationisthedefaultHTMLeditorwhenyoustartPowerPoint.

Page 1204: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThispropertyisusedonlyiftheWebbrowseryouareusingsupportsHTMLeditingandHTMLeditors.

TouseadifferentHTMLeditor,youmustsetthispropertytoFalseandthenregistertheeditorasthedefaultsystemHTMLeditor.

Page 1205: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecausesMicrosoftPowerPointnottocheckwhetheranOfficeapplicationisthedefaultHTMLeditor.

Application.DefaultWebOptions.CheckIfOfficeIsHTMLEditor=msoFalse

Page 1206: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1207: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ChildPropertyMsoTrueiftheshapeisachildshapeorifallshapesinashaperangearechildshapesofthesameparent.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesnotapplytothisproperty.msoFalseTheshapeisnotachildshapeor,ifashaperange,allchildshapesdonotbelongtothesameparent.msoTriStateMixedDoesnotapplytothisproperty.msoTriStateToggleDoesnotapplytothisproperty.msoTrueTheshapeisachildshapeor,ifashaperange,allchildshapesbelongtothesameparent.

expression.Child

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1208: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleselectsthefirstshapeinthecanvas,andiftheselectedshapeisachildshape,fillstheshapewiththespecifiedcolor.Thisexampleassumesthatthefirstshapeintheactivepresentationisadrawingcanvasthatcontainsmultipleshapes.

SubFillChildShape()

'Selectthefirstshapeinthedrawingcanvas

ActivePresentation.Slides(1).Shapes(1).CanvasItems(1).Select

'Fillselectedshapeifitisachildshape

WithActiveWindow.Selection

If.ShapeRange.Child=msoTrueThen

.ShapeRange.Fill.ForeColor.RGB=RGB(Red:=100,Green:=0,Blue:=200)

Else

MsgBox"Thisshapeisnotachildshape."

EndIf

EndWith

EndSub

Page 1209: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ChildrenPropertyReturnsaDiagramNodeChildrenobjectthatrepresentsallofthechildrenofthespecifieddiagramnode.

expression.Children

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1210: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesapyramiddiagramandaddschildnodestoit.

SubCreatePyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addspyramiddiagramandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreeadditionalchildnodestodiagram

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

EndSub

Page 1211: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ChildShapeRangePropertyReturnsaShapeRangeobjectthatrepresentsthechildshapesofaselection.

expression.ChildShapeRange

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1212: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanewdocumentwithadrawingcanvas,populatesthedrawingcanvaswithshapes,andselectstheshapesaddedtothecanvas.Thenaftercheckingthattheshapesselectedarechildshapes,itfillsthechildshapeswithapattern.

SubChildShapes()

DimsldNewAsSlide

DimshpCanvasAsShape

'Createanewslidewithadrawingcanvasandshapes

SetsldNew=Presentations(1).Slides_

.Add(Index:=1,Layout:=ppLayoutBlank)

SetshpCanvas=sldNew.Shapes.AddCanvas(_

Left:=100,Top:=100,Width:=200,Height:=200)

WithshpCanvas.CanvasItems

.AddShapemsoShapeRectangle,Left:=0,Top:=0,_

Width:=100,Height:=100

.AddShapemsoShapeOval,Left:=0,Top:=50,_

Width:=100,Height:=100

.AddShapemsoShapeDiamond,Left:=0,Top:=100,_

Width:=100,Height:=100

EndWith

'Selectallshapesinthecanvas

shpCanvas.CanvasItems.SelectAll

'Fillcanvaschildshapeswithapattern

WithActiveWindow.Selection

If.HasChildShapeRange=TrueThen

.ChildShapeRange.Fill.PatternedPattern:=msoPatternDivot

Else

MsgBox"Thisisnotarangeofchildshapes."

EndIf

EndWith

EndSub

Page 1213: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 1214: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1215: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CollatePropertyDetermineswhetheracompletecopyofthespecifiedpresentationisprintedbeforethefirstpageofthenextcopyisprinted.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.Acompletecopyofthespecifiedpresentationisprintedbeforethefirstpageofthenextcopyisprinted.

Page 1216: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SpecifyingavaluefortheCollateargumentofthePrintOutmethodsetsthevalueofthisproperty.

Page 1217: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintsthreecollatedcopiesoftheactivepresentation.

WithActivePresentation.PrintOptions

.NumberOfCopies=3

.Collate=msoTrue

.Parent.PrintOut

EndWith

Page 1218: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorPropertyReturnsaColorFormatobjectthatrepresentsthecolorforthespecifiedcharacters.Read-only.

Page 1219: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthecolorofcharactersonethroughfiveinthetitleonslideone.

myRed=RGB(255,0,0)

SetmyT=Application.ActivePresentation.Slides(1).Shapes.Title

myT.TextFrame.TextRange.Characters(1,5).Font.Color.RGB=myRed

Page 1220: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Color2PropertyReturnsaColorFormatobjectthatrepresentsthecoloronwhichtoendacolor-cycleanimation.

expression.Color2

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1221: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashape,addsafillanimationtothatshape,thenreportsthestartingandendingfillcolors.

SubSetStartEndColors()

DimeffChangeFillAsEffect

DimshpCubeAsShape

DimaAsAnimationBehavior

'Addscubeandsetfilleffect

SetshpCube=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeCube,Left:=300,_

Top:=300,Width:=100,Height:=100)

SeteffChangeFill=ActivePresentation.Slides(1).TimeLine_

.MainSequence.AddEffect(Shape:=shpCube,_

effectId:=msoAnimEffectChangeFillColor)

'Setsdurationofeffectanddisplaysamessagecontaining

'thestartingandendingcolorsforthefilleffect

effChangeFill.Timing.Duration=3

MsgBox"StartColor="&effChangeFill.EffectParameters_

.Color1&vbCrLf&"EndColor="&effChangeFill_

.EffectParameters.Color2

EndSub

Page 1222: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorEffectPropertyReturnsaColorEffectobjectthatrepresentsthecolorpropertiesforaspecifiedanimationbehavior.

expression.ColorEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1223: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsashapetothefirstslideoftheactivepresentationandsetsacoloreffectbehaviortochangethefillcolorofthenewshape.

SubChangeColorEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(Type:=msoAnimTypeColor)

WithbhvEffect.ColorEffect

.From.RGB=RGB(Red:=255,Green:=0,Blue:=0)

.To.RGB=RGB(Red:=0,Green:=0,Blue:=255)

EndWith

EndSub

Page 1224: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorSchemePropertyReturnsorsetstheColorSchemeobjectthatrepresentstheschemecolorsforthespecifiedslide,sliderange,orslidemaster.Read/write.

Page 1225: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetitlecolortogreenforslidesoneandthreeintheactivepresentation.

SetmySlides=ActivePresentation.Slides.Range(Array(1,3))

mySlides.ColorScheme.Colors(ppTitle).RGB=RGB(0,255,0)

Page 1226: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorSchemesPropertyReturnsaColorSchemescollectionthatrepresentsthecolorschemesinthespecifiedpresentation.Read-only.

Page 1227: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebackgroundcolorforcolorschemethreeintheactivepresentationandthenappliesthecolorschemetoallslidesinthepresentationthatarebasedontheslidemaster.

WithActivePresentation

Setcs1=.ColorSchemes(3)

cs1.Colors(ppBackground).RGB=RGB(128,128,0)

.SlideMaster.ColorScheme=cs1

EndWith

Page 1228: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1229: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorTypePropertyReturnsorsetsthetypeofcolortransformationappliedtothespecifiedpictureorOLEobject.Read/writeMsoPictureColorType.

MsoPictureColorTypecanbeoneoftheseMsoPictureColorTypeconstants.msoPictureAutomaticmsoPictureBlackAndWhitemsoPictureGrayscalemsoPictureMixedmsoPictureWatermark

expression.ColorType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1230: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthecolortransformationtograyscaleforshapeoneonmyDocument.ShapeonemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).PictureFormat.ColorType=msoPictureGrayScale

Page 1231: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColumnsPropertyReturnsaColumnscollectionthatrepresentsallthecolumnsinatable.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1232: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaystheshapenumber,theslidenumber,andthenumberofcolumnsinthefirsttableoftheactivepresentation.

DimColCountAsInteger

DimslAsInteger

DimshAsInteger

WithActivePresentation

Forsl=1To.Slides.Count

Forsh=1To.Slides(sl).Shapes.Count

If.Slides(sl).Shapes(sh).HasTableThen

ColCount=.Slides(sl).Shapes(sh)_

.Table.Columns.Count

MsgBox"Shape"&sh&"onslide"&sl&_

"containsthefirsttableandhas"&_

ColCount&"columns."

ExitSub

EndIf

Next

Next

EndWith

Thisexampleteststheselectedshapetoseeifitcontainsatable.Ifitdoes,thecodesetsthewidthofcolumnoneto72points(oneinch).

WithActiveWindow.Selection.ShapeRange

If.HasTable=TrueThen

.Table.Columns(1).Width=72

EndIf

EndWith

Page 1233: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

COMAddInsPropertyReturnsareferencetotheComponentObjectModel(COM)add-inscurrentlyloadedinMicrosoftPowerPoint.ThesearelistedintheCOMAdd-Insdialogbox.YoucanaddtheCOMAdd-InscommandtoyourToolsmenubyusingtheCustomizedialogbox.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1234: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CommandPropertySetsorreturnsaStringthatrepresentsthecommandtobeexecutedforthecommandeffect.Read/write.

expression.Command

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1235: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucansendOLEverbstoembeddedobjectsusingthisproperty.

IftheshapeisanOLEobject,thentheoleobjectwillexecutethecommandifitunderstandstheverb.

Iftheshapeisamediaobject(sound/video),PowerPointunderstandsthefollowingverbs:play,stop,pause,togglepause,resumeandplayfrom.Anyothercommandsenttotheshapewillbeignored.

Page 1236: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleshowshowtosetacommandeffectanimationbehavior.

SetbhvEffect=effectNew.Behaviors.Add(msoAnimTypeCommand)

WithbhvEffect.CommandEffect

.Type=msoAnimCommandTypeVerb

.Command=Play

EndWith

Page 1237: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1238: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CommandBarsPropertyCommandBarspropertyasitappliestotheApplicationobject.

ReturnsaCommandBarscollectionthatrepresentsallthecommandbarsinPowerPoint.Read-only.

CommandBarspropertyasitappliestothePresentationobject.

ReturnsaCommandBarscollectionthatrepresentsthemergedcommandbarsetfromthehostcontainerapplicationandPowerPoint.ThispropertyreturnsavalidobjectonlywhenthecontainerisaDocObjectserver,likeMicrosoftBinder,andPowerPointisactingasanOLEserver.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1239: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheApplicationobject.

ThisexampleenlargesallcommandbarbuttonsandenablesToolTips.

WithApplication.CommandBars

.LargeButtons=True

.DisplayTooltips=True

EndWith

AsitappliestothePresentationobject.

ThisexampledisplaystheFormattingcommandbarwiththemergedcommandbarsetatthetopoftheapplicationwindow.

WithActivePresentation.CommandBars("Formatting")

.Visible=True

.Position=msoBarTop

EndWith

Page 1240: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CommandEffectPropertyReturnsaCommandEffectobjectforthespecifiedanimationbehavior.Read-only.

expression.CommandEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1241: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcansendevents,callfunctions,andsendOLEverbstoembeddedobjectsusingthisproperty.

Page 1242: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleshowshowtosetacommandeffectanimationbehavior.

SetbhvEffect=effectNew.Behaviors.Add(msoAnimTypeCommand)

WithbhvEffect.CommandEffect

.Type=msoAnimCommandTypeVerb

.Command=Play

EndWith

Page 1243: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CommentsPropertyReturnsaCommentsobjectthatrepresentsacollectionofcomments.

expression.Comments

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1244: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsacommenttoaslide.

SubAddNewComment()

ActivePresentation.Slides(1).Comments.Add_

Left:=0,Top:=0,Author:="JohnDoe",AuthorInitials:="jd",_

Text:="Pleasecheckthisspellingagainbeforethenextdraft."

EndSub

Page 1245: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConnectionSiteCountPropertyReturnsthenumberofconnectionsitesonthespecifiedshape.Read-onlyLong.

Page 1246: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstworectanglestomyDocumentandjoinsthemwithtwoconnectors.Thebeginningsofbothconnectorsattachtoconnectionsiteoneonthefirstrectangle;theendsoftheconnectorsattachtothefirstandlastconnectionsitesofthesecondrectangle.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

lastsite=secondRect.ConnectionSiteCount

Withs.AddConnector(msoConnectorCurve,0,0,100,100)_

.ConnectorFormat

.BeginConnectConnectedShape:=firstRect,ConnectionSite:=1

.EndConnectConnectedShape:=secondRect,ConnectionSite:=1

EndWith

Withs.AddConnector(msoConnectorCurve,0,0,100,100)_

.ConnectorFormat

.BeginConnectConnectedShape:=firstRect,ConnectionSite:=1

.EndConnectConnectedShape:=secondRect,_

ConnectionSite:=lastsite

EndWith

Page 1247: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1248: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConnectorPropertyDetermineswhetherthespecifiedshapeisaconnector.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisaconnector.

Page 1249: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledeletesallconnectorsonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

Fori=.CountTo1Step-1

With.Item(i)

If.ConnectorThen.Delete

EndWith

Next

EndWith

Page 1250: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ConnectorFormatPropertyReturnsaConnectorFormatobjectthatcontainsconnectorformattingproperties.AppliestoShapeorShapeRangeobjectsthatrepresentconnectors.Read-only.

Page 1251: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstworectanglestomyDocument,attachesthemwithaconnector,automaticallyreroutestheconnectoralongtheshortestpath,andthendetachestheconnectorfromtherectangles.

SetmyDocument=ActivePresentation.Slides(1)

Sets=myDocument.Shapes

SetfirstRect=s.AddShape(msoShapeRectangle,100,50,200,100)

SetsecondRect=s.AddShape(msoShapeRectangle,300,300,200,100)

Withs.AddConnector(msoConnectorCurve,0,0,0,0).ConnectorFormat

.BeginConnectfirstRect,1

.EndConnectsecondRect,1

.Parent.RerouteConnections

.BeginDisconnect

.EndDisconnect

EndWith

Page 1252: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ContainerPropertyReturnstheobjectthatcontainsthespecifiedembeddedpresentation.Read-onlyObject.

NoteIfthecontainerdoesn'tsupportOLEAutomation,orifthespecifiedpresentationisn'tembeddedinaMicrosoftBinderfile,thispropertyfails.

Page 1253: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplehidesthesecondsectionoftheMicrosoftBinderfilethatcontainstheembeddedactivepresentation.TheContainerpropertyofthepresentationreturnsaSectionobject,andtheParentpropertyoftheSectionobjectreturnsaBinderobject.

Application.ActivePresentation.Container.Parent.Sections(2)_

.Visible=False

Page 1254: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ContrastPropertyReturnsorsetsthecontrastforthespecifiedpictureorOLEobject.Thevalueforthispropertymustbeanumberfrom0.0(theleastcontrast)to1.0(thegreatestcontrast).Read/writeSingle.

Page 1255: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthecontrastforshapeoneonmyDocument.ShapeonemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).PictureFormat.Contrast=0.8

Page 1256: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CountPropertyReturnsthenumberofobjectsinthespecifiedcollection.

Read-onlyIntegerforthefollowingobjects:Adjustments,CanvasShapes,DiagramNodeChildren,DiagramNodes,GroupShapes,ShapeNodes,andShapes.

Read-onlyLongforthefollowingobjects:ActionSettings,AddIns,AnimationPoints,Animations10,Borders,CellRange,ColorScheme,ColorSchemes,Columns,Comments,Designs,DocumentWindows,ExtraColors,Fonts,Hyperlinks,NamedSlideShow,NamedSlideShows,ObjectVerbs,Panes,Placeholders,Presentations,PrintRanges,PublishObjects,Rows,RulerLevels,ShapeRange,SlideRange,Slides,SlideShowWindows,TabStops,Tags,TextRange,TextStyleLevels,TextStyles,TimeNodes,andTriggers.

Page 1257: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleclosesallwindowsexcepttheactivewindow.

WithApplication.Windows

Fori=2To.Count

.Item(2).Close

Next

EndWith

Page 1258: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CreatorPropertyReturnsaLongthatrepresentsthefour-charactercreatorcodefortheapplicationinwhichthespecifiedobjectwascreated.Forexample,iftheobjectwascreatedinPowerPoint,thispropertyreturnsthehexadecimalnumber50575054.Read-only.

expression.Creator

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1259: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheCreatorpropertyisdesignedtobeusedinMicrosoftOfficeapplicationsfortheMacintosh.

Page 1260: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaysamessageaboutthecreatorofmyObject.

SetmyObject=Application.ActivePresentation.Slides(1).Shapes(1)

IfmyObject.Creator=&h50575054Then

MsgBox"ThisisaPowerPointobject"

Else

MsgBox"ThisisnotaPowerPointobject"

EndIf

Page 1261: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CropBottomPropertyReturnsorsetsthenumberofpointsthatarecroppedoffthebottomofthespecifiedpictureorOLEobject.Read/writeSingle.

NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointshigh,rescaleitsothatit's200pointshigh,andthensettheCropBottompropertyto50,100points(not50)willbecroppedoffthebottomofyourpicture.

Page 1262: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecrops20pointsoffthebottomofshapethreeonmyDocument.Fortheexampletowork,shapethreemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).PictureFormat.CropBottom=20

Thisexamplecropsthepercentagespecifiedbytheuseroffthebottomoftheselectedshape,regardlessofwhethertheshapehasbeenscaled.Fortheexampletowork,theselectedshapemustbeeitherapictureoranOLEobject.

percentToCrop=InputBox("Whatpercentagedoyou"&_

"wanttocropoffthebottomofthispicture?")

SetshapeToCrop=ActiveWindow.Selection.ShapeRange(1)

WithshapeToCrop.Duplicate

.ScaleHeight1,True

origHeight=.Height

.Delete

EndWith

cropPoints=origHeight*percentToCrop/100

shapeToCrop.PictureFormat.CropBottom=cropPoints

Page 1263: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CropLeftPropertyReturnsorsetsthenumberofpointsthatarecroppedofftheleftsideofthespecifiedpictureorOLEobject.Read/writeSingle.

NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointswide,rescaleitsothatit's200pointswide,andthensettheCropLeftpropertyto50,100points(not50)willbecroppedofftheleftsideofyourpicture.

Page 1264: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecrops20pointsofftheleftsideofshapethreeonmyDocument.Fortheexampletowork,shapethreemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).PictureFormat.CropLeft=20

Thisexamplecropsthepercentagespecifiedbytheuserofftheleftsideoftheselectedshape,regardlessofwhethertheshapehasbeenscaled.Fortheexampletowork,theselectedshapemustbeeitherapictureoranOLEobject.

percentToCrop=InputBox("Whatpercentagedoyou"&_

"wanttocropofftheleftofthispicture?")

SetshapeToCrop=ActiveWindow.Selection.ShapeRange(1)

WithshapeToCrop.Duplicate

.ScaleWidth1,True

.Width=origWidth

.Delete

EndWith

cropPoints=origWidth*percentToCrop/100

shapeToCrop.PictureFormat.CropLeft=cropPoints

Page 1265: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CropRightPropertyReturnsorsetsthenumberofpointsthatarecroppedofftherightsideofthespecifiedpictureorOLEobject.Read/writeSingle.

NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointswide,rescaleitsothatit's200pointswide,andthensettheCropRightpropertyto50,100points(not50)willbecroppedofftherightsideofyourpicture.

Page 1266: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecrops20pointsofftherightsideofshapethreeonmyDocument.Forthisexampletowork,shapethreemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).PictureFormat.CropRight=20

Thisexamplecropsthepercentagespecifiedbytheuserofftherightsideoftheselectedshape,regardlessofwhethertheshapehasbeenscaled.Fortheexampletowork,theselectedshapemustbeeitherapictureoranOLEobject.

percentToCrop=InputBox("Whatpercentagedoyou"&_

"wanttocropofftherightofthispicture?")

SetshapeToCrop=ActiveWindow.Selection.ShapeRange(1)

WithshapeToCrop.Duplicate

.ScaleWidth1,True

origWidth=.Width

.Delete

EndWith

cropPoints=origWidth*percentToCrop/100

shapeToCrop.PictureFormat.CropRight=cropPoints

Page 1267: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CropTopPropertyReturnsorsetsthenumberofpointsthatarecroppedoffthetopofthespecifiedpictureorOLEobject.Read/writeSingle.

NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointshigh,rescaleitsothatit's200pointshigh,andthensettheCropToppropertyto50,100points(not50)willbecroppedoffthetopofyourpicture.

Page 1268: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecrops20pointsoffthetopofshapethreeonmyDocument.Fortheexampletowork,shapethreemustbeeitherapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).PictureFormat.CropTop=20

Thisexamplecropsthepercentagespecifiedbytheuseroffthetopoftheselectedshape,regardlessofwhethertheshapehasbeenscaled.Fortheexampletowork,theselectedshapemustbeeitherapictureoranOLEobject.

percentToCrop=InputBox("Whatpercentagedoyou"&_

"wanttocropoffthetopofthispicture?")

SetshapeToCrop=ActiveWindow.Selection.ShapeRange(1)

WithshapeToCrop.Duplicate

.ScaleHeight1,True

origHeight=.Height

.Delete

EndWith

cropPoints=origHeight*percentToCrop/100

shapeToCrop.PictureFormat.CropTop=cropPoints

Page 1269: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CurrentShowPositionPropertyReturnsthepositionofthecurrentslidewithintheslideshowthatisshowinginthespecifiedview.Read-onlyLong.

Page 1270: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifthespecifiedviewcontainsacustomshow,theCurrentShowPositionpropertyreturnsthepositionofthecurrentslidewithinthecustomshow,notthepositionofthecurrentslidewithintheentirepresentation.

Page 1271: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsavariabletothepositionofthecurrentslideintheslideshowrunninginslideshowwindowone.

lastSlideSeen=SlideShowWindows(1).View.CurrentShowPosition

Page 1272: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CustomDocumentPropertiesPropertyReturnsaDocumentPropertiescollectionthatrepresentsallthecustomdocumentpropertiesforthespecifiedpresentation.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1273: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheBuiltInDocumentPropertiespropertytoreturnthecollectionofbuilt-indocumentproperties.

Page 1274: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsastaticcustompropertynamed"Complete"fortheactivepresentation.

Application.ActivePresentation.CustomDocumentProperties_

.AddName:="Complete",LinkToContent:=False,_

Type:=msoPropertyTypeBoolean,Value:=False

Thisexampleprintsouttheactivepresentationifthevalueofthe"Complete"custompropertyisTrue.

WithApplication.ActivePresentation

If.CustomDocumentProperties("complete")Then.PrintOut

EndWith

Page 1275: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1276: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DashStylePropertyReturnsorsetsthedashstyleforthespecifiedline.Read/writeMsoLineDashStyle.

MsoLineDashStylecanbeoneoftheseMsoLineDashStyleconstants.msoLineDashmsoLineDashDotmsoLineDashDotDotmsoLineDashStyleMixedmsoLineLongDashmsoLineLongDashDotmsoLineRoundDotmsoLineSolidmsoLineSquareDot

expression.DashStyle

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1277: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsabluedashedlinetomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(10,10,250,250).Line

.DashStyle=msoLineDashDotDot

.ForeColor.RGB=RGB(50,0,128)

EndWith

Page 1278: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DateAndTimePropertyReturnsaHeaderFooterobjectthatrepresentsthedateandtimeitemthatappearsinthelower-leftcornerofaslideorintheupper-rightcornerofanotespage,handout,oroutline.Read-only.

Page 1279: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedateandtimeformatfortheslidemasterintheactivepresentation.Thissettingwillapplytoallslidesthatarebasedonthismaster.

SetmyPres=Application.ActivePresentation

WithmyPres.SlideMaster.HeadersFooters.DateAndTime

.Format=ppDateTimeMdyy

.UseFormat=True

EndWith

Page 1280: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DateTimePropertyReturnsaDaterepresentingthedateandtimeacommentwascreated.

expression.DateTime

expressionRequired.AnexpressionthatreturnsaCommentobject.

Page 1281: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Don'tconfusethispropertywiththeDateAndTimeproperty,whichappliestotheheadersandfootersofaslide.

Page 1282: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleprovidesinformationaboutallthecommentsforagivenslide.

SubListComments()

DimcmtExistingAsComment

DimstrAuthorInfoAsString

ForEachcmtExistingInActivePresentation.Slides(1).Comments

WithcmtExisting

strAuthorInfo=strAuthorInfo&.Author&"'scomment#"&_

.AuthorIndex&"("&.Text&")wascreatedon"&_

.DateTime&vbCrLf

EndWith

Next

IfstrAuthorInfo<>""Then

MsgBoxstrAuthorInfo

Else

MsgBox"Therearenocommentsonthisslide."

EndIf

EndSub

Page 1283: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DeceleratePropertySetsorreturnsaSinglethatrepresentsthepercentofthedurationoverwhichatimingdecelerationshouldtakeplace.Forexample,avalueof0.9meansthatandecelerationshouldstartatthedefaultspeed,andthenstarttoslowdownafterthefirsttenpercentoftheanimation.Read/write.

expression.Decelerate

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1284: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsashapeandaddsananimationthatstartsatthedefaultspeedandslowsdownafter70%oftheanimationhasfinished.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsrectangleandsetsanimationeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine_

.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectPathDiamond)

'Slowstheeffectafterseventypercentoftheanimationhasfinished

WitheffDiamond.Timing

.Decelerate=0.3

EndWith

EndSub

Page 1285: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1286: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DefaultLanguageIDPropertyReturnsorsetsthedefaultlanguageofapresentation.WhenyousettheDefaultLanguageIDpropertyforapresentation,yousetitforallsubsequentnewpresentationsaswell.Read/writeMsoLanguageID.

MsoLanguageIDcanbeoneoftheseMsoLanguageIDconstants.msoLanguageIDAfrikaansmsoLanguageIDAlbanianmsoLanguageIDAmharicmsoLanguageIDArabicmsoLanguageIDArabicAlgeriamsoLanguageIDArabicBahrainmsoLanguageIDArabicEgyptmsoLanguageIDArabicIraqmsoLanguageIDArabicJordanmsoLanguageIDArabicKuwaitmsoLanguageIDArabicLebanonmsoLanguageIDArabicLibyamsoLanguageIDArabicMoroccomsoLanguageIDArabicOmanmsoLanguageIDArabicQatarmsoLanguageIDArabicSyriamsoLanguageIDArabicTunisiamsoLanguageIDArabicUAEmsoLanguageIDArabicYemenmsoLanguageIDArmenianmsoLanguageIDAssamesemsoLanguageIDAzeriCyrillicmsoLanguageIDAzeriLatinmsoLanguageIDBasquemsoLanguageIDBelgianDutch

Page 1287: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDBelgianFrenchmsoLanguageIDBengalimsoLanguageIDBrazilianPortuguesemsoLanguageIDBulgarianmsoLanguageIDBurmesemsoLanguageIDByelorussianmsoLanguageIDCatalanmsoLanguageIDCherokeemsoLanguageIDChineseHongKongmsoLanguageIDChineseMacaomsoLanguageIDChineseSingaporemsoLanguageIDCroatianmsoLanguageIDCzechmsoLanguageIDDanishmsoLanguageIDDutchmsoLanguageIDEnglishAUSmsoLanguageIDEnglishBelizemsoLanguageIDEnglishCanadianmsoLanguageIDEnglishCaribbeanmsoLanguageIDEnglishIrelandmsoLanguageIDEnglishJamaicamsoLanguageIDEnglishNewZealandmsoLanguageIDEnglishPhilippinesmsoLanguageIDEnglishSouthAfricamsoLanguageIDEnglishTrinidadmsoLanguageIDEnglishUKmsoLanguageIDEnglishUSmsoLanguageIDEnglishZimbabwemsoLanguageIDEstonianmsoLanguageIDFaeroesemsoLanguageIDFarsimsoLanguageIDFinnishmsoLanguageIDFrench

Page 1288: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDFrenchCameroonmsoLanguageIDFrenchCanadianmsoLanguageIDFrenchCotedIvoiremsoLanguageIDFrenchLuxembourgmsoLanguageIDFrenchMalimsoLanguageIDFrenchMonacomsoLanguageIDFrenchReunionmsoLanguageIDFrenchSenegalmsoLanguageIDFrenchWestIndiesmsoLanguageIDFrenchZairemsoLanguageIDFrisianNetherlandsmsoLanguageIDGaelicIrelandmsoLanguageIDGaelicScotlandmsoLanguageIDGalicianmsoLanguageIDGeorgianmsoLanguageIDGermanmsoLanguageIDGermanAustriamsoLanguageIDGermanLiechtensteinmsoLanguageIDGermanLuxembourgmsoLanguageIDGreekmsoLanguageIDGujaratimsoLanguageIDHebrewmsoLanguageIDHindimsoLanguageIDHungarianmsoLanguageIDIcelandicmsoLanguageIDIndonesianmsoLanguageIDInuktitutmsoLanguageIDItalianmsoLanguageIDJapanesemsoLanguageIDKannadamsoLanguageIDKashmirimsoLanguageIDKazakhmsoLanguageIDKhmer

Page 1289: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDKirghizmsoLanguageIDKonkanimsoLanguageIDKoreanmsoLanguageIDLaomsoLanguageIDLatvianmsoLanguageIDLithuanianmsoLanguageIDMacedonianmsoLanguageIDMalayalammsoLanguageIDMalayBruneiDarussalammsoLanguageIDMalaysianmsoLanguageIDMaltesemsoLanguageIDManipurimsoLanguageIDMarathimsoLanguageIDMexicanSpanishmsoLanguageIDMixedmsoLanguageIDMongolianmsoLanguageIDNepalimsoLanguageIDNonemsoLanguageIDNoProofingmsoLanguageIDNorwegianBokmolmsoLanguageIDNorwegianNynorskmsoLanguageIDOriyamsoLanguageIDPolishmsoLanguageIDPunjabimsoLanguageIDRhaetoRomanicmsoLanguageIDRomanianmsoLanguageIDRomanianMoldovamsoLanguageIDRussianmsoLanguageIDRussianMoldovamsoLanguageIDSamiLappishmsoLanguageIDSanskritmsoLanguageIDSerbianCyrillicmsoLanguageIDSerbianLatin

Page 1290: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDSesothomsoLanguageIDSimplifiedChinesemsoLanguageIDSindhimsoLanguageIDSlovakmsoLanguageIDSlovenianmsoLanguageIDSorbianmsoLanguageIDSpanishmsoLanguageIDSpanishArgentinamsoLanguageIDSpanishBoliviamsoLanguageIDSpanishChilemsoLanguageIDSpanishColombiamsoLanguageIDSpanishCostaRicamsoLanguageIDSpanishDominicanRepublicmsoLanguageIDSpanishEcuadormsoLanguageIDSpanishElSalvadormsoLanguageIDSpanishGuatemalamsoLanguageIDSpanishHondurasmsoLanguageIDSpanishModernSortmsoLanguageIDSpanishNicaraguamsoLanguageIDSpanishPanamamsoLanguageIDSpanishParaguaymsoLanguageIDSpanishPerumsoLanguageIDSpanishPuertoRicomsoLanguageIDSpanishUruguaymsoLanguageIDSpanishVenezuelamsoLanguageIDSutumsoLanguageIDSwahilimsoLanguageIDSwedishmsoLanguageIDSwedishFinlandmsoLanguageIDSwissFrenchmsoLanguageIDSwissGermanmsoLanguageIDSwissItalianmsoLanguageIDTajik

Page 1291: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDTamilmsoLanguageIDTatarmsoLanguageIDTelugumsoLanguageIDThaimsoLanguageIDTibetanmsoLanguageIDTraditionalChinesemsoLanguageIDTsongamsoLanguageIDTswanamsoLanguageIDTurkishmsoLanguageIDTurkmenmsoLanguageIDUkrainianmsoLanguageIDUrdumsoLanguageIDUzbekCyrillicmsoLanguageIDUzbekLatinmsoLanguageIDVendamsoLanguageIDVietnamesemsoLanguageIDWelshmsoLanguageIDXhosamsoLanguageIDZulumsoLanguageIDPortuguese

expression.DefaultLanguageID

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

YoucanusetheLanguageIDpropertytosettextrangestodifferentlanguages.Anytextrangenotexplicitlysettoanotherlanguagewillbesettothisdefault.

Page 1292: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedefaultlanguagefortheactivepresentation,andallsubsequentnewpresentations,toGerman.

ActivePresentation.DefaultLanguageID=msoLanguageIDGerman

Page 1293: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DefaultShapePropertyReturnsaShapeobjectthatrepresentsthedefaultshapeforthepresentation.Read-only.

Page 1294: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsashapetoslideoneintheactivepresentation,setsthedefaultfillcolortoredforshapesinthepresentation,andthenaddsanothershape.Thissecondshapewillautomaticallyhavethenewdefaultfillcolorappliedtoit.

WithApplication.ActivePresentation

Setsld1Shapes=.Slides(1).Shapes

sld1Shapes.AddShapemsoShape16pointStar,20,20,100,100

.DefaultShape.Fill.ForeColor.RGB=RGB(255,0,0)

sld1Shapes.AddShapemsoShape16pointStar,150,20,100,100

EndWith

Page 1295: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DefaultSpacingPropertyReturnsorsetsthedefaulttab-stopspacingforthespecifiedtext,inpoints.Read/writeSingle.

Page 1296: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedefaulttab-stopspacingto0.5inch(36points)forthetextinshapetwoonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes(2).TextFrame_

.Ruler.TabStops.DefaultSpacing=36

Page 1297: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DefaultWebOptionsPropertyReturnstheDefaultWebOptionsobject,whichcontainsglobalapplication-levelattributesusedbyMicrosoftPowerPointwhenyoupublishorsaveacompleteorpartialpresentationasaWebpageoropenaWebpage.Read-only.

Page 1298: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecheckstoseewhetherthedefaultdocumentencodingisWestern.Ifitis,thestringstrDocEncodingissetaccordingly.

SetobjAppWebOptions=Application.DefaultWebOptions

WithobjAppWebOptions

If.Encoding=msoEncodingWesternThen

strDocEncoding="Western"

EndIf

EndWith

Page 1299: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DepthPropertyReturnsorsetsthedepthoftheshape'sextrusion.Canbeavaluefrom–600through9600(positivevaluesproduceanextrusionwhosefrontfaceistheoriginalshape;negativevaluesproduceanextrusionwhosebackfaceistheoriginalshape).Read/writeSingle.

Page 1300: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsanovaltomyDocument,andthenspecifiesthattheovalbeextrudedtoadepthof50pointsandthattheextrusionbepurple.

SetmyDocument=ActivePresentation.Slides(1)

SetmyShape=myDocument.Shapes_

.AddShape(msoShapeOval,90,90,90,40)

WithmyShape.ThreeD

.Visible=True

.Depth=50

'RGBvalueforpurple

.ExtrusionColor.RGB=RGB(255,100,255)

EndWith

Page 1301: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DesignPropertyReturnsaDesignobjectrepresentingadesign.

expression.Design

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1302: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsatitlemaster.

SubAddDesignMaster

ActivePresentation.Slides(1).Design.AddTitleMaster

EndSub

Page 1303: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DesignsPropertyReturnsaDesignsobject,representingacollectionofdesigns.

expression.Designs

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1304: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampledisplaysamessageforeachdesignintheactivepresentation.

SubAddDesignMaster()

DimdesNameAsDesign

WithActivePresentation

ForEachdesNameIn.Designs

MsgBox"Thedesignnameis"&.Designs.Item(desName.Index).Name

Next

EndWith

EndSub

Page 1305: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DiagramPropertyReturnsaDiagramobjecttowhichadiagramnodebelongs.

expression.Diagram

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1306: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsadiagramtoaslide.

SubAddADiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addsdiagramandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramCycle,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreeadditionalchildnodes

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

'Automaticallyformatsthediagram

dgnNode.Diagram.AutoFormat=msoTrue

EndSub

Page 1307: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DiagramNodePropertyReturnsaDiagramNodeobjectthatrepresentsanodeinadiagram.

expression.DiagramNode

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1308: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsapyramidcharttothefirstslideintheactivepresentation.

SubCreatePyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintCountAsInteger

'Addpyramiddiagramtocurrentdocument

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

'Addfirstdiagramnodechild

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addthreemorediagramchildnodes

ForintCount=1To3

dgnNode.AddNode

NextintCount

EndSub

Page 1309: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DimPropertyReturnsaColorFormatobjectthatrepresentsthecolortodimtoafterananimationisfinished.

expression.Dim

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1310: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthecolortodimtoaftertheanimation.

SubQueryDimColor()

DimeffDimAsEffect

SeteffDim=ActivePresentation.Slides(1).TimeLine.MainSequence(1)

MsgBoxeffDim.EffectInformation.Dim

EndSub

Page 1311: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DimColorPropertyReturnsorsetsaColorFormatobjectthatrepresentsthecolorofthespecifiedshapeafterit'sbeenbuilt.Read-only.

Page 1312: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyoudon'tgettheeffectyouexpect,checkyourotherbuildsettings.Youwon'tseetheeffectoftheDimColorpropertyunlesstheTextLevelEffectpropertyoftheAnimationSettingsobjectissettosomethingotherthanppAnimateLevelNone,theAfterEffectpropertyissettoppAfterEffectDim,andtheAnimatepropertyissettoTrue.Inaddition,ifthespecifiedshapeistheonlyitemorthelastitemtobebuiltontheslide,theshapewon'tbedimmed.Tochangethebuildorderoftheshapesonaslide,usetheAnimationOrderproperty.

Page 1313: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaslidethatcontainsbothatitleandathree-itemlisttotheactivepresentation,setsthetitleandlisttobedimmedafterbeingbuilt,andsetsthecolorthateachofthemwillbedimmedto.

WithActivePresentation.Slides.Add(2,ppLayoutText).Shapes

With.Item(1)

.TextFrame.TextRange.Text="Sampletitle"

With.AnimationSettings

.TextLevelEffect=ppAnimateByAllLevels

.AfterEffect=ppAfterEffectDim

.DimColor.SchemeColor=ppShadow

.Animate=True

EndWith

EndWith

With.Item(2)

.TextFrame.TextRange.Text="Itemone"_

&Chr(13)&"Itemtwo"

With.AnimationSettings

.TextLevelEffect=ppAnimateByFirstLevel

.AfterEffect=ppAfterEffectDim

.DimColor.RGB=RGB(100,150,130)

.Animate=True

EndWith

EndWith

EndWith

Page 1314: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1315: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DirectionPropertyReturnsanMsoAnimDirectionthatrepresentsthedirectionusedforananimationeffect.Thispropertycanbeusedonlyiftheeffectusesadirection.Read/write.

MsoAnimDirectioncanbeoneoftheseMsoAnimDirectionconstants.msoAnimDirectionAcrossmsoAnimDirectionBottommsoAnimDirectionBottomLeftmsoAnimDirectionBottomRightmsoAnimDirectionCentermsoAnimDirectionClockwisemsoAnimDirectionCounterclockwisemsoAnimDirectionCycleClockwisemsoAnimDirectionCycleCounterclockwisemsoAnimDirectionDownmsoAnimDirectionDownLeftmsoAnimDirectionDownRightmsoAnimDirectionFontAllCapsmsoAnimDirectionFontBoldmsoAnimDirectionFontItalicmsoAnimDirectionFontShadowmsoAnimDirectionFontStrikethroughmsoAnimDirectionFontUnderlinemsoAnimDirectionGradualmsoAnimDirectionHorizontalmsoAnimDirectionHorizontalInmsoAnimDirectionHorizontalOutmsoAnimDirectionInmsoAnimDirectionInBottommsoAnimDirectionInCenter

Page 1316: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimDirectionInSlightlymsoAnimDirectionInstantmsoAnimDirectionLeftmsoAnimDirectionNonemsoAnimDirectionOrdinalMaskmsoAnimDirectionOutmsoAnimDirectionOutBottommsoAnimDirectionOutCentermsoAnimDirectionOutSlightlymsoAnimDirectionRightmsoAnimDirectionSlightlymsoAnimDirectionTopmsoAnimDirectionTopLeftmsoAnimDirectionTopRightmsoAnimDirectionUpmsoAnimDirectionUpLeftmsoAnimDirectionUpRightmsoAnimDirectionVerticalmsoAnimDirectionVerticalInmsoAnimDirectionVerticalOut

expression.Direction

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1317: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashape,andanimatestheshapetoflyinfromtheleft.

SubAddShapeSetAnimFly()

DimeffFlyAsEffect

DimshpCubeAsShape

SetshpCube=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeCube,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffFly=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpCube,effectId:=msoAnimEffectFly)

effFly.Timing.Duration=3

effFly.EffectParameters.Direction=msoAnimDirectionLeft

EndSub

Page 1318: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1319: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayAlertsPropertySetsorreturnsaPpAlertLevelconstantthatrepresentswhetherMicrosoftPowerPointdisplaysalertswhilerunningamacro.Read/write.

PpAlertLevelcanbeoneofthesePpAlertLevelconstants.ppAlertsAllAllmessageboxesandalertsaredisplayed;errorsarereturnedtothemacro.ppAlertsNoneDefault.Noalertsormessageboxesaredisplayed.Ifamacroencountersamessagebox,thedefaultvalueischosenandthemacrocontinues.

expression.DisplayAlerts

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Page 1320: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThevalueoftheDisplayAlertspropertyisnotresetonceamacrostopsrunning;itismaintainedthroughoutasession.Itisnotstoredacrosssessions,sowhenPowerPointbegins,itresettoppAlertsNone.

Page 1321: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowinglineofcodeinstructsPowerPointtodisplayallmessageboxesandalerts,returningerrorstothemacro.

SubSetAlert

Application.DisplayAlerts=ppAlertsAll

EndSub

Page 1322: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1323: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayAutoCorrectOptionsPropertyMsoTrueforMicrosoftPowerPointtodisplaytheAutoCorrectOptionsbutton.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.DisplayAutoCorrectOptions

expressionRequired.AnexpressionthatreturnsanAutoCorrectobject.

Page 1324: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisablesdisplayoftheAutoCorrectOptionsandAutoLayoutOptionsbuttons.

SubHideAutoCorrectOpButton()

WithApplication.AutoCorrect

.DisplayAutoCorrectOptions=msoFalse

.DisplayAutoLayoutOptions=msoFalse

EndWith

EndSub

Page 1325: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1326: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayAutoLayoutOptionsPropertyMsoTrueforMicrosoftPowerPointtodisplaytheAutoLayoutOptionsbutton.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.DisplayAutoLayoutOptions

expressionRequired.AnexpressionthatreturnsanAutoCorrectobject.

Page 1327: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisablesdisplayoftheAutoCorrectOptionsandAutoLayoutOptionsbuttons.

SubHideAutoCorrectOpButton()

WithApplication.AutoCorrect

.DisplayAutoCorrectOptions=msoFalse

.DisplayAutoLayoutOptions=msoFalse

EndWith

EndSub

Page 1328: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1329: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayCommentsPropertyDetermineswhethercommentsaredisplayedinthespecifiedpresentation.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueCommentsaredisplayedinthespecifiedpresentation.

Page 1330: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplehidescommentsintheactivepresentation.

ActivePresentation.DisplayComments=msoFalse

Page 1331: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1332: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayGridLinesPropertyMsoTruetodisplaygridlinesinMicrosoftPowerPoint.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.DisplayGridLines

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Page 1333: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampletogglesthedisplayofthegridlinesinPowerPoint.

SubToggleGridLines()

WithApplication

If.DisplayGridLines=msoTrueThen

.DisplayGridLines=msoFalse

Else

.DisplayGridLines=msoTrue

EndIf

EndWith

EndSub

Page 1334: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1335: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayMasterShapesPropertyDetermineswhetherthespecifiedslideorrangeofslidesdisplaysthebackgroundobjectsontheslidemaster.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideorrangeofslidesdisplaysthebackgroundobjectsontheslidemaster.Thesebackgroundobjectscanincludetext,drawings,OLEobjects,andclipartyouaddtotheslidemaster.Headersandfootersaren'tincluded.

Page 1336: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Whenyoucreateanewslide,thedefaultvalueforthispropertyismsoTrue.Ifyoucopyaslidefromanotherpresentation,itretainsthesettingithadintheoriginalpresentation.Thatis,iftheslideomittedslidemasterbackgroundobjectsintheoriginalpresentation,itwillomittheminthenewpresentationaswell.

Notethatthelookoftheslide'sbackgroundisdeterminedbythecolorschemeandbackgroundaswellasbythebackgroundobjects.IfsettingtheDisplayMasterShapespropertyalonedoesn'tgiveyoutheresultsyouwant,trysettingtheFollowMasterBackgroundandColorSchemepropertiesaswell.

Page 1337: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecopiesslideonefrompresentationtwo,pastesitattheendofpresentationone,andmatchestheslide'sbackground,colorscheme,andbackgroundobjectstotherestofpresentationone.

Presentations(2).Slides(1).Copy

WithPresentations(1).Slides.Paste

.FollowMasterBackground=True

.ColorScheme=Presentations(1).SlideMaster.ColorScheme

.DisplayMasterShapes=msoTrue

EndWith

Page 1338: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayNamePropertyReturnsaStringthatrepresentsthenameofananimationeffect.Read-only.

expression.DisplayName

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1339: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthenameforthefirstanimationsequenceofthefirstslide'smainanimationsequencetimeline.

SubDisplayEffectName()

DimeffMainAsEffect

SeteffMain=ActivePresentation.Slides(1).TimeLine.MainSequence(1)

MsgBoxeffMain.DisplayName

EndSub

Page 1340: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1341: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayOnTitleSlidePropertyDetermineswhetherthefooter,dateandtime,andslidenumberappearonthetitleslide.Read/writeMsoTriState.Appliestoslidemasters.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThefooter,dateandtime,andslidenumberappearsonallslidesexceptthetitleslide.msoTriStateMixedmsoTriStateTogglemsoTrueThefooter,dateandtime,andslidenumberappearonthetitleslide.

Page 1342: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefooter,dateandtime,andslidenumbertonotappearonthetitleslide.

Application.ActivePresentation.SlideMaster.HeadersFooters_

.DisplayOnTitleSlide=msoFalse

Page 1343: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1344: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayPasteOptionsPropertyMsoTrueforMicrosoftPowerPointtodisplaythePasteOptionsbutton,whichdisplaysdirectlyundernewlypastedtext.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.DisplayPasteOptions

expressionRequired.AnexpressionthatreturnsanOptionsobject.

Page 1345: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleenablesthePasteOptionsbuttoniftheoptionhasbeendisabled.

SubShowPasteOptionsButton()

WithApplication.Options

If.DisplayPasteOptions=FalseThen

.DisplayPasteOptions=True

EndIf

EndWith

EndSub

Page 1346: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1347: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplaySlideMiniaturePropertyDeterminesifandwhentheslideminiaturewindowisdisplayedautomatically.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheslideminiaturewindowisnotdisplayedautomatically.msoTriStateMixedmsoTriStateTogglemsoTrueTheslideminiaturewindowisdisplayedautomaticallywhenthedocumentwindowisinblack-and-whiteview,theslidepaneiszoomedtogreaterthan150%ofthefitpercentage,oramasterviewisvisible.

Page 1348: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyisnotavailableinslideshowviewandslidesorterview.Theslideminiaturewindowisn'tamemberofeithertheWindowscollectionortheSlideShowWindowscollection.

Thefitpercentageisdeterminedbyacombinationofthesizeoftheslidepaneandthesizeofthepresentationwindow.Todeterminethefitpercentage,settheZoomToFitpropertytoTrueandthenreturnthevalueoftheZoomproperty.

Page 1349: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Ifdocumentwindowoneisinslideview,thisexampledisplaystheslideminiaturewindow.

WithWindows(1).View

If.Type=ppViewSlideThen.DisplaySlideMiniature=msoTrue

EndWith

Page 1350: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DocumentLibraryVersionsPropertyReturnsaDocumentLibraryVersionscollectionthatrepresentsthecollectionofversionsofasharedpresentationthathasversioningenabledandthatisstoredinadocumentlibraryonaserver.

expression.DocumentLibraryVersions

expressionRequired.AnexpressionthatreturnsaPresentationobject.

Page 1351: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplereturnsthecollectionofversionsfortheactivepresentation.Thisexampleassumesthattheactivepresentationhasversioningenabledandisstoredinashareddocumentlibraryonaserver.

DimobjVersionsAsDocumentLibraryVersions

SetobjVersions=ActivePresentation.DocumentLibraryVersions

Page 1352: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DropPropertyForcalloutswithanexplicitlysetdropvalue,thispropertyreturnstheverticaldistance(inpoints)fromtheedgeofthetextboundingboxtotheplacewherethecalloutlineattachestothetextbox.ThisdistanceismeasuredfromthetopofthetextboxunlesstheAutoAttachpropertyissettoTrueandthetextboxistotheleftoftheoriginofthecalloutline(theplacethatthecalloutpointsto).Inthiscasethedropdistanceismeasuredfromthebottomofthetextbox.Read-onlySingle.

Page 1353: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheCustomDropmethodtosetthevalueofthisproperty.

Thevalueofthispropertyaccuratelyreflectsthepositionofthecalloutlineattachmenttothetextboxonlyifthecallouthasanexplicitlysetdropvalue—thatis,ifthevalueoftheDropTypepropertyismsoCalloutDropCustom.

Page 1354: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplereplacesthecustomdropforshapeoneonmyDocumentwithoneoftwopresetdrops,dependingonwhetherthecustomdropvalueisgreaterthanorlessthanhalftheheightofthecallouttextbox.Fortheexampletowork,shapeonemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).Callout

If.DropType=msoCalloutDropCustomThen

If.Drop<.Parent.Height/2Then

.PresetDropmsoCalloutDropTop

Else

.PresetDropmsoCalloutDropBottom

EndIf

EndIf

EndWith

Page 1355: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1356: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DropTypePropertyReturnsavaluethatindicateswherethecalloutlineattachestothecallouttextbox.Read-onlyMsoCalloutDropType.

MsoCalloutDropTypecanbeoneoftheseMsoCalloutDropTypeconstants.msoCalloutDropBottommsoCalloutDropCentermsoCalloutDropCustommsoCalloutDropMixedmsoCalloutDropTop

expression.DropType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1357: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfthecalloutdroptypeismsoCalloutDropCustom,thevaluesoftheDropandAutoAttachpropertiesandtherelativepositionsofthecallouttextboxandcalloutlineorigin(theplacethatthecalloutpointsto)areusedtodeterminewherethecalloutlineattachestothetextbox.

Thispropertyisread-only.UsethePresetDropmethodtosetthevalueofthisproperty.

Page 1358: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecheckstodeterminewhethershapethreeonmyDocumentisacalloutwithacustomdrop.Ifitis,thecodereplacesthecustomdropwithoneoftwopresetdrops,dependingonwhetherthecustomdropvalueisgreaterthanorlessthanhalftheheightofthecallouttextbox.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.Type=msoCalloutThen

With.Callout

If.DropType=msoCalloutDropCustomThen

If.Drop<.Parent.Height/2Then

.PresetDropmsoCalloutDropTop

Else

.PresetDropmsoCalloutDropBottom

EndIf

EndIf

EndWith

EndIf

EndWith

Page 1359: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DurationPropertyReturnsorsetsaSinglethatrepresentsthelengthofananimationinseconds.Read/write.

expression.Duration

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1360: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapeandananimationtothatshape,thensetsitsanimationduration.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsshapeandsetsanimationeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=sh,effectId:=msoAnimEffectPathDiamond)

'Setsdurationofeffect

effDiamond.Timing.Duration=5

EndSub

Page 1361: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1362: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EditingTypePropertyIfthespecifiednodeisavertex,thispropertyreturnsavaluethatindicateshowchangesmadetothenodeaffectthetwosegmentsconnectedtothenode.Ifthenodeisacontrolpointforacurvedsegment,thispropertyreturnstheeditingtypeoftheadjacentvertex.Read-onlyMsoEditingType.

MsoEditingTypecanbeoneoftheseMsoEditingTypeconstants.msoEditingAutomsoEditingCornermsoEditingSmoothmsoEditingSymmetric

expression.EditingType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1363: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyisread-only.UsetheSetEditingTypemethodtosetthevalueofthisproperty.

Page 1364: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesallcornernodestosmoothnodesinshapethreeonmyDocument.Shapethreemustbeafreeformdrawing.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

Forn=1to.Count

If.Item(n).EditingType=msoEditingCornerThen

.SetEditingTypen,msoEditingSmooth

EndIf

Next

EndWith

Page 1365: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EffectInformationPropertyReturnsanEffectInformationobjectrepresentinginformationforaspecifiedanimationeffect.

expression.EffectInformation

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1366: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsasoundeffecttothemainanimationsequenceforagivenshape.

SubAddSoundEffect()

DimeffMainAsEffect

SeteffMain=ActivePresentation.Slides(1).TimeLine.MainSequence(1)

MsgBoxeffMain.EffectInformation.AfterEffect

EndSub

Page 1367: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EffectParametersPropertyReturnsanEffectParametersobjectrepresentinganimationeffectproperties.

expression.EffectParameters

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1368: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaneffecttothemainanimationsequenceonthefirstslide.ThiseffectchangesthefontforthefirstshapetoBroadway.

SubChangeFontName()

DimshpTextAsShape

DimeffNewAsEffect

SetshpText=ActivePresentation.Slides(1).Shapes(1)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpText,EffectId:=msoAnimEffectChangeFont)

effNew.EffectParameters.FontName="Broadway"

EndSub

Page 1369: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1370: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EffectTypePropertySetsorreturnsanMsoAnimEffectconstantthatrepresentsananimationeffecttype.Read/write.

MsoAnimEffectcanbeoneoftheseMsoAnimEffectconstants.msoAnimEffectAppearmsoAnimEffectArcUpmsoAnimEffectAscendmsoAnimEffectBlastmsoAnimEffectBlindsmsoAnimEffectBoldFlashmsoAnimEffectBoldRevealmsoAnimEffectBoomerangmsoAnimEffectBouncemsoAnimEffectBoxmsoAnimEffectBrushOnColormsoAnimEffectBrushOnUnderlinemsoAnimEffectCenterRevolvemsoAnimEffectChangeFillColormsoAnimEffectChangeFontmsoAnimEffectChangeFontColormsoAnimEffectChangeFontSizemsoAnimEffectChangeFontStylemsoAnimEffectChangeLineColormsoAnimEffectCheckerboardmsoAnimEffectCirclemsoAnimEffectColorBlendmsoAnimEffectColorRevealmsoAnimEffectColorWavemsoAnimEffectComplementaryColormsoAnimEffectComplementaryColor2

Page 1371: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectContrastingColormsoAnimEffectCrawlmsoAnimEffectCreditsmsoAnimEffectCustommsoAnimEffectDarkenmsoAnimEffectDesaturatemsoAnimEffectDescendmsoAnimEffectDiamondmsoAnimEffectDissolvemsoAnimEffectEaseInmsoAnimEffectExpandmsoAnimEffectFademsoAnimEffectFadedAscendmsoAnimEffectFadedSwivelmsoAnimEffectFadedZoommsoAnimEffectFlashBulbmsoAnimEffectFlashOncemsoAnimEffectFlickermsoAnimEffectFlipmsoAnimEffectFloatmsoAnimEffectFlymsoAnimEffectFoldmsoAnimEffectGlidemsoAnimEffectGrowAndTurnmsoAnimEffectGrowShrinkmsoAnimEffectGrowWithColormsoAnimEffectLightenmsoAnimEffectMediaPausemsoAnimEffectMediaPlaymsoAnimEffectMediaStopmsoAnimEffectPath4PointStarmsoAnimEffectPath5PointStarmsoAnimEffectPath6PointStar

Page 1372: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectPath8PointStarmsoAnimEffectPathArcDownmsoAnimEffectPathArcLeftmsoAnimEffectPathArcRightmsoAnimEffectPathArcUpmsoAnimEffectPathBeanmsoAnimEffectPathBounceLeftmsoAnimEffectPathBounceRightmsoAnimEffectPathBuzzsawmsoAnimEffectPathCirclemsoAnimEffectPathCrescentMoonmsoAnimEffectPathCurvedSquaremsoAnimEffectPathCurvedXmsoAnimEffectPathCurvyLeftmsoAnimEffectPathCurvyRightmsoAnimEffectPathCurvyStarmsoAnimEffectPathDecayingWavemsoAnimEffectPathDiagonalDownRightmsoAnimEffectPathDiagonalUpRightmsoAnimEffectPathDiamondmsoAnimEffectPathDownmsoAnimEffectPathEqualTrianglemsoAnimEffectPathFigure8FourmsoAnimEffectPathFootballmsoAnimEffectPathFunnelmsoAnimEffectPathHeartmsoAnimEffectPathHeartbeatmsoAnimEffectPathHexagonmsoAnimEffectPathHorizontalFigure8msoAnimEffectPathInvertedSquaremsoAnimEffectPathInvertedTrianglemsoAnimEffectPathLeftmsoAnimEffectPathLoopdeLoop

Page 1373: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectPathNeutronmsoAnimEffectPathOctagonmsoAnimEffectPathParallelogrammsoAnimEffectPathPeanutmsoAnimEffectPathPentagonmsoAnimEffectPathPlusmsoAnimEffectPathPointyStarmsoAnimEffectPathRightTrianglemsoAnimEffectPathSCurve1msoAnimEffectPathSCurve2msoAnimEffectPathSineWavemsoAnimEffectPathSpiralLeftmsoAnimEffectPathSpiralRightmsoAnimEffectPathSpringmsoAnimEffectPathSquaremsoAnimEffectPathStairsDownmsoAnimEffectPathSwooshmsoAnimEffectPathTeardropmsoAnimEffectPathTrapezoidmsoAnimEffectPathTurnDownmsoAnimEffectPathTurnRightmsoAnimEffectPathTurnUpmsoAnimEffectPathTurnUpRightmsoAnimEffectPathVerticalFigure8msoAnimEffectPathWavemsoAnimEffectPathZigzagmsoAnimEffectPeekmsoAnimEffectPinwheelmsoAnimEffectPlusmsoAnimEffectRandomBarsmsoAnimEffectRandomEffectsmsoAnimEffectRiseUpmsoAnimEffectShimmer

Page 1374: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectSlingmsoAnimEffectSpinmsoAnimEffectSpinnermsoAnimEffectSpiralmsoAnimEffectSplitmsoAnimEffectStretchmsoAnimEffectStretchymsoAnimEffectStripsmsoAnimEffectStyleEmphasismsoAnimEffectSwishmsoAnimEffectSwivelmsoAnimEffectTeetermsoAnimEffectThinLinemsoAnimEffectTransparencymsoAnimEffectUnfoldmsoAnimEffectVerticalGrowmsoAnimEffectWavemsoAnimEffectWedgemsoAnimEffectWheelmsoAnimEffectWhipmsoAnimEffectWipemsoAnimEffectZipmsoAnimEffectZoommsoAnimEffectLightSpeed

expression.EffectType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1375: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplechangesananimationeffecttoarandombaranimation.

SubChangeEffectType()

DimeffRandomAsEffect

SeteffRandom=ActivePresentation.Slides(1).TimeLine.MainSequence(1)

effRandom.EffectType=msoAnimEffectRandomBars

EndSub

Page 1376: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EmailSubjectPropertyReturnsorsetsthetextstringofthehyperlinksubjectline.ThesubjectlineisappendedtotheInternetaddress(URL)ofthehyperlink.Read/writeString.

Page 1377: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyiscommonlyusedwithe-mailhyperlinks.Thevalueofthispropertytakesprecedenceoveranye-mailsubjectspecifiedintheAddresspropertyofthesameHyperlinkobject.

Page 1378: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthee-mailsubjectlineofthefirsthyperlinkonslideoneintheactivepresentation.

ActivePresentation.Slides(1).Hyperlinks(1)_

.EmailSubject="QuoteRequest"

Page 1379: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1380: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EmbeddablePropertyDetermineswhetherthespecifiedfontcanbeembeddedinthepresentation.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedfontcanbeembeddedinthepresentation.

expression.Embeddable

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1381: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecheckseachfontusedintheactivepresentationtodeterminewhetherit'sembeddableinthepresentation.

ForEachusedFontInPresentations(1).Fonts

IfusedFont.EmbeddableThen

MsgBoxusedFont.Name&":Embeddable"

Else

MsgBoxusedFont.Name&":Notembeddable"

EndIf

NextusedFont

Page 1382: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1383: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EmbeddedPropertyDetermineswhetherthespecifiedfontisembeddedinthepresentation.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedfontisembeddedinthepresentation.

expression.Embedded

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1384: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecheckseachfontusedintheactivepresentationtodeterminewhetherit'sembeddedinthepresentation.

ForEachusedFontInPresentations(1).Fonts

IfusedFont.EmbeddedThen

MsgBoxusedFont.Name&":Embedded"

Else

MsgBoxusedFont.Name&":Notembedded"

EndIf

NextusedFont

Page 1385: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1386: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EmbossPropertyDetermineswhetherthecharacterformatisembossed.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThecharacterformatisnotembossed.msoTriStateMixedThespecifiedtextrangecontainsbothembossedandunembossedcharacters.msoTriStateTogglemsoTrueThecharacterformatisembossed.

expression.Emboss

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1387: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetitletextonslideonetoembossed.

Application.ActivePresentation.Slides(1).Shapes.Title_

.TextFrame.TextRange.Font.Emboss=msoTrue

Page 1388: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1389: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EncodingPropertyReturnsorsetsthedocumentencoding(codepageorcharacterset)tobeusedbytheWebbrowserwhenyouviewthesaveddocument.Thedefaultisthesystemcodepage.Read/writeMsoEncoding.

AlthoughMsoEncodingcanbeoneoftheseMsoEncodingconstants,youcannotnotuseanyoftheconstantsthathavethesuffixAutoDetect.ThoseconstantsareusedbytheReloadAsmethod.msoEncodingArabicmsoEncodingArabicASMOmsoEncodingArabicAutoDetectmsoEncodingArabicTransparentASMOmsoEncodingAutoDetectmsoEncodingBalticmsoEncodingCentralEuropeanmsoEncodingCyrillicmsoEncodingCyrillicAutoDetectmsoEncodingEBCDICArabicmsoEncodingEBCDICDenmarkNorwaymsoEncodingEBCDICFinlandSwedenmsoEncodingEBCDICFrancemsoEncodingEBCDICGermanymsoEncodingEBCDICGreekmsoEncodingEBCDICGreekModernmsoEncodingEBCDICHebrewmsoEncodingEBCDICIcelandicmsoEncodingEBCDICInternationalmsoEncodingEBCDICItalymsoEncodingEBCDICJapaneseKatakanaExtendedmsoEncodingEBCDICJapaneseKatakanaExtendedAndJapanesemsoEncodingEBCDICJapaneseLatinExtendedAndJapanese

Page 1390: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoEncodingEBCDICKoreanExtendedmsoEncodingEBCDICKoreanExtendedAndKoreanmsoEncodingEBCDICLatinAmericaSpainmsoEncodingEBCDICMultilingualROECELatin2msoEncodingEBCDICRussianmsoEncodingEBCDICSerbianBulgarianmsoEncodingEBCDICSimplifiedChineseExtendedAndSimplifiedChinesemsoEncodingEBCDICThaimsoEncodingEBCDICTurkishmsoEncodingEBCDICTurkishLatin5msoEncodingEBCDICUnitedKingdommsoEncodingEBCDICUSCanadamsoEncodingEBCDICUSCanadaAndJapanesemsoEncodingEBCDICUSCanadaAndTraditionalChinesemsoEncodingEUCChineseSimplifiedChinesemsoEncodingEUCJapanesemsoEncodingEUCKoreanmsoEncodingEUCTaiwaneseTraditionalChinesemsoEncodingEuropa3msoEncodingExtAlphaLowercasemsoEncodingGreekmsoEncodingGreekAutoDetectmsoEncodingHebrewmsoEncodingHZGBSimplifiedChinesemsoEncodingIA5GermanmsoEncodingIA5IRVmsoEncodingIA5NorwegianmsoEncodingIA5SwedishmsoEncodingISO2022CNSimplifiedChinesemsoEncodingISO2022CNTraditionalChinesemsoEncodingISO2022JPJISX02011989msoEncodingISO2022JPJISX02021984msoEncodingISO2022JPNoHalfwidthKatakana

Page 1391: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoEncodingISO2022KR

msoEncodingISO6937NonSpacingAccentmsoEncodingISO885915Latin9msoEncodingISO88591Latin1msoEncodingISO88592CentralEuropemsoEncodingISO88593Latin3msoEncodingISO88594BalticmsoEncodingISO88595CyrillicmsoEncodingISO88596ArabicmsoEncodingISO88597GreekmsoEncodingISO88598HebrewmsoEncodingISO88599TurkishmsoEncodingJapaneseAutoDetectmsoEncodingJapaneseShiftJISmsoEncodingKOI8RmsoEncodingKOI8UmsoEncodingKoreanmsoEncodingKoreanAutoDetectmsoEncodingKoreanJohabmsoEncodingMacCroatiamsoEncodingMacCyrillicmsoEncodingMacGreek1msoEncodingMacHebrewmsoEncodingMacIcelandicmsoEncodingMacJapanesemsoEncodingMacKoreanmsoEncodingMacLatin2msoEncodingMacRomanmsoEncodingMacRomaniamsoEncodingMacSimplifiedChineseGB2312msoEncodingMacTraditionalChineseBig5msoEncodingMacTurkishmsoEncodingMacUkraine

Page 1392: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoEncodingOEMArabicmsoEncodingOEMBalticmsoEncodingOEMCanadianFrenchmsoEncodingOEMCyrillicmsoEncodingOEMCyrillicIImsoEncodingOEMGreek437GmsoEncodingOEMHebrewmsoEncodingOEMIcelandicmsoEncodingOEMModernGreekmsoEncodingOEMMultilingualLatinImsoEncodingOEMMultilingualLatinIImsoEncodingOEMNordicmsoEncodingOEMPortuguesemsoEncodingOEMTurkishmsoEncodingOEMUnitedStatesmsoEncodingSimplifiedChineseAutoDetectmsoEncodingSimplifiedChineseGBKmsoEncodingT61msoEncodingTaiwanCNSmsoEncodingTaiwanEtenmsoEncodingTaiwanIBM5550msoEncodingTaiwanTCAmsoEncodingTaiwanTeleTextmsoEncodingTaiwanWangmsoEncodingThaimsoEncodingTraditionalChineseAutoDetectmsoEncodingTraditionalChineseBig5msoEncodingTurkishmsoEncodingUnicodeBigEndianmsoEncodingUnicodeLittleEndianmsoEncodingUSASCIImsoEncodingUTF7msoEncodingUTF8

Page 1393: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoEncodingVietnamesemsoEncodingWestern

msoEncodingMacArabic

expression.Encoding

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1394: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplecheckstoseewhetherthedefaultdocumentencodingisWestern,andthenitsetsthestringstrDocEncodingaccordingly.

IfApplication.DefaultWebOptions.Encoding=msoEncodingWesternThen

strDocEncoding="Western"

Else

strDocEncoding="Other"

EndIf

Page 1395: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndPropertyReturnsthenumberofthelastslideinthespecifiedprintrange.Read-onlyLong.

Page 1396: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysamessagethatindicatesthestartingandendingslidenumbersforprintrangeoneintheactivepresentation.

WithActivePresentation.PrintOptions.Ranges

If.Count>0Then

With.Item(1)

MsgBox"Printrange1startsonslide"&.Start&_

"andendsonslide"&.End

EndWith

EndIf

EndWith

Page 1397: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1398: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndArrowheadLengthPropertyReturnsorsetsthelengthofthearrowheadattheendofthespecifiedline.Read/writeMsoArrowheadLength.

MsoArrowheadLengthcanbeoneoftheseMsoArrowheadLengthconstants.msoArrowheadLengthMediummsoArrowheadLengthMixedmsoArrowheadLongmsoArrowheadShort

expression.EndArrowheadLength

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1399: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsalinetomyDocument.There'sashort,narrowovalontheline'sstartingpointandalong,widetriangleonitsendpoint.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(100,100,200,300).Line

.BeginArrowheadLength=msoArrowheadShort

.BeginArrowheadStyle=msoArrowheadOval

.BeginArrowheadWidth=msoArrowheadNarrow

.EndArrowheadLength=msoArrowheadLong

.EndArrowheadStyle=msoArrowheadTriangle

.EndArrowheadWidth=msoArrowheadWide

EndWith

Page 1400: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1401: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndArrowheadStylePropertyReturnsorsetsthestyleofthearrowheadattheendofthespecifiedline.Read/writeMsoArrowheadStyle.

MsoArrowheadStylecanbeoneoftheseMsoArrowheadStyleconstants.msoArrowheadDiamondmsoArrowheadNonemsoArrowheadOpenmsoArrowheadOvalmsoArrowheadStealthmsoArrowheadStyleMixedmsoArrowheadTriangle

expression.EndArrowheadStyle

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1402: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsalinetomyDocument.There'sashort,narrowovalontheline'sstartingpointandalong,widetriangleonitsendpoint.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(100,100,200,300).Line

.BeginArrowheadLength=msoArrowheadShort

.BeginArrowheadStyle=msoArrowheadOval

.BeginArrowheadWidth=msoArrowheadNarrow

.EndArrowheadLength=msoArrowheadLong

.EndArrowheadStyle=msoArrowheadTriangle

.EndArrowheadWidth=msoArrowheadWide

EndWith

Page 1403: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1404: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndArrowheadWidthPropertyReturnsorsetsthewidthofthearrowheadattheendofthespecifiedline.Read/writeMsoArrowheadWidth.

MsoArrowheadWidthcanbeoneoftheseMsoArrowheadWidthconstants.msoArrowheadNarrowmsoArrowheadWidemsoArrowheadWidthMediummsoArrowheadWidthMixed

expression.EndArrowheadWidth

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1405: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsalinetomyDocument.There'sashort,narrowovalontheline'sstartingpointandalong,widetriangleonitsendpoint.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(100,100,200,300).Line

.BeginArrowheadLength=msoArrowheadShort

.BeginArrowheadStyle=msoArrowheadOval

.BeginArrowheadWidth=msoArrowheadNarrow

.EndArrowheadLength=msoArrowheadLong

.EndArrowheadStyle=msoArrowheadTriangle

.EndArrowheadWidth=msoArrowheadWide

EndWith

Page 1406: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1407: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndConnectedPropertyDetermineswhethertheendofthespecifiedconnectorisconnectedtoashape.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheendofthespecifiedconnectorisconnectedtoashape.

expression.EndConnected

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1408: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Iftheendoftheconnectorrepresentedbyshapethreeonthefirstslideintheactivepresentationisconnectedtoashape,thisexamplestorestheconnectionsitenumberinthevariableoldEndConnSite,storesareferencetotheconnectedshapeintheobjectvariableoldEndConnShape,andthendisconnectstheendoftheconnectorfromtheshape.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.ConnectorThen

With.ConnectorFormat

If.EndConnectedThen

oldEndConnSite=.EndConnectionSite

SetoldEndConnShape=.EndConnectedShape

.EndDisconnect

EndIf

EndWith

EndIf

EndWith

Page 1409: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndConnectedShapePropertyReturnsaShapeobjectthatrepresentstheshapethattheendofthespecifiedconnectorisattachedto.Read-only.

NoteIftheendofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.

Page 1410: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleassumesthatthefistslideintheactivepresentationalreadycontainstwoshapesattachedbyaconnectornamed"Conn1To2."Thecodeaddsarectangleandaconnectortothefirstslide.Theendofthenewconnectorwillbeattachedtothesameconnectionsiteastheendoftheconnectornamed"Conn1To2,"andthebeginningofthenewconnectorwillbeattachedtoconnectionsiteoneonthenewrectangle.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

Setr3=.AddShape(msoShapeRectangle,100,420,200,100)

.AddConnector(msoConnectorCurve,0,0,10,10)_

.Name="Conn1To3"

With.Item("Conn1To2").ConnectorFormat

endConnSite1=.EndConnectionSite

SetendConnShape1=.EndConnectedShape

EndWith

With.Item("Conn1To3").ConnectorFormat

.BeginConnectr3,1

.EndConnectendConnShape1,endConnSite1

EndWith

EndWith

Page 1411: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndConnectionSitePropertyReturnsanintegerthatspecifiestheconnectionsitethattheendofaconnectorisconnectedto.Read-onlyLong.

NoteIftheendofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.

Page 1412: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleassumesthatthefirstslideintheactivepresentationalreadycontainstwoshapesattachedbyaconnectornamed"Conn1To2."Thecodeaddsarectangleandaconnectortothefirstslide.Theendofthenewconnectorwillbeattachedtothesameconnectionsiteastheendoftheconnectornamed"Conn1To2,"andthebeginningofthenewconnectorwillbeattachedtoconnectionsiteoneonthenewrectangle.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

Setr3=.AddShape(msoShapeRectangle,100,420,200,100)

.AddConnector(msoConnectorCurve,0,0,10,10)_

.Name="Conn1To3"

With.Item("Conn1To2").ConnectorFormat

endConnSite1=.EndConnectionSite

SetendConnShape1=.EndConnectedShape

EndWith

With.Item("Conn1To3").ConnectorFormat

.BeginConnectr3,1

.EndConnectendConnShape1,endConnSite1

EndWith

EndWith

Page 1413: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EndingSlidePropertyReturnsorsetsthelastslidetobedisplayedinthespecifiedslideshow.Read/writeLong.

Page 1414: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowoftheactivepresentation,startingwithslidetwoandendingwithslidefour.

WithActivePresentation.SlideShowSettings

.RangeType=ppShowSlideRange

.StartingSlide=2

.EndingSlide=4

.Run

EndWith

Page 1415: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1416: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EntryEffectPropertyFortheAnimationSettingsobject,thispropertyreturnsorsetsthespecialeffectappliedtotheanimationforthespecifiedshape.FortheSlideShowTransitionobject,thispropertyreturnsorsetsthespecialeffectappliedtothespecifiedslidetransition.Read/writePpEntryEffect.

PpEntryEffectcanbeoneofthesePpEntryEffectconstants.ppEffectAppearppEffectBlindsHorizontalppEffectBlindsVerticalppEffectBoxInppEffectBoxOutppEffectCheckerboardAcrossppEffectCheckerboardDownppEffectCoverDownppEffectCoverLeftppEffectCoverLeftDownppEffectCoverLeftUpppEffectCoverRightppEffectCoverRightDownppEffectCoverRightUpppEffectCoverUpppEffectCrawlFromDownppEffectCrawlFromLeftppEffectCrawlFromRightppEffectCrawlFromUpppEffectCutppEffectCutThroughBlackppEffectDissolveppEffectFadeppEffectFlashOnceFast

Page 1417: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppEffectFlashOnceMediumppEffectFlashOnceSlowppEffectFlyFromBottomppEffectFlyFromBottomLeftppEffectFlyFromBottomRightppEffectFlyFromLeftppEffectFlyFromRightppEffectFlyFromTopppEffectFlyFromTopLeftppEffectFlyFromTopRightppEffectMixedppEffectNoneppEffectPeekFromDownppEffectPeekFromLeftppEffectPeekFromRightppEffectPeekFromUpppEffectRandomppEffectRandomBarsHorizontalppEffectRandomBarsVerticalppEffectSpiralppEffectSplitHorizontalInppEffectSplitHorizontalOutppEffectSplitVerticalInppEffectSplitVerticalOutppEffectStretchAcrossppEffectStretchDownppEffectStretchLeftppEffectStretchRightppEffectStretchUpppEffectStripsDownLeftppEffectStripsDownRightppEffectStripsLeftDownppEffectStripsLeftUp

Page 1418: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppEffectStripsRightDownppEffectStripsRightUpppEffectStripsUpLeftppEffectStripsUpRightppEffectSwivelppEffectUncoverDownppEffectUncoverLeftppEffectUncoverLeftDownppEffectUncoverLeftUpppEffectUncoverRightppEffectUncoverRightDownppEffectUncoverRightUpppEffectUncoverUpppEffectWipeDownppEffectWipeLeftppEffectWipeRightppEffectWipeUpppEffectZoomBottomppEffectZoomCenterppEffectZoomInppEffectZoomInSlightlyppEffectZoomOutppEffectZoomOutSlightly

expression.EntryEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1419: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IftheTextLevelEffectpropertyforthespecifiedshapeissettoppAnimateLevelNone(thedefaultvalue)ortheAnimatepropertyissettoFalse,youwon'tseethespecialeffectyou'veappliedwiththeEntryEffectproperty.

Page 1420: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsatitleslidetotheactivepresentationandsetsthetitletoflyinfromtherightwheneverit'sanimatedduringaslideshow.

WithActivePresentation.Slides.Add(1,ppLayoutTitleOnly).Shapes(1)

.TextFrame.TextRange.Text="Sampletitle"

With.AnimationSettings

.TextLevelEffect=ppAnimateByAllLevels

.EntryEffect=ppEffectFlyFromRight

.Animate=True

EndWith

EndWith

Page 1421: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1422: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EnvelopeVisiblePropertyDetermineswhetherthee-mailmessageheaderisvisibleinthedocumentwindow.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueThee-mailmessageheaderisvisibleinthedocumentwindow.

expression.EnvelopeVisible

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1423: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthee-mailmessageheader.

ActivePresentation.EnvelopeVisible=msoTrue

Page 1424: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1425: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ExitPropertyReturnsorsetsanMsoTriStatethatrepresentswhethertheanimationeffectisanexiteffect.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheeffectisnotanexiteffect.msoTriStateMixedmsoTriStateTogglemsoTrueTheeffectisanexiteffect.

expression.Exit

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1426: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplayswhetherthespecifiedanimationisanexitanimationeffect.

SubEffectExit()

DimeffMainAsEffect

SeteffMain=ActivePresentation.Slides(1).TimeLine.MainSequence(1)

IfeffMain.Exit=msoTrueThen

MsgBox"Thisisanexitanimationeffect."

Else

MsgBox"Thisisnotanexitanimationeffect."

EndIf

EndSub

Page 1427: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1428: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ExtraColorsPropertyReturnsanExtraColorsobjectthatrepresentstheextracolorsavailableinthespecifiedpresentation.Read-only.

Page 1429: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsarectangletoslideoneintheactivepresentationandsetsitsfillforegroundcolortothefirstextracolor.Iftherehasn'tbeenatleastoneextracolordefinedforthepresentation,thisexamplewillfail.

WithActivePresentation

Setrect=.Slides(1).Shapes_

.AddShape(msoShapeRectangle,50,50,100,200)

rect.Fill.ForeColor.RGB=.ExtraColors(1)

EndWith

Page 1430: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ExtrusionColorPropertyReturnsaColorFormatobjectthatrepresentsthecoloroftheshape'sextrusion.Read-only.

Page 1431: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsanovaltomyDocument,andthenspecifiesthattheovalbeextrudedtoadepthof50pointsandthattheextrusionbepurple.

SetmyDocument=ActivePresentation.Slides(1)

SetmyShape=myDocument.Shapes_

.AddShape(msoShapeOval,90,90,90,40)

WithmyShape.ThreeD

.Visible=True

.Depth=50

'RGBvalueforpurple

.ExtrusionColor.RGB=RGB(255,100,255)

EndWith

Page 1432: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1433: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ExtrusionColorTypePropertyReturnsorsetsavaluethatindicateswhethertheextrusioncolorisbasedontheextrudedshape'sfill(thefrontfaceoftheextrusion)andautomaticallychangeswhentheshape'sfillchanges,orwhethertheextrusioncolorisindependentoftheshape'sfill.Read/writeMsoExtrusionColorType.

MsoExtrusionColorTypecanbeoneoftheseMsoExtrusionColorTypeconstants.msoExtrusionColorAutomaticExtrusioncolorisbasedonshapefill.msoExtrusionColorCustomExtrusioncolorisindependentofshapefill.msoExtrusionColorTypeMixed

expression.ExtrusionColorType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1434: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

IfshapeoneonmyDocumenthasanautomaticextrusioncolor,thisexamplegivestheextrusionacustomyellowcolor.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

If.ExtrusionColorType=msoExtrusionColorAutomaticThen

.ExtrusionColor.RGB=RGB(240,235,16)

EndIf

EndWith

Page 1435: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1436: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FarEastLineBreakControlPropertyReturnsorsetsthelinebreakcontroloptionifyouhaveanAsianlanguagesettingspecifiedTrueifthelinebreakcontroloptionisselected.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

Page 1437: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleselectsthelinebreakoptionforthetextinshapeoneonthefirstslideoftheactivepresentation.

ActivePresentation.Slides(1).Shapes(1).TextFrame_

.TextRange.ParagraphFormat.FarEastLineBreakControl=msoTrue

Page 1438: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1439: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FarEastLineBreakLanguagePropertyReturnsorsetsthelanguageusedtodeterminewhichlinebreaklevelisusedwhenthelinebreakcontroloptionisturnedon.Read/writeMsoFarEastLineBreakLanguageID.

MsoFarEastLineBreakLanguageIDcanbeoneoftheseMsoFarEastLineBreakLanguageIDconstants.MsoFarEastLineBreakLanguageJapaneseMsoFarEastLineBreakLanguageKoreanMsoFarEastLineBreakLanguageSimplifiedChineseMsoFarEastLineBreakLanguageTraditionalChinese

expression.FarEastLineBreakLanguage

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1440: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowingexamplesetsthelinebreaklanguagetoJapanese.

ActivePresentation.FarEastLineBreakLanguage=_

MsoFarEastLineBreakLanguageJapanese

Page 1441: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1442: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FarEastLineBreakLevelPropertyReturnsorsetsthelinebreakbaseduponAsiancharacterlevel.Read/writeLong.Read/writePpFarEastLineBreakLevel.

PpFarEastLineBreakLevelcanbeoneofthesePpFarEastLineBreakLevelconstants.ppFarEastLineBreakLevelCustomppFarEastLineBreakLevelNormalppFarEastLineBreakLevelStrict

expression.FarEastLineBreakLevel

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1443: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetslinebreakcontroltouselevelonekinsokucharacters.

ActivePresentation.FarEastLineBreakLevel=_

ppFarEastLineBreakLevelNormal

Page 1444: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1445: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FeatureInstallPropertyReturnsorsetshowMicrosoftPowerPointhandlescallstomethodsandpropertiesthatrequirefeaturesnotyetinstalled.Read/writeMsoFeatureInstall.

MsoFeatureInstallcanbeoneoftheseMsoFeatureInstallconstants.msoFeatureInstallNoneDefault.Atrappablerun-timeautomationerrorisgeneratedwhenuninstalledfeaturesarecalled.msoFeatureInstallOnDemandAdialogboxisdisplayedpromptingtheusertoinstallnewfeatures.msoFeatureInstallOnDemandWithUIAprogressmeterisdisplayedduringinstallation.Theuserisn'tpromptedtoinstallnewfeatures.

expression.FeatureInstall

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1446: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucanusethemsoFeatureInstallOnDemandWithUIconstanttopreventusersfrombelievingthattheapplicationisn'trespondingwhileafeatureisbeinginstalled.UsethemsoFeatureInstallNoneconstantwitherrortrappingroutinestoexcludeend-userfeatureinstallation.

NoteIfyourefertoanuninstalledpresentationdesigntemplateinastring,arun-timeerrorisgenerated.ThetemplateisnotinstalledautomaticallyregardlessofyourFeatureInstallpropertysetting.TousetheApplyTemplatemethodforatemplatethatisnotcurrentlyinstalled,youfirstmustinstalltheadditionaldesigntemplates.Todoso,installtheAdditionalDesignTemplatesforPowerPointbyrunningtheMicrosoftOfficeinstallationprogram(availablethroughtheAdd/RemoveProgramsiconinWindowsControlPanel).

Page 1447: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechecksthevalueoftheFeatureInstallproperty.IfthepropertyissettomsoFeatureInstallNone,thecodedisplaysamessageboxthataskstheuserwhethertheywanttochangethepropertysetting.Iftheuserresponds"Yes",thepropertyissettomsoFeatureInstallOnDemand.

WithApplication

If.FeatureInstall=msoFeatureInstallNoneThen

Reply=MsgBox("Uninstalledfeaturesforthis"_

&"application"&vbCrLf_

&"maycausearun-timeerrorwhencalled."&vbCrLf_

&vbCrLf_

&"Wouldyouliketochangethissetting"&vbCrLf_

&"toautomaticallyinstallmissingfeatureswhencalled?"_

,52,"FeatureInstallSetting")

IfReply=6Then

.FeatureInstall=msoFeatureInstallOnDemand

EndIf

EndIf

EndWith

Page 1448: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1449: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FileDialogPropertyReturnsaFileDialogobjectthatrepresentsasingleinstanceofafiledialogbox.

expression.FileDialog(Type)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

TypeRequiredMsoFileDialogType.Thetypeofdialogtoreturn.

MsoFileDialogTypecanbeoneoftheseMsoFileDialogTypeconstants.msoFileDialogFilePickermsoFileDialogFolderPickermsoFileDialogOpenmsoFileDialogSaveAs

Page 1450: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaystheSaveAsdialogbox.

SubShowSaveAsDialog()

DimdlgSaveAsAsFileDialog

SetdlgSaveAs=Application.FileDialog(_

Type:=msoFileDialogSaveAs)

dlgSaveAs.Show

EndSub

ThisexampledisplaystheOpendialogboxandallowsausertoselectmultiplefilestoopen.

SubShowFileDialog()

DimdlgOpenAsFileDialog

SetdlgOpen=Application.FileDialog(_

Type:=msoFileDialogOpen)

WithdlgOpen

.AllowMultiSelect=True

.Show

EndWith

EndSub

Page 1451: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FileFindPropertyReturnsanIFindobjectthatcanbeusedtolocatefiles.Read-only.

expression.FileFind

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1452: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaysthenamesofallfilesintheMyDocumentsfolderthatbeginwith"New."

WithApplication.FileFind

.Name="New*.*"

.SearchPath="C:\MyDocuments"

.Execute

ForI=1To.Results.Count

MsgBox.Results(I)

Next

EndWith

Page 1453: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FileNamePropertyReturnsorsetsthepathandfilenameoftheWebpresentationcreatedwhenallorpartoftheactivepresentationispublished.Read/writeString.

Page 1454: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheFileNamepropertygeneratesanerrorifafolderinthespecifiedpathdoesnotexist.

Page 1455: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htmandsavesitintheTestfolder.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

Page 1456: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FileSearchPropertyReturnsaFileSearchobjectthatcanbeusedtosearchforfilesusingeitheranabsoluteorrelativepath.Read-only.

Page 1457: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaysthenamesofallfilesintheMyDocumentsfolderthatbeginwith"New."

WithApplication.FileSearch

.FileName="New*.*"

.LookIn="C:\MyDocuments"

.Execute

ForI=1To.FoundFiles.Count

MsgBox.FoundFiles(I)

Next

EndWith

Page 1458: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FillPropertyReturnsaFillFormatobjectthatcontainsfillformattingpropertiesforthespecifiedshape.Read-only.

Page 1459: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocumentandthensetstheforegroundcolor,backgroundcolor,andgradientfortherectangle'sfill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeRectangle,90,90,90,50).Fill

.ForeColor.RGB=RGB(128,0,0)

.BackColor.RGB=RGB(170,170,170)

.TwoColorGradientmsoGradientHorizontal,1

EndWith

Page 1460: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FilterEffectPropertyReturnsaFilterEffectobjectthatrepresentsafiltereffectforananimationbehavior.Read-only.

expression.FilterEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1461: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetothefirstslideoftheactivepresentationandsetsafiltereffectanimationbehavior.

SubChangeFilterEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(msoAnimTypeFilter)

WithbhvEffect.FilterEffect

.Type=msoAnimFilterEffectTypeWipe

.Subtype=msoAnimFilterEffectSubtypeUp

.Reveal=msoTrue

EndWith

EndSub

Page 1462: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FirstChildPropertyReturnsaDiagramNodeobjectrepresentingthefirstdiagramnodeinacollectionofdiagramnodes.

expression.FirstChild

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1463: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesanewdiagramandidentifiesthefirstchilddiagramnode.

SubFirstChildNodeHello()

DimdgnNodeAsDiagramNode

DimdgnFirstAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramOrgChart,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

SetdgnFirst=dgnNode.Children.FirstChild

dgnFirst.Shape.TextFrame.TextRange.Text="HereIam!"

EndSub

Page 1464: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FirstMarginPropertyReturnsorsetsthefirst-lineindentforthespecifiedoutlinelevel,inpoints.Read/writeSingle.

Page 1465: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifaparagraphbeginswithabullet,thebulletpositionisdeterminedbytheFirstMarginproperty,andthepositionofthefirsttextcharacterintheparagraphisdeterminedbytheLeftMarginproperty.

NoteTheRulerLevelscollectioncontainsfiveRulerLevelobjects,eachofwhichcorrespondstooneofthepossibleoutlinelevels.TheFirstMarginpropertyvaluefortheRulerLevelobjectthatcorrespondstothefirstoutlinelevelhasavalidrangeof(-9.0to4095.875).ThevalidrangefortheFirstMarginpropertyvaluesfortheRulerLevelobjectsthatcorrespondtothesecondthroughthefifthoutlinelevelsaredeterminedasfollows:

Themaximumvalueisalways4095.875.TheminimumvalueisthemaximumassignedvaluebetweentheFirstMarginpropertyandLeftMarginpropertyofthepreviouslevelplus9.

YoucanusethefollowingequationstodeterminetheminimumvaluefortheFirstMarginproperty.Index,theindexnumberoftheRulerLevelobject,indicatestheobject’scorrespondingoutlinelevel.TodeterminetheminimumFirstMarginpropertyvaluesfortheRulerLevelobjectsthatcorrespondtothesecondthroughthefifthoutlinelevels,substitute2,3,4,or5fortheindexplaceholder.

Minimum(RulerLevel(index).FirstMargin)=Maximum(RulerLevel(index-1).FirstMargin,RulerLevel(index-1).LeftMargin)+9

Minimum(RulerLevel(index).LeftMargin)=Maximum(RulerLevel(index-1).FirstMargin,RulerLevel(index-1).LeftMargin)+9

Page 1466: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation.

WithApplication.ActivePresentation_

.SlideMaster.TextStyles(ppBodyStyle)

With.Ruler.Levels(1)

.FirstMargin=9

.LeftMargin=54

EndWith

EndWith

Page 1467: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FirstSlideNumberPropertyReturnsorsetstheslidenumberforthefirstslideinthepresentation.Read/writeLong.

Page 1468: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Theslidenumberistheactualnumberthatwillappearinthelower-rightcorneroftheslidewhenyoudisplayslidenumbers.Thisnumberisdeterminedbythenumber(order)oftheslidewithinthepresentation(theSlideIndexpropertyvalue)andthestartingslidenumberforthepresentation(theFirstSlideNumberpropertyvalue).Theslidenumberwillalwaysbeequaltothestartingslidenumber+theslideindexnumber–1.TheSlideNumberpropertyreturnstheslidenumber.

Page 1469: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleshowshowchangingthefirstslidenumberintheactivepresentationaffectstheslidenumberofaspecificslide.

WithApplication.ActivePresentation

.PageSetup.FirstSlideNumber=1'startsslidenumberingat1

MsgBox.Slides(2).SlideNumber'returns2

.PageSetup.FirstSlideNumber=10'startsslidenumberingat10

MsgBox.Slides(2).SlideNumber'returns11

EndWith

Page 1470: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1471: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FitToPagePropertyDetermineswhethertheslideswillbescaledtofillthepagethey'reprintedon.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.TheslideswillhavethedimensionsspecifiedinthePageSetupdialogbox,whetherornotthosedimensionsmatchthepagethey'reprintedon.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideswillbescaledtofillthepagethey'reprintedon,regardlessofthevaluesintheHeightandWidthboxesinthePageSetupdialogbox(Filemenu)

Page 1472: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintstheactivepresentationandscaleseachslidetofittheprintedpage.

WithActivePresentation

.PrintOptions.FitToPage=msoTrue

.PrintOut

EndWith

Page 1473: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FolderSuffixPropertyReturnsthefoldersuffixthatMicrosoftPowerPointuseswhenyousaveorpublishacompleteorpartialpresentationasaWebpage,uselongfilenames,andchoosetosavesupportingfilesinaseparatefolder(thatis,iftheUseLongFileNamesandOrganizeInFolderpropertiesaresettoTrue).Read-onlyString.

Page 1474: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

NewlycreatedpresentationsusethesuffixreturnedbytheFolderSuffixpropertyoftheDefaultWebOptionsobject.ThevalueoftheFolderSuffixpropertyoftheWebOptionsobjectmaydifferfromthatoftheDefaultWebOptionsobjectifthepresentationwaspreviouslyeditedinadifferentlanguageversionofMicrosoftPowerPoint.YoucanusetheUseDefaultFolderSuffixmethodtochangethesuffixtothatofthelanguageyouarecurrentlyusinginMicrosoftOffice.

Bydefault,thenameofthesupportingfolderisthenameoftheWebpageplusanunderscore(_),aperiod(.),orahyphen(-)andtheword"files"(appearinginthelanguageoftheversionofPowerPointinwhichthefilewassavedasaWebpage).Forexample,supposethatyouusetheDutchlanguageversionofPowerPointtosaveafilecalled"Page1"asaWebpage.ThedefaultnameofthesupportingfolderwouldbePage1_bestanden.

ThefollowingtablelistseachlanguageversionofOffice,andgivesitscorrespondingfoldersuffix.Forthelanguagesthatarenotlistedinthetable,thesuffix".files"isused.

Language

Language FoldersuffixArabic .filesBasque _fitxategiakBrazilian _arquivosBulgarian .filesCatalan _fitxersChinese-Simplified .filesChinese-Traditional .filesCroatian _datotekeCzech _souboryDanish -filerDutch _bestanden

Page 1475: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

English _filesEstonian _failidFinnish _tiedostotFrench _fichiersGerman -DateienGreek .filesHebrew .filesHungarian _elemeiItalian -fileJapanese .filesKorean .filesLatvian _failsLithuanian _bylosNorwegian -filerPolish _plikiPortuguese _ficheirosRomanian .filesRussian .filesSerbian(Cyrillic) .filesSerbian(Latin) _fajloviSlovakian .filesSlovenian _datotekeSpanish _archivosSwedish -filerThai .filesTurkish _dosyalarUkranian .filesVietnamese .files

Page 1476: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplereturnsthefoldersuffixusedbypresentationone.ThesuffixisreturnedinthestringvariablestrFolderSuffix.

strFolderSuffix=Presentations(1).WebOptions.FolderSuffix

Page 1477: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1478: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FollowColorsPropertyReturnsorsetstheextenttowhichthecolorsinthespecifiedobjectfollowtheslide'scolorscheme.ThespecifiedobjectmustbeachartcreatedineitherMicrosoftGraphorMicrosoftOrganizationChart.Read/writePpFollowColors.

PpFollowColorscanbeoneofthesePpFollowColorsconstants.ppFollowColorsNoneThechartcolorsdon'tfollowtheslide'scolorscheme.ppFollowColorsMixedppFollowColorsSchemeAllthecolorsinthechartfollowtheslide'scolorscheme.ppFollowColorsTextAndBackgroundOnlythetextandbackgroundfollowtheslide'scolorscheme.

expression.FollowColors

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1479: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatthetextandbackgroundofshapetwoonslideoneintheactivepresentationfollowtheslide'scolorscheme.ShapetwomustbeachartcreatedineitherMicrosoftGraphorMicrosoftOrganizationChart.

ActivePresentation.Slides(1).Shapes(2).OLEFormat.FollowColors=_

ppFollowColorsTextAndBackground

Page 1480: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1481: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FollowMasterBackgroundPropertyDetermineswhethertheslideorrangeofslidesfollowstheslidemasterbackground.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedslideorrangeofslideshasacustombackground.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideorrangeofslidesfollowstheslidemasterbackground.

Page 1482: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Whenyoucreateanewslide,thedefaultvalueforthispropertyisTrue.Ifyoucopyaslidefromanotherpresentation,itretainsthesettingithadintheoriginalpresentation.Thatis,iftheslidefollowedtheslidemasterbackgroundintheoriginalpresentation,itwillautomaticallyfollowtheslidemasterbackgroundinthenewpresentation;or,iftheslidehadacustombackground,itwillretainthatcustombackground.

Notethatthelookoftheslide'sbackgroundisdeterminedbythecolorschemeandbackgroundobjectsaswellasbythebackgrounditself.IfsettingtheFollowMasterBackgroundpropertyalonedoesn'tgiveyoutheresultsyouwant,trysettingtheColorSchemeandDisplayMasterShapespropertiesaswell.

Page 1483: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecopiesslideonefrompresentationtwo,pastestheslideattheendofpresentationone,andmatchestheslide'sbackground,colorscheme,andbackgroundobjectstotherestofpresentationone.

Presentations(2).Slides(1).Copy

WithPresentations(1).Slides.Paste

.FollowMasterBackground=msoTrue

.ColorScheme=Presentations(1).SlideMaster.ColorScheme

.DisplayMasterShapes=True

EndWith

Page 1484: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontPropertyReturnsaFontobjectthatrepresentscharacterformatting.Read-only.

Page 1485: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheformattingforthetextinshapeoneonslideoneintheactivepresentation.

WithActivePresentation.Slides(1).Shapes(1)

With.TextFrame.TextRange.Font

.Size=48

.Name="Palatino"

.Bold=True

.Color.RGB=RGB(255,127,255)

EndWith

EndWith

Thisexamplesetsthecolorandfontnameforbulletsinshapetwoonslideone.

WithActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat.Bullet

.Visible=True

With.Font

.Name="Palatino"

.Color.RGB=RGB(0,0,255)

EndWith

EndWith

EndWith

Page 1486: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1487: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontBoldPropertyDetermineswhetherthefontinthespecifiedWordArtisbold.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThefontinthespecifiedWordArtisbold.

Page 1488: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthefonttoboldforshapethreeonmyDocumentiftheshapeisWordArt.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.Type=msoTextEffectThen

.TextEffect.FontBold=msoTrue

EndIf

EndWith

Page 1489: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1490: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontItalicPropertyDetermineswhetherthefontinthespecifiedWordArtisitalic.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThefontinthespecifiedWordArtisitalic.

Page 1491: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefonttoitalicfortheshapenamed"WordArt4"onmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes("WordArt4").TextEffect.FontItalic=msoTrue

Page 1492: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontNamePropertyReturnsorsetsthenameofthefontinthespecifiedWordArt.Read/writeString.

Page 1493: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefontnameto"CourierNew"forshapethreeonmyDocumentiftheshapeisWordArt.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.Type=msoTextEffectThen

.TextEffect.FontName="CourierNew"

EndIf

EndWith

Page 1494: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1495: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontsPropertyFontspropertyasitappliestothePresentationobject.

ReturnsaFontscollectionthatrepresentsallfontsusedinthespecifiedpresentation.Read-only.

expression.Fonts

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

FontspropertyasitappliestotheDefaultWebOptionsobject.

ReturnsaWebPageFontscollectionrepresentingthesetofavailablefontsforsavingapresentationasaWebpage.Read-only.

expression.Fonts

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1496: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestothePresentationobject.

ThisexamplereplacestheTimesNewRomanfontwiththeCourierfontintheactivepresentation.

Application.ActivePresentation.Fonts_

.Replace"TimesNewRoman","Courier"

AsitappliestotheDefaultWebOptionsobject.

Thisexamplesetsthefixed-widthfontdefaultWeboption,specifiedbythecharactersetconstantmsoCharacterSetEnglishWesternEuropeanOtherLatinScript,tobeCourierNew10points.

WithApplication.DefaultWebOptions_

.Fonts(msoCharacterSetEnglishWesternEuropeanOtherLatinScript)

.FixedWidthFont="CourierNew"

.FixedWidthFontSize=10

EndWith

Page 1497: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FontSizePropertyReturnsorsetsthefontsizeforthespecifiedWordArt,inpoints.Read/writeSingle.

Page 1498: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefontsizeto16pointsfortheshapenamed"WordArt4"inmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes("WordArt4").TextEffect.FontSize=16

Page 1499: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FooterPropertyReturnsaHeaderFooterobjectthatrepresentsthefooterthatappearsatthebottomofaslideorinthelower-leftcornerofanotespage,handout,oroutline.Read-only.

Page 1500: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetextforthefooterontheslidemasterintheactivepresentationandsetsthefooter,dateandtime,andslidenumbertoappearonthetitleslide.

WithApplication.ActivePresentation.SlideMaster.HeadersFooters

.Footer.Text="Introduction"

.DisplayOnTitleSlide=True

EndWith

Page 1501: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ForeColorPropertyReturnsorsetsaColorFormatobjectthatrepresentstheforegroundcolorforthefill,line,orshadow.Read/write.

Page 1502: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocumentandthensetstheforegroundcolor,backgroundcolor,andgradientfortherectangle'sfill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeRectangle,90,90,90,50).Fill

.ForeColor.RGB=RGB(128,0,0)

.BackColor.RGB=RGB(170,170,170)

.TwoColorGradientmsoGradientHorizontal,1

EndWith

ThisexampleaddsapatternedlinetomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(10,100,250,0).Line

.Weight=6

.ForeColor.RGB=RGB(0,0,255)

.BackColor.RGB=RGB(128,0,0)

.Pattern=msoPatternDarkDownwardDiagonal

EndWith

Page 1503: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1504: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FormatPropertyReturnsorsetstheformatfortheautomaticallyupdateddateandtime.AppliesonlytoHeaderFooterobjectsthatrepresentadateandtime(returnedfromtheHeadersFooterscollectionbytheDateAndTimeproperty).Read/writePpDateTimeFormat.

PpDateTimeFormatcanbeoneofthesePpDateTimeFormatconstants.ppDateTimeddddMMMMddyyyyppDateTimedMMMMyyyyppDateTimedMMMyyppDateTimeFormatMixedppDateTimeHmmppDateTimehmmAMPMppDateTimeHmmssppDateTimehmmssAMPMppDateTimeMdyyppDateTimeMMddyyHmmppDateTimeMMddyyhmmAMPMppDateTimeMMMMdyyyyppDateTimeMMMMyyppDateTimeMMyy

expression.Format

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1505: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Makesurethatthedateandtimearesettobeupdatedautomatically(notdisplayedasfixedtext)bysettingtheUseFormatpropertytoTrue.

Page 1506: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedateandtimefortheslidemasteroftheactivepresentationtobeupdatedautomaticallyandthenitsetsthedateandtimeformattoshowhours,minutes,andseconds.

SetmyPres=Application.ActivePresentation

WithmyPres.SlideMaster.HeadersFooters.DateAndTime

.UseFormat=True

.Format=ppDateTimeHmmss

EndWith

Page 1507: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FormulaPropertyReturnsorsetsaStringthatrepresentsaformulatouseforcalculatingananimation.Read/write.

expression.Formula

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1508: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashape,andaddsathree-secondfillanimationtothatshape.

SubAddShapeSetAnimFill()

DimeffBlindsAsEffect

DimshpRectangleAsShape

DimanimBlindsAsAnimationBehavior

'Addsrectangleandsetsanimiationeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffBlinds=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectBlinds)

'Setsthedurationoftheanimation

effBlinds.Timing.Duration=3

'Addsabehaviortotheanimation

SetanimBlinds=effBlinds.Behaviors.Add(msoAnimTypeProperty)

'Setstheanimationcoloreffectandtheformulatouse

WithanimBlinds.PropertyEffect

.Property=msoAnimColor

.Formula=RGB(Red:=255,Green:=255,Blue:=255)

EndWith

EndSub

Page 1509: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1510: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FrameColorsPropertyReturnsorsetsthetextcolorfortheoutlinepaneandthebackgroundcolorfortheoutlineandslidepanesforWebpresentations.Read/writePpFrameColors.

PpFrameColorscanbeoneofthesePpFrameColorsconstants.ppFrameColorsBlackTextOnWhiteppFrameColorsBrowserColorsppFrameColorsPresentationSchemeAccentColorppFrameColorsPresentationSchemeTextColorppFrameColorsWhiteTextOnBlack

expression.FrameColors

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1511: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatwhensavingorpublishingtheactivepresentationasaWebpage,thetextcolorfortheoutlinepaneiswhiteandthebackgroundcolorfortheoutlineandslidepanesisblack,andPortableNetworkGraphics(PNG)areallowedasanimageformat.

WithActivePresentation.WebOptions

.FrameColors=ppFrameColorsWhiteTextOnBlack

.AllowPNG=True

EndWith

Page 1512: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1513: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FrameSlidesPropertyDetermineswhetherathinframeisplacedaroundtheborderoftheprintedslides.Read/writeMsoTriState.Appliestoprintedslides,handouts,andnotespages.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueAthinframeisplacedaroundtheborderoftheprintedslides.

Page 1514: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintstheactivepresentationwithaframearoundeachslide.

WithActivePresentation

.PrintOptions.FrameSlides=msoTrue

.PrintOut

EndWith

Page 1515: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1516: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FromPropertyFrompropertyasitappliestotheColorEffectobject.

SetsorreturnsaColorFormatobjectthatrepresentsthestartingRGBcolorvalueofananimationbehavior.

expression.From

expressionRequired.AnexpressionthatreturnsaColorEffectobject.

Page 1517: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsethispropertyinconjunctionwiththeTopropertytotransitionfromonecolortoanother.

FrompropertyasitappliestotheRotationEffectobject.

SetsorreturnsaSinglethatrepresentsthestartingangleindegrees,specifiedrelativetothescreen(forexample,90degreesiscompletelyhorizontal).Read/write.

expression.From

expressionRequired.AnexpressionthatreturnsaRotationEffectobject.

Page 1518: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsethispropertyinconjunctionwiththeTopropertytotransitionfromonerotationangletoanother.

ThedefaultvalueisEmptyinwhichcasethecurrentpositionoftheobjectisused.

FrompropertyasitappliestothePropertyEffectobject.

SetsorreturnsaVariantthatrepresentsthestartingvalueofanobject’sproperty.Read/write.

expression.From

expressionRequired.AnexpressionthatreturnsaPropertyEffectobject.

Page 1519: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheFrompropertyissimilartothePointsproperty,butusingtheFrompropertyiseasierforsimpletasks.

ThedefaultvalueisEmpty,inwhichcasethecurrentpositionoftheobjectisused.

Page 1520: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

DonotconfusethispropertywiththeFromXorFromYpropertiesoftheScaleEffectandMotionEffectobjects,whichareonlyusedforscalingormotioneffects.

Page 1521: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheColorEffectobject.

Thefollowingexampleaddsacoloreffectandimmediatelychangesitscolor.

SubAddAndChangeColorEffect()

DimeffBlindsAsEffect

DimtlnTimingAsTimeLine

DimshpRectangleAsShape

DimanimColorEffectAsAnimationBehavior

DimclrEffectAsColorEffect

'Addsrectangleandsetseffectandanimation

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffBlinds=t.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectBlinds)

SetanimColorEffect=tlnTimming.MainSequence(1).Behaviors_

.Add(Type:=msoAnimTypeColor)

SetclrEffect=animColorEffect.ColorEffect

'Setstheanimationeffectstartingandendingcolors

clrEffect.From.RGB=RGB(Red:=255,Green:=255,Blue:=0)

clrEffect.To.RGB=RGB(Red:=0,Green:=255,Blue:=255)

EndSub

AsitappliestotheRotationEffectobject.

Thefollowingexampleaddsarotationeffectandimmediatelychangesitsrotationangle.

SubAddAndChangeRotationEffect()

DimeffBlindsAsEffect

DimtlnTimingAsTimeLine

DimshpRectangleAsShape

DimanimRotationAsAnimationBehavior

DimrtnEffectAsRotationEffect

'Addsrectangleandsetseffectandanimation

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Page 1522: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Top:=100,Width:=50,Height:=50)

SettlnTiming=ActivePresentation.Slides(1).TimeLine

SeteffBlinds=tlnTiming.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectBlinds)

SetanimRotation=tlnTiming.MainSequence(1).Behaviors_

.Add(Type:=msoAnimTypeRotation)

SetrtnEffect=animRotation.RotationEffect

'Setstherotationeffectstartingandendingpositions

rtnEffect.From=90

rtnEffect.To=270

EndSub

Page 1523: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FromXPropertySetsorreturnsaSinglethatrepresentsthestartingwidthorhorizontalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentofthescreenwidth.Read/write.

expression.FromX

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1524: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.

UsethispropertyinconjunctionwiththeToXpropertytoresizeorjumpfromonepositiontoanother.

DonotconfusethispropertywiththeFrompropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.

Page 1525: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsamotionpathandsetsthestartingandendinghorizontalandverticalpositions.

SubAddMotionPath()

DimeffCustomAsEffect

DimanimMotionAsAnimationBehavior

DimshpRectangleAsShape

'Addsshapeandsetseffectandanimationproperties

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffCustom=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectCustom)

SetanimMotion=effCustom.Behaviors.Add(msoAnimTypeMotion)

'Setsstartingandendinghorizontalandverticalpositions

WithanimMotion.MotionEffect

.FromX=0

.FromY=0

.ToX=50

.ToY=50

EndWith

EndSub

Page 1526: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FromYPropertyReturnsorsetsaSinglethatrepresentsthestartingheightorverticalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentageofthescreenwidth.Read/write.

expression.FromY

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1527: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.

UsethispropertyinconjunctionwiththeToYpropertytoresizeorjumpfromonepositiontoanother.

DonotconfusethispropertywiththeFrompropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.

Page 1528: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsananimationpathandsetsthestartingandendinghorizontalandverticalpositions.

SubAddMotionPath()

DimeffCustomAsEffect

DimanimMotionAsAnimationBehavior

DimshpRectangleAsShape

'Addsshapeandsetseffectandanimationproperties

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffCustom=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectCustom)

SetanimMotion=effCustom.Behaviors.Add(msoAnimTypeMotion)

'Setsstartingandendinghorizontalandverticalpositions

WithanimMotion.MotionEffect

.FromX=0

.FromY=0

.ToX=50

.ToY=50

EndWith

EndSub

Page 1529: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

FullNamePropertyReturnsthenameofthespecifiedadd-inorsavedpresentation,includingthepath,thecurrentfilesystemseparator,andthefilenameextension.Read-onlyString.

Page 1530: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThispropertyisequivalenttothePathproperty,followedbythecurrentfilesystemseparator,followedbytheNameproperty.

Page 1531: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthepathandfilenameofeveryavailableadd-in.

ForEachaInApplication.AddIns

MsgBoxa.FullName

Nexta

Thisexampledisplaysthepathandfilenameoftheactivepresentation(assumingthatthepresentationhasbeensaved).

MsgBoxApplication.ActivePresentation.FullName

Page 1532: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GapPropertyReturnsorsetsthehorizontaldistance(inpoints)betweentheendofthecalloutlineandthetextboundingbox.Read/writeSingle.

Page 1533: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedistancebetweenthecalloutlineandthetextboundingboxto3pointsforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(1).Callout.Gap=3

Page 1534: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1535: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GradientColorTypePropertyReturnsthegradientcolortypeforthespecifiedfill.Thispropertyisread-only.UsetheOneColorGradient,PresetGradient,orTwoColorGradientmethodtosetthegradienttypeforthefill.Read-onlyMsoGradientColorType.

MsoGradientColorTypecanbeoneoftheseMsoGradientColorTypeconstants.msoGradientColorMixedmsoGradientOneColormsoGradientPresetColorsmsoGradientTwoColors

expression.GradientColorType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1536: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesthefillforallshapesinmyDocumentthathaveatwo-colorgradientfilltoapresetgradientfill.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Withs.Fill

If.GradientColorType=msoGradientTwoColorsThen

.PresetGradientmsoGradientHorizontal,_

1,msoGradientBrass

EndIf

EndWith

Next

Page 1537: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GradientDegreePropertyReturnsavaluethatindicateshowdarkorlightaone-colorgradientfillis.Avalueof0(zero)meansthatblackismixedinwiththeshape'sforegroundcolortoformthegradient;avalueof1meansthatwhiteismixedin;andvaluesbetween0and1meanthatadarkerorlightershadeoftheforegroundcolorismixedin.Read-onlySingle.

Thispropertyisread-only.UsetheOneColorGradientmethodtosetthegradientdegreeforthefill.

Page 1538: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocumentandsetsthedegreeofitsfillgradienttomatchthatoftheshapenamed"Rectangle2."IfRectangle2doesn'thaveaone-colorgradientfill,thisexamplefails.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

gradDegree1=.Item("Rectangle2").Fill.GradientDegree

With.AddShape(msoShapeRectangle,0,0,40,80).Fill

.ForeColor.RGB=RGB(128,0,0)

.OneColorGradientmsoGradientHorizontal,1,gradDegree1

EndWith

EndWith

Page 1539: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1540: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GradientStylePropertyReturnsthegradientstyleforthespecifiedfill.UsetheOneColorGradient,PresetGradient,orTwoColorGradientmethodtosetthegradientstyleforthefill.Attemptingtoreturnthispropertyforafillthatdoesn'thaveagradientgeneratesanerror.UsetheTypepropertytodeterminewhetherthefillhasagradient.Read-onlyMsoGradientStyle.

MsoGradientStylecanbeoneoftheseMsoGradientStyleconstants.msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVertical

expression.GradientStyle

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1541: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocumentandsetsitsfillgradientstyletomatchthatoftheshapenamed"rect1."Fortheexampletowork,rect1musthaveagradientfill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

gradStyle1=.Item("rect1").Fill.GradientStyle

With.AddShape(msoShapeRectangle,0,0,40,80).Fill

.ForeColor.RGB=RGB(128,0,0)

.OneColorGradientgradStyle1,1,1

EndWith

EndWith

Page 1542: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GradientVariantPropertyReturnsthegradientvariantforthespecifiedfillasanintegervaluefrom1to4formostgradientfills.IfthegradientstyleismsoGradientFromTitleormsoGradientFromCenter,thispropertyreturnseither1or2.Thevaluesforthispropertycorrespondtothegradientvariants(numberedfromlefttorightandfromtoptobottom)ontheGradienttabintheFillEffectsdialogbox.Read-onlyLong.

Thispropertyisread-only.UsetheOneColorGradient,PresetGradient,orTwoColorGradientmethodtosetthegradientvariantforthefill.

Page 1543: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocumentandsetsitsfillgradientvarianttomatchthatoftheshapenamed"rect1."Fortheexampletowork,rect1musthaveagradientfill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

gradVar1=.Item("rect1").Fill.GradientVariant

With.AddShape(msoShapeRectangle,0,0,40,80).Fill

.ForeColor.RGB=RGB(128,0,0)

.OneColorGradientmsoGradientHorizontal,gradVar1,1

EndWith

EndWith

Page 1544: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GridDistancePropertySetsorreturnsaSinglethatrepresentsthedistancebetweengridlines.Read/write.

expression.GridDistance

expressionRequired.AnexpressionthatreturnsanPresentationobject.

Page 1545: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthegridlines,andthenspecifiesthedistancebetweengridlinesandenablesthesnaptogridsetting.

SubSetGridLines()

Application.DisplayGridLines=msoTrue

WithActivePresentation

.GridDistance=18

.SnapToGrid=msoTrue

EndWith

EndSub

Page 1546: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

GroupItemsPropertyReturnsaGroupShapesobjectthatrepresentstheindividualshapesinthespecifiedgroup.UsetheItemmethodoftheGroupShapesobjecttoreturnasingleshapefromthegroup.AppliestoShapeorShapeRangeobjectsthatrepresentgroupedshapes.Read-only.

Page 1547: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsthreetrianglestomyDocument,groupsthem,setsacolorfortheentiregroup,andthenchangesthecolorforthesecondtriangleonly.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShape(msoShapeIsoscelesTriangle,10,_

10,100,100).Name="shpOne"

.AddShape(msoShapeIsoscelesTriangle,150,_

10,100,100).Name="shpTwo"

.AddShape(msoShapeIsoscelesTriangle,300,_

10,100,100).Name="shpThree"

With.Range(Array("shpOne","shpTwo","shpThree")).Group

.Fill.PresetTexturedmsoTextureBlueTissuePaper

.GroupItems(2).Fill.PresetTexturedmsoTextureGreenMarble

EndWith

EndWith

Page 1548: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HandoutMasterPropertyReturnsaMasterobjectthatrepresentsthehandoutmaster.Read-only.

Page 1549: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebackgroundpatternonthehandoutmasterintheactivepresentation.

Application.ActivePresentation.HandoutMaster.Background.Fill_

.PatternedmsoPatternDarkHorizontal

Page 1550: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1551: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HandoutOrderPropertyReturnsorsetsthepagelayoutorderinwhichslidesappearonprintedhandoutsthatshowmultipleslidesononepage.Read/writePpPrintHandoutOrder.

PpPrintHandoutOrdercanbeoneofthesePpPrintHandoutOrderconstants.ppPrintHandoutHorizontalFirstSlidesareorderedhorizontally,withthefirstslideintheupper-leftcornerandthesecondslidetotherightofit.Ifyourlanguagesettingspecifiesaright-to-leftlanguage,thefirstslideisintheupper-rightcornerwiththesecondslidetotheleftofit.ppPrintHandoutVerticalFirstSlidesareorderedvertically,withthefirstslideintheupper-leftcornerandthesecondslidebelowit.Ifyourlanguagesettingspecifiesaright-to-leftlanguage,thefirstslideisintheupper-rightcornerwiththesecondslidebelowit.

expression.HandoutOrder

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1552: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetshandoutsoftheactivepresentationtocontainsixslidesperpage,orderstheslideshorizontallyonthehandouts,andprintsthem.

WithActivePresentation

.PrintOptions.OutputType=ppPrintOutputSixSlideHandouts

.PrintOptions.HandoutOrder=ppPrintHandoutHorizontalFirst

.PrintOut

EndWith

Page 1553: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1554: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HangingPunctuationPropertyReturnsorsetsthehangingpunctuationoptionifyouhaveanAsianlanguagesettingspecified.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThehangingpunctuationoptionisselected.

Page 1555: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleselectshangingpunctuationforthefirstparagraphoftheactivepresentation.

ActivePresentation.Paragraphs(1).HangingPunctuation=msoTrue

Page 1556: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasChildShapeRangePropertyTrueiftheselectioncontainschildshapes.Read-onlyBoolean.

expression.HasChildShapeRange

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1557: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanewslidewithadrawingcanvas,populatesthedrawingcanvaswithshapes,andselectstheshapesaddedtothecanvas.Thenaftercheckingthattheshapesselectedarechildshapes,itfillsthechildshapeswithapattern.

SubChildShapes()

DimsldNewAsSlide

DimshpCanvasAsShape

'Createanewslidewithadrawingcanvasandshapes

SetsldNew=Presentations(1).Slides_

.Add(Index:=1,Layout:=ppLayoutBlank)

SetshpCanvas=sldNew.Shapes.AddCanvas(_

Left:=100,Top:=100,Width:=200,Height:=200)

WithshpCanvas.CanvasItems

.AddShapemsoShapeRectangle,Left:=0,Top:=0,_

Width:=100,Height:=100

.AddShapemsoShapeOval,Left:=0,Top:=50,_

Width:=100,Height:=100

.AddShapemsoShapeDiamond,Left:=0,Top:=100,_

Width:=100,Height:=100

EndWith

'Selectallshapesinthecanvas

shpCanvas.CanvasItems.SelectAll

'Fillcanvaschildshapeswithapattern

WithActiveWindow.Selection

If.HasChildShapeRange=TrueThen

.ChildShapeRange.Fill.PatternedPattern:=msoPatternDivot

Else

MsgBox"Thisisnotarangeofchildshapes."

EndIf

EndWith

EndSub

Page 1558: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 1559: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1560: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasDiagramPropertyMsoTrueifashapeisadiagram.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseShapeisnotadiagram.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueShapeisadiagram.

expression.HasDiagram

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1561: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesearchesthecurrentdocumentfordiagramswithnodesandifitfindsboth,createsablackballoonwithboldwhitetext.

SubHasDiagramProperties()

DimshpDiagramAsShape

DimshpNodeAsDiagramNode

DimshpBalloonAsShape

DimsldFirstAsSlide

SetsldFirst=ActivePresentation.Slides(1)

'Looksthroughthecurrentdocumentandwhenitfindsadiagram

'withoneormorediagramnodes,createsaballoonwithtext

ForEachshpDiagramInsldFirst.Shapes

IfshpDiagram.HasDiagram=msoTrueAnd_

shpDiagram.HasDiagramNode=msoTrueThen

SetshpBalloon=sldFirst.Shapes.AddShape(_

Type:=msoShapeBalloon,Left:=350,_

Top:=75,Width:=150,Height:=150)

WithshpBalloon

With.TextFrame

.WordWrap=msoTrue

With.TextRange

.Text="Thisisadiagramwithnodes."

.Font.Color.RGB=RGB(Red:=255,_

Green:=255,Blue:=255)

.Font.Bold=True

.Font.Name="Tahoma"

.Font.Size=15

EndWith

EndWith

.Line.BackColor.RGB=RGB(_

Red:=0,Green:=25,Blue:=25)

.Fill.ForeColor.RGB=RGB(_

Red:=0,Green:=25,Blue:=25)

EndWith

EndIf

NextshpDiagram

EndSub

Page 1562: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 1563: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1564: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasDiagramNodePropertyMsoTrueifashapeisadiagramnode.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseShapeisnotadiagramnode.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueShapeisadiagramnode.

expression.HasDiagramNode

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1565: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesearchesthecurrentdocumentfordiagramswithnodes,andifitfindsboth,createsablackballoonwithboldwhitetext.

SubHasDiagramProperties()

DimshpDiagramAsShape

DimshpNodeAsDiagramNode

DimshpBalloonAsShape

DimsldFirstAsSlide

SetsldFirst=ActivePresentation.Slides(1)

'Looksthroughthecurrentdocumentandwhenitfindsadiagram

'withoneormorediagramnodes,createsaballoonwithtext

ForEachshpDiagramInsldFirst.Shapes

IfshpDiagram.HasDiagram=msoTrueAnd_

shpDiagram.HasDiagramNode=msoTrueThen

SetshpBalloon=sldFirst.Shapes.AddShape(_

Type:=msoShapeBalloon,Left:=350,_

Top:=75,Width:=150,Height:=150)

WithshpBalloon

With.TextFrame

.WordWrap=msoTrue

With.TextRange

.Text="Thisisadiagramwithnodes."

.Font.Color.RGB=RGB(Red:=255,_

Green:=255,Blue:=255)

.Font.Bold=True

.Font.Name="Tahoma"

.Font.Size=15

EndWith

EndWith

.Line.BackColor.RGB=RGB(_

Red:=0,Green:=25,Blue:=25)

.Fill.ForeColor.RGB=RGB(_

Red:=0,Green:=25,Blue:=25)

EndWith

EndIf

NextshpDiagram

EndSub

Page 1566: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 1567: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1568: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasRevisionInfoPropertyReturnsaPpRevisionInfoconstantthatrepresentswhetherapresentationisamergedauthordocument,areviewerdocumentwithbaselines,oraregularMicrosoftPowerPointdocument.Read-only.

PpRevisionInfocanbeoneofthesePpRevisionInfoconstants.ppRevisionInfoBaselineThepresentationhasabaseline.ppRevisionInfoMergedThepresentationisamergedauthorpresentation.ppRevisionInfoNoneThepresentationhasnoreviewerinformation.

expression.HasRevisionInfo

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1569: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Commentsarenotconsideredreviewerinformation.

Page 1570: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsandremovesbaselines,reportingstatustotheuseralongtheway.

SubAddABaseline()

ActivePresentation.AddBaseline

CallReportRevisionInfo(ActivePresentation)

ActivePresentation.RemoveBaseline

CallReportRevisionInfo(ActivePresentation)

EndSub

SubReportRevisionInfo(preAsPresentation)

SelectCasepre.HasRevisionInfo

CaseppRevisionInfoBaseline

MsgBox"Thepresentationhasabaseline."

CaseppRevisionInfoMerged

MsgBox"Thepresentationisamergedauthorpresentation."

CaseppRevisionInfoNone

MsgBox"Thepresentationhasnoreviewerinformation."

CaseElse

MsgBox"Couldn'tdeterminerevisioninformation."

EndSelect

EndSub

Page 1571: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1572: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasTablePropertyReturnswhetherthespecifiedshapeisatable.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisatable.

Page 1573: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplechecksthecurrentlyselectedshapetoseeifitisatable.Ifitis,thecodesetsthewidthofcolumnonetooneinch(72points).

WithActiveWindow.Selection.ShapeRange

If.HasTable=msoTrueThen

.Table.Columns(1).Width=72

EndIf

EndWith

Page 1574: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1575: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasTextPropertyReturnswhetherthespecifiedshapehastextassociatedwithit.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapehastextassociatedwithit.

Page 1576: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

IfshapetwoonmyDocumentcontainstext,thisexampleresizestheshapetofitthetext.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(2).TextFrame

If.HasTextThen.AutoSize=ppAutoSizeShapeToFitText

EndWith

Page 1577: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1578: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasTextFramePropertyReturnswhetherthespecifiedshapehasatextframe.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapehasatextframeandcanthereforecontaintext.

Page 1579: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleextractstextfromallshapesonthefirstslidethatcontaintextframes,andthenitstoresthenamesoftheseshapesandthetexttheycontaininanarray.

DimshpTextArray()AsVariant

DimnumShapes,numAutoShapes,iAsLong

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

numShapes=.Count

IfnumShapes>1Then

numTextShapes=0

ReDimshpTextArray(1To2,1TonumShapes)

Fori=1TonumShapes

If.Item(i).HasTextFrameThen

numTextShapes=numTextShapes+1

shpTextArray(numTextShapes,1)=.Item(i).Name

shpTextArray(numTextShapes,2)=.Item(i)_

.TextFrame.TextRange.Text

EndIf

Next

ReDimPreserveshpTextArray(1To2,1TonumTextShapes)

EndIf

EndWith

Page 1580: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1581: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasTitlePropertyReturnswhetherthecollectionofobjectsonthespecifiedslidecontainsatitleplaceholder.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThecollectionofobjectsonthespecifiedslidecontainsatitleplaceholder.

Page 1582: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerestoresthetitleplaceholdertoslideoneintheactivepresentationifthisplaceholderhasbeendeleted.Thetextoftherestoredtitleis"Restoredtitle."

WithActivePresentation.Slides(1)

If.Layout<>ppLayoutBlankThen

With.Shapes

IfNot.HasTitleThen

.AddTitle.TextFrame.TextRange_

.Text="Restoredtitle"

EndIf

EndWith

EndIf

EndWith

Page 1583: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1584: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HasTitleMasterPropertyMsoTrueifthespecifiedpresentationhasatitlemaster.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedpresentationhasatitlemaster.

expression.HasTitleMaster

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1585: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsatitlemastertotheactivepresentationifitdoesn'talreadyhaveone.

WithApplication.ActivePresentation

IfNot.HasTitleMasterThen.AddTitleMaster

EndWith

Page 1586: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HeaderPropertyReturnsaHeaderFooterobjectthatrepresentstheheaderthatappearsatthetopofaslideorintheupper-leftcornerofanotespage,handout,oroutline.Read-only.

Page 1587: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheheadertextforthehandoutmasterfortheactivepresentation.Thistextwillappearintheupper-leftcornerofthepagewhenyouprintyourpresentationasanoutlineorahandout.

SetmyHandHF=Application.ActivePresentation.HandoutMaster_

.HeadersFooters

myHandHF.Header.Text="ThirdQuarterReport"

Page 1588: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HeadersFootersPropertyReturnsaHeadersFooterscollectionthatrepresentstheheader,footer,dateandtime,andslidenumberassociatedwiththeslide,slidemaster,orrangeofslides.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1589: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefootertextandthedateandtimeformatforthenotesmasterintheactivepresentationandsetsthedateandtimetobeupdatedautomatically.

WithActivePresentation.NotesMaster.HeadersFooters

.Footer.Text="RegionalSales"

With.DateAndTime

.UseFormat=True

.Format=ppDateTimeHmmss

EndWith

EndWith

Page 1590: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HeightPropertyReturnsorsetstheheightofthespecifiedobject,inpoints.Read-onlySinglefortheMasterobject,read/writeSingleforallotherobjects.

Page 1591: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheHeightpropertyofaShapeobjectreturnsorsetstheheightoftheforward-facingsurfaceofthespecifiedshape.Thismeasurementdoesn'tincludeshadowsor3-Deffects.

Page 1592: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheheightofdocumentwindowtwotohalftheheightoftheapplicationwindow.

Windows(2).Height=Application.Height/2

Thisexamplesetstheheightforrowtwointhespecifiedtableto100points(72pointsperinch).

ActivePresentation.Slides(2).Shapes(5).Table.Rows(2).Height=100

Page 1593: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1594: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HiddenPropertyDetermineswhetherthespecifiedslideishiddenduringaslideshow.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideishiddenduringaslideshow.

Page 1595: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemakesslidetwointheactivepresentationahiddenslide.

ActivePresentation.Slides(2).SlideShowTransition.Hidden=msoTrue

Page 1596: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1597: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HideWhileNotPlayingPropertyDetermineswhetherthespecifiedmediaclipishiddenduringaslideshowexceptwhenit'splaying.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedmediaclipishiddenduringaslideshowexceptwhenit'splaying.

Page 1598: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleinsertsamovienamed"Clock.avi"ontoslideoneintheactivepresentation,setsittoplayautomaticallyaftertheslidetransition,andspecifiesthatthemovieobjectbehiddenduringaslideshowexceptwhenit'splaying.

WithActivePresentation.Slides(1).Shapes_

.AddOLEObject(Left:=10,Top:=10,_

Width:=250,Height:=250,_

FileName:="c:\winnt\clock.avi")

With.AnimationSettings.PlaySettings

.PlayOnEntry=True

.HideWhileNotPlaying=msoTrue

EndWith

EndWith

Page 1599: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1600: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HorizontalAnchorPropertyReturnsorsetsthehorizontalalignmentoftextinatextframe.Read/writeMsoHorizontalAnchor.

MsoHorizontalAnchorcanbeoneoftheseMsoHorizontalAnchorconstants.msoAnchorNonemsoHorizontalAnchorMixedmsoAnchorCenter

expression.HorizontalAnchor

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1601: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthealignmentofthetextinshapeoneonmyDocumenttotopcentered.

SetmyDocument=ActivePresentation.SlideMaster

WithmyDocument.Shapes(1)

.TextFrame.HorizontalAnchor=msoAnchorCenter

.TextFrame.VerticalAnchor=msoAnchorTop

EndWith

Page 1602: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1603: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HorizontalFlipPropertyReturnswhetherthespecifiedshapeisflippedaroundthehorizontalaxis.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisflippedaroundthehorizontalaxis.

Page 1604: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplerestoreseachshapeonmyDocumenttoitsoriginalstate,ifit'sbeenflippedhorizontallyorvertically.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.HorizontalFlipThens.FlipmsoFlipHorizontal

Ifs.VerticalFlipThens.FlipmsoFlipVertical

Next

Page 1605: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HTMLProjectPropertyReturnstheHTMLProjectobject,whichisaWebpresentation(HTMLformat)accessedthroughtheMicrosoftScriptEditor.Read-only.

Page 1606: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheHTMLProjectobjectcanbeinterpretedasthetop-levelprojectbranchintheProjectExplorerwindowoftheScriptEditor,foraloadedpresentation.ItcontainstheHTMLProjectItemscollection.MembersoftheHTMLProjectItemscollectionrepresentaslide,master,orthehandoutfortheWebpresentation.

Page 1607: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechecksthenameofeachmemberintheHTMLProjectItemscollectionfortheloadedHTMLProject.IfthenameisSlide2,itthenopensthegeneratedHTMLforthatslideintheMicrosoftScriptEditor.

DimiAsInteger

WithActivePresentation.HTMLProject

Fori=1To.HTMLProjectItems.Count

If.HTMLProjectItems(i).Name="Slide2"Then

.HTMLProjectItems(i).Open

EndIf

Next

EndWith

Page 1608: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1609: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HTMLVersionPropertyReturnsorsetstheversionofHTMLforapublishedpresentation.Read/writePpHTMLVersion.

PpHTMLVersioncanbeoneofthesePpHTMLVersionconstants.ppHTMLAutodetectppHTMLDualppHTMLv3ppHTMLv4Default.

expression.HTMLVersion

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1610: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationinHTMLversion3.0.ItnamesthepublishedpresentationMallard.htm.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.HTMLVersion=ppHTMLv3

.Publish

EndWith

Page 1611: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HyperlinkPropertyReturnsaHyperlinkobjectthatrepresentsthehyperlinkforthespecifiedshape.Forthehyperlinktobeactiveduringaslideshow,theActionpropertymustbesettoppActionHyperlink.Read-only.

Page 1612: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsshapeoneonslideoneintheactivepresentationtojumptotheMicrosoftWebsitewhentheshapeisclickedduringaslideshow.

WithActivePresentation.Slides(1).Shapes(1)_

.ActionSettings(ppMouseClick)

.Action=ppActionHyperlink

.Hyperlink.Address="http://www.microsoft.com/"

EndWith

Page 1613: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HyperlinksPropertyReturnsaHyperlinkscollectionthatrepresentsallthehyperlinksonthespecifiedslide.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1614: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleallowstheusertoupdateanoutdatedinternetaddressforallhyperlinksintheactivepresentation.

oldAddr=InputBox("Oldinternetaddress")

newAddr=InputBox("Newinternetaddress")

ForEachsInActivePresentation.Slides

ForEachhIns.Hyperlinks

IfLCase(h.Address)=oldAddrThenh.Address=newAddr

Next

Next

Page 1615: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IdPropertyReturnsaLongthatidentifiestheshapeorrangeofshapes.Read-only.

expression.Id

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1616: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsanewshapetotheactivepresentation,thenfillstheshapeaccordingtothevalueoftheIDproperty.

SubShapeID()

WithActivePresentation.Slides(1).Shapes.AddShape_

(Type:=msoShape5pointStar,Left:=100,_

Top:=100,Width:=100,Height:=100)

SelectCase.Id

Case0To500

.Fill.ForeColor.RGB=RGB(Red:=255,Green:=0,Blue:=0)

Case500To1000

.Fill.ForeColor.RGB=RGB(Red:=255,Green:=255,Blue:=0)

Case1000To1500

.Fill.ForeColor.RGB=RGB(Red:=255,Green:=0,Blue:=255)

Case1500To2000

.Fill.ForeColor.RGB=RGB(Red:=0,Green:=255,Blue:=0)

Case2000To2500

.Fill.ForeColor.RGB=RGB(Red:=0,Green:=255,Blue:=255)

CaseElse

.Fill.ForeColor.RGB=RGB(Red:=0,Green:=0,Blue:=255)

EndSelect

EndWith

EndSub

Page 1617: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1618: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IncludeNavigationPropertyDetermineswhetherthelinkbarforWebpresentationsisvisible.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThenavigationbarforWebpresentationsisnotvisible,whichenlargestheslide.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.ThenavigationbarforWebpresentationsisvisibleatthebottomofthepage.

Page 1619: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatthelinkbarisnottobeincludedinthespecifiedWebpresentation.ItthenpreviewsthepresentationintheactiveWebbrowser.

WithPresentations(2)

.WebOptions.IncludeNavigation=msoFalse

.WebPagePreview

EndWith

Page 1620: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IndentLevelPropertyReturnsorsetsthetheindentlevelforthespecifiedtextasanintegerfrom1to5,where1indicatesafirst-levelparagraphwithnoindentation.Read/writeLong.

Page 1621: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleindentsthesecondparagraphinshapetwoonslidetwointheactivepresentation.

Application.ActivePresentation.Slides(2).Shapes(2).TextFrame_

.TextRange.Paragraphs(2).IndentLevel=2

Page 1622: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IndexPropertyReturnsaLongthatrepresentstheindexnumberforananimationeffectordesign.Read-only.

expression.Index

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1623: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampledisplaysthenameandindexnumberforalleffectsinthemainanimationsequenceofthefirstslide.

SubEffectInfo()

DimeffIndexAsEffect

DimseqMainAsSequence

SetseqMain=ActivePresentation.Slides(1).TimeLine.MainSequence

ForEacheffIndexInseqMain

WitheffIndex

MsgBox"EffectName:"&.DisplayName&vbLf&_

"EffectIndex:"&.Index

EndWith

Next

EndSub

Page 1624: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1625: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InsetPenPropertyMsoTruetodrawlinesontheinsideofaspecifiedshape.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Aninsetpenisnotenabled.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueAninsetpenisenabled.

expression.InsetPen

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1626: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

AnerroroccursifthispropertyattemptstosetinsetpendrawingonanyMicrosoftOfficeAutoShapewhichdoesnotsupportinsetpendrawing.

Page 1627: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowinglineofcodeenablesaninsetpenforashape.Thisexampleassumesthatthefirstslideoftheactivepresentationcontainsashapeandtheshapesupportsinsetpendrawing.

SubDrawLinesInsideShape

ActivePresentation.Slides(1).Shapes(1).Line.InsetPen=msoTrue

EndSub

Page 1628: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InteractiveSequencesPropertyReturnsaSequencesobjectthatrepresentsanimationsthataretriggeredbyclickingonaspecifiedshape.

expression.InteractiveSequences

expressionRequired.AnexpressionthatreturnsaTimeLineobject.

Page 1629: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueoftheInteractiveSequencespropertyisanemptySequencescollection.

Page 1630: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsaninteractivesequencetothefirstslideandsetsthetexteffectpropertiesforthenewanimationsequence.

SubNewInteractiveSeqence()

DimseqInteractiveAsSequence

DimshpTextAsShape

DimeffTextAsEffect

SetseqInteractive=ActivePresentation.Slides(1).TimeLine_

.InteractiveSequences.Add(1)

SetshpText=ActivePresentation.Slides(1).Shapes(1)

SeteffText=ActivePresentation.Slides(1).TimeLine_

.MainSequence.AddEffect(Shape:=shpText,_

EffectId:=msoAnimEffectChangeFont,_

Trigger:=msoAnimTriggerOnPageClick)

effText.EffectParameters.FontName="Broadway"

seqInteractive.ConvertToTextUnitEffectEffect:=effText,_

UnitEffect:=msoAnimTextUnitEffectByWord

EndSub

Page 1631: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1632: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IsFullScreenPropertyReturnswhetherthespecifiedslideshowwindowoccupiesthefullscreen.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowwindowoccupiesthefullscreen.

Page 1633: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplereducestheheightofafull-screenslideshowwindowjustenoughsothatyoucanseethetaskbar.

WithApplication.SlideShowWindows(1)

If.IsFullScreenThen

.Height=.Height-20

EndIf

EndWith

Page 1634: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1635: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IsNamedShowPropertyDetermineswhetheracustom(named)slideshowisdisplayedinthespecifiedslideshowview.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueAcustom(named)slideshowisdisplayedinthespecifiedslideshowview.

Page 1636: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Iftheslideshowrunninginslideshowwindowoneisacustomslideshow,thisexampledisplaysitsname.

WithSlideShowWindows(1).View

If.IsNamedShowThen

MsgBox"Nowshowinginslideshowwindow1:"_

&.SlideShowName

EndIf

EndWith

Page 1637: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1638: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ItalicPropertyDetermineswhetherthecharacterformatisitalic.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThecharacterformatisnotitalic.msoTriStateMixedThespecifiedtextrangecontainsbothitalicandnonitaliccharacters.msoTriStateTogglemsoTrueThecharacterformatisitalic.

Page 1639: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetitletextonslideoneandmakesthetitleblueanditalic.

WithApplication.ActivePresentation.Slides(1)_

.Shapes.Title.TextFrame.TextRange

.Text="VolcanoCoffee"

With.Font

.Italic=msoTrue

.Name="palatino"

.Color.RGB=RGB(0,0,255)

EndWith

EndWith

Page 1640: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ItemPropertyReturnsorsetstheadjustmentvaluespecifiedbytheIndexargument.Forlinearadjustments,anadjustmentvalueof0.0generallycorrespondstotheleftortopedgeoftheshape,andavalueof1.0generallycorrespondstotherightorbottomedgeoftheshape.However,adjustmentscanpassbeyondshapeboundariesforsomeshapes.Forradialadjustments,anadjustmentvalueof1.0correspondstothewidthoftheshape.Forangularadjustments,theadjustmentvalueisspecifiedindegrees.TheItempropertyappliesonlytoshapesthathaveadjustments.Read/writeSingle.

expression.Item(Index)

expressionRequired.AnexpressionthatreturnsanAdjustmentsobject.

IndexRequiredLong.Theindexnumberoftheadjustment.

Page 1641: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

AutoShapes,connectors,andWordArtobjectscanhaveuptoeightadjustments.

Page 1642: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddstwocrossestomyDocumentandthensetsthevalueforadjustmentone(theonlyoneonthistypeofAutoShape)oneachcross.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShape(msoShapeCross,10,10,100,100)_

.Adjustments.Item(1)=0.4

.AddShape(msoShapeCross,150,10,100,100)_

.Adjustments.Item(1)=0.2

EndWith

Thisexamplehasthesameresultasthepreviousexampleeventhoughitdoesn'texplicitlyusetheItemproperty.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddShape(msoShapeCross,10,10,100,100)_

.Adjustments(1)=0.4

.AddShape(msoShapeCross,150,10,100,100)_

.Adjustments(1)=0.2

EndWith

Page 1643: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1644: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

KernedPairsPropertyDetermineswhetherthecharacterpairsinthespecifiedWordArtarekerned.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueCharacterpairsinthespecifiedWordArtarekerned.

Page 1645: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleturnsoncharacterpairkerningforshapethreeonmyDocumentiftheshapeisWordArt.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.Type=msoTextEffectThen

.TextEffect.KernedPairs=msoTrue

EndIf

EndWith

Page 1646: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1647: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LanguageIDPropertyReturnsorsetsthelanguageforthespecifiedtextrange.UsedfortaggingportionsoftextwritteninadifferentlanguagethantheDefaultLanguageIDpropertyspecifies.ThisallowsMicrosoftPowerPointtocheckspellingandgrammaraccordingtothelanguageforeachtextrange.Thispropertyisnotrelatedtotheapplicationinterfacelanguage.Read/writeMsoLanguageID.

MsoLanguageIDcanbeoneoftheseMsoLanguageIDconstants.msoLanguageIDAfrikaansmsoLanguageIDAlbanianmsoLanguageIDAmharicmsoLanguageIDArabicmsoLanguageIDArabicAlgeriamsoLanguageIDArabicBahrainmsoLanguageIDArabicEgyptmsoLanguageIDArabicIraqmsoLanguageIDArabicJordanmsoLanguageIDArabicKuwaitmsoLanguageIDArabicLebanonmsoLanguageIDArabicLibyamsoLanguageIDArabicMoroccomsoLanguageIDArabicOmanmsoLanguageIDArabicQatarmsoLanguageIDArabicSyriamsoLanguageIDArabicTunisiamsoLanguageIDArabicUAEmsoLanguageIDArabicYemenmsoLanguageIDArmenianmsoLanguageIDAssamesemsoLanguageIDAzeriCyrillicmsoLanguageIDAzeriLatin

Page 1648: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDBasquemsoLanguageIDBelgianDutchmsoLanguageIDBelgianFrenchmsoLanguageIDBengalimsoLanguageIDBrazilianPortuguesemsoLanguageIDBulgarianmsoLanguageIDBurmesemsoLanguageIDByelorussianmsoLanguageIDCatalanmsoLanguageIDCherokeemsoLanguageIDChineseHongKongmsoLanguageIDChineseMacaomsoLanguageIDChineseSingaporemsoLanguageIDCroatianmsoLanguageIDCzechmsoLanguageIDDanishmsoLanguageIDDutchmsoLanguageIDEnglishAUSmsoLanguageIDEnglishBelizemsoLanguageIDEnglishCanadianmsoLanguageIDEnglishCaribbeanmsoLanguageIDEnglishIrelandmsoLanguageIDEnglishJamaicamsoLanguageIDEnglishNewZealandmsoLanguageIDEnglishPhilippinesmsoLanguageIDEnglishSouthAfricamsoLanguageIDEnglishTrinidadmsoLanguageIDEnglishUKmsoLanguageIDEnglishUSmsoLanguageIDEnglishZimbabwemsoLanguageIDEstonianmsoLanguageIDFaeroesemsoLanguageIDFarsi

Page 1649: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDFinnishmsoLanguageIDFrenchmsoLanguageIDFrenchCameroonmsoLanguageIDFrenchCanadianmsoLanguageIDFrenchCotedIvoiremsoLanguageIDFrenchLuxembourgmsoLanguageIDFrenchMalimsoLanguageIDFrenchMonacomsoLanguageIDFrenchReunionmsoLanguageIDFrenchSenegalmsoLanguageIDFrenchWestIndiesmsoLanguageIDFrenchZairemsoLanguageIDFrisianNetherlandsmsoLanguageIDGaelicIrelandmsoLanguageIDGaelicScotlandmsoLanguageIDGalicianmsoLanguageIDGeorgianmsoLanguageIDGermanmsoLanguageIDGermanAustriamsoLanguageIDGermanLiechtensteinmsoLanguageIDGermanLuxembourgmsoLanguageIDGreekmsoLanguageIDGujaratimsoLanguageIDHebrewmsoLanguageIDHindimsoLanguageIDHungarianmsoLanguageIDIcelandicmsoLanguageIDIndonesianmsoLanguageIDInuktitutmsoLanguageIDItalianmsoLanguageIDJapanesemsoLanguageIDKannadamsoLanguageIDKashmiri

Page 1650: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDKazakhmsoLanguageIDKhmermsoLanguageIDKirghizmsoLanguageIDKonkanimsoLanguageIDKoreanmsoLanguageIDLaomsoLanguageIDLatvianmsoLanguageIDLithuanianmsoLanguageIDMacedonianmsoLanguageIDMalayalammsoLanguageIDMalayBruneiDarussalammsoLanguageIDMalaysianmsoLanguageIDMaltesemsoLanguageIDManipurimsoLanguageIDMarathimsoLanguageIDMexicanSpanishmsoLanguageIDMixedmsoLanguageIDMongolianmsoLanguageIDNepalimsoLanguageIDNonemsoLanguageIDNoProofingmsoLanguageIDNorwegianBokmolmsoLanguageIDNorwegianNynorskmsoLanguageIDOriyamsoLanguageIDPolishmsoLanguageIDPunjabimsoLanguageIDRhaetoRomanicmsoLanguageIDRomanianmsoLanguageIDRomanianMoldovamsoLanguageIDRussianmsoLanguageIDRussianMoldovamsoLanguageIDSamiLappishmsoLanguageIDSanskrit

Page 1651: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDSerbianCyrillicmsoLanguageIDSerbianLatinmsoLanguageIDSesothomsoLanguageIDSimplifiedChinesemsoLanguageIDSindhimsoLanguageIDSlovakmsoLanguageIDSlovenianmsoLanguageIDSorbianmsoLanguageIDSpanishmsoLanguageIDSpanishArgentinamsoLanguageIDSpanishBoliviamsoLanguageIDSpanishChilemsoLanguageIDSpanishColombiamsoLanguageIDSpanishCostaRicamsoLanguageIDSpanishDominicanRepublicmsoLanguageIDSpanishEcuadormsoLanguageIDSpanishElSalvadormsoLanguageIDSpanishGuatemalamsoLanguageIDSpanishHondurasmsoLanguageIDSpanishModernSortmsoLanguageIDSpanishNicaraguamsoLanguageIDSpanishPanamamsoLanguageIDSpanishParaguaymsoLanguageIDSpanishPerumsoLanguageIDSpanishPuertoRicomsoLanguageIDSpanishUruguaymsoLanguageIDSpanishVenezuelamsoLanguageIDSutumsoLanguageIDSwahilimsoLanguageIDSwedishmsoLanguageIDSwedishFinlandmsoLanguageIDSwissFrenchmsoLanguageIDSwissGerman

Page 1652: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoLanguageIDSwissItalianmsoLanguageIDTajikmsoLanguageIDTamilmsoLanguageIDTatarmsoLanguageIDTelugumsoLanguageIDThaimsoLanguageIDTibetanmsoLanguageIDTraditionalChinesemsoLanguageIDTsongamsoLanguageIDTswanamsoLanguageIDTurkishmsoLanguageIDTurkmenmsoLanguageIDUkrainianmsoLanguageIDUrdumsoLanguageIDUzbekCyrillicmsoLanguageIDUzbekLatinmsoLanguageIDVendamsoLanguageIDVietnamesemsoLanguageIDWelshmsoLanguageIDXhosamsoLanguageIDZulumsoLanguageIDPortuguese

expression.LanguageID

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1653: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthelanguageforthespecifiedtextinshapeonetoUSEnglish.

ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange_

.LanguageID=msoLanguageIDEnglishUS

Page 1654: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LanguageSettingsPropertyReturnsaLanguageSettingsobjectwhichcontainsinformationaboutthelanguagesettingsinMicrosoftPowerPoint.Read-only.

Page 1655: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LastChildPropertyReturnsaDiagramNodeobjectrepresentingthelastdiagramnodeinacollectionofdiagramnodes.

expression.LastChild

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1656: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesanewdiagramandidentifiesthelastchilddiagramnode.

SubLastChildNodeHello()

DimshpDiagramAsShape

DimdgnNodeAsDiagramNode

DimdgnLastAsDiagramNode

DimintNodesAsInteger

'Addorgcharttofirstslideandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramOrgChart,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addthreeadditionalnodes

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

'Entertextintolastchildnode

SetdgnLast=dgnNode.Children.LastChild

dgnLast.Shape.TextFrame.TextRange.Text="HereIam!"

EndSub

Page 1657: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LastSlideViewedPropertyReturnsaSlideobjectthatrepresentstheslideviewedimmediatelybeforethecurrentslideinthespecifiedslideshowview.

Page 1658: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampletakesyoutotheslideviewedimmediatelybeforethecurrentslideinslideshowwindowone.

WithSlideShowWindows(1).View

.GotoSlide(.LastSlideViewed.SlideIndex)

EndWith

Page 1659: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1660: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LayoutPropertyLayoutpropertyasitappliestotheDiagramNodeobject.

ReturnsorsetsanMsoOrgChartLayoutTypeconstantthatrepresentsthelayouttypeforthediagramnodesinanorganizationchart.Read/write.

MsoOrgChartLayoutTypecanbeoneoftheseMsoOrgChartLayoutTypeconstants.msoOrgChartLayoutAssistantmsoOrgChartLayoutBothHangingmsoOrgChartLayoutLeftHangingmsoOrgChartLayoutMixedmsoOrgChartLayoutRightHangingmsoOrgChartLayoutStandard

expression.Layout

expressionRequired.AnexpressionthatreturnsaDiagramNodeobject.

Page 1661: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertygeneratesanerrorunlessthediagram'sTypepropertyismsoDiagramTypeOrgChart.

LayoutpropertyasitappliestotheSlideandSlideRangeobjects.

ReturnsorsetsaPpSlideLayoutconstantthatrepresentstheslidelayout.Read/write.

PpSlideLayoutcanbeoneofthesePpSlideLayoutconstants.ppLayoutBlankppLayoutChartppLayoutChartAndTextppLayoutClipartAndTextppLayoutClipArtAndVerticalTextppLayoutFourObjectsppLayoutLargeObjectppLayoutMediaClipAndTextppLayoutMixedppLayoutObjectppLayoutObjectAndTextppLayoutObjectOverTextppLayoutOrgchartppLayoutTableppLayoutTextppLayoutTextAndChartppLayoutTextAndClipartppLayoutTextAndMediaClipppLayoutTextAndObjectppLayoutTextAndTwoObjectsppLayoutTextOverObjectppLayoutTitle

Page 1662: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppLayoutTitleOnlyppLayoutTwoColumnTextppLayoutTwoObjectsAndTextppLayoutTwoObjectsOverTextppLayoutVerticalTextppLayoutVerticalTitleAndTextppLayoutVerticalTitleAndTextOverChart

expression.Layout

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1663: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheDiagramNodeobject.

Thefollowingexamplechangesthelayoutofanewly-crateddiagram.

SubChangeDiagramLayout()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramOrgChart,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

dgnNode.Layout=msoOrgChartLayoutRightHanging

EndSub

AsitappliestotheSlideobject.

Thisexamplechangesthelayoutofslideoneintheactivepresentationtoincludeatitleandsubtitleifitinitiallyhasonlyatitle.

WithActivePresentation.Slides(1)

If.Layout=ppLayoutTitleOnlyThen

.Layout=ppLayoutTitle

EndIf

EndWith

Page 1664: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 1665: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1666: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LayoutDirectionPropertyReturnsorsetsthelayoutdirectionfortheuserinterface.CanbeoneofthefollowingThedefaultvaluedependsonthelanguagesupportyouhaveselectedorinstalled.Read/writePpDirection.

PpDirectioncanbeoneofthesePpDirectionconstants.ppDirectionLeftToRightppDirectionMixedppDirectionRightToLeft

expression.LayoutDirection

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1667: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthelayoutdirectiontoright-to-left.

Application.ActivePresentation.LayoutDirection=_

ppDirectionRightToLeft

Page 1668: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1669: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LeftPropertyLeftpropertyasitappliestotheApplication,DocumentWindow,Shape,

ShapeRange,andSlideShowWindowobjects.

Application,DocumentWindowandSlideShowWindowobjects:ReturnsorsetsaSinglethatrepresentsthedistanceinpointsfromtheleftedgeofthedocument,application,andslideshowwindowstotheleftedgeoftheapplicationwindow'sclientarea.Settingthispropertytoaverylargepositiveornegativevaluemaypositionthewindowcompletelyoffthedesktop.Read/write.

Shapeobject:ReturnsorsetsaSinglethatrepresentsthedistanceinpointsfromtheleftedgeoftheshape'sboundingboxtotheleftedgeoftheslide.Read/write.

ShapeRangeobject:ReturnsorsetsaSinglethatrepresentsthedistanceinpointsfromtheleftedgeoftheleftmostshapeintheshaperangetotheleftedgeoftheslide.Read/write.

expression.Left

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

LeftpropertyasitappliestotheCommentobject.

ReturnsaSinglethatrepresentsthedistanceinpointsfromtheleftedgeofthecommenttotheleftedgeoftheslide.Read-only.

expression.Left

expressionRequired.AnexpressionthatreturnsaCommentobject.

Page 1670: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheDocumentWindowsobject.

Thisexamplearrangeswindowsoneandtwohorizontally;inotherwords,eachwindowoccupieshalftheavailableverticalspaceandalltheavailablehorizontalspaceintheapplicationwindow'sclientarea.Forthisexampletowork,theremustbeonlytwodocumentwindowsopen.

Windows.ArrangeppArrangeTiled

sngHeight=Windows(1).Height'availableheight

sngWidth=Windows(1).Width+Windows(2).Width'availablewidth

WithWindows(1)

.Width=sngWidth

.Height=sngHeight/2

.Left=0

EndWith

WithWindows(2)

.Width=sngWidth

.Height=sngHeight/2

.Top=sngHeight/2

.Left=0

EndWith

Page 1671: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LeftMarginPropertyReturnsorsetstheleftindentforthespecifiedoutlinelevel,inpoints.Read/writeSingle.

Page 1672: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifaparagraphbeginswithabullet,thebulletpositionisdeterminedbytheFirstMarginproperty,andthepositionofthefirsttextcharacterintheparagraphisdeterminedbytheLeftMarginproperty.

NoteTheRulerLevelscollectioncontainsfiveRulerLevelobjects,eachofwhichcorrespondstooneofthepossibleoutlinelevels.TheLeftMarginpropertyvaluefortheRulerLevelobjectthatcorrespondstothefirstoutlinelevelhasavalidrangeof(-9.0to4095.875).ThevalidrangefortheLeftMarginpropertyvaluesfortheRulerLevelobjectsthatcorrespondtothesecondthroughthefifthoutlinelevelsaredeterminedasfollows:

Themaximumvalueisalways4095.875.TheminimumvalueisthemaximumassignedvaluebetweentheFirstMarginpropertyandLeftMarginpropertyofthepreviouslevelplus9.

YoucanusethefollowingequationstodeterminetheminimumvaluefortheLeftMarginproperty.Index,theindexnumberoftheRulerLevelobject,indicatestheobject’scorrespondingoutlinelevel.TodeterminetheminimumLeftMarginpropertyvaluesfortheRulerLevelobjectsthatcorrespondtothesecondthroughthefifthoutlinelevels,substitute2,3,4,or5fortheindexplaceholder.

Minimum(RulerLevel(index).FirstMargin)=Maximum(RulerLevel(index-1).FirstMargin,RulerLevel(index-1).LeftMargin)+9

Minimum(RulerLevel(index).LeftMargin)=Maximum(RulerLevel(index-1).FirstMargin,RulerLevel(index-1).LeftMargin)+9

Page 1673: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation.

WithApplication.ActivePresentation_

.SlideMaster.TextStyles(ppBodyStyle)

With.Ruler.Levels(1)

.FirstMargin=9

.LeftMargin=54

EndWith

EndWith

Page 1674: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1675: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LengthPropertyLengthpropertyasitappliestotheCalloutFormatobject.

WhentheAutoLengthpropertyofthespecifiedcalloutissettoFalse,theLengthpropertyreturnsthelength(inpoints)ofthefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox).Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).Read-onlyFloat.UsetheCustomLengthmethodtosetthevalueofthispropertyfortheCalloutFormatobject.

expression.Length

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

LengthpropertyasitappliestotheTextRangeobject.

Returnsthelengthofthespecifiedtextrange,incharacters.Read-onlyLong.

expression.Length

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1676: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheCalloutFormatobject.

Ifthefirstlinesegmentinthecalloutnamed"co1"hasafixedlength,thisexamplespecifiesthatthelengthofthefirstlinesegmentinthecalloutnamed"co2"willalsobefixedatthatlength.Fortheexampletowork,bothcalloutsmusthavemultiple-segmentlines.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

With.Item("co1").Callout

IfNot.AutoLengthThenlen1=.Length

EndWith

Iflen1Then.Item("co2").Callout.CustomLengthlen1

EndWith

AsitappliestotheTextRangeobject.

Thisexamplesetsthetitlefontsizeto48pointsifthetitleofslidetwocontainsmorethanfivecharacters,oritsetsthefontsizeto72pointsifthetitlehasfiveorfewercharacters.

SetmyDocument=ActivePresentation.Slides(2)

WithmyDocument.Shapes(1).TextFrame.TextRange

If.Length>5Then

.Font.Size=48

Else

.Font.Size=72

EndIf

EndWith

Page 1677: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1678: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LevelsPropertyLevelspropertyasitappliestotheRulerobject.

ReturnsaRulerLevelsobjectthatrepresentsoutlineindentformatting.Read-only.

expression.Levels

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

LevelspropertyasitappliestotheTextStyleobject.

ReturnsaTextStyleLevelsobjectthatrepresentsoutlinetextformatting.Read-only.

expression.Levels

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1679: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation,andthenitsetsthefontnameandfontsizefortextatthatlevel.

WithApplication.ActivePresentation_

.SlideMaster.TextStyles(ppBodyStyle)

With.Ruler.Levels(1)'setsindentsforlevel1

.FirstMargin=9

.LeftMargin=54

EndWith

With.Levels(1).Font'setstextformattingforlevel1

.Name="arial"

.Size=36

EndWith

EndWith

Page 1680: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LinePropertyReturnsaLineFormatobjectthatcontainslineformattingpropertiesforthespecifiedshape.(Foraline,theLineFormatobjectrepresentsthelineitself;forashapewithaborder,theLineFormatobjectrepresentstheborder.)Read-only.

Page 1681: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsabluedashedlinetomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(10,10,250,250).Line

.DashStyle=msoLineDashDotDot

.ForeColor.RGB=RGB(50,0,128)

EndWith

Thisexampleaddsacrosstothefirstslideandthensetsitsbordertobe8pointsthickandred.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeCross,10,10,50,70).Line

.Weight=8

.ForeColor.RGB=RGB(255,0,0)

EndWith

Page 1682: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1683: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LineRuleAfterPropertyDetermineswhetherlinespacingafterthelastlineineachparagraphissettoaspecificnumberofpointsorlines.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLinespacingafterthelastlineineachparagraphissettoaspecificnumberofpoints.msoTriStateMixedmsoTriStateTogglemsoTrueLinespacingafterthelastlineineachparagraphissettoaspecificnumberoflines.

Page 1684: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysamessageboxthatshowsthesettingforspaceafterparagraphsforthetextinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame

With.TextRange.ParagraphFormat

sa=.SpaceAfter

If.LineRuleAfterThen

saUnits="lines"

Else

saUnits="points"

EndIf

EndWith

EndWith

MsgBox"Currentspacingafterparagraphs:"&sa&saUnits

Page 1685: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1686: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LineRuleBeforePropertyDetermineswhetherlinespacingbeforethefirstlineineachparagraphissettoaspecificnumberofpointsorlines.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLinespacingbeforethefirstlineineachparagraphissettoaspecificnumberofpoints.msoTriStateMixedmsoTriStateTogglemsoTrueLinespacingbeforethefirstlineineachparagraphissettoaspecificnumberoflines.

Page 1687: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysamessageboxthatshowsthesettingforspacebeforeparagraphsfortextinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame

With.TextRange.ParagraphFormat

sb=.SpaceBefore

If.LineRuleBeforeThen

sbUnits="lines"

Else

sbUnits="points"

EndIf

EndWith

EndWith

MsgBox"Currentspacingbeforeparagraphs:"&sb&sbUnits

Page 1688: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1689: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LineRuleWithinPropertyDetermineswhetherlinespacingbetweenbaselinesissettoaspecificnumberofpointsorlines.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLinespacingbetweenbaselinesissettoaspecificnumberofpoints.msoTriStateMixedmsoTriStateTogglemsoTrueLinespacingbetweenbaselinesissettoaspecificnumberoflines.

Page 1690: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysamessageboxthatshowsthesettingforlinespacingfortextinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame

With.TextRange.ParagraphFormat

ls=.SpaceWithin

If.LineRuleWithinThen

lsUnits="lines"

Else

lsUnits="points"

EndIf

EndWith

EndWith

MsgBox"Currentlinespacing:"&ls&lsUnits

Page 1691: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LinkFormatPropertyReturnsaLinkFormatobjectthatcontainsthepropertiesthatareuniquetolinkedOLEobjects.Read-only.

Page 1692: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleupdatesthelinksbetweenanyOLEobjectsonslideoneintheactivepresentationandtheirsourcefiles.

ForEachshInActivePresentation.Slides(1).Shapes

Ifsh.Type=msoLinkedOLEObjectThen

Withsh.LinkFormat

.Update

EndWith

EndIf

Next

Page 1693: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1694: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LoadedPropertyDetermineswhetherthespecifiedadd-inisloaded.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedadd-inisloaded.IntheAdd-Insdialogbox(Toolsmenu),thecheckboxesnexttoloadedadd-insareselected.

Page 1695: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsMyTools.ppatothelistintheAdd-Insdialogbox(Toolsmenu)andthenloadsit.

Addins.Add("c:\mydocuments\mytools.ppa").Loaded=msoTrue

Thisexampleunloadstheadd-innamed"MyTools."

Application.Addins("mytools").Loaded=msoFalse

Page 1696: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1697: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LockAspectRatioPropertyDetermineswhetherthespecifiedshaperetainsitsoriginalproportionswhenyouresizeit.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseYoucanchangetheheightandwidthoftheshapeindependentlyofoneanotherwhenyouresizeit.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshaperetainsitsoriginalproportionswhenyouresizeit.

Page 1698: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsacubetomyDocument.Thecubecanbemovedandresized,butnotreproportioned.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddShape(msoShapeCube,50,50,100,200)_

.LockAspectRatio=msoTrue

Page 1699: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1700: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LoopSoundUntilNextPropertyRead/writeMsoTriState.Specifieswhetherthesoundthat'sbeensetforthespecifiedslidetransitionloopsuntilthenextsoundstarts.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThesoundthat'sbeensetforthespecifiedslidetransitionloopsuntilthenextsoundstarts.

Page 1701: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatthefileDudududu.wavwillstarttoplayatthetransitiontoslidetwointheactivepresentationandwillcontinuetoplayuntilthenextsoundstarts.

WithActivePresentation.Slides(2).SlideShowTransition

.SoundEffect.ImportFromFile"c:\sndsys\dudududu.wav"

.LoopSoundUntilNext=msoTrue

EndWith

Page 1702: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1703: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

LoopUntilStoppedPropertyAsitappliestothePlaySettingsobject.

Determineswhetherthespecifiedmovieorsoundloopscontinuouslyuntileitherthenextmovieorsoundstarts,theuserclickstheslide,oraslidetransitionoccurs.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedmovieorsoundloopscontinuouslyuntileitherthenextmovieorsoundstarts,theuserclickstheslide,oraslidetransitionoccurs.

expression.LoopUntilStopped

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

AsitappliestotheSlideShowSettingsobject.

DetermineswhetherspecifiedslideshowloopscontinuouslyuntiltheuserpressesESC.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowloopscontinuouslyuntiltheuserpressesESC.

Page 1704: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expression.LoopUntilStopped

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1705: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestothePlaySettingsobject.

Thisexamplespecifiesthatshapethreeonslideoneintheactivepresentationwillstarttoplayintheanimationorderandwillcontinuetoplayuntilthenextmediaclipstarts.Shapethreemustbeasoundormovieobject.

ActivePresentation.Slides(1).Shapes(3)_

.AnimationSettings.PlaySettings.LoopUntilStopped=msoTrue

AsitappliestotheSlideShowSettingsobject.

Thisexamplestartsaslideshowoftheactivepresentationthatwillautomaticallyadvancetheslides(usingthestoredtimings)andwillloopcontinuouslythroughthepresentationuntiltheuserpressesESC.

WithActivePresentation.SlideShowSettings

.AdvanceMode=ppSlideShowUseSlideTimings

.LoopUntilStopped=msoTrue

.Run

EndWith

Page 1706: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MainSequencePropertyReturnsaSequenceobjectthatrepresentsthecollectionofEffectobjectsinthemainanimationsequenceofaslide.

expression.MainSequence

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1707: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueoftheMainSequencepropertyisanemptySequencecollection.AnyattempttoreturnavaluefromthispropertywithoutaddingoneormoreEffectobjectstothemainanimationsequencewillresultinarun-timeerror.

Page 1708: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsaboomeranganimationtoanewshapeonanewslideaddedtotheactivepresentation.

SubNewSequence()

DimsldNewAsSlide

DimshpnewAsShape

SetsldNew=ActivePresentation.Slides.Add(Index:=1,Layout:=ppLayoutBlank)

Setshpnew=sldNew.Shapes.AddShape(Type:=msoShape5pointStar,_

Left:=25,Top:=25,Width:=100,Height:=100)

WithsldNew.TimeLine.MainSequence.AddEffect(Shape:=shpnew,_

EffectId:=msoAnimEffectBoomerang)

.Timing.Speed=0.5

.Timing.Accelerate=0.2

EndWith

EndSub

Page 1709: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MarginBottomPropertyReturnsorsetsthedistance(inpoints)betweenthebottomofthetextframeandthebottomoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.

Page 1710: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocument,addstexttotherectangle,andthensetsthemarginsforthetextframe.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,_

0,0,250,140).TextFrame

.TextRange.Text="Hereissometesttext"

.MarginBottom=0

.MarginLeft=10

.MarginRight=0

.MarginTop=20

EndWith

Page 1711: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MarginLeftPropertyReturnsorsetsthedistance(inpoints)betweentheleftedgeofthetextframeandtheleftedgeoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.

Page 1712: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocument,addstexttotherectangle,andthensetsthemarginsforthetextframe.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,_

0,0,250,140).TextFrame

.TextRange.Text="Hereissometesttext"

.MarginBottom=0

.MarginLeft=10

.MarginRight=0

.MarginTop=20

EndWith

Page 1713: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MarginRightPropertyReturnsorsetsthedistance(inpoints)betweentherightedgeofthetextframeandtherightedgeoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.

Page 1714: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocument,addstexttotherectangle,andthensetsthemarginsforthetextframe.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,_

0,0,250,140).TextFrame

.TextRange.Text="Hereissometesttext"

.MarginBottom=0

.MarginLeft=10

.MarginRight=5

.MarginTop=20

EndWith

Page 1715: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MarginTopPropertyReturnsorsetsthedistance(inpoints)betweenthetopofthetextframeandthetopoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.

Page 1716: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocument,addstexttotherectangle,andthensetsthemarginsforthetextframe.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,_

0,0,250,140).TextFrame

.TextRange.Text="Hereissometesttext"

.MarginBottom=0

.MarginLeft=10

.MarginRight=0

.MarginTop=20

EndWith

Page 1717: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MasterPropertyReturnsaMasterobjectthatrepresentstheslidemaster.Read-only.

Page 1718: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebackgroundfillfortheslidemasterforslideoneintheactivepresentation.

ActivePresentation.Slides(1).Master.Background.Fill_

.PresetGradientmsoGradientDiagonalUp,1,msoGradientDaybreak

Page 1719: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1720: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MediaTypePropertyReturnstheOLEmediatype.Read-onlyPpMediaType.

PpMediaTypecanbeoneofthesePpMediaTypeconstants.ppMediaTypeMixedppMediaTypeMovieppMediaTypeOtherppMediaTypeSound

expression.MediaType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1721: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsallnativesoundobjectsonslideoneintheactivepresentationtoloopuntilmanuallystoppedduringaslideshow.

ForEachsoInActivePresentation.Slides(1).Shapes

Ifso.Type=msoMediaThen

Ifso.MediaType=ppMediaTypeSoundThen

so.AnimationSettings.PlaySettings_

.LoopUntilStopped=True

EndIf

EndIf

Next

Page 1722: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MotionEffectPropertyReturnsaMotionEffectobjectthatrepresentsthepropertiesofamotionanimation.

expression.MotionEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1723: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsanewmotionbehaviortothefirstslide'smainsequencethatmovesthespecifiedanimationsequencefromonesideofthepagetotheshape'soriginalposition.

SubNewMotion()

WithActivePresentation.Slides(1).TimeLine.MainSequence(1)_

.Behaviors.Add(msoAnimTypeMotion).MotionEffect

.FromX=100

.FromY=100

.ToX=0

.ToY=0

EndWith

EndSub

Page 1724: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1725: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NamePropertyNamepropertyasitappliestotheColorFormat,Design,Font,Master,

Shape,ShapeRange,Slide,SlideRange,andSoundEffectobjects.

ColorFormat,Design,Font,andMasterobjects:Returnsorsetsthenameofthespecifiedobject.Read/writeString.

ShapeorShapeRangeobjects.Whenashapeiscreated,MicrosoftPowerPointautomaticallyassignsitanameintheformShapeTypeNumber,whereShapeTypeidentifiesthetypeofshapeorAutoShape,andNumberisanintegerthat'suniquewithinthecollectionofshapesontheslide.Forexample,theautomaticallygeneratednamesoftheshapesonaslidecouldbePlaceholder1,Oval2,andRectangle3.Toavoidconflictwithautomaticallyassignednames,don'tusetheformShapeTypeNumberforuser-definednames,whereShapeTypeisavaluethatisusedforautomaticallygeneratednames,andNumberisanypositiveinteger.Ashaperangemustcontainexactlyoneshape.Read/writeString.

SlideorSlideRangeobjects:Whenaslideisinsertedintoapresentation,PowerPointautomaticallyassignsitanameintheformSliden,wherenisanintegerthatrepresentstheorderinwhichtheslidewascreatedinthepresentation.Forexample,thefirstslideinsertedintoapresentationisautomaticallynamedSlide1.Ifyoucopyaslidefromonepresentationtoanother,theslidelosesthenameithadinthefirstpresentationandisautomaticallyassignedanewnameinthesecondpresentation.Asliderangemustcontainexactlyoneslide.Read/writeString.

SoundEffectobject:ThesetofvalidnamesforapresentationappearsintheSoundboxintheSlideTransitiontaskpane(SlideShowmenu).Read/writeString.

expression.Name

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1726: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NamepropertyasitappliestotheAddIn,Application,NamedSlideShow,andPresentationobjects.

AddInobject:Thename(title)oftheadd-inforfiletypesthatareregistered.Read-onlyString.

Applicationobject:Returnsthestring"MicrosoftPowerPoint."Read-onlyString.

NamedSlideShowobject:Youcannotusethispropertytosetthenameforacustomslideshow.UsetheAddmethodtoredefineacustomslideshowunderanewname.Read-onlyString.

Presentationobject:Thenameofthepresentationincludesthefilenameextension(forfiletypesthatareregistered)butdoesn'tincludeitspath.Youcannotusethispropertytosetthename.UsetheSaveAsmethodtosavethepresentationunderadifferentnameifyouneedtochangethename.Read-onlyString.

expression.Name

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1727: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcanusetheobject'snameinconjunctionwiththeItemmethodtoreturnareferencetotheobjectiftheItemmethodforthecollectionthatcontainstheobjecttakesaVariantargument.Forexample,ifthevalueoftheNamepropertyforashapeisRectangle2,then.Shapes("Rectangle2")willreturnareferencetothatshape.

Page 1728: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheShapeobject.

Thisexamplesetsthenameofobjecttwoonslideoneintheactivepresentationto"bigtriangle."

ActivePresentation.Slides(1).Shapes(2).Name="bigtriangle"

Thisexamplesetsthefillcolorfortheshapenamed"bigtriangle"onslideoneintheactivepresentation.

ActivePresentation.Slides(1)_

.Shapes("bigtriangle").Fill.ForeColor.RGB=RGB(0,0,255)

Page 1729: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NameAsciiPropertyReturnsorsetsthefontusedforASCIIcharacters(characterswithcharactersetnumberswithintherangeof0to127).Read/writeString.

Page 1730: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueofthispropertyisTimesNewRoman.UsetheReplacemethodtochangethefontthat’sappliedtoalltextandthatappearsintheFontboxontheFormattingtoolbar.

Page 1731: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthefontusedforASCIIcharactersinthetitleofthefirstslidetoCentury.

Application.ActivePresentation.Slides(1).Shapes.Title_

.TextFrame.TextRange.Font.NameAscii="Century"

Page 1732: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NameComplexScriptPropertyReturnsorsetsthecomplexscriptfontname.Usedformixedlanguagetext.Read/writeString.

Page 1733: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Whenyouhavearight-to-leftlanguagesettingspecified,thispropertyisequivalenttotheComplexscriptsfontlistintheFontdialogbox(Formatmenu).WhenyouhaveanAsianlanguagesettingspecified,thispropertyisequivalenttotheAsiantextfontlistintheFontdialogbox(Formatmenu).

Page 1734: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthecomplexscriptfonttoTimesNewRoman.

ActivePresentation.Slides(1).Shapes.Title.TextFrame_

.TextRange.Font.NameComplexScript="TimesNewRoman"

Page 1735: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NamedSlideShowsPropertyReturnsaNamedSlideShowscollectionthatrepresentsallthenamedslideshows(customslideshows)inthespecifiedpresentation.Eachnamedslideshow,orcustomslideshow,isauser-selectedsubsetofthespecifiedpresentation.Read-only.

Page 1736: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheAddmethodoftheNamedSlideShowsobjecttocreateanamedslideshow.

Page 1737: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstotheactivepresentationanamedslideshow"QuickShow"thatcontainsslides2,7,and9.Theexamplethenrunsthisslideshow.

DimqSlides(1To3)AsLong

WithActivePresentation

With.Slides

qSlides(1)=.Item(2).SlideID

qSlides(2)=.Item(7).SlideID

qSlides(3)=.Item(9).SlideID

EndWith

With.SlideShowSettings

.RangeType=ppShowNamedSlideShow

.NamedSlideShows.Add"QuickShow",qSlides

.SlideShowName="QuickShow"

.Run

EndWith

EndWith

Page 1738: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NameFarEastPropertyReturnsorsetstheAsianfontname.Read/writeString.

Page 1739: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheReplacemethodtochangethefontthat’sappliedtoalltextandthatappearsintheFontboxontheFormattingtoolbar.

Page 1740: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaysthenameoftheAsianfontappliedtotheselection.

MsgBoxActiveWindow.Selection.ShapeRange_

.TextFrame.TextRange.Font.NameFarEast

Page 1741: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NameOtherPropertyReturnsorsetsthefontusedforcharacterswhosecharactersetnumbersaregreaterthan127.Read/writeString.

Remarks

IntheU.S.EnglishversionofMicrosoftPowerPoint,thispropertyisread-onlyandthedefaultvalueisTimesNewRoman.UsetheReplacemethodtochangeafontinapresentation.TheNameOtherpropertysettingisthesameastheNameASCIIpropertysettingexceptwhentheNameASCIIpropertyissetto"UseFEFont."

Page 1742: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefontusedforcharacterswhosecharactersetnumbersaregreaterthan127,forthefirstmemberoftheFontscollection.

ActivePresentation.Fonts(1).NameOther="Tahoma"

Page 1743: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewPresentationPropertyReturnsaNewFileobjectthatrepresentsapresentationlistedontheNewPresentationtaskpane.Read-only.

expression.NewPresentation

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1744: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplelistsapresentationontheNewPresentationtaskpaneatthebottomofthelastsectioninthepane.

SubCreateNewPresentationListItem()

Application.NewPresentation.AddFileName:="C:\Presentation.ppt"

Application.CommandBars("TaskPane").Visible=True

EndSub

Page 1745: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1746: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NodesPropertyNodespropertyasitappliestotheDiagramobject.

ReturnsaDiagramNodesobjectthatcontainsaflatlistofallofthenodesinthespecifieddiagram.

expression.Nodes

expressionRequired.AnexpressionthatreturnsaDiagramobject.

NodespropertyasitappliestotheShapeandShapeRangeobjects.

ReturnsaShapeNodescollectionthatrepresentsthegeometricdescriptionofthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentfreeformdrawings.

expression.Nodes

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1747: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheDiagramobject.

Thefollowingexamplereturnsthenumberofnodesinanewly-createddiagram.

SubConvertPyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Createpyramiddiagramandaddfirstnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramPyramid,Left:=10,_

Top:=15,Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addthreechildnodestothefirstnode

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

'Automaticallylayoutdiagramandconverttoradialdiagram

WithdgnNode.Diagram

.AutoLayout=msoTrue

.ConvertType:=msoDiagramRadial

EndWith

'Displaythenumberofnodesinthediagram

MsgBoxdgnNode.Diagram.Nodes.Count

EndSub

AsitappliestotheShapeobject.

ThisexampleaddsasmoothnodewithacurvedsegmentafternodefourinshapethreeonmyDocument.Shapethreemustbeafreeformdrawingwithatleastfournodes.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

.InsertIndex:=4,SegmentType:=msoSegmentCurve,_

Page 1748: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

EditingType:=msoEditingSmooth,X1:=210,Y1:=100

EndWith

Page 1749: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NoLineBreakAfterPropertyReturnsorsetsthecharactersthatcannotendaline.Read/writeString.

Page 1750: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesets"$","(","[","\",and"{"ascharactersthatcannotendaline.

WithActivePresentation

.FarEastLineBreakLevel=ppFarEastLineBreakLevelCustom

.NoLineBreakAfter="$([\{"

EndWith

Page 1751: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NoLineBreakBeforePropertyReturnsorsetsthecharactersthatcannotbeginaline.Read/writeString.

Page 1752: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesets"!",")",and"]"ascharactersthatcannotbeginaline.

WithActivePresentation

.FarEastLineBreakLevel=ppFarEastLineBreakLevelCustom

.NoLineBreakBefore="!)]"

EndWith

Page 1753: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1754: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NormalizedHeightPropertyDetermineswhetherthecharacters(bothuppercaseandlowercase)inthespecifiedWordArtarethesameheight.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueAllcharacters(bothuppercaseandlowercase)inthespecifiedWordArtarethesameheight.

Page 1755: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsWordArtthatcontainsthetext"TestEffect"tomyDocumentandgivesthenewWordArtthename"texteff1."Thecodethenmakesallcharactersintheshapenamed"texteff1"thesameheight.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddTextEffect(PresetTextEffect:=msoTextEffect1,_

Text:="TestEffect",FontName:="CourierNew",_

FontSize:=44,FontBold:=True,_

FontItalic:=False,Left:=10,Top:=10)_

.Name="texteff1"

myDocument.Shapes("texteff1").TextEffect.NormalizedHeight=msoTrue

Page 1756: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NotesMasterPropertyReturnsaMasterobjectthatrepresentsthenotesmaster.Read-only.

Page 1757: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheheaderandfootertextforthenotesmasterfortheactivepresentation.

WithApplication.ActivePresentation.NotesMaster.HeadersFooters

.Header.Text="EmployeeGuidelines"

.Footer.Text="VolcanoCoffee"

EndWith

Page 1758: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1759: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NotesOrientationPropertyReturnsorsetstheon-screenandprintedorientationofnotespages,handouts,andoutlinesforthespecifiedpresentation.Read/writeMsoOrientation.

MsoOrientationcanbeoneoftheseMsoOrientationconstants.msoOrientationHorizontalmsoOrientationMixedmsoOrientationVertical

expression.NotesOrientation

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1760: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheorientationofallnotespages,handouts,andoutlinesintheactivepresentationtohorizontal(landscape).

Application.ActivePresentation.PageSetup.NotesOrientation=_

msoOrientationHorizontal

Page 1761: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NotesPagePropertyReturnsaSlideRangeobjectthatrepresentsthenotespagesforthespecifiedslideorrangeofslides.Read-only.

NoteThefollowingpropertiesandmethodswillfailifappliedtoaSlideRangeobjectthatrepresentsanotespage:Copymethod,Cutmethod,Deletemethod,Duplicatemethod,HeadersFootersproperty,Hyperlinksproperty,Layoutproperty,PrintStepsproperty,SlideShowTransitionproperty.

Page 1762: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheNotesPagepropertyreturnsthenotespageforeitherasingleslideorarangeofslidesandallowsyoutomakechangesonlytothosenotespages.Ifyouwanttomakechangesthataffectallnotespages,usetheNotesMasterpropertytoreturntheSlideobjectthatrepresentsthenotesmaster.

Page 1763: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebackgroundfillforthenotespageforslideoneintheactivepresentation.

WithActivePresentation.Slides(1).NotesPage

.FollowMasterBackground=False

.Background.Fill.PresetGradient_

msoGradientHorizontal,1,msoGradientLateSunset

EndWith

Page 1764: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NumberPropertyReturnsthebulletnumberofaparagraphwhentheTypepropertyoftheBulletFormatobjectissettoppBulletNumbered.Read-onlyLong.

Page 1765: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifthispropertyisqueriedformultipleparagraphswithdifferentnumbers,thenthevalueppBulletMixedisreturned.IfthispropertyisqueriedforaparagraphwithatypeotherthanppBulletNumbered,thenarun-timeerroroccurs.

Page 1766: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplereturnsthebulletnumberofparagraphoneintheselectedtextrangetoavariablenamedmyParnum.

WithActiveWindow.Selection

If.Type=ppSelectionTextRangeThen

With.TextRange.Paragraphs(1).ParagraphFormat.Bullet

If.Type=ppBulletNumberedThen

myParnum=.Number

EndIf

EndWith

EndIf

EndWith

Page 1767: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NumberOfCopiesPropertyReturnsorsetsthenumberofcopiesofapresentationtobeprinted.Thedefaultvalueis1.Read/writeLong.

Page 1768: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SpecifyingavaluefortheCopiesargumentofthePrintOutmethodsetsthevalueofthisproperty.

Page 1769: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintsthreecollatedcopiesoftheactivepresentation.

WithActivePresentation.PrintOptions

.NumberOfCopies=3

.Collate=True

.Parent.PrintOut

EndWith

Page 1770: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ObjectPropertyReturnstheobjectthatrepresentsthespecifiedOLEobject'stop-levelinterface.ThispropertyallowsyoutoaccessthepropertiesandmethodsoftheapplicationinwhichanOLEobjectwascreated.Read-only.

Page 1771: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheTypeNamefunctiontodeterminethetypeofobjectthispropertyreturnsforaspecificOLEobject.

Page 1772: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthetypeofobjectcontainedinshapeoneonslideoneintheactivepresentation.ShapeonemustcontainanOLEobject.

MsgBoxTypeName(ActivePresentation.Slides(1)_

.Shapes(1).OLEFormat.Object)

ThisexampledisplaysthenameoftheapplicationinwhicheachembeddedOLEobjectonslideoneintheactivepresentationwascreated.

ForEachsInActivePresentation.Slides(1).Shapes

Ifs.Type=msoEmbeddedOLEObjectThen

MsgBoxs.OLEFormat.Object.Application.Name

EndIf

Next

ThisexampleaddstexttocellA1onworksheetoneintheMicrosoftExcelworkbookcontainedinshapethreeonslideoneintheactivepresentation.

WithActivePresentation.Slides(1).Shapes(3)

.OLEFormat.Object.Worksheets(1).Range("A1").Value="Newtext"

EndWith

Page 1773: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1774: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ObjectVerbsPropertyReturnsaObjectVerbscollectionthatcontainsalltheOLEverbsforthespecifiedOLEobject.Read-only.

Page 1775: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaysalltheavailableverbsfortheOLEobjectcontainedinshapeoneonslidetwointheactivepresentation.Forthisexampletowork,shapeonemustbeashapethatrepresentsanOLEobject.

WithActivePresentation.Slides(2).Shapes(1).OLEFormat

ForEachvIn.ObjectVerbs

MsgBoxv

Next

EndWith

ThisexamplespecifiesthattheOLEobjectrepresentedbyshapeoneonslidetwointheactivepresentationwillopenwhenit'sclickedduringaslideshowif"Open"isoneoftheOLEverbsforthatobject.Forthisexampletowork,shapeonemustbeashapethatrepresentsanOLEobject.

WithActivePresentation.Slides(2).Shapes(1)

ForEachsVerbIn.OLEFormat.ObjectVerbs

IfsVerb="Open"Then

With.ActionSettings(ppMouseClick)

.Action=ppActionOLEVerb

.ActionVerb=sVerb

EndWith

ExitFor

EndIf

Next

EndWith

Page 1776: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1777: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ObscuredPropertyDetermineswhethertheshadowofthespecifiedshapeappearsfilledinandisobscuredbytheshape.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheshadowhasnofillandtheoutlineoftheshadowisvisiblethroughtheshapeiftheshapehasnofill.msoTriStateMixedmsoTriStateTogglemsoTrueTheshadowofthespecifiedshapeappearsfilledinandisobscuredbytheshape,eveniftheshapehasnofill.

Page 1778: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthehorizontalandverticaloffsetsoftheshadowforshapethreeonmyDocument.Theshadowisoffset5pointstotherightoftheshapeand3pointsaboveit.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.Theshadowwillbefilledinandobscuredbytheshape,eveniftheshapehasnofill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Shadow

.Visible=True

.OffsetX=5

.OffsetY=-3

.Obscured=msoTrue

EndWith

Page 1779: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OffsetXPropertyReturnsorsetsthehorizontaloffsetoftheshadowfromthespecifiedshape,inpoints.Apositivevalueoffsetstheshadowtotherightoftheshape;anegativevalueoffsetsittotheleft.Read/writeSingle.

Page 1780: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyouwanttonudgeashadowhorizontallyorverticallyfromitscurrentpositionwithouthavingtospecifyanabsoluteposition,usetheIncrementOffsetXmethodortheIncrementOffsetYmethod.

Page 1781: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthehorizontalandverticaloffsetsoftheshadowforshapethreeonmyDocument.Theshadowisoffset5pointstotherightoftheshapeand3pointsaboveit.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Shadow

.Visible=True

.OffsetX=5

.OffsetY=-3

EndWith

Page 1782: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OffsetYPropertyReturnsorsetstheverticaloffsetoftheshadowfromthespecifiedshape,inpoints.Apositivevalueoffsetstheshadowtotherightoftheshape;anegativevalueoffsetsittotheleft.Read/writeSingle.

Page 1783: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyouwanttonudgeashadowhorizontallyorverticallyfromitscurrentpositionwithouthavingtospecifyanabsoluteposition,usetheIncrementOffsetXmethodortheIncrementOffsetYmethod.

Page 1784: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthehorizontalandverticaloffsetsoftheshadowforshapethreeonmyDocument.Theshadowisoffset5pointstotherightoftheshapeand3pointsaboveit.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Shadow

.Visible=True

.OffsetX=5

.OffsetY=-3

EndWith

Page 1785: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OLEFormatPropertyReturnsanOLEFormatobjectthatcontainsOLEformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentOLEobjects.Read-only

Page 1786: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleloopsthroughalltheobjectsonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftWorddocumentstobeupdatedmanually.

ForEachsldInActivePresentation.Slides

ForEachshInsld.Shapes

Ifsh.Type=msoLinkedOLEObjectThen

Ifsh.OLEFormat.ProgID="Word.Document"Then

sh.LinkFormat.AutoUpdate=ppUpdateOptionManual

EndIf

EndIf

Next

Next

Page 1787: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OperatingSystemPropertyReturnsthenameoftheoperatingsystem.Read-onlyString.

Page 1788: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleteststheOperatingSystempropertytoseewhetherPowerPointisrunningwitha32-bitversionofMicrosoftWindows.

os=Application.OperatingSystem

IfInStr(os,"Windows(32-bit)")<>0Then

MsgBox"Runninga32-bitversionofMicrosoftWindows"

EndIf

Page 1789: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OptionsPropertyReturnsanOptionsobjectthatrepresentsapplicationoptionsinMicrosoftPowerPoint.

expression.Options

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Page 1790: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

UsetheOptionspropertytoreturntheOptionsobject.ThefollowingexamplesetsthreeapplicationoptionsforPowerPoint.

SubTogglePasteOptionsButton()

WithApplication.Options

If.DisplayPasteOptions=FalseThen

.DisplayPasteOptions=True

EndIf

EndWith

EndSub

Page 1791: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1792: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OrganizeInFolderPropertyDetermineswhetherallsupportingfiles,suchasbackgroundtexturesandgraphics,areorganizedinaseparatefolderwhenyousaveorpublishthespecifiedpresentationasaWebpage.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseSupportingfilesaresavedinthesamefolderastheWebpage.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Allsupportingfiles,suchasbackgroundtexturesandgraphics,areorganizedinaseparatefolderwhenyousaveorpublishthespecifiedpresentationasaWebpage.

Page 1793: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThenewfolderiscreatedwithinthefolderwhereyouhavesavedtheWebpage,andisnamedafterthepresentation.IftheUseLongFileNamespropertyissettoTrue,asuffixisaddedtothefoldername.

IfyousaveapresentationthatwaspreviouslysavedwiththeOrganizeInFolderpropertysettoadifferentvalue,MicrosoftPowerPointautomaticallymovesthesupportingfilesintooroutofthefolderasappropriate.

Ifyoudon'tuselongfilenames(thatis,iftheUseLongFileNamespropertyissettoFalse),PowerPointautomaticallysavesanysupportingfilesinaseparatefolder.ThefilescannotbesavedinthesamefolderastheWebpage.

Page 1794: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatallsupportingfilesaresavedinthesamefolderwhenpresentationtwoissavedorpublishedasaWebpage.

Presentations(2).WebOptions.OrganizeInFolder=msoFalse

Page 1795: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1796: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OrientationPropertyReturnsorsetstextorientation.Read/writeMsoTextOrientation.Someoftheseconstantsmaynotbeavailabletoyou,dependingonthelanguagesupport(U.S.English,forexample)thatyou’veselectedorinstalled.

MsoTextOrientationcanbeoneoftheseMsoTextOrientationconstants.msoTextOrientationDownwardmsoTextOrientationHorizontalmsoTextOrientationHorizontalRotatedFarEastmsoTextOrientationMixedmsoTextOrientationUpwardmsoTextOrientationVerticalmsoTextOrientationVerticalFarEast

expression.Orientation

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1797: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleorientsthetexthorizontallywithinshapethreeonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(3).TextFrame_

.Orientation=msoTextOrientationHorizontal

Page 1798: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1799: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

OutputTypePropertyReturnsorsetsavaluethatindicateswhichcomponent(slides,handouts,notespages,oranoutline)ofthepresentationistobeprinted.Read/writePpPrintOutputType.

PpPrintOutputTypecanbeoneofthesePpPrintOutputTypeconstants.ppPrintOutputBuildSlidesppPrintOutputFourSlideHandoutsppPrintOutputNineSlideHandoutsppPrintOutputNotesPagesppPrintOutputOneSlideHandoutsppPrintOutputOutlineppPrintOutputSixSlideHandoutsppPrintOutputSlidesppPrintOutputThreeSlideHandoutsppPrintOutputTwoSlideHandouts

expression.OutputType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1800: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintshandoutsoftheactivepresentationwithsixslidestoapage.

WithActivePresentation

.PrintOptions.OutputType=ppPrintOutputSixSlideHandouts

.PrintOut

EndWith

Page 1801: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PageSetupPropertyReturnsaPageSetupobjectwhosepropertiescontrolslidesetupattributesforthespecifiedpresentation.Read-only.

Page 1802: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetstheslidesizeandslideorientationforthepresentationnamed"Pres1."

WithPresentations("pres1").PageSetup

.SlideSize=ppSlideSize35MM

.SlideOrientation=msoOrientationHorizontal

EndWith

Page 1803: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1804: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PanesPropertyReturnsaPanescollectionthatrepresentsthepanesinthedocumentwindow.Read-only.

Page 1805: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampletestsforthenumberofpanesintheactivewindow.Ifthevalueisone,indicatinganyviewotherthatnormalview,normalviewisactivated.

IfActiveWindow.Panes.Count=1Then

ActiveWindow.ViewType=ppViewNormal

EndIf

Page 1806: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ParagraphPropertyReturnsorsetsaLongthatrepresentstheparagraphinatextrangetowhichtoapplyanimationeffects.Read/write.

expression.Paragraph

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1807: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ParagraphFormatPropertyReturnsaParagraphFormatobjectthatrepresentsparagraphformattingforthespecifiedtext.Read-only.

Page 1808: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthelinespacingbefore,within,andaftereachparagraphinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(2).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat

.LineRuleWithin=msoTrue

.SpaceWithin=1.4

.LineRuleBefore=msoTrue

.SpaceBefore=0.25

.LineRuleAfter=msoTrue

.SpaceAfter=0.75

EndWith

EndWith

Page 1809: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ParentPropertyReturnstheparentobjectforthespecifiedobject.

expression.Parent

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1810: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsanovalcontainingtexttoslideoneintheactivepresentationandrotatestheovalandthetext45degrees.TheparentobjectforthetextframeistheShapeobjectthatcontainsthetext.

SetmyShapes=ActivePresentation.Slides(1).Shapes

WithmyShapes.AddShape(Type:=msoShapeOval,Left:=50,_

Top:=50,Width:=300,Height:=150).TextFrame

.TextRange.Text="Testtext"

.Parent.Rotation=45

EndWith

Page 1811: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ParentGroupPropertyReturnsaShapeobjectthatrepresentsthecommonparentshapeofachildshapeorarangeofchildshapes.

expression.ParentGroup

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1812: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatestwoshapesonthefirstslideintheactivepresentationandgroupsthoseshapes;thenusingoneshapeinthegroup,accessestheparentgroupandfillsallshapesintheparentgroupwiththesamefillcolor.Thisexampleassumesthatthefirstslideoftheactivepresentationdoesnotcurrentlycontainanyshapes.Ifitdoes,youwillreceiveanerror.

SubParentGroup()

DimsldNewSlideAsSlide

DimshpParentGroupAsShape

'Addtwoshapestoactivedocumentandgroup

SetsldNewSlide=ActivePresentation.Slides_

.Add(Index:=1,Layout:=ppLayoutBlank)

WithsldNewSlide.Shapes

.AddShapeType:=msoShapeBalloon,Left:=72,_

Top:=72,Width:=100,Height:=100

.AddShapeType:=msoShapeOval,Left:=110,_

Top:=120,Width:=100,Height:=100

.Range(Array(1,2)).Group

EndWith

SetshpParentGroup=ActivePresentation.Slides(1).Shapes(1)_

.GroupItems(1).ParentGroup

shpParentGroup.Fill.ForeColor.RGB=RGB_

(Red:=151,Green:=51,Blue:=250)

EndSub

Page 1813: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PasswordPropertyReturnsorsetsaStringthatrepresentsapasswordthatmustbesuppliedtoopenthespecifiedpresentation.Read/write.

expression.Password

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1814: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleopensEarnings.ppt,setsapasswordforit,andthenclosesthepresentation.

SubSetPassword()

WithPresentations.Open(FileName:="C:\MyDocuments\Earnings.ppt")

.Password=complexstrPWD'globalvariable

.Save

.Close

EndWith

EndSub

Page 1815: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PasswordEncryptionAlgorithmPropertyReturnsaStringindicatingthealgorithmMicrosoftPowerPointusesforencryptingdocumentswithpasswords.Read-only.

expression.PasswordEncryptionAlgorithm

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1816: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.

Page 1817: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthepasswordencryptionoptionsifthepasswordencryptionalgorithminuseisnotRC4.

SubPasswordSettings()

WithActivePresentation

If.PasswordEncryptionAlgorithm<>"RC4"Then

.SetPasswordEncryptionOptions_

PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_

PasswordEncryptionAlgorithm:="RC4",_

PasswordEncryptionKeyLength:=56,_

PasswordEncryptionFileProperties:=True

EndIf

EndWith

EndSub

Page 1818: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1819: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PasswordEncryptionFilePropertiesPropertyReturnsMsoTrueifMicrosoftPowerPointencryptsfilepropertiesforpassword-protecteddocuments.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.PasswordEncryptionFileProperties

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1820: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.

Page 1821: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthepasswordencryptionoptionsifthefilepropertiesarenotencryptedforpassword-protecteddocuments.

SubPasswordSettings()

WithActivePresentation

If.PasswordEncryptionFileProperties=msoFalseThen

.SetPasswordEncryptionOptions_

PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_

PasswordEncryptionAlgorithm:="RC4",_

PasswordEncryptionKeyLength:=56,_

PasswordEncryptionFileProperties:=True

EndIf

EndWith

EndSub

Page 1822: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PasswordEncryptionKeyLengthPropertyReturnsaLongindicatingthekeylengthofthealgorithmMicrosoftPowerPointuseswhenencryptingdocumentswithpasswords.Read-only.

expression.PasswordEncryptionKeyLength

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1823: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.

Page 1824: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthepasswordencryptionoptionsifthepasswordencryptionkeylengthislessthan40.

SubPasswordSettings()

WithActivePresentation

If.PasswordEncryptionKeyLength<40Then

.SetPasswordEncryptionOptions

_

PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_

PasswordEncryptionAlgorithm:="RC4",_

PasswordEncryptionKeyLength:=56,_

PasswordEncryptionFileProperties:=True

EndIf

EndWith

EndSub

Page 1825: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PasswordEncryptionProviderPropertyReturnsaStringspecifyingthenameofthealgorithmencryptionproviderthatMicrosoftPowerPointuseswhenencryptingdocumentswithpasswords.Read-only.

expression.PasswordEncryptionProvider

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1826: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.

Page 1827: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthepasswordencryptionoptionsifthepasswordencryptionalgorithminuseisnottheMicrosoftRSASChannelCryptographicProvider.

SubPasswordSettings()

WithActivePresentation

If.PasswordEncryptionProvider<>"MicrosoftRSASChannelCryptographicProvider"Then

.SetPasswordEncryptionOptions_

PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_

PasswordEncryptionAlgorithm:="RC4",_

PasswordEncryptionKeyLength:=56,_

PasswordEncryptionFileProperties:=True

EndIf

EndWith

EndSub

Page 1828: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PathPropertyReturnsaStringthatrepresentsthepathtothespecifiedAddIn,Application,orPresentationobjectorthepathfollowedbyaMotionEffectobject.Read-only.

expression.Path

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1829: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyouusethispropertytoreturnapathforapresentationthathasnotbeensaved,itreturnsanemptystring.Usingthispropertytoreturnthepathforanadd-inthathasnotbeenloadedcausesanerror.

Thepathdoesn'tincludethefinalbackslash(\)orthenameofthespecifiedobject.UsetheNamepropertyofthePresentationobjecttoreturnthefilenamewithoutthepath,andusetheFullNamepropertytoreturnthefilenameandthepathtogether.

TheStringreturnedforaMotionEffectobjectisaspecificpaththatthemotioneffectfollowsbetweenFromandTousingthesamesyntaxastheVMLpathdescription.

Page 1830: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesavestheactivepresentationinthesamefolderasPowerPoint.

WithApplication

fName=.Path&"\testpresentation"

ActivePresentation.SaveAsfName

EndWith

Page 1831: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1832: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PatternPropertyPatternpropertyasitappliestotheLineFormatobject.

Setsorreturnsavaluethatrepresentsthepatternappliedtothespecifiedline.Read/writeMsoPatternType.

MsoPatternTypecanbeoneoftheseMsoPatternTypeconstants.msoPattern10PercentmsoPattern20PercentmsoPattern25PercentmsoPattern30PercentmsoPattern40PercentmsoPattern50PercentmsoPattern5PercentmsoPattern60PercentmsoPattern70PercentmsoPattern75PercentmsoPattern80PercentmsoPattern90PercentmsoPatternDarkDownwardDiagonalmsoPatternDarkHorizontalmsoPatternDarkUpwardDiagonalmsoPatternDashedDownwardDiagonalmsoPatternDashedHorizontalmsoPatternDashedUpwardDiagonalmsoPatternDashedVerticalmsoPatternDiagonalBrickmsoPatternDivotmsoPatternDottedDiamondmsoPatternDottedGridmsoPatternHorizontalBrick

Page 1833: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoPatternLargeCheckerBoardmsoPatternLargeConfettimsoPatternLargeGridmsoPatternLightDownwardDiagonalmsoPatternLightHorizontalmsoPatternLightUpwardDiagonalmsoPatternLightVerticalmsoPatternMixedmsoPatternNarrowHorizontalmsoPatternNarrowVerticalmsoPatternOutlinedDiamondmsoPatternPlaidmsoPatternShinglemsoPatternSmallCheckerBoardmsoPatternSmallConfettimsoPatternSmallGridmsoPatternSolidDiamondmsoPatternSpheremsoPatternTrellismsoPatternWavemsoPatternWeavemsoPatternWideDownwardDiagonalmsoPatternWideUpwardDiagonalmsoPatternZigZagmsoPatternDarkVertical

expression.Pattern

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

PatternpropertyasitappliestotheFillFormatobject.

Setsorreturnsavaluethatrepresentsthepatternappliedtothespecifiedfill.UsetheBackColorandForeColorpropertiestosetthecolorsusedinthepattern.Read-onlyMsoPatternType.

Page 1834: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MsoPatternTypecanbeoneoftheseMsoPatternTypeconstants.msoPattern10PercentmsoPattern20PercentmsoPattern25PercentmsoPattern30PercentmsoPattern40PercentmsoPattern50PercentmsoPattern5PercentmsoPattern60PercentmsoPattern70PercentmsoPattern75PercentmsoPattern80PercentmsoPattern90PercentmsoPatternDarkDownwardDiagonalmsoPatternDarkHorizontalmsoPatternDarkUpwardDiagonalmsoPatternDashedDownwardDiagonalmsoPatternDashedHorizontalmsoPatternDashedUpwardDiagonalmsoPatternDashedVerticalmsoPatternDiagonalBrickmsoPatternDivotmsoPatternDottedDiamondmsoPatternDottedGridmsoPatternHorizontalBrickmsoPatternLargeCheckerBoardmsoPatternLargeConfettimsoPatternLargeGridmsoPatternLightDownwardDiagonalmsoPatternLightHorizontalmsoPatternLightUpwardDiagonalmsoPatternLightVerticalmsoPatternMixed

Page 1835: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoPatternNarrowHorizontalmsoPatternNarrowVerticalmsoPatternOutlinedDiamondmsoPatternPlaidmsoPatternShinglemsoPatternSmallCheckerBoardmsoPatternSmallConfettimsoPatternSmallGridmsoPatternSolidDiamondmsoPatternSpheremsoPatternTrellismsoPatternWavemsoPatternWeavemsoPatternWideDownwardDiagonalmsoPatternWideUpwardDiagonalmsoPatternZigZagmsoPatternDarkVertical

expression.Pattern

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1836: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheLineFormatobject.

ThisexampleaddsapatternedlinetomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(10,100,250,0).Line

.Weight=6

.ForeColor.RGB=RGB(0,0,255)

.BackColor.RGB=RGB(128,0,0)

.Pattern=msoPatternDarkDownwardDiagonal

EndWith

AsitappliestotheFillFormatobject.

ThisexampleaddsarectangletomyDocumentandsetsitsfillpatterntomatchthatoftheshapenamed"rect1."Thenewrectanglehasthesamepatternasrect1,butnotnecessarilythesamecolors.ThecolorsusedinthepatternaresetwiththeBackColorandForeColorproperties.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

pattern1=.Item("rect1").Fill.Pattern

With.AddShape(msoShapeRectangle,100,100,120,80).Fill

.ForeColor.RGB=RGB(128,0,0)

.BackColor.RGB=RGB(0,0,255)

.Patternedpattern1

EndWith

EndWith

Page 1837: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1838: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PauseAnimationPropertyDetermineswhethertheslideshowpausesuntilthespecifiedmediaclipisfinishedplaying.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheslideshowcontinueswhilethemediaclipplaysinthebackground.msoTriStateMixedmsoTriStateTogglemsoTrueTheslideshowpausesuntilthespecifiedmediaclipisfinishedplaying.

Page 1839: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ForthePauseAnimationpropertysettingtotakeeffect,thePlayOnEntrypropertyofthespecifiedshapemustbesettomsoTrue.

Page 1840: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatshapethreeonslideoneintheactivepresentationwillbeplayedautomaticallywhenit'sanimatedandthattheslideshowwon'tcontinuewhilethemovieisplayinginthebackground.Shapethreemustbeasoundormovieobject.

SetOLEobj=ActivePresentation.Slides(1).Shapes(3)

WithOLEobj.AnimationSettings.PlaySettings

.PlayOnEntry=msoTrue

.PauseAnimation=msoTrue

EndWith

Page 1841: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PermissionPropertyReturnsaPermissionobjectthatcanbeusedtorestrictpermissionstotheactivepresentationandtoreturnorsetspecificpermissionssettings.Read-only.

NoteUseofthePermissionobjectraisesanerroriftheWindowsRightsManagementclientisnotinstalled.

expression.Permission

expressionRequired.AnexpressionthatreturnsaPresentationobject.

Page 1842: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsethePermissionobjecttorestrictpermissionstotheactivedocumentandtoreturnorsetspecificpermissionssettings.

UsetheEnabledpropertytodeterminewhetherpermissionsarerestrictedontheactivedocument.UsetheCountpropertytoreturnthenumberofuserswithpermissions,andtheRemoveAllmethodtoresetallexistingpermissions.

TheDocumentAuthor,EnableTrustedBrowser,RequestPermissionURL,andStoreLicensespropertiesprovideadditionalinformationaboutpermissionsettings.

ThePermissionobjectgivesaccesstoacollectionofUserPermissionobjects.UsetheUserPermissionobjecttoassociatespecificsetsofrightswithindividualusers.Whilesomepermissionsgrantedthroughtheuserinterface(suchasmsoPermissionPrint)applytoallusers,youcanusetheUserPermissionobjecttoassignthemonaper-userbasiswithper-userexpirationdates.

InformationRightsManagement,includedinMicrosoftOffice2003,supportstheuseofadministrativepermissionpolicieswhichlistusersandgroupsandtheirdocumentpermissions.UsetheApplyPolicymethodtoapplyapermissionpolicy,andthePermissionFromPolicy,PolicyName,andPolicyDescriptionpropertiestoreturnpolicyinformation.

ThePermissionobjectmodelisavailablewhetherpermissionsarerestrictedontheactivedocumentornot.ThePermissionpropertyofthePresentationobjectdoesnotreturnNothingwhentheactivedocumentdoesnothaverestrictedpermissions.UsetheEnabledpropertytodeterminewhetheradocumenthasrestrictedpermissions.

Page 1843: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesanewpresentationandassignstheuserwithe-mailaddress"[email protected]"readpermissiononthenewpresentation.Theexamplewilldisplaythepermissionsoftheownerandthenewuser.

SubAddUserPermissions()

DimmyPresAsPowerPoint.Presentation

DimmyPerAsOffice.Permission

DimNewOwnerPerAsOffice.UserPermission

SetmyPres=Application.Presentations.Add(msoTrue)

SetmyPer=myPres.Permission

myPer.Enabled=True

SetNewOwnerPer=myPer.Add("[email protected]",msoPermissionRead)

MsgBoxmyPer(1).UserId+""+Str(myPer(1).Permission)

MsgBoxmyPer(2).UserId+""+Str(myPer(2).Permission)

EndSub

Page 1844: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1845: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PerspectivePropertyDetermineswhethertheextrusionappearsinperspective.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheextrusionisaparallel,ororthographic,projection—thatis,ifthewallsdon'tnarrowtowardavanishingpoint.msoTriStateMixedmsoTriStateTogglemsoTrueTheextrusionappearsinperspective—thatis,ifthewallsoftheextrusionnarrowtowardavanishingpoint.

Page 1846: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetstheextrusiondepthforshapeoneonmyDocumentto100pointsandspecifiesthattheextrusionbeparallel,ororthographic.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

.Visible=True

.Depth=100

.Perspective=msoFalse

EndWith

Page 1847: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PictureFormatPropertyReturnsaPictureFormatobjectthatcontainspictureformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentpicturesorOLEobjects.Read-only.

Page 1848: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthebrightnessandcontrastforshapeoneonmyDocument.ShapeonemustbeapictureoranOLEobject.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).PictureFormat

.Brightness=0.3

.Contrast=.75

EndWith

Page 1849: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlaceholderFormatPropertyReturnsaPlaceholderFormatobjectthatcontainsthepropertiesthatareuniquetoplaceholders.Read-only.

Page 1850: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddstexttoplaceholderoneonslideoneintheactivepresentationifthatplaceholderisahorizontaltitleplaceholder.

WithActivePresentation.Slides(1).Shapes.Placeholders

If.Count>0Then

With.Item(1)

SelectCase.PlaceholderFormat.Type

CaseppPlaceholderTitle

.TextFrame.TextRange="TitleText"

CaseppPlaceholderCenterTitle

.TextFrame.TextRange="CenteredTitleText"

CaseElse

MsgBox"There'snohorizontal"&_

"titleonthisslide"

EndSelect

EndWith

EndIf

EndWith

Page 1851: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlaceholdersPropertyReturnsaPlaceholderscollectionthatrepresentsthecollectionofalltheplaceholdersonaslide.Eachplaceholderinthecollectioncancontaintext,achart,atable,anorganizationalchart,oranotherobject.Read-only.

Page 1852: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaslidetotheactivepresentationandthenaddstexttoboththetitle(whichisthefirstplaceholderontheslide)andthesubtitle.

SetmyDocument=ActivePresentation.Slides(1)

WithActivePresentation.Slides_

.Add(1,ppLayoutTitle).Shapes.Placeholders

.Item(1).TextFrame.TextRange.Text="Thisisthetitletext"

.Item(2).TextFrame.TextRange.Text="Thisissubtitletext"

EndWith

Page 1853: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1854: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlayOnEntryPropertyDetermineswhetherthespecifiedmovieorsoundisplayedautomaticallywhenit'sanimated.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedmovieorsoundisplayedautomaticallywhenit'sanimated.

Page 1855: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingthispropertytomsoTruesetstheAnimatepropertyoftheAnimationSettingsobjecttomsoTrue.SettingtheAnimatepropertytomsoFalseautomaticallysetsthePlayOnEntrypropertytomsoFalse.

UsetheActionVerbpropertytosettheverbthatwillbeinvokedwhenthemediaclipisanimated.

Page 1856: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatshapethreeonslideoneintheactivepresentationwillbeplayedautomaticallywhenit'sanimated.Shapethreemustbeasoundormovieobject.

SetOLEobj=ActivePresentation.Slides(1).Shapes(3)

OLEobj.AnimationSettings.PlaySettings.PlayOnEntry=msoTrue

Page 1857: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PlaySettingsPropertyReturnsaPlaySettingsobjectthatcontainsinformationabouthowthespecifiedmediaclipplaysduringaslideshow.

expression.PlaySettings

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1858: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleinsertsamovienamedClock.aviontoslideoneintheactivepresentation,setsittoplayautomaticallyaftertheslidetransition,andspecifiesthatthemovieobjectbehiddenduringaslideshowexceptwhenit'splaying.

WithActivePresentation.Slides(1).Shapes.AddOLEObject(Left:=10,_

Top:=10,Width:=250,Height:=250,_

FileName:="c:\winnt\Clock.avi")

With.AnimationSettings.PlaySettings

.PlayOnEntry=True

.HideWhileNotPlaying=True

EndWith

EndWith

Page 1859: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1860: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PointerColorPropertyPointerColorPropertyasitappliestotheSlideShowSettingsobject.

ReturnsthepointercolorforthespecifiedpresentationasaColorFormatobject.Thiscolorissavedwiththepresentationandisthedefaultpencoloreachtimeyoushowthepresentation.Read-only.

PointerColorPropertyasitappliestotheSlideShowViewobject.

ReturnsaColorFormatobjectthatrepresentsthepointercolorforthespecifiedpresentationduringoneslideshow.Assoonastheslideshowisfinished,thecolorrevertstothedefaultcolorforthepresentation.Read-only.

Page 1861: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Tochangethepointertoapen,setthePointerTypepropertytoppSlideShowPointerPen.

Page 1862: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheSlideShowSettingsobject.

Thisexamplesetsthedefaultpencolorfortheactivepresentationtoblue,startsaslideshow,changesthepointertoapen,andthensetsthepencolortoredforthisslideshowonly.

WithActivePresentation.SlideShowSettings

.PointerColor.RGB=RGB(0,0,255)'blue

With.Run.View

.PointerColor.RGB=RGB(255,0,0)'red

.PointerType=ppSlideShowPointerPen

EndWith

EndWith

Page 1863: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1864: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PointerTypePropertyReturnsorsetsthetypeofpointerusedintheslideshow.Read/writePpSlideShowPointerType.

PpSlideShowPointerTypecanbeoneofthesePpSlideShowPointerTypeconstants.ppSlideShowPointerAlwaysHiddenppSlideShowPointerArrowppSlideShowPointerAutoArrowppSlideShowPointerNoneppSlideShowPointerPen

expression.PointerType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1865: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowoftheactivepresentation,changesthepointertoapen,andsetsthepencolorforthisslideshowtored.

SetcurrView=ActivePresentation.SlideShowSettings.Run.View

WithcurrView

.PointerColor.RGB=RGB(255,0,0)

.PointerType=ppSlideShowPointerPen

EndWith

Page 1866: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1867: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PointsPropertyPointspropertyasitappliestothePropertyEffectobject.

ReturnsanAnimationPointsobjectthatrepresentsapointinananimation.UsetheFromandTopropertiestosetthevalueofthisproperty.

expression.Points

expressionRequired.AnexpressionthatreturnsaPropertyEffectobject.

PointspropertyasitappliestotheShapeNodeobject.

ReturnsaVariantthatrepresentsthepositionofthespecifiednodeasacoordinatepair.Eachcoordinateisexpressedinpoints.UsetheSetPositionmethodtosetthevalueofthisproperty.Read-only.

expression.Points

expressionRequired.AnexpressionthatreturnsaShapeNodeobject.

Page 1868: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheShapeNodeobject.

Thisexamplemovesnodetwoinshapethreeintheactivepresentationtotheright200pointsanddown300points.Shapethreemustbeafreeformdrawing.

WithActivePresentation.Slides(1).Shapes(3).Nodes

pointsArray=.Item(2).Points

currXvalue=pointsArray(1,1)

currYvalue=pointsArray(1,2)

.SetPositionIndex:=2,X1:=currXvalue+200,Y1:=currYvalue+300

EndWith

Page 1869: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PositionPropertyReturnsorsetsthepositionofthespecifiedtabstop,inpoints.Read/writeSingle.

Page 1870: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledeletesalltabstopsgreaterthan1inch(72points)forthetextinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame_

.Ruler.TabStops

Fori=.CountTo1Step-1

With.Item(i)

If.Position>72Then.Clear

EndWith

Next

EndWith

Page 1871: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationPropertyReturnsaPresentationobjectthatrepresentsthepresentationinwhichthespecifieddocumentwindoworslideshowwindowwascreated.Read-only.

Page 1872: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Iftheslidethat'scurrentlydisplayedindocumentwindowoneisfromanembeddedpresentation,Windows(1).View.Slide.Parentreturnstheembeddedpresentation,andWindows(1).Presentationreturnsthepresentationinwhichdocumentwindowonewascreated.

Iftheslidethat'scurrentlydisplayedinslideshowwindowoneisfromanembeddedpresentation,SlideShowWindows(1).View.Slide.Parentreturnstheembeddedpresentation,andSlideShowWindows(1).Presentationreturnsthepresentationinwhichtheslideshowwasstarted.

Page 1873: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecontinuestheslidenumberingforthepresentationinwindowoneintotheslidenumberingforthepresentationinwindowtwo.

firstPresSlides=Windows(1).Presentation.Slides.Count

Windows(2).Presentation.PageSetup_

.FirstSlideNumber=firstPresSlides+1

Page 1874: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationElapsedTimePropertyReturnsthenumberofsecondsthathaveelapsedsincethebeginningofthespecifiedslideshow.Read-onlyLong.

Page 1875: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplegoestoslideseveninslideshowwindowoneifmorethanfiveminuteshaveelapsedsincethebeginningoftheslideshow.

WithSlideShowWindows(1).View

If.PresentationElapsedTime>300Then

.GotoSlide7

EndIf

EndWith

Page 1876: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationsPropertyReturnsaPresentationscollectionthatrepresentsallopenpresentations.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1877: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleopensthepresentationnamed"LongVersion.ppt."

Application.Presentations.Open_

FileName:="c:\MyDocuments\Longversion.ppt"

Thisexamplesavespresentationoneas"Year-EndReport.ppt."

Application.Presentations(1).SaveAs"Year-EndReport"

ThisexampleclosestheYear-endreportpresentation.

Application.Presentations("Year-EndReport.ppt").Close

Page 1878: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1879: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PreservedPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetheradesignmasterispreservedfromchanges.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseThedesignmasterisnotpreservedandcanbeedited.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThedesignmasterispreservedandcannotbeedited.

expression.Preserved

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1880: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowinglineofcodelocksandpreservesthefirstdesignmaster.

SubPreserveMaster

ActivePresentation.Designs(1).Preserved=msoTrue

EndSub

Page 1881: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1882: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetExtrusionDirectionPropertyReturnsthedirectionthattheextrusion'ssweeppathtakesawayfromtheextrudedshape(thefrontfaceoftheextrusion).Read-onlyMsoPresetExtrusionDirection.

MsoPresetExtrusionDirectioncanbeoneoftheseMsoPresetExtrusionDirectionconstants.msoExtrusionBottommsoExtrusionBottomLeftmsoExtrusionBottomRightmsoExtrusionLeftmsoExtrusionNonemsoExtrusionRightmsoExtrusionTopmsoExtrusionTopLeftmsoExtrusionTopRightmsoPresetExtrusionDirectionMixed

expression.PresetExtrusionDirection

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1883: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyisread-only.Tosetthevalueofthisproperty,usetheSetExtrusionDirectionmethod.

Page 1884: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangeseachextrusiononmyDocumentthatextendstowardtheupper-leftcorneroftheextrusion'sfrontfacetoanextrusionthatextendstowardthelower-rightcornerofthefrontface.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Withs.ThreeD

If.PresetExtrusionDirection=msoExtrusionTopLeftThen

.SetExtrusionDirectionmsoExtrusionBottomRight

EndIf

EndWith

Next

Page 1885: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1886: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetGradientTypePropertyReturnsthepresetgradienttypeforthespecifiedfill.Read-onlyMsoPresetGradientType.UsethePresetGradientmethodtosetthepresetgradienttypeforthefill.

MsoPresetGradientTypecanbeoneoftheseMsoPresetGradientTypeconstants.msoGradientBrassmsoGradientCalmWatermsoGradientChromemsoGradientChromeIImsoGradientDaybreakmsoGradientDesertmsoGradientEarlySunsetmsoGradientFiremsoGradientFogmsoGradientGoldmsoGradientGoldIImsoGradientHorizonmsoGradientLateSunsetmsoGradientMahoganymsoGradientMossmsoGradientNightfallmsoGradientOceanmsoGradientParchmentmsoGradientPeacockmsoGradientRainbowmsoGradientRainbowIImsoGradientSapphiremsoGradientSilvermsoGradientWheatmsoPresetGradientMixed

Page 1887: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expression.PresetGradientType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1888: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesthefillforallshapesinmyDocumentwiththeMosspresetgradientfilltotheFogpresetgradientfill.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Withs.Fill

If.PresetGradientType=msoGradientMossThen

.PresetGradient=msoGradientFog

EndIf

EndWith

Next

Page 1889: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1890: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetLightingDirectionPropertyReturnsorsetsthepositionofthelightsourcerelativetotheextrusion.Read/writeMsoPresetLightingDirection.

MsoPresetLightingDirectioncanbeoneoftheseMsoPresetLightingDirectionconstants.msoLightingBottommsoLightingBottomLeftmsoLightingBottomRightmsoLightingLeftmsoLightingNonemsoLightingRightmsoLightingTopmsoLightingTopLeftmsoLightingTopRightmsoPresetLightingDirectionMixed

expression.PresetLightingDirection

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

NoteYouwon'tseethelightingeffectsyousetiftheextrusionhasawireframesurface.

Page 1891: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthattheextrusionforshapeoneonmyDocumentextendtowardthetopoftheshapeandthatthelightingfortheextrusioncomefromtheleft.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

.Visible=True

.SetExtrusionDirectionmsoExtrusionTop

.PresetLightingDirection=msoLightingLeft

EndWith

Page 1892: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1893: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetLightingSoftnessPropertyReturnsorsetstheintensityoftheextrusionlighting.Read/writeMsoPresetLightingSoftness.

MsoPresetLightingSoftnesscanbeoneoftheseMsoPresetLightingSoftnessconstants.msoLightingBrightmsoLightingDimmsoLightingNormalmsoPresetLightingSoftnessMixed

expression.PresetLightingSoftness

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1894: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthattheextrusionforshapeoneonmyDocumentbelitbrightlyfromtheleft.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

.Visible=True

.PresetLightingSoftness=msoLightingBright

.PresetLightingDirection=msoLightingLeft

EndWith

Page 1895: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1896: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetMaterialPropertyReturnsorsetstheextrusionsurfacematerial.Read/writeMsoPresetMaterial.

MsoPresetMaterialcanbeoneoftheseMsoPresetMaterialconstants.msoMaterialMattemsoMaterialMetalmsoMaterialPlasticmsoMaterialWireFramemsoPresetMaterialMixed

expression.PresetMaterial

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1897: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthattheextrusionsurfaceforshapeoneinmyDocumentbewireframe.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

.Visible=True

.PresetMaterial=msoMaterialWireFrame

EndWith

Page 1898: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1899: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetShapePropertyReturnsorsetstheshapeofthespecifiedWordArt.Read/writeMsoPresetTextEffectShape.

MsoPresetTextEffectShapecanbeoneoftheseMsoPresetTextEffectShapeconstants.msoTextEffectShapeArchDownCurvemsoTextEffectShapeArchDownPourmsoTextEffectShapeArchUpCurvemsoTextEffectShapeArchUpPourmsoTextEffectShapeButtonCurvemsoTextEffectShapeButtonPourmsoTextEffectShapeCanDownmsoTextEffectShapeCanUpmsoTextEffectShapeCascadeDownmsoTextEffectShapeCascadeUpmsoTextEffectShapeChevronDownmsoTextEffectShapeChevronUpmsoTextEffectShapeCircleCurvemsoTextEffectShapeCirclePourmsoTextEffectShapeCurveDownmsoTextEffectShapeCurveUpmsoTextEffectShapeDeflatemsoTextEffectShapeDeflateBottommsoTextEffectShapeDeflateInflatemsoTextEffectShapeDeflateInflateDeflatemsoTextEffectShapeDeflateTopmsoTextEffectShapeDoubleWave2msoTextEffectShapeFadeDownmsoTextEffectShapeFadeLeftmsoTextEffectShapeFadeRight

Page 1900: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoTextEffectShapeFadeUpmsoTextEffectShapeInflatemsoTextEffectShapeInflateBottommsoTextEffectShapeInflateTopmsoTextEffectShapeMixedmsoTextEffectShapePlainTextmsoTextEffectShapeRingInsidemsoTextEffectShapeRingOutsidemsoTextEffectShapeSlantDownmsoTextEffectShapeSlantUpmsoTextEffectShapeStopmsoTextEffectShapeTriangleDownmsoTextEffectShapeTriangleUpmsoTextEffectShapeWave1msoTextEffectShapeWave2msoTextEffectShapeDoubleWave1

expression.PresetShape

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1901: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingthePresetTextEffectpropertyautomaticallysetsthePresetShapeproperty.

Page 1902: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetstheshapeofallWordArtonmyDocumenttoachevronwhosecenterpointsdown.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.Type=msoTextEffectThen

s.TextEffect.PresetShape=msoTextEffectShapeChevronDown

EndIf

Next

Page 1903: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1904: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetTextEffectPropertyReturnsorsetsthestyleofthespecifiedWordArt.ThevaluesforthispropertycorrespondtotheformatsintheWordArtGallerydialogbox(numberedfromlefttoright,toptobottom).Read/writeMsoPresetTextEffect.

MsoPresetTextEffectcanbeoneoftheseMsoPresetTextEffectconstants.msoTextEffect1msoTextEffect2msoTextEffect3msoTextEffect4msoTextEffect5msoTextEffect6msoTextEffect7msoTextEffect8msoTextEffect9msoTextEffect10msoTextEffect11msoTextEffect12msoTextEffect13msoTextEffect14msoTextEffect15msoTextEffect16msoTextEffect17msoTextEffect18msoTextEffect19msoTextEffect20msoTextEffect21msoTextEffect22msoTextEffect23msoTextEffect24msoTextEffect25

Page 1905: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoTextEffect26msoTextEffect27msoTextEffect28msoTextEffect29msoTextEffect30msoTextEffectMixed

expression.PresetTextEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1906: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingthePresetTextEffectpropertyautomaticallysetsmanyotherformattingpropertiesofthespecifiedshape.

Page 1907: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthestyleforallWordArtonmyDocumenttothefirststylelistedintheWordArtGallerydialogbox.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.Type=msoTextEffectThen

s.TextEffect.PresetTextEffect=msoTextEffect1

EndIf

Next

Page 1908: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1909: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetTexturePropertyReturnsthepresettextureforthespecifiedfill.Read-onlyMsoPresetTexture.

MsoPresetTexturecanbeoneoftheseMsoPresetTextureconstants.msoPresetTextureMixedmsoTextureBlueTissuePapermsoTextureBouquetmsoTextureBrownMarblemsoTextureCanvasmsoTextureCorkmsoTextureDenimmsoTextureFishFossilmsoTextureGranitemsoTextureGreenMarblemsoTextureMediumWoodmsoTextureNewsprintmsoTextureOakmsoTexturePaperBagmsoTexturePapyrusmsoTextureParchmentmsoTexturePinkTissuePapermsoTexturePurpleMeshmsoTextureRecycledPapermsoTextureSandmsoTextureStationerymsoTextureWalnutmsoTextureWaterDropletsmsoTextureWhiteMarblemsoTextureWovenMat

expression.PresetTexture

Page 1910: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

UsethePresetTexturedmethodtosetthepresettextureforthefill.

Page 1911: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletothemyDocumentandsetsitspresettexturetomatchthatofshapetwo.Fortheexampletowork,shapetwomusthaveapresettexturedfill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

presetTexture2=.Item(2).Fill.PresetTexture

.AddShape(msoShapeRectangle,100,0,40,80).Fill_

.PresetTexturedpresetTexture2

EndWith

Page 1912: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1913: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresetThreeDFormatPropertyReturnsthepresetextrusionformat.Eachpresetextrusionformatcontainsasetofpresetvaluesforthevariouspropertiesoftheextrusion.Thevaluesforthispropertycorrespondtotheoptions(numberedfromlefttoright,toptobottom)displayedwhenyouclickthe3-DbuttonontheDrawingtoolbar.Read-onlyMsoPresetThreeDFormat.

MsoPresetThreeDFormatcanbeoneoftheseMsoPresetThreeDFormatconstants.msoPresetThreeDFormatMixedTheextrusionhasacustomformatratherthanapresetformat.msoThreeD1msoThreeD2msoThreeD3msoThreeD4msoThreeD5msoThreeD6msoThreeD7msoThreeD8msoThreeD9msoThreeD10msoThreeD11msoThreeD12msoThreeD13msoThreeD14msoThreeD15msoThreeD16msoThreeD17msoThreeD18msoThreeD19msoThreeD20

Page 1914: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expression.PresetThreeDFormat

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1915: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyisread-only.Tosetthepresetextrusionformat,usetheSetThreeDFormatmethod.

Page 1916: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetstheextrusionformatforshapeoneonmyDocumentto3DStyle12iftheshapeinitiallyhasacustomextrusionformat.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

If.PresetThreeDFormat=msoPresetThreeDFormatMixedThen

.SetThreeDFormatmsoThreeD12

EndIf

EndWith

Page 1917: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1918: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintColorTypePropertyReturnsorsetsthewaythespecifieddocumentwillbeprinted:inblackandwhite,inpureblackandwhite(alsoreferredtoashighcontrast),orincolor.Thedefaultvalueissetbytheprinter.Read/writePpPrintColorType.

PpPrintColorTypecanbeoneofthesePpPrintColorTypeconstants.ppPrintBlackAndWhiteppPrintColorppPrintPureBlackAndWhite

expression.PrintColorType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1919: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintstheslidesintheactivepresentationincolor.

WithApplication.ActivePresentation

.PrintOptions.PrintColorType=ppPrintColor

.PrintOut

EndWith

Page 1920: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1921: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintCommentsPropertySetsorreturnswhethercommentswillbeprinted.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Commentswillnotbeprinted.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueCommentswillbeprinted.

expression.PrintComments

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1922: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleinstructsMicrosoftPowerPointtoprintcomments.

SubPrintPresentationComments

ActivePresentation.PrintOptions.PrintComments=msoTrue

EndSub

Page 1923: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1924: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintFontsAsGraphicsPropertyDetermineswhetherTrueTypefontsareprintedasgraphics.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTrueTypefontsareprintedasgraphics.

Page 1925: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatTrueTypefontsintheactivepresentationbeprintedasgraphics.

ActivePresentation.PrintOptions.PrintFontsAsGraphics=msoTrue

Page 1926: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1927: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintHiddenSlidesPropertyDetermineswhetherhiddenslidesinthespecifiedpresentationwillbeprinted.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueThehiddenslidesinthespecifiedpresentationwillbeprinted.

Page 1928: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintsallslides,whethervisibleorhidden,intheactivepresentation.

WithActivePresentation

.PrintOptions.PrintHiddenSlides=msoTrue

.PrintOut

EndWith

Page 1929: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1930: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintInBackgroundPropertyDetermineswhetherthespecifiedpresentationisprintedinthebackground.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.Thespecifiedpresentationisprintedinthebackground,whichmeansthatyoucancontinuetoworkwhileit'sbeingprinted.

Page 1931: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintstheactivepresentationinthebackground.

WithActivePresentation

.PrintOptions.PrintInBackground=msoTrue

.PrintOut

EndWith

Page 1932: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintOptionsPropertyReturnsaPrintOptionsobjectthatrepresentsprintoptionsthataresavedwiththespecifiedpresentation.Read-only.

Page 1933: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecauseshiddenslidesintheactivepresentationtobeprinted,anditscalestheprintedslidestofitthepapersize.

WithApplication.ActivePresentation

With.PrintOptions

.PrintHiddenSlides=True

.FitToPage=True

EndWith

.PrintOut

EndWith

Page 1934: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PrintStepsPropertyReturnsthenumberofslidesyou'dneedtoprinttosimulatethebuildsonthespecifiedslide,slidemaster,orrangeofslides.Read-onlyLong.

Page 1935: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsavariabletothenumberofslidesyou'dneedtoprinttosimulatethebuildsonslideoneintheactivepresentationandthendisplaysthevalueofthevariable.

steps1=ActivePresentation.Slides(1).PrintSteps

MsgBoxsteps1

Page 1936: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ProductCodePropertyReturnstheMicrosoftPowerPointgloballyuniqueidentifier(GUID).YoumightusetheGUID,forexample,whenmakingprogramcallstoanApplicationProgrammingInterface(API).Read-onlyString.

Page 1937: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplereturnsthePowerPointGUIDtothevariablepptGUID.

DimpptGUIDAsString

pptGUID=Application.ProductCode

Page 1938: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1939: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ProgIDPropertyReturnstheprogrammaticidentifier(ProgID)forthespecifiedOLEobject.Read-onlyString.

Page 1940: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleloopsthroughalltheobjectsonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.

ForEachsldInActivePresentation.Slides

ForEachshInsld.Shapes

Ifsh.Type=msoLinkedOLEObjectThen

Ifsh.OLEFormat.ProgID="Excel.Sheet"Then

sh.LinkFormat.AutoUpdate=ppUpdateOptionManual

EndIf

EndIf

Next

Next

Page 1941: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1942: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PropertyPropertySetsorreturnsanMsoAnimPropertyconstantthatrepresentsananimationproperty.Read/write.

MsoAnimPropertycanbeoneoftheseMsoAnimPropertyconstants.msoAnimColormsoAnimHeigthmsoAnimNoneDefault.msoAnimOpacitymsoAnimRotationmsoAnimShape3DExtrudeForwardmsoAnimShape3DExtrusionColormsoAnimShape3DXRotationAnglemsoAnimShape3DYRotationAnglemsoAnimShapefBackColormsoAnimShapefColormsoAnimShapefGradientPresetmsoAnimShapefGradientTypemsoAnimShapeFlipHmsoAnimShapeFlipVmsoAnimShapefOnmsoAnimShapefOpacitymsoAnimShapefTypemsoAnimShapelColormsoAnimShapelDashesmsoAnimShapelEndArrowHeadmsoAnimShapelEndArrowLengthmsoAnimShapelEndArrowWidthmsoAnimShapelOnmsoAnimShapelStartArrowHeadmsoAnimShapelStartArrowLength

Page 1943: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimShapelStartArrowWidthmsoAnimShapelStylemsoAnimShapelWidthmsoAnimShapepBrightnessmsoAnimShapepContrastmsoAnimShapepCropFromBottommsoAnimShapepCropFromLeftmsoAnimShapepCropFromRightmsoAnimShapepCropFromTopmsoAnimShapepFilenamemsoAnimShapepGammamsoAnimShapepGrayscalemsoAnimShapeRotationmsoAnimShapesColormsoAnimShapesEmbossedmsoAnimShapesOffsetXmsoAnimShapesOffsetYmsoAnimShapesOnmsoAnimShapesOpacitymsoAnimShapesTypemsoAnimShapeTypemsoAnimShapewfontBoldmsoAnimShapewfontItalicmsoAnimShapewfontNamemsoAnimShapewfontShadowmsoAnimShapewfontSizemsoAnimShapewfontSmallCapsmsoAnimShapewfontStrikeThroughmsoAnimShapewfontUnderlinemsoAnimShapewSpacingmsoAnimShapewVerticalmsoAnimTextBulletCharactermsoAnimTextBulletColor

Page 1944: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimTextBulletFontNamemsoAnimTextBulletNumbermsoAnimTextBulletPicturemsoAnimTextBulletRelativeSizemsoAnimTextBulletStylemsoAnimTextBulletTypemsoAnimTextFontBoldmsoAnimTextFontColormsoAnimTextFontEmbossmsoAnimTextFontItalicmsoAnimTextFontNamemsoAnimTextFontShadowmsoAnimTextFontSizemsoAnimTextFontStrikeThroughmsoAnimTextFontSubscriptmsoAnimTextFontSuperscriptmsoAnimTextFontUnderlinemsoAnimWidthmsoAnimXmsoAnimY

expression.Property

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1945: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashape,addsathree-secondfillanimationtothatshape,andsetsthefillanimationtocolor.

SubAddShapeSetAnimFill()

DimeffBlindsAsEffect

DimshpRectangleAsShape

DimanimPropertyAsAnimationBehavior

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffBlinds=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectBlinds)

effBlinds.Timing.Duration=3

SetanimProperty=effBlinds.Behaviors.Add(msoAnimTypeProperty)

WithanimProperty.PropertyEffect

.Property=msoAnimColor

.From=RGB(Red:=0,Green:=0,Blue:=255)

.To=RGB(Red:=255,Green:=0,Blue:=0)

EndWith

EndSub

Page 1946: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PropertyEffectPropertyReturnsaPropertyEffectobjectforagivenanimationbehavior.

expression.PropertyEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1947: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapewithaneffecttotheactivepresentationandsetstheanimationeffectpropertiesfortheshapetochangecolors.

SubAddShapeSetAnimFill()

DimeffBlindsAsEffect

DimshpRectangleAsShape

DimanimBlindsAsAnimationBehavior

'Addsrectangleandsetsanimiationeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffBlinds=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectBlinds)

'Setsthedurationoftheanimation

effBlinds.Timing.Duration=3

'Addsabehaviortotheanimation

SetanimBlinds=effBlinds.Behaviors.Add(msoAnimTypeProperty)

'Setstheanimationcoloreffectandtheformulatouse

WithanimBlinds.PropertyEffect

.Property=msoAnimColor

.From=RGB(Red:=0,Green:=0,Blue:=255)

.To=RGB(Red:=255,Green:=0,Blue:=0)

EndWith

EndSub

Page 1948: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PublishObjectsPropertyReturnsaPublishObjectscollectionrepresentingthesetofcompleteorpartialloadedpresentationsthatareavailabletopublishtoHTML.Read-only.

Page 1949: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.

WithActivePresentation.PublishObjects.Item(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

Page 1950: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RangeEndPropertyReturnsorsetsthenumberofthelastslideinarangeofslidesyouarepublishingasaWebpresentation.Read/writeInteger.

Page 1951: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

Page 1952: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RangesPropertyReturnsthePrintRangesobject,whichrepresentstherangesofslidesinthepresentationtobeprinted.Read-only.

Page 1953: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyoudon'twanttoprintanentirepresentation,youmustusetheAddmethodtocreateaPrintRangeobjectforeachconsecutiverunofslidesyouwanttoprint.Forexample,ifyouwanttoprintslide1,slides3through5,andslides8and9inaspecifiedpresentation,youmustcreatethreePrintRangeobjects:onethatrepresentsslide1;onethatrepresentsslides3through5;andonethatrepresentsslides8and9.Formoreinformation,seetheexampleforthisproperty.

TheRangeTypepropertymustbesettoppPrintSlideRangefortherangesinthePrintRangescollectiontobeapplied.

ToclearalltheexistingprintrangesfromthePrintRangescollection,usetheClearAllmethod.

SpecifyingavaluefortheToandFromargumentsofthePrintOutmethodsetsthecontentsofthePrintRangesobject.

Page 1954: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleprintsslide1,slides3through5,andslides8and9intheactivepresentation.

WithActivePresentation

With.PrintOptions

.RangeType=ppPrintSlideRange

With.Ranges

.Add1,1

.Add3,5

.Add8,9

EndWith

EndWith

.PrintOut

EndWith

Page 1955: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RangeStartPropertyReturnsorsetsthenumberofthefirstslideinarangeofslidesyouarepublishingasaWebpresentation.Read/writeInteger.

Page 1956: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

Page 1957: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1958: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RangeTypePropertyRangeTypepropertyasitappliestothePrintOptionsobject.

Returnsorsetsthetypeofprintrangeforthepresentation.Read/writePpPrintRangeType.

PpPrintRangeTypecanbeoneofthesePpPrintRangeTypeconstants.ppPrintAllppPrintCurrentppPrintNamedSlideShowppPrintSelectionppPrintSlideRange

expression.RangeType

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

RangeTypepropertyasitappliestotheSlideShowSettingsobject.

Returnsorsetsthetypeofslideshowtorun.Read/writePpSlideShowRangeType.

PpSlideShowRangeTypecanbeoneofthesePpSlideShowRangeTypeconstants.ppShowAllppShowNamedSlideShowppShowSlideRange

expression.RangeType

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 1959: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Toprinttheslidesrangesyou'vedefinedinthePrintRangescollection,youmustfirstsettheRangeTypepropertytoppPrintSlideRange.SettingRangeTypetoanythingotherthanppPrintSlideRangemeansthattherangesyou'vedefinedinthePrintRangescollectionwon'tbeapplied.However,thisdoesn'taffectthecontentsofthePrintRangescollectioninanyway.Thatis,ifyoudefinesomeprintranges,settheRangeTypepropertytoavalueotherthanppPrintSlideRange,andthenlatersetRangeTypebacktoppPrintSlideRange,theprintrangesyoudefinedbeforewillremainunchanged.

SpecifyingavaluefortheToandFromargumentsofthePrintOutmethodsetsthevalueofthisproperty.

Page 1960: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestothePrintOptionsobject.

Thisexampleprintsthecurrentslidetheactivepresentation.

WithActivePresentation

.PrintOptions.RangeType=ppPrintCurrent

.PrintOut

EndWith

AsitappliestotheSlideShowSettingsobject.

Thisexamplerunsthenamedslideshow"QuickShow."

WithActivePresentation.SlideShowSettings

.RangeType=ppShowNamedSlideShow

.SlideShowName="QuickShow"

.Run

EndWith

Page 1961: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1962: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReadOnlyPropertyReturnswhetherthespecifiedpresentationisread-only.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedpresentationisread-only.

Page 1963: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Iftheactivepresentationisread-only,thisexamplesavesitasNewfile.ppt.

WithApplication.ActivePresentation

If.ReadOnlyThen.SaveAsFileName:="newfile"

EndWith

Page 1964: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1965: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RegisteredPropertyReturnswhetherthespecifiedadd-inisregisteredintheWindowsregistry.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedadd-inisregisteredintheWindowsregistry.

Page 1966: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleregisterstheadd-innamed"MyTools"intheWindowsregistry.

Application.Addins("MyTools").Registered=msoTrue

Page 1967: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1968: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RelativePropertyMsoTruetosetthemotionpositionrelativetothepositionoftheshape.Thispropertyisonlyusedinconjunctionwithmotionpaths.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Themotionpathisabsolute.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThemotionpathisrelative.

expression.Relative

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1969: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashape,addsananimatedmotionpathtotheshape,andreportsonitsmotionpathrelativity.

SubAddShapeSetAnimPath()

DimeffDiamondAsEffect

DimshpCubeAsShape

SetshpCube=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeCube,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpCube,effectId:=msoAnimEffectPathDiamond)

effDiamond.Timing.Duration=3

MsgBox"Ismotionpathrelativeorabsolute:"&_

effDiamond.EffectParameters.Relative&vbCrLf&_

"0=Relative,-1=Absolute"

EndSub

Page 1970: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RelativeSizePropertyReturnsorsetsthebulletsizerelativetothesizeofthefirsttextcharacterintheparagraph.Canbeafloating-pointvaluefrom0.25through4,indicatingthatthebulletsizecanbefrom25percentthrough400percentofthetext-charactersize.Read/writeSingle.

Page 1971: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheformattingforthebulletinshapetwoonslideoneintheactivepresentation.Thesizeofthebulletis125percentofthesizeofthefirsttextcharacterintheparagraph.

WithActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat.Bullet

.Visible=True

.RelativeSize=1.25

.Character=169

With.Font

.Name="Symbol"

.Color.RGB=RGB(255,0,0)

EndWith

EndWith

EndWith

Page 1972: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1973: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RelyOnVMLPropertyDetermineswwhetherimagefilesaregeneratedfromdrawingobjectswhenyousaveorpublishacompleteorpartialpresentationasaWebpage.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.ImagesarenotgeneratedfromdrawingobjectswhenyousaveorpublishacompleteorpartialpresentationasaWebpage.msoTriStateMixedmsoTriStateTogglemsoTrueImagefilesaregeneratedfromdrawingobjectswhenyousaveorpublishacompleteorpartialpresentationasaWebpage.

Page 1974: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcanreducefilesizesbynotgeneratingimagesfordrawingobjects,ifyourWebbrowsersupportsVectorMarkupLanguage(VML).Forexample,MicrosoftInternetExplorer5andhighersupportthisfeature,andyoushouldsettheRelyOnVMLpropertytomsoTrueifyouaretargetingthisbrowser.ForbrowsersthatdonotsupportVML,theimagewillnotappearwhenyouviewaWebpagesavedwiththispropertysettomsoTrue.

Forexample,youshouldnotgenerateimagesifyourWebpageusesimagefilesthatyouhavegeneratedearlier,andifthelocationwhereyousavethepresentationisdifferentfromthefinallocationofthepageontheWebserver.

Page 1975: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatimagefilesaregeneratedwhensavingorpublishingtheactivepresentationtoaWebpage.

ActivePresentation.WebOptions.RelyOnVML=msoFalse

Page 1976: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1977: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RemovePersonalInformationPropertyMsoTrueforMicrosoftPowerPointtoremovealluserinformationfromcomments,revisions,andthePropertiesdialogboxuponsavingapresentation.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseComments,revisions,andpersonalinformationremaininthepresentation.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueRemovescomments,revisions,andpersonalinformationwhensavingpresentation.

expression.RemovePersonalInformation

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1978: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Beforeyougiveothersacopyofthedocument,itisagoodideatoreviewpersonalandhiddeninformation,anddecidewhetheritisappropriatetoinclude.Youmaywanttoremovesomeinformationfromthedocumentandfromthedocumentfilepropertiesbeforeyousharethedocumentwithothers.

Whereispersonalorhiddeninformationstored?

FilepropertiesThesepropertiesincludeAuthor,Manager,Company,andLastSavedBy.

OtherhiddeninformationForexample,hidden,revisedtext,comments,orfieldcodecanremaininadocumenteventhoughyoudon'tseeitorexpectittobeinthefinalversion.Ifyouenteredpersonalinformationsuchasyournameore-mailaddresswhenyouregisteredyoursoftware,someMicrosoftOfficedocumentsstorethatinformationaspartofthedocument.

Informationcontainedincustomfieldsthatyouaddtothedocument,suchasan'author'or'owner'field,isnotautomaticallyremoved.Youmusteditorremovethecustomfieldtoremovethatinformation.

Page 1979: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheactivepresentationtoremovepersonalinformationthenexttimetheusersavesit.

SubRemovePersonalInfo()

ActivePresentation.RemovePersonalInformation=msoTrue

EndSub

Page 1980: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RepeatCountPropertySetsorreturnsanLongthatrepresentsthenumberoftimestorepeatananimation.Read/write.

expression.RepeatCount

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1981: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesashapeandaddsananimationtoit,thenrepeatstheanimationtwice.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

WitheffDiamond.Timing

.Duration=5'Lengthofeffect.

.RepeatCount=2'Howmanytimestorepeat.

EndWith

EndSub

Page 1982: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RepeatDurationPropertySetsorreturnsaSinglethatrepresents,inseconds,howlongrepeatedanimationsshouldlast.Read/write.

expression.RepeatDuration

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1983: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

AnanimationwillstopattheendofitstimesequenceorthevalueoftheRepeatDurationproperty,whicheverisshorter.

Page 1984: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesaddsashapeandananimationtoit,thenrepeatstheanimationtentimes.However,afterfiveseconds,theanimationwillbecutoff,eventhoughtheanimationisdimensionedfora20-secondtimeline(iftheDurationpropertyisnotspecified,ananimationdefaultstotwoseconds).

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsnewshapeandsetsanimationeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

'Setsrepeatdurationandnumberoftimestorepeatanimation

WitheffDiamond.Timing

.RepeatDuration=5

.RepeatCount=10

EndWith

EndSub

Page 1985: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1986: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ResizeGraphicsPropertyDetermineswhetherslidesandanygraphicsonthemaresizedtofittheWebpagedisplayareaofthetargetWebbrowser.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseSlidesandgraphicsremainthesizetheyareinthesourcepresentation,regardlessoftheWebbrowserdisplayarea.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.SlidesandanygraphicsonthemaresizedtofittheWebpagedisplayareaofthetargetWebbrowser.

Page 1987: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsgraphicsinthespecifiedWebpresentationtoberesizedforthetargetWebbrowser.Itthenpublishesthecompletepresentation,withspeaker'snotes,toafilenamed"Mallard.htm."

WithPresentations(2)

.WebOptions.ResizeGraphics=msoTrue

With.PublishObjects(1)

.FileName="C:\Mallard.htm"

.SourceType=ppPublishAll

.SpeakerNotes=True

.Publish

EndWith

EndWith

Page 1988: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1989: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RestartPropertySetsorreturnsanMsoAnimEffectRestartconstantthatrepresentswhethertheanimationeffectrestartsaftertheeffecthasstartedonce.Read/write.

MsoAnimEffectRestartcanbeoneoftheseMsoAnimEffectRestartconstants.msoAnimEffectRestartAlwaysmsoAnimEffectRestartNeverDefault.msoAnimEffectRestartWhenOff

expression.Restart

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1990: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapeandananimationtoit,thensetstheanimation'srestartbehavior.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsshapeandsetsanimation

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,Top:=100,_

Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

WitheffDiamond.Timing

.Duration=3

.RepeatDuration=5

.RepeatCount=3

.Restart=msoAnimEffectRestartAlways

EndWith

EndSub

Page 1991: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1992: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RevealPropertySetsorreturnsaMsoTriStateconstantthatdetermineshowtheembeddedobjectswillberevealed.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseComments,revisions,andpersonalinformationremaininthepresentation.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueRemovescomments,revisions,andpersonalinformationwhensavingthepresentation.

expression.Reveal

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1993: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingavalueofmsoTruefortheRevealpropertywhenthefiltereffecttypeismsoAnimFilterEffectTypeWipewillmaketheshapeappear.SettingavalueofmsoFalsewillmaketheobjectdisappear.Inotherwords,ifyourfilterissettowipeandRevealistrue,youwillgetawipeineffectandwhenRevealisfalse,youwillgetawipeouteffect.

Page 1994: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetothefirstslideoftheactivepresentationandsetsafiltereffectanimationbehavior.

SubChangeFilterEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(msoAnimTypeFilter)

WithbhvEffect.FilterEffect

.Type=msoAnimFilterEffectTypeWipe

.Subtype=msoAnimFilterEffectSubtypeUp

.Reveal=msoTrue

EndWith

EndSub

Page 1995: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 1996: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReversePropertySetsorreturnsanMsoTriStateconstantthatrepresentsadiagram'sreversestate.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseThediagramisnotreversed.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThediagramisreversed.

expression.Reverse

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1997: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thismethodgeneratesanerrorifthevalueofthetargetdiagram'sTypepropertyisanorganizationchart(msoDiagramTypeOrgChart).

Page 1998: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesapyramiddiagram,andreversesitscoloring.

SubReversePyramidDiagram()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

'Addsapyramiddiagramandfirstchildnode

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramPyramid,Left:=10,Top:=15,_

Width:=400,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreeadditionalnodestodiagram

ForintNodes=1To3

dgnNode.AddNode

NextintNodes

'Automaticallyplacesnodes,andreversesnodeorder

WithdgnNode.Diagram

.AutoLayout=msoTrue

.Reverse=msoTrue

EndWith

EndSub

Page 1999: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2000: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RewindAtEndPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetheranobjectreturnstoitsbeginningpositionafterananimationhasended.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Theobjectdoesnotreturntoitsbeginningpositionafterananimationhasended.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueTheobjectreturnstoitsbeginningpositionafterananimationhasended.

expression.RewindAtEnd

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2001: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapeandananimationtotheshape,theninstructstheshapetoreturntoitsbeginningpositionaftertheanimationhasended.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsshapeandsetsanimationeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

'Setsdurationofanimationandreturnsshapetoitsoriginalposition

WitheffDiamond.Timing

.Duration=3

.RewindAtEnd=msoTrue

EndWith

EndSub

Page 2002: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2003: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RewindMoviePropertyDetermineswhetherthefirstframeofthespecifiedmovieisautomaticallyredisplayedassoonasthemoviehasfinishedplaying.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThefirstframeofthespecifiedmovieisautomaticallyredisplayedassoonasthemoviehasfinishedplaying.

Page 2004: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatthefirstframeofthemovierepresentedbyshapethreeonslideoneintheactivepresentationwillbeautomaticallyredisplayedwhenthemoviehasfinishedplaying.Shapethreemustbeamovieobject.

SetOLEobj=ActivePresentation.Slides(1).Shapes(3)

OLEobj.AnimationSettings.PlaySettings.RewindMovie=msoTrue

Page 2005: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2006: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RGBPropertyRGBpropertyasitappliestotheColorFormatobject.

Returnsorsetsthered-green-blue(RGB)valueofthespecifiedcolor.Read/writeLong.

RGBpropertyasitappliestotheRGBColorobject.

Returnsorsetsthered-green-blue(RGB)valueofaspecifiedcolor-schemecolororextracolorwhenusedwitharead/writePpColorSchemeIndexconstant.TheColorsmethodisusedtoreturntheRGBColorobject.

PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppShadowppTitle

Page 2007: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheColorFormatobject.

Thisexamplesetsthebackgroundcolorforcolorschemethreeintheactivepresentationandthenappliesthecolorschemetoallslidesinthepresentationthatarebasedontheslidemaster.

WithActivePresentation

Setcs1=.ColorSchemes(3)

cs1.Colors(ppBackground).RGB=RGB(128,128,0)

.SlideMaster.ColorScheme=cs1

EndWith

AsitappliestotheRGBColorobject.

Thisexampledisplaysthevalueofthered,green,andbluecomponentsofthefillforecolorforshapeoneonslideoneintheactivedocument.

SetmyDocument=ActivePresentation.Slides(1)

c=myDocument.Shapes(1).Fill.ForeColor.RGB

redComponent=cMod256

greenComponent=c\256Mod256

blueComponent=c\65536Mod256

MsgBox"RGBcomponents:"&redComponent&_

","&greenComponent&","&blueComponent

Page 2008: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RootPropertyReturnsaDiagramNodeobjectthatrepresentstherootdiagramnodetowhichthesourcediagramnodebelongs.

expression.Root

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2009: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplecreatesanorganizationchartandaddschildnodestotherootdiagramnode.

SubAddChildNodesToRoot()

DimdgnNodeAsDiagramNode

DimshpOrgChartAsShape

DimintNodesAsInteger

'Addsorganizationchartandfirstnode

SetshpOrgChart=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramOrgChart,Left:=10,_

Top:=15,Width:=400,Height:=475)

shpOrgChart.DiagramNode.Children.AddNode

SetdgnNode=shpOrgChart.DiagramNode.Root

'Addsthreechildnodestorootnode

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

EndSub

Page 2010: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2011: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RotatedCharsPropertyDetermineswhethercharactersinthespecifiedWordArtarerotated90degreesrelativetotheWordArt'sboundingshape.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseCharactersinthespecifiedWordArtretaintheiroriginalorientationrelativetotheboundingshape.msoTriStateMixedmsoTriStateTogglemsoTrueCharactersinthespecifiedWordArtarerotated90degreesrelativetotheWordArt'sboundingshape.

Page 2012: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IftheWordArthashorizontaltext,settingtheRotatedCharspropertytomsoTruerotatesthecharacters90degreescounterclockwise.IftheWordArthasverticaltext,settingtheRotatedCharspropertytomsoFalserotatesthecharacters90degreesclockwise.UsetheToggleVerticalTextmethodtoswitchbetweenhorizontalandverticaltextflow.

TheFlipmethodandRotationpropertyoftheShapeobjectandtheRotatedCharspropertyandToggleVerticalTextmethodoftheTextEffectFormatobjectallaffectthecharacterorientationanddirectionoftextflowinaShapeobjectthatrepresentsWordArt.Youmayhavetoexperimenttofindouthowtocombinetheeffectsofthesepropertiesandmethodstogettheresultyouwant.

Page 2013: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsWordArtthatcontainsthetext"Test"tomyDocumentandrotatesthecharacters90degreescounterclockwise.

SetmyDocument=ActivePresentation.Slides(1)

SetnewWordArt=myDocument.Shapes.AddTextEffect_

(PresetTextEffect:=msoTextEffect1,Text:="Test",_

FontName:="ArialBlack",FontSize:=36,_

FontBold:=msoFalse,FontItalic:=msoFalse,Left:=10,Top:=10)

newWordArt.TextEffect.RotatedChars=msoTrue

Page 2014: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2015: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RotationPropertyReturnsorsetsthenumberofdegreesthespecifiedshapeisrotatedaroundthez-axis.Apositivevalueindicatesclockwiserotation;anegativevalueindicatescounterclockwiserotation.Read/writeSingle

Page 2016: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Tosettherotationofathree-dimensionalshapearoundthex-axisorthey-axis,usetheRotationXpropertyortheRotationYpropertyoftheThreeDFormatobject.

Page 2017: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplematchestherotationofallshapesonmyDocumenttotherotationofshapeone.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

sh1Rotation=.Item(1).Rotation

Foro=1To.Count

.Item(o).Rotation=sh1Rotation

Next

EndWith

Page 2018: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RotationEffectPropertyReturnsaRotationEffectobjectforananimationbehavior.

expression.RotationEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2019: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsanewshapetothefirstslideandsetstherotationanimationbehavior.

SubAddRotation()

DimshpNewAsShape

DimeffNewAsEffect

DimaniNewAsAnimationBehavior

SetshpNew=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShape5pointStar,Left:=0,_

Top:=0,Width:=100,Height:=100)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpNew,effectId:=msoAnimEffectCustom)

SetaniNew=effNew.Behaviors.Add(msoAnimTypeRotation)

WithaniNew.RotationEffect

'Rotate270degreesfromcurrentposition

.By=270

EndWith

EndSub

Page 2020: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2021: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RotationXPropertyReturnsorsetstherotationoftheextrudedshapearoundthex-axis,indegrees.Canbeavaluefrom–90through90.Apositivevalueindicatesupwardrotation;anegativevalueindicatesdownwardrotation.Read/writeSingle.

Page 2022: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Tosettherotationoftheextrudedshapearoundthey-axis,usetheRotationYpropertyoftheThreeDFormatobject.Tosettherotationoftheextrudedshapearoundthez-axis,usetheRotationpropertyoftheShapeobject.Tochangethedirectionoftheextrusion'ssweeppathwithoutrotatingthefrontfaceoftheextrusion,usetheSetExtrusionDirectionmethod.

Page 2023: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsthreeidenticalextrudedovalstomyDocumentandsetstheirrotationaroundthex-axisto–30,0,and30degrees,respectively.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

With.AddShape(msoShapeOval,30,60,50,25).ThreeD

.Visible=True

.RotationX=-30

EndWith

With.AddShape(msoShapeOval,90,60,50,25).ThreeD

.Visible=True

.RotationX=0

EndWith

With.AddShape(msoShapeOval,150,60,50,25).ThreeD

.Visible=True

.RotationX=30

EndWith

EndWith

Page 2024: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2025: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RotationYPropertyReturnsorsetstherotationoftheextrudedshapearoundthey-axis,indegrees.Canbeavaluefrom–90through90.Apositivevalueindicatesrotationtotheleft;anegativevalueindicatesrotationtotheright.Read/writeSingle.

Page 2026: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Tosettherotationoftheextrudedshapearoundthex-axis,usetheRotationXpropertyoftheThreeDFormatobject.Tosettherotationoftheextrudedshapearoundthez-axis,usetheRotationpropertyoftheShapeobject.Tochangethedirectionoftheextrusion'ssweeppathwithoutrotatingthefrontfaceoftheextrusion,usetheSetExtrusionDirectionmethod.

Page 2027: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsthreeidenticalextrudedovalstomyDocumentandsetstheirrotationaroundthey-axisto–30,0,and30degrees,respectively.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

With.AddShape(msoShapeOval,30,30,50,25).ThreeD

.Visible=True

.RotationY=-30

EndWith

With.AddShape(msoShapeOval,30,70,50,25).ThreeD

.Visible=True

.RotationY=0

EndWith

With.AddShape(msoShapeOval,30,110,50,25).ThreeD

.Visible=True

.RotationY=30

EndWith

EndWith

Page 2028: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RowsPropertyReturnsaRowscollectionthatrepresentsalltherowsinatable.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 2029: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledeletesthethirdrowfromthetableinshapefiveofslidetwointheactivepresentation.

ActivePresentation.Slides(2).Shapes(5).Table.Rows(3).Delete

Thisexampleappliesadashedlinestyletothebottomborderofthesecondrowoftablecells.

ActiveWindow.Selection.ShapeRange.Table.Rows(2)_

.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash

Page 2030: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RulerPropertyReturnsaRulerobjectthatrepresentstherulerforthespecifiedtext.Read-only.

Page 2031: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsaleft-alignedtabstopat2inches(144points)forthetextinshapetwoonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes(2).TextFrame.Ruler.TabStops_

.AddppTabStopLeft,144

Page 2032: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

RunPropertyReturnsorsetsthenameofthepresentationormacrotoberunwhenthespecifiedshapeisclickedorthemousepointerpassesovertheshapeduringaslideshow.TheActionpropertymustbesettoppActionRunMacroorppActionRunProgramforthispropertytoaffecttheslideshowaction.Read/writeString.

Page 2033: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IfthevalueoftheActionpropertyisppActionRunMacro,thespecifiedstringvalueshouldbethenameofaglobalmacrothat'scurrentlyloaded.IfthevalueoftheActionpropertyisppActionRunProgram,thespecifiedstringvalueshouldbethefullpathandfilenameofaprogram.

YoucansettheRunpropertytoamacrothattakesnoargumentsoramacrothattakesasingleShapeorObjectargument.Theshapethatwasclickedduringtheslideshowwillbepassedasthisargument.

Page 2034: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthattheCalculateTotalmacroberunwheneverthemousepointerpassesovertheshapeduringaslideshow.

WithActivePresentation.Slides(1)_

.Shapes(3).ActionSettings(ppMouseOver)

.Action=ppActionRunMacro

.Run="CalculateTotal"

.AnimateAction=True

EndWith

Page 2035: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2036: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SavedPropertyDetermineswhetherchangeshavebeenmadetoapresentationsinceitwaslastsaved.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueNochangeshavebeenmadetoapresentationsinceitwaslastsaved.

Page 2037: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

IftheSavedpropertyofamodifiedpresentationissettomsoTrue,theuserwon'tbepromptedtosavechangeswhenclosingthepresentation,andallchangesmadetoitsinceitwaslastsavedwillbelost.

Page 2038: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesavestheactivepresentationifit'sbeenchangedsincethelasttimeitwassaved.

WithApplication.ActivePresentation

IfNot.SavedAnd.Path<>""Then.Save

EndWith

Page 2039: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2040: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SaveNewWebPagesAsWebArchivesPropertyMsoTrueforMicrosoftPowerPointtosavenewWebpagesasWebarchives.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseSavesnewWebpagesasindividualWebpages.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueSavesnewWebpagesasWebarchives.

expression.SaveNewWebPagesAsWebArchives

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2041: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingtheSaveNewWebPagesAsWebArchivespropertywon'tchangetheformatofanycurrentlyopenWebpages.YoumustindividuallysaveopenWebpagesandexplicitlysettheWebpageformatusingtheSaveAsmethod.

Page 2042: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleenablestheSaveNewWebPagesAsWebArchivesproperty,sothatwhennewWebpagesaresaved,theyaresavedasWebarchives.

SubSetWebOption()

Application.DefaultWebOptions_

.SaveNewWebPagesAsWebArchives=True

EndSub

Page 2043: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScaleEffectPropertyReturnsaScaleEffectobjectforagivenanimationbehavior.

expression.ScaleEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2044: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplescalesthefirstshapeonthefirstslidestartingatzeroandincreasinginsizeuntilitreaches100percentofitsoriginalsize.

SubChangeScale()

DimshpFirstAsShape

DimeffNewAsEffect

DimaniScaleAsAnimationBehavior

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpFirst,effectId:=msoAnimEffectCustom)

SetaniScale=effNew.Behaviors.Add(msoAnimTypeScale)

WithaniScale.ScaleEffect

'Startingsize

.FromX=0

.FromY=0

'Sizeafterscaleeffect

.ToX=100

.ToY=100

EndWith

EndSub

Page 2045: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2046: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SchemeColorPropertyReturnsorsetsthecolorintheappliedcolorschemethat'sassociatedwiththespecifiedobject.Read/writePpColorSchemeIndex.

PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppNotSchemeColorppSchemeColorMixedppShadowppTitle

expression.SchemeColor

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2047: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleswitchesthebackgroundcoloronslideoneintheactivepresentationbetweenanexplicitred-green-bluevalueandthecolor-schemebackgroundcolor.

WithActivePresentation.Slides(1)

.FollowMasterBackground=False

With.Background.Fill.ForeColor

If.Type=msoColorTypeSchemeThen

.RGB=RGB(0,128,128)

Else

.SchemeColor=ppBackground

EndIf

EndWith

EndWith

Page 2048: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2049: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScreenSizePropertyReturnsorsetstheidealminimumscreensize(widthbyheight,inpixels)thatyoushouldusewhenviewingthesavedpresentationinaWebbrowser.Read/writeMsoScreenSize.

MsoScreenSizecanbeoneoftheseMsoScreenSizeconstants.msoScreenSize1024x768msoScreenSize1152x882msoScreenSize1152x900msoScreenSize1280x1024msoScreenSize1600x1200msoScreenSize1800x1440msoScreenSize1920x1200msoScreenSize544x376msoScreenSize640x480msoScreenSize720x512msoScreenSize800x600Default.

expression.ScreenSize

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2050: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetargetscreensizeto640x480pixels.

Presentations(2).WebOptions.ScreenSize=_

msoScreenSize640x480

Page 2051: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScreenTipPropertyReturnsorsetstheScreenTiptextofahyperlink.Read/writeString.

Page 2052: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ScreenTiptextappears,forexample,whenyousaveapresentationtoHTML,viewitinaWebbrowser,andrestthemousepointeroverahyperlink.SomebrowsersmaynotsupportScreenTips.

Page 2053: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetstheScreenTiptextforthefirsthyperlink.

ActivePresentation.Slides(1).Hyperlinks(1)_

.ScreenTip="GototheMicrosofthomepage"

Page 2054: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScriptPropertyReturnsaScriptobjectthatrepresentsablockofscriptcodeonaMicrosoftPowerPointslide.InPowerPoint,scriptisassociatedwithananchorshape.Ifnoscriptisassociatedwiththespecifiedshape,thennothingisreturned.Read-only.

Page 2055: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ScriptcodeinsertedonaslidecanonlyberuninWebpresentations.

Bydefault,scriptanchorshapesarenotvisible.Tomakethemvisible,usethePowerPointuserinterface.YoucannotmakescriptanchorshapesvisiblewithVisualBasiccode.

ItispossibletousetheScriptpropertyonarangeofshapes(ShapeRange.Script)insteadofspecifyingasingleanchorshape.However,iftherangecontainsmorethanoneshape,yourcodewillnotworkandwillreturnamessagethatindicatestheScriptpropertycannotbeaccessed.

Page 2056: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthescriptinglanguageforthescriptanchor(shapeeightonslideone)toMicrosoftVisualBasicScriptingEdition(VBScript).

WithActivePresentation.Slides(1).Shapes(8)

.Script.Language=msoScriptLanguageVisualBasic

EndWith

Page 2057: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScriptsPropertyReturnsaScriptscollectionthatrepresentsallScriptobjects(blocksofscriptcode)inapresentation.Read-only.

Page 2058: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Scriptcode,representedbyaScriptobject,canberunonlyinaWebpresentation.

Page 2059: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2060: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SegmentTypePropertyReturnsavaluethatindicateswhetherthesegmentassociatedwiththespecifiednodeisstraightorcurved.Read-onlyMsoSegmentType.

MsoSegmentTypecanbeoneoftheseMsoSegmentTypeconstants.msoSegmentCurveTheSegmentTypepropertyreturnsthisvalueifthespecifiednodeisacontrolpointforacurvedsegment.msoSegmentLine

expression.SegmentType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2061: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertyisread-only.UsetheSetSegmentTypemethodtosetthevalueofthisproperty.

Page 2062: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesallstraightsegmentstocurvedsegmentsinshapethreeonmyDocument.Shapethreemustbeafreeformdrawing.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Nodes

n=1

Whilen<=.Count

If.Item(n).SegmentType=msoSegmentLineThen

.SetSegmentTypen,msoSegmentCurve

EndIf

n=n+1

Wend

EndWith

Page 2063: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SelectedPropertyTrueifthespecifiedtablecellisselected.Read-onlyBoolean.

expression.Selected

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2064: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleputsaborderaroundthefirstcellinthespecifiedtableifthecellisselected.

SubIsCellSelected()

DimcelSelectedAsCell

SetcelSelected=ActivePresentation.Slides(1).Shapes(1)_

.Table.Columns(1).Cells(1)

IfcelSelected.SelectedThen

WithcelSelected

.Borders(ppBorderTop).DashStyle=msoLineRoundDot

.Borders(ppBorderBottom).DashStyle=msoLineRoundDot

.Borders(ppBorderLeft).DashStyle=msoLineRoundDot

.Borders(ppBorderRight).DashStyle=msoLineRoundDot

EndWith

EndIf

EndSub

Page 2065: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SelectionPropertyReturnsaSelectionobjectthatrepresentstheselectioninthespecifieddocumentwindow.Read-only.

Page 2066: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Ifthere'stextselectedintheactivewindow,thisexamplemakesthetextitalic.

WithApplication.ActiveWindow.Selection

If.Type=ppSelectionTextThen

.TextRange.Font.Italic=True

EndIf

EndWith

Page 2067: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SetEffectPropertyReturnsaSetEffectobjectfortheanimationbehavior.Read-only.YoucanusetheSetEffectobjecttosetthevalueofaproperty.

expression.SetEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2068: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetothefirstslideoftheactivepresentationandsetsaseteffectanimationbehavior.

SubChangeSetEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(msoAnimTypeSet)

WithbhvEffect.SetEffect

.Property=msoAnimShapeFillColor

.To=RGB(Red:=0,Green:=255,Blue:=255)

EndWith

EndSub

Page 2069: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2070: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShadowPropertyShadowpropertyasitappliestotheFontobject.

Determineswhetherthespecifiedtexthasashadow.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedtextdoesn'thaveashadow.msoTriStateMixedSomeofthetexthasashadowandsomedoesn't.msoTriStateTogglemsoTrueThespecifiedtexthasashadow.

expression.Shadow

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

ShadowpropertyasitappliestotheShapeandShapeRangeobjects.

Returnsaread/onlyShadowFormatobjectthatcontainsshadowformattingpropertiesforthespecifiedshapeorshapes.

expression.Shadow

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2071: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheFontobject.

Thisexampleaddsashadowtothetitletextonslideoneintheactivepresentation.

Application.ActivePresentation.Slides(1).Shapes.Title_

.TextFrame.TextRange.Font.Shadow=True

AsitappliestotheShapeandShapeRangeobjects.

Thisexampleaddsashadowedrectangletoslideoneintheactivepresentation.Theblue,embossedshadowisoffset3pointstotherightofand2pointsdownfromtherectangle.

SetmyShap=Application.ActivePresentation.Slides(1).Shapes

WithmyShap.AddShape(msoShapeRectangle,10,10,150,90).Shadow

.Type=msoShadow17

.ForeColor.RGB=RGB(0,0,128)

.OffsetX=3

.OffsetY=2

EndWith

Page 2072: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapePropertyReturnsaShapeobjectthatrepresentsashapeinatablecell(fortheCellobject),adiagramnodeinadiagram(fortheDiagramNodeobject),orananimatedshape(fortheEffectobject).

expression.Shape

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2073: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesa3x3tableinanewpresentationandinsertsafour-pointedstarintothefirstcellofthetable.

WithPresentations.Add

With.Slides.Add(1,ppLayoutBlank)

.Shapes.AddTable(3,3).Select

.Shapes(1).Table.Cell(1,1).Shape_

.AutoShapeType=msoShape4pointStar

EndWith

EndWith

Thefollowingexamplecreatesadiagramandaddschildnodestotherootmode.Aseachchildisadded,therootnodedisplaysthenumberofchildnodesithas.

SubCountChildNodes()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

SetshpDiagram=ActivePresentation.Slides(1).Shapes.AddDiagram_

(Type:=msoDiagramRadial,Left:=10,Top:=15,_

Width:=400,Height:=475)

shpDiagram.DiagramNode.Children.AddNode

SetdgnNode=shpDiagram.DiagramNode.Root

ForintNodes=1To3

dgnNode.Children.AddNode

dgnNode.Shape.TextFrame.TextRange.Text=intNodes

NextintNodes

EndSub

Page 2074: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 2075: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapeRangePropertyReturnsaShapeRangeobjectthatrepresentsalltheslideobjectsthathavebeenselectedonthespecifiedslide.Thisrangecancontainthedrawings,shapes,OLEobjects,pictures,textobjects,titles,headers,footers,slidenumberplaceholder,anddateandtimeobjectsonaslide.Read-only.

Page 2076: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcanreturnashaperangefromaselectionwhenthepresentationisinnormal,slide,oranymasterview.

Page 2077: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefillforegroundcolorforalltheselectedshapesinwindowone.

Windows(1).Selection.ShapeRange.Fill_

.ForeColor.RGB=RGB(255,0,255)

Page 2078: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShapesPropertyReturnsaShapescollectionthatrepresentsalltheelementsthathavebeenplacedorinsertedonthespecifiedslide,slidemaster,orrangeofslides.Thiscollectioncancontainthedrawings,shapes,OLEobjects,pictures,textobjects,titles,headers,footers,slidenumbers,anddateandtimeobjectsonaslide,orontheslideimageonanotespage.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 2079: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsarectanglethat's100pointswideand50pointshigh,andwhoseupper-leftcorneris5pointsfromtheleftedgeofslideoneintheactivepresentationand25pointsfromthetopoftheslide.

SetfirstSlide=ActivePresentation.Slides(1)

firstSlide.Shapes.AddShapemsoShapeRectangle,5,25,100,50

Thisexamplesetsthefilltextureforshapethreeonslideoneintheactivepresentation.

SetnewRect=ActivePresentation.Slides(1).Shapes(3)

newRect.Fill.PresetTexturedmsoTextureOak

Assumingthatslideoneintheactivepresentationcontainsatitle,boththesecondandthirdlinesofcodeinthefollowingexamplesetthetitletextonslideoneinthepresentation.

SetfirstSl=ActivePresentation.Slides(1)

firstSl.Shapes.Title.TextFrame.TextRange.Text="Sometitletext"

firstSl.Shapes(1).TextFrame.TextRange.Text="Othertitletext"

Assumingthatshapetwoonslidetwointheactivepresentationcontainsatextframe,thefollowingexampleaddsaseriesofparagraphstotheslide.NotethatChr(13)isusedtoinsertparagraphmarkswithinthetext.

SettShape=ActivePresentation.Slides(2).Shapes(2)

tShape.TextFrame.TextRange.Text="FirstItem"&Chr(13)&_

"SecondItem"&Chr(13)&"ThirdItem"

Formostslidelayouts,thefirstshapesontheslidearetextplaceholders,andthefollowingexampleaccomplishesthesametaskastheprecedingexample.

SettestShape=ActivePresentation.Slides(2).Shapes.Placeholders(2)

testShape.TextFrame.TextRange.Text="FirstItem"&_

Chr(13)&"SecondItem"&Chr(13)&"ThirdItem"

Page 2080: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 2081: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SharedWorkspacePropertyReturnsaSharedWorkspaceobjectthatrepresentstheDocumentWorkspaceinwhichaspecifiedpresentationislocated.Read-only.

expression.SharedWorkspace

expressionRequired.AnexpressionthatreturnsaPresentationobject.

Page 2082: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheSharedWorkspaceobjecttoaddtheactiveMicrosoftPowerPointpresentationtoaMicrosoftWindowsSharePointServicesDocumentWorkspacesiteontheserverinordertotakeadvantageoftheworkspace'scollaborationfeatures,ortodisconnectorremovethedocumentfromtheworkspace.UsetheSharedWorkspaceobject'scollectionstomanagefiles,folders,links,membersandtasksassociatedwiththeshareddocument.

TheSharedWorkspaceobjectmodelisavailablewhetherornotadocumentisstoredinaworkspace.TheSharedWorkspacepropertyofthePresentationobjectdoesnotreturnNothingwhenthedocumentisnotshared.UsetheConnectedpropertyoftheSharedWorkspaceobjecttodeterminewhethertheactivepresentationisinfactsavedinandconnectedtoasharedworkspace.

Usersrequireappropriatepermissionstousetheobjects,properties,andmethodsintheSharedWorkspaceobjecthierarchy.

UsetheSharedWorkspaceFilescollection,accessedthroughtheFilespropertyoftheSharedWorkspaceobject,tomanagepresentationsandfilessavedinasharedworkspace.

UsetheSharedWorkspaceFolderscollection,accessedthroughtheFolderspropertyoftheSharedWorkspaceobject,tomanagesubfolderswithinthemaindocumentlibraryfolderofasharedworkspace.

UsetheSharedWorkspaceLinkscollection,accessedthroughtheLinkspropertyoftheSharedWorkspaceobject,tomanagelinkstoadditionaldocumentsandinformationofinteresttothememberswhoarecollaboratingonthedocumentsinthesharedworkspace.

UsetheSharedWorkspaceMemberscollection,accessedthroughtheMemberspropertyoftheSharedWorkspaceobject,tomanageuserswhohaverightstoparticipateinasharedworkspaceandtocollaborateontheshareddocumentssavedintheworkspace.

UsetheSharedWorkspaceTaskscollection,accessedthroughtheTaskspropertyoftheSharedWorkspaceobject,tomanagetasksassignedtothe

Page 2083: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

memberswhoarecollaboratingonthedocumentsinthesharedworkspace.

UsetheCreateNewmethodtocreateanewDocumentWorkspaceandtoaddtheactivedocumenttotheworkspace.UsetheNameandURLpropertiestoreturninformationabouttheworkspace.

TheSharedWorkspaceobjectusesalocalcacheofobjectsandpropertiesfromtheserver.Thedevelopermayneedtoupdatethiscachebeforeperformingcertainoperationsortosavecachedpropertychangesbacktotheserver.UsetheRefreshmethodoftheSharedWorkspaceobjecttorefreshthelocalcachefromtheserver,andtheLastRefreshedpropertytodeterminewhentherefreshoperationlasttookplace.UsetheSavemethodoftheSharedWorkspaceLinkandSharedWorkspaceTaskobjectsaftermodifyingtheirpropertieslocally,inordertouploadthechangestotheserver.

UsetheDisconnectmethodtodisconnectthelocalcopyoftheactivedocumentfromthesharedworkspace,whileleavingthesharedcopyintactintheworkspace.UsetheRemoveDocumentmethodtoremovetheshareddocumentfromthesharedworkspaceentirely.

Usersrequireappropriatepermissionstousetheobjects,properties,andmethodsintheSharedWorkspaceobjecthierarchy.UsetheRoleargumentwhenaddingmemberstotheSharedWorkspaceMemberscollectiontospecifythesetofpermissionsspecifictoeachworkspacemember.

WhenusingtheSharedWorkspaceobjectmodel,itispossibletocreateconditionswheretheSharedWorkspaceobjectcacheisnotsynchronizedwiththeuserinterfacedisplayedintheSharedWorkspacepaneoftheactivedocument.Forexample,iftheCreateNewmethodprogrammaticallyaddstheactivedocumenttoanewworkspacewhiletheSharedWorkspacepaneisopen,theSharedWorkspacepanewillcontinuetodisplaytheCreateNewbutton.Incircumstanceslikethese,iftheusermakesaselectionintheSharedWorkspacepanethatisnolongervalid,anerrorisraisedandarefreshoperationiscarriedouttosynchronizethedisplaywiththecurrentdocumentstateandsharedworkspacedata.

ThePresentationobjectalsohasaSyncpropertywhichreturnsaSyncobject.UsetheSyncobjectanditspropertiesandmethodstomanagethesynchronizationofthelocalandtheservercopiesoftheshareddocument.

Page 2084: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowingexamplereturnsareferencetotheDocumentWorkspaceinwhichtheactivepresentationisstored.ThisexampleassumesthattheactivedocumentbelongstoaDocumentWorkspace.

DimobjWorkspaceAsSharedWorkspace

SetobjWorkspace=ActivePresentation.SharedWorkspace

Page 2085: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2086: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowScrollbarPropertyMsoTruetodisplaythescrollbarduringaslideshowinbrowsemode.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueNotusedwiththisproperty.msoFalsemsoTriStateMixedNotusedwiththisproperty.msoTriStateToggleNotusedwiththisproperty.msoTrue

expression.ShowScrollbar

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2087: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheShowTypepropertypriortosettingtheShowScrollbarproperty.

Page 2088: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiestodisplaytheslideshowfortheactivepresentationinawindowanddisplaysascrollbarusedforbrowsingthroughtheslidesduringaslideshow.

SubShowSlideShowScrollBar()

WithActivePresentation.SlideShowSettings

.ShowType=ppShowTypeWindow

.ShowScrollBar=msoTrue

EndWith

EndSub

Page 2089: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2090: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowSlideAnimationPropertyDetermineswhetherslideanimationsareenabledwhenpreviewing,saving,orpublishingaWebpresentation.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueSlideanimationsareenabledwhenpreviewing,saving,orpublishingaWebpresentation.

Page 2091: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatslideanimationsinpresentationtwoareenabledfortheWebpresentation.ItthenpreviewstheWebpage.

WithPresentations(2)

.WebOptions.ShowSlideAnimation=msoTrue

.WebPagePreview

EndWith

Page 2092: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2093: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowStartupDialogPropertyMsoTruetodisplaytheNewPresentationtaskpanewhenMicrosoftPowerPointisstarted.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseHidestheNewPresentationsidepane.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueDefault.DisplaystheNewPresentationsidepane.

expression.ShowStartupDialog

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2094: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowinglineofcodedisablestheNewPresentationtaskpanewhenPowerPointstarts.

SubDontShowStartup

Application.ShowStartupDialog=msoFalse

EndSub

Page 2095: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2096: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowTypePropertyReturnsorsetstheshowtypeforthespecifiedslideshow.Read/writePpSlideShowType.

PpSlideShowTypecanbeoneofthesePpSlideShowTypeconstants.ppShowTypeKioskppShowTypeSpeakerppShowTypeWindow

expression.ShowType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2097: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowoftheactivepresentationinawindow,startingwithslidetwoandendingwithslidefour.Thenewslideshowwindowisplacedintheupper-leftcornerofthescreen,anditswidthandheightareboth300points.

WithActivePresentation.SlideShowSettings

.RangeType=ppShowSlideRange

.StartingSlide=2

.EndingSlide=4

.ShowType=ppShowTypeWindow

With.Run

.Left=0

.Top=0

.Width=300

.Height=300

EndWith

EndWith

Page 2098: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2099: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowWindowsInTaskbarPropertyDetermineswhetherthereisaseparateWindowstaskbarbuttonforeachopenpresentation.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.ThereisaseparateWindowstaskbarbuttonforeachopenpresentation.

Page 2100: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

WhensettoTrue,thispropertysimulatesthelookofasingle-documentinterface(SDI),whichmakesiteasiertonavigatebetweenopenpresentations.However,ifyouworkwithmultiplepresentationswhileotherapplicationsareopen,youmaywanttosetthispropertytoFalsetoavoidfillingyourtaskbarwithunnecessarybuttons.

ThispropertyisavailableonlywhenusingMicrosoftOfficewithWindowsUpdateorWindows2000.

Page 2101: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthateachopenpresentationdoesn'thaveaseparateWindowstaskbarbutton.

Application.ShowWindowsInTaskbar=msoFalse

Page 2102: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2103: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowWithAnimationPropertyDetermineswhetherthespecifiedslideshowdisplaysshapeswithassignedanimationsettings.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowdisplaysshapeswithassignedanimationsettings.

Page 2104: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowoftheactivepresentationwithanimationandnarrationturnedoff.

WithActivePresentation.SlideShowSettings

.ShowWithAnimation=msoFalse

.ShowWithNarration=msoFalse

.Run

EndWith

Page 2105: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2106: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowWithNarrationPropertyDetermineswhetherthespecifiedslideshowisshownwithnarration.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowisshownwithnarration.

Page 2107: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowoftheactivepresentationwithanimationandnarrationturnedoff.

WithActivePresentation.SlideShowSettings

.ShowWithAnimation=msoFalse

.ShowWithNarration=msoFalse

.Run

EndWith

Page 2108: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SignaturesPropertyReturnsaSignatureSetobjectthatrepresentsacollectionofdigitalsignatures.

expression.Signatures

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2109: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowinglineofcodedisplaysthenumberofdigitalsignatures.

SubDisplayNumberOfSignatures

MsgBox"Numberofdigitalsignatures:"&_

ActivePresentation.Signatures.Count

EndSub

Page 2110: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SizePropertyReturnsorsetsthecharactersize,inpoints.Read/writeSingle.

Page 2111: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthesizeofthetextattachedtoshapeoneonslideoneto24points.

Application.ActivePresentation.Slides(1)_

.Shapes(1).TextFrame.TextRange.Font_

.Size=24

Page 2112: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2113: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlidePropertySlidepropertyasitappliestotheViewobject.

ReturnsorsetsaSlideobjectthatrepresentstheslidethat'scurrentlydisplayedinthespecifieddocumentwindowview.Read/write.

expression.Slide

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

SlidepropertyasitappliestotheSlideShowViewobject.

ReturnsaSlideobjectthatrepresentstheslidethat'scurrentlydisplayedinthespecifiedslideshowwindowview.Read-only.

expression.Slide

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2114: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifthecurrentlydisplayedslideisfromanembeddedpresentation,youcanusetheParentpropertyoftheSlideobjectreturnedbytheSlidepropertytoreturntheembeddedpresentationthatcontainstheslide.(ThePresentationpropertyoftheSlideShowWindowobjectorDocumentWindowobjectreturnsthepresentationfromwhichthewindowwascreated,nottheembeddedpresentation.)

Page 2115: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheViewobject.

ThisexampleplacesontheClipboardacopyoftheslidethat'scurrentlydisplayedinslideshowwindowone.

SlideShowWindows(1).View.Slide.Copy

Thisexampledisplaysthenameofthepresentationcurrentlyrunninginslideshowwindowone.

MsgBoxSlideShowWindows(1).View.Slide.Parent.Name

Page 2116: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideElapsedTimePropertyReturnsthenumberofsecondsthatthecurrentslidehasbeendisplayed.Read/writeLong.

Page 2117: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheResetSlideTimemethodtoresettheelapsedtimefortheslidethat'scurrentlydisplayed.

Page 2118: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsavariabletotheelapsedtimefortheslidethat'scurrentlydisplayedinslideshowwindowoneandthendisplaysthevalueofthevariable.

currTime=SlideShowWindows(1).View.SlideElapsedTime

MsgBoxcurrTime

Page 2119: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideHeightPropertyReturnsorsetstheslideheight,inpoints.Read/writeSingle.

Page 2120: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheslideheightto8.5inchesandtheslidewidthto11inchesfortheactivepresentation.

WithApplication.ActivePresentation.PageSetup

.SlideWidth=11*72

.SlideHeight=8.5*72

EndWith

Page 2121: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideIDPropertyReturnsauniqueIDnumberforthespecifiedslide.Read-onlyLong.

Page 2122: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UnliketheSlideIndexproperty,theSlideIDpropertyofaSlideobjectwon'tchangewhenyouaddslidestothepresentationorrearrangetheslidesinthepresentation.Therefore,usingtheFindBySlideIDmethodwiththeslide'sIDnumbercanbeamorereliablewaytoreturnaspecificSlideobjectfromaSlidescollectionthanusingtheItemmethodwiththeslide'sindexnumber.

Page 2123: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledemonstrateshowtoretrievetheuniqueIDnumberforaSlideobjectandthenusethisnumbertoreturnthatSlideobjectfromtheSlidescollection.

Setgslides=ActivePresentation.Slides

'GetslideID

graphSlideID=gslides.Add(2,ppLayoutChart).SlideID

gslides.FindBySlideID(graphSlideID)_

.SlideShowTransition.EntryEffect=_

ppEffectCoverLeft'UseIDtoreturnspecificslide

Page 2124: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideIDsPropertyReturnsanarrayofslideIDsforthespecifiednamedslideshow.Read-onlyVariant.

Page 2125: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsthecurrentslideintheactivewindowtothecustomslideshownamed"MarketingShortVersion."Notethattosaveamodifiedversionofthecustomslideshow,youmustdeletetheoriginalcustomshowandthenadditagain,usingthesamename.AlsonotethatifyouwanttoresizeanarraycontainedinaVariantvariable,youmustexplicitlydeclarethevariablebeforeattemptingtoresizeitsarray.

'NOTE-ThefollowingcodelineisNOToptional.

'Can'tredimarraywithoutthis

DimcustomShowSlideIDsAsVariant

DimcustomShowToExpandAsNamedSlideShow

customShowName="MarketingShortVersion"

SetcustomShowToExpand=ActivePresentation.SlideShowSettings_

.NamedSlideShows(customShowName)

slideToAddID=ActiveWindow.View.Slide.SlideID

customShowSlideIDs=customShowToExpand.SlideIDs

numSlides=UBound(customShowSlideIDs)

ReDimPreservecustomShowSlideIDs(numSlides+1)

customShowSlideIDs(numSlides+1)=slideToAddID

customShowToExpand.Delete

ActivePresentation.SlideShowSettings.NamedSlideShows_

.AddcustomShowName,customShowSlideIDs

Page 2126: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideIndexPropertyReturnstheindexnumberofthespecifiedslidewithintheSlidescollection.Read-onlyLong.

Page 2127: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UnliketheSlideIDproperty,theSlideIndexpropertyofaSlideobjectcanchangewhenyouaddslidestothepresentationorrearrangetheslidesinthepresentation.Therefore,usingtheFindBySlideIDmethodwiththeslide'sIDnumbercanbeamorereliablewaytoreturnaspecificSlideobjectfromaSlidescollectionthanusingtheItemmethodwiththeslide'sindexnumber.

Page 2128: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaystheindexnumberofthecurrentlydisplayedslideinslideshowwindowone.

MsgBoxSlideShowWindows(1).View.Slide.SlideIndex

Page 2129: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideMasterPropertyReturnsaMasterobjectthatrepresentstheslidemaster.

expression.SlideMaster

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2130: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebackgroundpatternfortheslidemasterfortheactivepresentation.

Application.ActivePresentation.SlideMaster.Background.Fill_

.PresetTexturedmsoTextureGreenMarble

Page 2131: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2132: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideNumberPropertySlideNumberpropertyasitappliestotheHeadersFootersobject.

ReturnsaHeaderFooterobjectthatrepresentstheslidenumberinthelower-rightcornerofaslide,orthepagenumberinthelower-rightcornerofanotespageorapageofaprintedhandoutoroutline.Read-only.

expression.SlideNumber

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

SlideNumberpropertyasitappliestotheSlideandSlideRangeobjects.

Returnstheslidenumber.Read-onlyInteger.

expression.SlideNumber

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2133: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheSlideNumberpropertyofaSlideobjectistheactualnumberthatappearsinthelower-rightcorneroftheslidewhenyoudisplayslidenumbers.Thisnumberisdeterminedbythenumberoftheslidewithinthepresentation(theSlideIndexpropertyvalue)andthestartingslidenumberforthepresentation(theFirstSlideNumberpropertyvalue).Theslidenumberisalwaysequaltothestartingslidenumber+theslideindexnumber–1.

Page 2134: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheHeadersFootersobject.

Thisexamplehidestheslidenumberonslidetwointheactivepresentationifthenumberiscurrentlyvisible,oritdisplaystheslidenumberifit'scurrentlyhidden.

WithApplication.ActivePresentation.Slides(2)_

.HeadersFooters.SlideNumber

If.VisibleThen

.Visible=False

Else

.Visible=True

EndIf

EndWith

AsitappliestotheSlideandSlideRangeobjects.

Thisexampleshowshowchangingthefirstslidenumberaffectstheslidenumberofaspecificslide.

WithApplication.ActivePresentation

.PageSetup.FirstSlideNumber=1'startsslidenumberingat1

MsgBox.Slides(2).SlideNumber'returns2

.PageSetup.FirstSlideNumber=10'startsslidenumberingat10

MsgBox.Slides(2).SlideNumber'returns11

EndWith

Page 2135: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2136: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideOrientationPropertyReturnsorsetstheon-screenandprintedorientationofslidesinthespecifiedpresentation.Read/writeMsoOrientation.

MsoOrientationcanbeoneoftheseMsoOrientationconstants.msoOrientationHorizontalmsoOrientationMixedmsoOrientationVertical

expression.SlideOrientation

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2137: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsorientationofallslidesintheactivepresentationtovertical(portrait).

Application.ActivePresentation.PageSetup.SlideOrientation=_

msoOrientationVertical

Page 2138: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideRangePropertyReturnsaSlideRangeobjectthatrepresentsarangeofselectedslides.Read-only.

Page 2139: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Asliderangecanbeconstructedinslideview,slidesorterview,normalview,notespageview,oroutlineview.Inslideview,SlideRangereturnsoneslide—thecurrent,displayedslide.

Page 2140: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebackgroundschemecolorforalltheselectedslidesinwindowone.

Windows(1).Selection.SlideRange.ColorScheme_

.Colors(ppBackground).RGB=RGB(0,0,255)

Page 2141: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlidesPropertyReturnsaSlidescollectionthatrepresentsallslidesinthespecifiedpresentation.Read-only.

Page 2142: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaslidetotheactivepresentation.

Application.ActivePresentation.Slides.Add1,ppLayoutTitle

Page 2143: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2144: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowNamePropertySlideShowNamepropertyasitappliestotheActionSetting,

PrintOptions,PublishObject,andSlideShowSettingsobjects.

Returnsorsetsthenameofthecustomslideshowtoruninresponsetoamouseactionontheshapeduringaslideshow(ActionSettingobject),returnsorsetsthenameofthecustomslideshowtoprint(PrintOptionsobject),orreturnsorsetsthenameofthecustomslideshowpublishedasawebpresentation(PublishObjectobject).Read/writeString.

expression.SlideShowName

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2145: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheRangeTypepropertymustbesettoppPrintNamedSlideShowtoprintacustomslideshow.

SlideShowNamepropertyasitappliestotheSlideShowViewobject.

Returnsthenameofthecustomslideshowthat'scurrentlyrunninginthespecifiedslideshowview.Read-onlyString.

expression.SlideShowName

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2146: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheActionSetting,PrintOptions,PublishObject,andSlideShowSettingsobjects.

Thisexampleprintsanexistingcustomslideshownamed"techtalk."

WithActivePresentation.PrintOptions

.RangeType=ppPrintNamedSlideShow

.SlideShowName="techtalk"

EndWith

ActivePresentation.PrintOut

ThefollowingexamplesavesthecurrentpresentationasanHTMLversion4.0filewiththename"mallard.htm."ItthendisplaysamessageindicatingthatthecurrentnamedpresentationisbeingsavedinbothPowerPointandHTMLformats.

WithPres.PublishObjects(1)

PresName=.SlideShowName

.SourceType=ppPublishAll

.FileName="C:\HTMLPres\mallard.htm"

.HTMLVersion=ppHTMLVersion4

MsgBox("Savingpresentation"&"'"_

&PresName&"'"&"inPowerPoint"_

&Chr(10)&Chr(13)_

&"formatandHTMLversion4.0format")

.Publish

EndWith

AsitappliestotheSlideShowViewobject.

Iftheslideshowrunninginslideshowwindowoneisacustomslideshow,thisexampledisplaysitsname.

WithSlideShowWindows(1).View

If.IsNamedShowThen

MsgBox"Nowshowinginslideshowwindow1:"_

&.SlideShowName

EndIf

EndWith

Page 2147: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 2148: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowSettingsPropertyReturnsaSlideShowSettingsobjectthatrepresentstheslideshowsettingsforthespecifiedpresentation.Read-only.

Page 2149: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplestartsaslideshowmeanttobepresentedbyaspeaker.Theslideshowwillrunwithanimationandnarrationturnedoff.

WithApplication.ActivePresentation.SlideShowSettings

.ShowType=ppShowTypeSpeaker

.ShowWithNarration=False

.ShowWithAnimation=False

.Run

EndWith

Page 2150: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowTransitionPropertyReturnsaSlideShowTransitionobjectthatrepresentsthespecialeffectsforthespecifiedslidetransition.Read-only.

Page 2151: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsslidetwointheactivepresentationtoadvanceautomaticallyafter5secondsduringaslideshowandtoplayadogbarksoundattheslidetransition.

WithActivePresentation.Slides(2).SlideShowTransition

.AdvanceOnTime=True

.AdvanceTime=5

.SoundEffect.ImportFromFile"c:\windows\media\dogbark.wav"

EndWith

ActivePresentation.SlideShowSettings.AdvanceMode=_

ppSlideShowUseSlideTimings

Page 2152: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowWindowPropertyReturnsaSlideShowWindowobjectthatrepresentstheslideshowwindowinwhichthespecifiedpresentationisrunning.Read-only.

Page 2153: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucanusethispropertyinconjunctionwiththeMekeywordandtheParentpropertytoreturntheslideshowwindowinwhichanActiveXcontroleventwasfired,asshownintheexample.

Page 2154: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowingexampleshowstheClickeventproceduresforbuttonsnamed"cmdBack"and"cmdForward".Ifyouaddthesebuttonstotheslidemasterandaddtheseeventprocedurestothem,allslidesbasedonthemaster(andsettoshowmasterbackgroundgraphics)willhavethesenavigationbuttonsthatwillbeactiveduringaslideshow.TheMekeywordreturnstheMasterobjectthatrepresentstheslidemasterthatcontainsthecontrol.Ifthecontrolwereonanindividualslide,theMekeywordinaneventprocedureforthatcontrolwouldreturnaSlideobject.

PrivateSubcmdBack_Click()

Me.Parent.SlideShowWindow.View.Previous

EndSub

PrivateSubcmdForward_Click()

Me.Parent.SlideShowWindow.View.Next

EndSub

Page 2155: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowWindowsPropertyReturnsaSlideShowWindowscollectionthatrepresentsallopenslideshowwindows.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 2156: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowinawindowandsetstheheightandwidthoftheslideshowwindow.

WithApplication

.Presentations(1).SlideShowSettings.Run

With.SlideShowWindows(1)

.Height=250

.Width=250

EndWith

EndWith

Page 2157: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2158: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideSizePropertyReturnsorsetstheslidesizeforthespecifiedpresentation.Read/writePpSlideSizeType.

PpSlideSizeTypecanbeoneofthesePpSlideSizeTypeconstants.ppSlideSize35MMppSlideSizeA3PaperppSlideSizeA4PaperppSlideSizeB4ISOPaperppSlideSizeB4JISPaperppSlideSizeB5ISOPaperppSlideSizeB5JISPaperppSlideSizeBannerppSlideSizeCustomppSlideSizeHagakiCardppSlideSizeLedgerPaperppSlideSizeLetterPaperppSlideSizeOnScreenppSlideSizeOverhead

expression.SlideSize

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2159: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheslidesizetooverheadfortheactivepresentation.

Application.ActivePresentation.PageSetup_

.SlideSize=ppSlideSizeOverhead

Page 2160: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideWidthPropertyReturnsorsetstheslidewidth,inpoints.Read/writeSingle.

Page 2161: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheslideheightto8.5inchesandtheslidewidthto11inchesfortheactivepresentation.

WithApplication.ActivePresentation.PageSetup

.SlideWidth=11*72

.SlideHeight=8.5*72

EndWith

Page 2162: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2163: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SmoothPropertySetsorreturnsanMsoTriStatethatrepresentswhetherthetransitionfromoneanimationpointtoanotherissmoothed.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheanimationpointshouldnotbesmoothed.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Theanimationshouldbesmoothed.

expression.Smooth

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2164: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplechangessmoothingforananimationpoint.

SubChangeSmooth(ByValaniAsAnimationBehavior,ByValblnAsMsoTriState)

ani.PropertyEffect.Points.Smooth=bln

EndSub

Page 2165: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2166: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SmoothEndPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetherananimationshoulddecelerateasitends.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Ananimationdoesnotdeceleratewhenitends.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueAnanimationdecelerateswhenitends.

expression.SmoothEnd

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2167: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetoaslide,animatestheshape,andinstructstheshapetodeceleratewhenitends.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

'Addsshapeandsetsanimationeffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

'Setsdurationofeffectandslowsanimationatend

WitheffDiamond.Timing

.Duration=5

.SmoothEnd=msoTrue

EndWith

EndSub

Page 2168: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2169: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SmoothStartPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetherananimationshouldacceleratewhenitstarts.Read/write.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Theanimationdoesnotacceleratewhenitstarts.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueTheanimationaccelerateswhenitstarts.

expression.SmoothStart

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2170: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetoaslide,animatestheshape,andinstructstheshapetoacceleratewhenitstarts.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

WitheffDiamond.Timing

.Duration=5

.SmoothStart=msoTrue

EndWith

EndSub

Page 2171: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2172: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SnapToGridPropertyMsoTruetosnapshapestothegridlinesinthespecifiedpresentation.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue

expression.SnapToGrid

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2173: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampletogglessnappingshapestothegridlinesintheactivepresentation.

SubToggleSnapToGrid()

WithActivePresentation

If.SnapToGrid=msoTrueThen

.SnapToGrid=msoFalse

Else

.SnapToGrid=msoTrue

EndIf

EndWith

EndSub

Page 2174: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SoundEffectPropertyActionSettingobject:ReturnsaSoundEffectobjectthatrepresentsthesoundtobeplayedwhenthespecifiedshapeisclickedorthemousepointerpassesovertheshape.Ifyoudon'thearthesoundthatyouassignedtotheshapewhenyouruntheslideshow,makesurethattheTextLevelEffectpropertyissettoavalueotherthanppAnimateLevelNoneandthattheAnimatepropertyissettoTrue.

AnimationSettingsandEffectInformationobjects:ReturnsaSoundEffectobjectthatrepresentsthesoundtobeplayedduringtheanimationofthespecifiedshape.

SlideShowTransitionobject:ReturnsaSoundEffectobjectthatrepresentsthesoundtobeplayedduringthetransitiontothespecifiedslide.

expression.SoundEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2175: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthefileBass.wavtobeplayedwhenevershapeoneonslideoneintheactivepresentationisanimated.

WithActivePresentation.Slides(1).Shapes(1).AnimationSettings

.Animate=True

.TextLevelEffect=ppAnimateByAllLevels

.SoundEffect.ImportFromFile"c:\bass.wav"

EndWith

Page 2176: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SourceFullNamePropertyReturnsorsetsthenameandpathofthesourcefileforthelinkedOLEobject.Read/writeString.

Page 2177: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthesourcefileforshapeoneonslideoneintheactivepresentationtoWordtest.docandspecifiesthattheobject'simagebeupdatedautomatically.

WithActivePresentation.Slides(1).Shapes(1)

If.Type=msoLinkedOLEObjectThen

With.LinkFormat

.SourceFullName="c:\mydocuments\wordtest.doc"

.AutoUpdate=ppUpdateOptionAutomatic

EndWith

EndIf

EndWith

Page 2178: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2179: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SourceTypePropertyReturnsorsetsthesourcetypeofthepresentationtobepublishedtoHTML.Read/writePpPublishSourceType.

PpPublishSourceTypecanbeoneofthesePpPublishSourceTypeconstants.ppPublishAllppPublishNamedSlideShowUsethisvaluetopublishacustomslideshow,specifyingthenameofthecustomslideshowwiththeSlideShowNameproperty.ppPublishSlideRange

expression.SourceType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2180: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplepublishesthespecifiedsliderange(slidesthreethroughfive)oftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.Publish

EndWith

Page 2181: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SpaceAfterPropertyReturnsorsetstheamountofspaceafterthelastlineineachparagraphofthespecifiedtext,inpointsorlines.Read/writeSingle.

Page 2182: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthespacingafterparagraphsto6pointsforthetextinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat

.LineRuleAfter=False

.SpaceAfter=6

EndWith

EndWith

Page 2183: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SpaceBeforePropertyReturnsorsetstheamountofspacebeforethefirstlineineachparagraphofthespecifiedtext,inpointsorlines.Read/writeSingle.

Page 2184: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthespacingbeforeparagraphsto6pointsforthetextinshapetwoonslideintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat

.LineRuleBefore=False

.SpaceBefore=6

EndWith

EndWith

Page 2185: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SpaceWithinPropertyReturnsorsetstheamountofspacebetweenbaselinesinthespecifiedtext,inpointsorlines.Read/writeSingle.

Page 2186: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetslinespacingto21pointsforthetextinshapetwoonslidetwointheactivepresentation.

WithApplication.ActivePresentation.Slides(2).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat

.LineRuleWithin=False

.SpaceWithin=21

EndWith

EndWith

Page 2187: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2188: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SpeakerNotesPropertyDetermineswhetherspeakernotesaretobepublishedwiththepresentation.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueSpeakernotesaretobepublishedwiththepresentation.

Page 2189: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.Itincludestheassociatedspeaker'snoteswiththepublishedpresentationandnamesitMallard.htm.

WithActivePresentation.PublishObjects(1)

.FileName="C:\Test\Mallard.htm"

.SourceType=ppPublishSlideRange

.RangeStart=3

.RangeEnd=5

.SpeakerNotes=msoTrue

.Publish

EndWith

Page 2190: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2191: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SpeedPropertySpeedpropertyasitappliestotheSlideShowTransitionobject.

ReturnsorsetsaPpTransitionSpeedconstantthatrepresentsthespeedofthetransitiontothespecifiedslide.Read/write.

PpTransitionSpeedcanbeoneofthesePpTransitionSpeedconstants.ppTransitionSpeedFastppTransitionSpeedMediumppTransitionSpeedMixedppTransitionSpeedSlow

expression.Speed

expressionRequired.AnexpressionthatreturnsaSlideShowTransitionobject.

SpeedpropertyasitappliestotheTimingobject.

ReturnsorsetsaSinglethatrepresentsthespeed,inseconds,ofthespecifiedanimation.Read/write.

expression.Speed

expressionRequired.AnexpressionthatreturnsaTimingobject.

Page 2192: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheSlideShowTransitionobject.

Thisexamplesetsthespecialeffectforthetransitiontothefirstslideintheactivepresentationandspecifiesthatthetransitionbefast.

WithActivePresentation.Slides(1).SlideShowTransition

.EntryEffect=ppEffectStripsDownLeft

.Speed=ppTransitionSpeedFast

EndWith

AsitappliestotheTimingobject.

Thisexamplesetstheanimationforthemainsequencetoreverseandsetsthespeedtoonesecond.

SubAnimPoints()

DimtmlAnimAsTimeLine

DimspdAnimAsTiming

SettmlAnim=ActivePresentation.Slides(1).TimeLine

SetspdAnim=tlnAnim.MainSequence(1).Timing

WithspdAnim

.AutoReverse=msoTrue

.Speed=1

EndWith

EndSub

Page 2193: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SplitHorizontalPropertyReturnsorsetsthepercentageofthedocumentwindowwidththattheoutlinepaneoccupiesinnormalview.Correspondstothepanedividerpositionbetweentheslideandoutlinepanes.Read/writeLong.

Page 2194: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThemaximumvalueoftheSplitHorizontalpropertyisalwayslessthan100%becausetheslidepanehasaminimumwidththatdependsona10%zoomlevel.Theactualmaximumvaluemayvarydependingonthesizeoftheapplicationwindow.

Page 2195: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetstheverticalpanedividerfortheactivedocumentwindowtodivideat15%outlinepaneand85%slidepane.

ActiveWindow.SplitHorizontal=15

Page 2196: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SplitVerticalPropertyReturnsorsetsthepercentageofthedocumentwindowheightthattheslidepaneoccupiesinnormalview.Correspondstothepanedividerpositionbetweentheslideandnotespanes.Read/writeLong.

Page 2197: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheminimumvalueoftheSplitVerticalpropertyisalwaysgreaterthan0%becausetheslidepanehasaminimumheightthatdependsona10%zoomlevel.Theactualminimumvaluemayvarydependingonthesizeoftheapplicationwindow.

Page 2198: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetsthehorizontalpanedividerfortheactivedocumentwindowtodivideat60%slidepaneand40%notespane.

ActiveWindow.SplitVertical=60

Page 2199: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2200: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

StartPropertyStartpropertyasitappliestothePrintRangeobject.

Returnsthenumberofthefirstslideintherangeofslidestobeprinted.Read-onlyInteger.

expression.Start

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

StartpropertyasitappliestotheTextRangeobject.

Returnsthepositionofthefirstcharacterinthespecifiedtextrangerelativetothefirstcharacterintheshapethatcontainsthetext.Read-onlyLong.

expression.Start

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2201: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestothePrintRangeobject.

Thisexampledisplaysamessagethatindicatesthestartingandendingslidenumbersforprintrangeoneintheactivepresentation.

WithActivePresentation.PrintOptions.Ranges

If.Count>0Then

With.Item(1)

MsgBox"Printrange1startsonslide"&.Start&_

"andendsonslide"&.End

EndWith

EndIf

EndWith

Page 2202: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

StartingSlidePropertyReturnsorsetsthefirstslidetobedisplayedinthespecifiedslideshow.Read/writeLong.

Page 2203: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplerunsaslideshowoftheactivepresentation,startingwithslidetwoandendingwithslidefour.

WithActivePresentation.SlideShowSettings

.RangeType=ppShowSlideRange

.StartingSlide=2

.EndingSlide=4

.Run

EndWith

Page 2204: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

StartValuePropertyReturnsorsetsthebeginningvalueofabulletedlistwhentheTypepropertyoftheBulletFormatobjectissettoppBulletNumbered.Thevaluemustbeintherangeof1to32767.Read/writeInteger.

Page 2205: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthebulletsinthetextboxspecifiedbyshapetwoonslideonetostartwiththenumberfive.

WithActivePresentation.Slides(1).Shapes(2).TextFrame

With.TextRange.ParagraphFormat.Bullet

.Type=ppBulletNumbered

.StartValue=5

EndWith

EndWith

Page 2206: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2207: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

StatePropertyReturnsorsetsthestateoftheslideshow.Read/writePpSlideShowState.

PpSlideShowStatecanbeoneofthesePpSlideShowStateconstants.ppSlideShowBlackScreenppSlideShowDoneppSlideShowPausedppSlideShowRunningppSlideShowWhiteScreen

expression.State

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2208: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheviewstateinslideshowwindowonetoablackscreen.

SlideShowWindows(1).View.State=ppSlideShowBlackScreen

Page 2209: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

StopAfterSlidesPropertyReturnsorsetsthenumberofslidestobedisplayedbeforethemediaclipstopsplaying.Read/writeLong.

Page 2210: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

FortheStopAfterSlidespropertysettingtotakeeffect,thePauseAnimationpropertyofthespecifiedslidemustbesettoFalse,andthePlayOnEntrypropertymustbesettoTrue.

Themediaclipwillstopplayingwhenthespecifiednumberofslideshavebeendisplayedorwhentheclipcomestoanend—whichevercomesfirst.Avalueof0(zero)specifiesthattheclipwillstopplayingafterthecurrentslide.

Page 2211: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatthemediacliprepresentedbyshapethreeonslideoneintheactivepresentationwillbeplayedautomaticallywhenit'sanimated,thattheslideshowwillcontinuewhilethemediaclipisplayinginthebackground,andthattheclipwillstopplayingafterthreeslidesaredisplayedorwhentheendoftheclipisreached—whichevercomesfirst.Shapethreemustbeasoundormovieobject.

SetOLEobj=ActivePresentation.Slides(1).Shapes(3)

WithOLEobj.AnimationSettings.PlaySettings

.PlayOnEntry=True

.PauseAnimation=False

.StopAfterSlides=3

EndWith

Page 2212: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2213: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

StylePropertyStylepropertyasitappliestotheLineFormatobject.

Returnsorsetsthelinestyle.Read/writeMsoLineStyle.

MsoLineStylecanbeoneoftheseMsoLineStyleconstants.msoLineSinglemsoLineStyleMixedmsoLineThickBetweenThinmsoLineThickThinmsoLineThinThickmsoLineThinThin

expression.Style

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

StylepropertyasitappliestotheBulletFormatobject.

Returnsorsetsthebulletstyle.Read/writePpNumberedBulletStyle.Someoftheseconstantsmaynotbeavailabletoyou,dependingonthelanguagesupport(U.S.English,forexample)thatyou’veselectedorinstalled.

PpNumberedBulletStylecanbeoneofthesePpNumberedBulletStyleconstants.ppBulletAlphaLCParenBothLowercasealphabeticcharacterswithbothparentheses.ppBulletAlphaLCParenRightLowercasealphabeticcharacterswithrightparenthesis.ppBulletAlphaLCPeriodLowercasealphabeticcharacterswithaperiod.ppBulletAlphaUCParenBothUppercasealphabeticcharacterswithbothparentheses.ppBulletAlphaUCParenRightUppercasealphabeticcharacterswithrightparenthesis.

Page 2214: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppBulletAlphaUCPeriodUppercasealphabeticcharacterswithaperiod.ppBulletArabicAbjadDashArabicAbjadalphabetswithadash.ppBulletArabicAlphaDashArabiclanguagealphabeticcharacterswithadash.ppBulletArabicDBPeriodDouble-byteArabicnumberingschemewithdouble-byteperiod.ppBulletArabicDBPlainDouble-byteArabicnumberingscheme(nopunctuation).ppBulletArabicParenBothArabicnumeralswithbothparentheses.ppBulletArabicParenRightArabicnumeralswithrightparenthesis.ppBulletArabicPeriodArabicnumeralswithaperiod.ppBulletArabicPlainArabicnumerals.ppBulletCircleNumDBPlainDouble-bytecirclednumberforvaluesupto10.ppBulletCircleNumWDBlackPlainShadowcolornumberwithcircularbackgroundofnormaltextcolor.ppBulletCircleNumWDWhitePlainTextcolorednumberwithsamecolorcircledrawnaroundit.ppBulletHebrewAlphaDashHebrewlanguagealphabeticcharacterswithadash.ppBulletHindiAlphaPeriodppBulletHindiNumPeriodppBulletKanjiKoreanPeriodJapanese/Koreannumberswithaperiod.ppBulletKanjiKoreanPlainJapanese/Koreannumberswithoutaperiod.ppBulletRomanLCParenBothLowercaseRomannumeralswithbothparentheses.ppBulletRomanLCParenRightLowercaseRomannumeralswithrightparenthesis.ppBulletRomanLCPeriodLowercaseRomannumeralswithperiod.ppBulletRomanUCParenBothUppercaseRomannumeralswithbothparentheses.ppBulletRomanUCParenRightUppercaseRomannumeralswithrightparenthesis.ppBulletRomanUCPeriodUppercaseRomannumeralswithperiod.ppBulletSimpChinPeriodSimplifiedChinesewithaperiod.ppBulletSimpChinPlainSimplifiedChinesewithoutaperiod.

Page 2215: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppBulletStyleMixedAnyundefinedstyle.ppBulletThaiAlphaParenBothppBulletThaiAlphaParenRightppBulletThaiAlphaPeriodppBulletThaiNumParenBothppBulletThaiNumParenRightppBulletThaiNumPeriodppBulletTradChinPeriodTraditionalChinesewithaperiod.ppBulletTradChinPlainTraditionalChinesewithoutaperiod.

expression.Style

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2216: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheLineFormatobject.

Thisexampleaddsathick,bluecompoundlinetomyDocument.Thecompoundlineconsistsofathicklinewithathinlineoneithersideofit.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(10,10,250,250).Line

.Style=msoLineThickBetweenThin

.Weight=8

.ForeColor.RGB=RGB(0,0,255)

EndWith

AsitappliestotheBulletFormatobject.

Thisexamplesetsthebulletstyleforthebulletedlist,representedbyshapeoneonthefirstslide,toashadowcolornumberwithcircularbackgroundofnormaltextcolor.

ActivePresentation.Slides(1).Shapes(1).TextFrame_

.TextRange.ParagraphFormat.Bullet_

.Style=ppBulletCircleNumWDBlackPlain

Page 2217: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SubAddressPropertyReturnsorsetsthelocationwithinadocument—suchasabookmarkinaworddocument,arangeinaMicrosoftExcelworksheet,oraslideinaPowerPointpresentation—associatedwiththespecifiedhyperlink.Read/writeString.

Page 2218: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsshapeoneonslideoneintheactivepresentationtojumptotheslidenamed"LastQuarter"inLatestFigures.pptwhentheshapeisclickedduringaslideshow.

WithActivePresentation.Slides(1).Shapes(1)_

.ActionSettings(ppMouseClick)

.Action=ppActionHyperlink

With.Hyperlink

.Address="c:\sales\latestfigures.ppt"

.SubAddress="lastquarter"

EndWith

EndWith

ThisexamplesetsshapeoneonslideoneintheactivepresentationtojumptorangeA1:B10inLatest.xlswhentheshapeisclickedduringaslideshow.

WithActivePresentation.Slides(1).Shapes(1)_

.ActionSettings(ppMouseClick)

.Action=ppActionHyperlink

With.Hyperlink

.Address="c:\sales\latest.xls"

.SubAddress="A1:B10"

EndWith

EndWith

Page 2219: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2220: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SubscriptPropertyDetermineswhetherthespecifiedtextissubscript.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Thespecifiedtextisnotsubscript.msoTriStateMixedSomecharactersaresubscriptandsomearen't.msoTriStateTogglemsoTrueThespecifiedtextissubscript.

Page 2221: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingtheBaselineOffsetpropertytoanegativevalueautomaticallysetstheSubscriptpropertytomsoTrueandtheSuperscriptpropertytomsoFalse.

SettingtheBaselineOffsetpropertytoapositivevalueautomaticallysetstheSubscriptpropertytomsoFalseandtheSuperscriptpropertytomsoTrue.

SettingtheSubscriptpropertytomsoTrueautomaticallysetstheBaselineOffsetpropertyto–0.25(–25percent).

Page 2222: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleenlargesthefirstcharacterinthetitleonslideoneifthatcharacterissubscript.

WithApplication.ActivePresentation.Slides(1)_

.Shapes.Title.TextFrame.TextRange

With.Characters(1,1).Font

If.SubscriptThen

scaleChar=-20*.BaselineOffset

.Size=.Size*scaleChar

EndIf

EndWith

EndWith

Page 2223: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SubtypePropertySetsorreturnsaMsoAnimFilterEffectSubtypeconstantthatdeterminesthesubtypeofthefiltereffect.Read/write.

expression.Subtype

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2224: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetothefirstslideoftheactivepresentationandsetsafiltereffectanimationbehavior.

SubChangeFilterEffect()

DimsldFirstAsSlide

DimshpHeartAsShape

DimeffNewAsEffect

DimbhvEffectAsAnimationBehavior

SetsldFirst=ActivePresentation.Slides(1)

SetshpHeart=sldFirst.Shapes.AddShape(Type:=msoShapeHeart,_

Left:=100,Top:=100,Width:=100,Height:=100)

SeteffNew=sldFirst.TimeLine.MainSequence.AddEffect_

(Shape:=shpHeart,EffectID:=msoAnimEffectChangeFillColor,_

Trigger:=msoAnimTriggerAfterPrevious)

SetbhvEffect=effNew.Behaviors.Add(msoAnimTypeFilter)

WithbhvEffect.FilterEffect

.Type=msoAnimFilterEffectTypeWipe

.Subtype=msoAnimFilterEffectSubtypeUp

.Reveal=msoTrue

EndWith

EndSub

Page 2225: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2226: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SuperscriptPropertyDetermineswhetherthespecifiedtextissuperscript.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Thespecifiedtextisnotsuperscript.msoTriStateMixedSomecharactersaresuperscriptandsomearen't.msoTriStateTogglemsoTrueThespecifiedtextissuperscript.

Page 2227: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

SettingtheBaselineOffsetpropertytoanegativevalueautomaticallysetstheSubscriptpropertytomsoTrueandtheSuperscriptpropertytomsoFalse.

SettingtheBaselineOffsetpropertytoapositivevalueautomaticallysetstheSubscriptpropertytomsoFalseandtheSuperscriptpropertytomsoTrue.

SettingtheSuperscriptpropertytomsoTrueautomaticallysetstheBaselineOffsetpropertyto0.3(30percent).

Page 2228: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthetextforshapetwoonslideoneandthenmakesthefifthcharactersuperscriptwitha30-percentoffset.

WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame

With.TextRange

.Text="E=mc2"

.Characters(5,1).Font.Superscript=msoTrue

EndWith

EndWith

Page 2229: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2230: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SyncPropertyReturnsaSyncobjectthatenablesyoutomanagethesynchronizationofthelocalandservercopiesofasharedpresentationstoredinaMicrosoftWindowsSharePointServicessharedworkspace.Read-only.

expression.Sync

expressionRequired.AnexpressionthatreturnsaPresentationobject.

Page 2231: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheStatuspropertyoftheSyncobjectreturnsimportantinformationaboutthecurrentstateofsynchronization.UsetheGetUpdatemethodtorefreshthesyncstatus.UsetheLastSyncTime,ErrorType,andWorkspaceLastChangedBypropertiestoreturnadditionalinformation.

Formoreinformationonthedifferencesandconflictsthatcanexistbetweenthelocalandservercopiesofsharedpresentations,seetheStatusproperty.

UsethePutUpdatemethodtosavelocalchangestotheserver.Closeandre-openthedocumenttoretrievethelatestversionfromtheserverwhennolocalchangeshavebeenmade.UsetheResolveConflictmethodtoresolvedifferencesbetweenthelocalandtheservercopies,ortheOpenVersionmethodtoopenadifferentversionalongwiththecurrentlyopenlocalversionofthedocument.

TheGetUpdate,PutUpdate,andResolveConflictmethodsoftheSyncobjectdonotreturnstatuscodesbecausetheycompletetheirtasksasynchronously.TheSyncobjectprovidesimportantstatusinformationthroughasingleevent,calledthePresentationSynceventoftheApplicationobject.

TheSynceventdescribedabovereturnsanmsoSyncEventTypevalue.

MsoSyncEventTypecanbeoneofthefollowingmsoSyncEventTypeconstants.msoSyncEventDownloadInitiated(0)msoSyncEventDownloadSucceeded(1)msoSyncEventDownloadFailed(2)msoSyncEventUploadInitiated(3)msoSyncEventUploadSucceeded(4)msoSyncEventUploadFailed(5)msoSyncEventDownloadNoChange(6)msoSyncEventOffline(7)

TheSyncobjectmodelisavailablewhethersharingandsynchronizationareenabledordisabledontheactivedocument.TheSyncpropertyofthePresentationobjectdoesnotreturnNothingwhentheactivedocumentisnot

Page 2232: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

sharedorsynchronizationisnotenabled.UsetheStatuspropertytodeterminewhetherthedocumentissharedandwhethersynchronizationisenabled.

Notalldocumentsynchronizationproblemsraiserun-timeerrorsthatcanbetrapped.AfterusingthemethodsoftheSyncobject,itisagoodideatochecktheStatusproperty.IftheStatuspropertyismsoSyncStatusError,checktheErrorTypepropertyforadditionalinformationonthetypeoferrorthathasoccurred.

Inmanycircumstances,thebestwaytoresolveanerrorconditionistocalltheGetUpdatemethod.Forexample,ifacalltoPutUpdateresultsinanerrorcondition,thenacalltoGetUpdatewillresetthestatustomsoSyncStatusLocalChanges.

Page 2233: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowingexampledisplaysthenameofthelastpersontomodifytheactivepresentationiftheactivepresentationisashareddocumentinaDocumentWorkspace.

DimeStatusAsMsoSyncStatusType

DimstrLastUserAsString

eStatus=ActivePresentation.Sync.Status

IfeStatus=msoSyncStatusLatestThen

strLastUser=ActivePresentation.Sync.WorkspaceLastChangedBy

MsgBox"Youhavethemostup-to-datecopy."&_

"Thisfilewaslastmodifiedby"&strLastUser

EndIf

Page 2234: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TablePropertyReturnsaTableobjectthatrepresentsatableinashapeorinashaperange.Read-only.

Page 2235: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthewidthofthefirstcolumninthetableinshapefiveonthesecondslideto80points.

ActivePresentation.Slides(2).Shapes(5).Table_

.Columns(1).Width=80

Page 2236: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2237: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TableDirectionPropertyReturnsorsetsthedirectioninwhichthetablecellsareordered.Read/writePpDirection.

PpDirectioncanbeoneofthesePpDirectionconstants.ppDirectionLeftToRightppDirectionMixedppDirectionRightToLeft

expression.TableDirection

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2238: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueoftheTableDirectionpropertyisppDirectionLefttToRightunlesstheLanguageSettingspropertyortheDefaultLanguageIDpropertyissettoaright-to-leftlanguage,inwhichcasethedefaultvalueisppDirectionRightToLeft.TheppDirectionMixedconstantmaybereturnedwhenusingtheTextDirectionproperty.

Page 2239: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedirectioninwhichcellsintheselectedtableareorderedtolefttoright(firstcolumnistheleftmostcolumn).

ActiveWindow.Selection.ShapeRange.Table.TableDirection=_

ppDirectionLeftToRight

Page 2240: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TabStopsPropertyReturnsaTabStopscollectionthatrepresentsthetabstopsforthespecifiedtext.Read-only.

Page 2241: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsaslidewithtwotextcolumnstotheactivepresentation,setsaleft-alignedtabstopforthetitleonthenewslide,alignsthetitleboxtotheleft,andassignstitletextutilizingthetabstopjustcreated.

WithApplication.ActivePresentation.Slides_

.Add(2,ppLayoutTwoColumnText).Shapes

With.Title.TextFrame

With.Ruler

.Levels(1).FirstMargin=0

.TabStops.AddppTabStopLeft,310

EndWith

.TextRange.ParagraphFormat.Alignment=ppAlignLeft

.TextRange="firstcolumn"+Chr(9)+"secondcolumn"

EndWith

EndWith

Page 2242: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TagsPropertyReturnsaTagsobjectthatrepresentsthetagsforthespecifiedobject.Read-only.

Page 2243: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

NoteTagvaluesareaddedandstoredinuppercasetext.Youshouldperformtestsontagvaluesusinguppercasetext,asshowninthesecondexample.

Thisexampleaddsatagnamed"REGION"andatagnamed"PRIORITY"toslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Tags

.Add"Region","East"'Adds"Region"tagwithvalue"East"

.Add"Priority","Low"'Adds"Priority"tagwithvalue"Low"

EndWith

Thisexamplesearchesthroughthetagsforeachslideintheactivepresentation.Ifthere'satagnamed"PRIORITY,"amessageboxdisplaysthetagvalue.Iftheobjectdoesn'thaveatagnamed"PRIORITY,"theexampleaddsthistagwiththevalue"Unknown."

ForEachsInApplication.ActivePresentation.Slides

Withs.Tags

found=False

Fori=1To.Count

If.Name(i)="PRIORITY"Then

found=True

slNum=.Parent.SlideIndex

MsgBox"Slide"&slNum&"Priority:"&.Value(i)

EndIf

Next

IfNotfoundThen

slNum=.Parent.SlideIndex

.Add"Priority","Unknown"

MsgBox"Slide"&slNum&"Prioritytagadded:Unknown"

EndIf

EndWith

Next

Page 2244: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 2245: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2246: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TargetBrowserPropertySetsorreturnsanMsoTargetBrowserconstantthatrepresentsthebrowserusedwithMicrosoftPowerPoint.Read/write.

MsoTargetBrowsercanbeoneoftheseMsoTargetBrowserconstants.msoTargetBrowserIE4msoTargetBrowserIE5msoTargetBrowserIE6msoTargetBrowserV3msoTargetBrowserV4

expression.TargetBrowser

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2247: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthetargetbrowserfortheactivepresentationtoMicrosoftInternetExplorer6ifthecurrenttargetbrowserisanearlierversion.

SubSetWebBrowser()

WithActivePresentation.WebOptions

If.TargetBrowser<msoTargetBrowserIE6Then

.TargetBrowser=msoTargetBrowserIE6

EndIf

EndWith

EndSub

ThisexamplesetsthetargetbrowserforallpresentationstoInternetExplorer6.

SubGlobalTargetBrowser()

Application.DefaultWebOptions_

.TargetBrowser=msoTargetBrowserIE6

EndSub

Page 2248: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TemplateNamePropertyReturnsthenameofthedesigntemplateassociatedwiththespecifiedpresentation.Read-onlyString.

Page 2249: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThereturnedstringincludestheMS-DOSfilenameextension(forfiletypesthatareregistered)butdoesn'tincludethefullpath.

Page 2250: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowingexampleappliesthedesigntemplateProfessional.pottothepresentationPres1.pptifit'snotalreadyappliedtoit.

WithPresentations("Pres1.ppt")

If.TemplateName<>"Professional.pot"Then

.ApplyTemplate"c:\programfiles\microsoftoffice"&_

"\templates\presentationdesigns\Professional.pot"

EndIf

EndWith

Page 2251: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2252: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextPropertyTextpropertyasitappliestotheHeaderFooter,TextEffectFormat,and

TextRangeobjects.

ReturnsorsetsaStringthatrepresentsthetextcontainedinthespecifiedobject.Read/write.

expression.Text

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

TextpropertyasitappliestotheCommentobject.

ReturnsaStringthatrepresentsthetextinacomment.Read-only.

expression.Text

expressionRequired.AnexpressionthatreturnsaCommentobject.

Page 2253: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheTextRangeobject.

Thisexamplesetsthetextandfontstyleforthetitleonslideoneintheactivepresentation.

SetmyPres=Application.ActivePresentation

WithmyPres.Slides(1).Shapes.Title.TextFrame.TextRange

.Text="Welcome!"

.Font.Italic=True

EndWith

Page 2254: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2255: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextDirectionPropertyReturnsorsetsthetextdirectionforthespecifiedparagraph.Read/writePpDirection.Thedefaultvaluedependsonthelanguagesupportyouhaveselectedorinstalled.

PpDirectioncanbeoneofthesePpDirectionconstants.ppDirectionLeftToRightppDirectionMixedppDirectionRightToLeft

expression.TextDirection

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2256: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysthetextdirectionfortheparagraphsinshapetwoonslideoneintheactivepresentation.

MsgBoxActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange_

.ParagraphFormat.TextDirection

Page 2257: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextEffectPropertyReturnsaTextEffectFormatobjectthatcontainstext-effectformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentWordArt.

expression.TextEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2258: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthefontstyletoboldforshapethreeonmyDocumentiftheshapeisWordArt.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3)

If.Type=msoTextEffectThen

.TextEffect.FontBold=True

EndIf

EndWith

Page 2259: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextFramePropertyReturnsaTextFrameobjectthatcontainsthealignmentandanchoringpropertiesforthespecifiedshapeormastertextstyle.

Page 2260: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheTextRangepropertyoftheTextFrameobjecttoreturnthetextinthetextframe.

UsetheHasTextFramepropertytodeterminewhetherashapecontainsatextframebeforeyouapplytheTextFrameproperty.

Page 2261: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsarectangletomyDocument,addstexttotherectangle,andsetsthetopmarginforthetextframe.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes_

.AddShape(msoShapeRectangle,180,175,350,140).TextFrame

.TextRange.Text="Hereissometesttext"

.MarginTop=10

EndWith

Page 2262: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2263: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextLevelEffectPropertyReturnsorsetsaPpTextLevelEffectconstantthatindicateswhetherthetextinthespecifiedshapeisanimatedbyfirst-levelparagraphs,second-levelparagraphs,orsomeotherlevel(uptofifth-levelparagraphs).Read/write.

PpTextLevelEffectcanbeoneofthesePpTextLevelEffectconstants.ppAnimateByAllLevelsppAnimateByFifthLevelppAnimateByFirstLevelppAnimateByFourthLevelppAnimateBySecondLevelppAnimateByThirdLevelppAnimateLevelMixedppAnimateLevelNone

expression.TextLevelEffect

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2264: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

FortheTextLevelEffectpropertysettingtotakeeffect,theAnimatepropertymustbesettoTrue.

Page 2265: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsatitleslideandtitletexttotheactivepresentationandsetsthetitletobebuiltletterbyletter.

WithActivePresentation.Slides.Add(1,ppLayoutTitleOnly).Shapes(1)

.TextFrame.TextRange.Text="Sampletitle"

With.AnimationSettings

.Animate=True

.TextLevelEffect=ppAnimateByFirstLevel

.TextUnitEffect=ppAnimateByCharacter

.EntryEffect=ppEffectFlyFromLeft

EndWith

EndWith

Page 2266: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextRangePropertyReturnsaTextRangeobjectthatrepresentstheselectedtext(Selectionobject)orthetextinthespecifiedtextframe(TextFrameobject).

expression.TextRange

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2267: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcanconstructatextrangefromaselectionwhenthepresentationisinslideview,normalview,outlineview,notespageview,oranymasterview.

Page 2268: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemakestheselectedtextboldinthefirstwindow.

Windows(1).Selection.TextRange.Font.Bold=True

Page 2269: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextRangeLengthPropertyReturnsorsetsanLongthatrepresentsthelengthofatextrange.Read-only.

expression.TextRangeLength

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2270: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsashapewithtextandrotatestheshapewithoutrotatingthetext.

SubSetTextRange()

DimshpStarAsShape

DimsldOneAsSlide

DimeffNewAsEffect

SetsldOne=ActivePresentation.Slides(1)

SetshpStar=sldOne.Shapes.AddShape(Type:=msoShape5pointStar,_

Left:=32,Top:=32,Width:=300,Height:=300)

shpStar.TextFrame.TextRange.Text="Animatedshape."

SeteffNew=sldOne.TimeLine.MainSequence.AddEffect(Shape:=shpStar,_

EffectId:=msoAnimEffectPath5PointStar,Level:=msoAnimateTextByAllLevels,_

Trigger:=msoAnimTriggerAfterPrevious)

WitheffNew

If.TextRangeStart=0And.TextRangeLength>0Then

With.Behaviors.Add(Type:=msoAnimTypeRotation).RotationEffect

.From=0

.To=360

EndWith

.Timing.AutoReverse=msoTrue

EndIf

EndWith

EndSub

Page 2271: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextRangeStartPropertyReturnsorsetsanLongthatrepresentsthestartofatextrange.Read-only.

expression.TextRangeStart

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2272: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleaddsashapewithtextandrotatestheshapewithoutrotatingthetext.

SubSetTextRange()

DimshpStarAsShape

DimsldOneAsSlide

DimeffNewAsEffect

SetsldOne=ActivePresentation.Slides(1)

SetshpStar=sldOne.Shapes.AddShape(Type:=msoShape5pointStar,_

Left:=32,Top:=32,Width:=300,Height:=300)

shpStar.TextFrame.TextRange.Text="Animatedshape."

SeteffNew=sldOne.TimeLine.MainSequence.AddEffect(Shape:=shpStar,_

EffectId:=msoAnimEffectPath5PointStar,Level:=msoAnimateTextByAllLevels,_

Trigger:=msoAnimTriggerAfterPrevious)

WitheffNew

If.TextRangeStart=0And.TextRangeLength>0Then

With.Behaviors.Add(Type:=msoAnimTypeRotation).RotationEffect

.From=0

.To=360

EndWith

.Timing.AutoReverse=msoTrue

EndIf

EndWith

EndSub

Page 2273: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextShapePropertyReturnsaShapeobjectrepresentingtheshapeofthetextboxassociatedwithadiagramnode.

expression.TextShape

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2274: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddschildnodestoaparentnode,anddisplaystextintheparentnodeindicatingthenumberofchildnodescreated.

SubCountChildNodes()

DimdgnNodeAsDiagramNode

DimshpDiagramAsShape

DimintNodesAsInteger

DimshpTextAsShape

'Addsdiagramandfirstnodetofirstslide

SetshpDiagram=ActivePresentation.Slides(1).Shapes_

.AddDiagram(Type:=msoDiagramRadial,Left:=200,Top:=75,_

Width:=300,Height:=475)

SetdgnNode=shpDiagram.DiagramNode.Children.AddNode

'Addsthreechildnodestofirstnode

ForintNodes=1To3

dgnNode.Children.AddNode

NextintNodes

'Entersnodenumberintoeachchildnode

ForintNodes=1TodgnNode.Children.Count

SetshpText=shpDiagram.DiagramNode.Children(1)_

.Children(intNodes).TextShape

shpText.TextFrame.TextRange.Text=CStr(intNodes)

NextintNodes

EndSub

Page 2275: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextStylesPropertyReturnsaTextStylescollectionthatrepresentsthreetextstyles—titletext,bodytext,anddefaulttext—forthespecifiedslidemaster.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 2276: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthefontnameandfontsizeforlevel-onebodytextonslidesintheactivepresentation.

WithActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).Levels(1)

With.Font

.Name="arial"

.Size=36

EndWith

EndWith

Page 2277: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextToDisplayPropertyReturnsorsetsthedisplaytextforahyperlinknotassociatedwithagraphic.Read/writeString.

Page 2278: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thispropertywillcausearun-timeerrorifusedwithahyperlinkthatisnotassociatedwithatextrange.Youcanusecodesimilartothefollowingtotestwhetherornotagivenhyperlink,representedherebymyHyperlink,isassociatedwithatextrange.

IfTypeName(myHyperlink.Parent.Parent)="TextRange"Then

strTRtest="True"

EndIf

Page 2279: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanassociatedhyperlinkwiththetextinshapetwoonslideone.Itthensetsthedisplaytextto"MicrosoftHomePage"andsetsthehyperlinkaddresstothecorrectURL.

WithActivePresentation.Slides(1).Shapes(2)_

.TextFrame.TextRange

With.ActionSettings(ppMouseClick)

.Action=ppActionHyperlink

.Hyperlink.TextToDisplay="MicrosoftHomePage"

.Hyperlink.Address="http://www.microsoft.com/"

EndWith

EndWith

Page 2280: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2281: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextUnitEffectPropertyTextUnitEffectpropertyasitappliestotheAnimationSettingsobject.

ReturnsorsetsaPpTextUnitEffectconstantthatindicateswhetherthetextinthespecifiedshapeisanimatedparagraphbyparagraph,wordbyword,orletterbyletter.Read/write.

PpTextUnitEffectcanbeoneofthesePpTextUnitEffectconstants.ppAnimateByCharacterppAnimateByParagraphppAnimateByWordppAnimateUnitMixed

expression.TextUnitEffect

expressionRequired.AnexpressionthatreturnsanAnimationSettingsobject.

Page 2282: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

FortheTextUnitEffectpropertysettingtotakeeffect,theTextLevelEffectpropertyforthespecifiedshapemusthaveavalueotherthanppAnimateLevelNoneorppAnimateByAllLevels,andtheAnimatepropertymustbesettoTrue.

TextUnitEffectpropertyasitappliestotheEffectInformationobject.

ReturnsanMsoAnimTextUnitEffectconstantthatindicateswhetherthetextinthespecifiedshapeisanimatedparagraphbyparagraph,wordbyword,orletterbyletter.Read-only.

MsoAnimTextUnitEffectcanbeoneoftheseMsoAnimTextUnitEffectconstants.msoAnimTextUnitEffectByCharactermsoAnimTextUnitEffectByParagraphmsoAnimTextUnitEffectByWordmsoAnimTextUnitEffectMixed

expression.TextUnitEffect

expressionRequired.AnexpressionthatreturnsanEffectInformationobject.

Page 2283: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheAnimationSettingsobject.

Thisexampleaddsatitleslideandtitletexttotheactivepresentationandsetsthetitletobebuiltletterbyletter.

WithActivePresentation.Slides.Add(Index:=1,_

Layout:=ppLayoutTitleOnly).Shapes(1)

.TextFrame.TextRange.Text="Sampletitle"

With.AnimationSettings

.Animate=True

.TextLevelEffect=ppAnimateByFirstLevel

.TextUnitEffect=ppAnimateByCharacter

.EntryEffect=ppEffectFlyFromLeft

EndWith

EndWith

Page 2284: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextureNamePropertyReturnsthenameofthecustomtexturefileforthespecifiedfill.Read-onlyString.

Thispropertyisread-only.UsetheUserTexturedmethodtosetthetexturefileforthefill.

Page 2285: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsanovaltomyDocument.IfshapeoneonmyDocumenthasauser-definedtexturedfill,thenewovalwillhavethesamefillasshapeone.Ifshapeonehasanyothertypeoffill,thenewovalwillhaveagreenmarblefill.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

SetnewFill=.AddShape(msoShapeOval,0,0,200,90).Fill

With.Item(1).Fill

If.Type=msoFillTexturedAnd_

.TextureType=msoTextureUserDefinedThen

newFill.UserTextured.TextureName

Else

newFill.PresetTexturedmsoTextureGreenMarble

EndIf

EndWith

EndWith

Page 2286: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2287: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TextureTypePropertyReturnsthetexturetypeforthespecifiedfill.Read-onlyMsoTextureType.UsethePresetTexturedorUserTexturedmethodtosetthetexturetypeforthefill.

MsoTextureTypecanbeoneoftheseMsoTextureTypeconstants.msoTexturePresetmsoTextureTypeMixedmsoTextureUserDefined

expression.TextureType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2288: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesthefilltocanvasforallshapesonmyDocumentthathaveacustomtexturedfill.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Withs.Fill

If.TextureType=msoTextureUserDefinedThen

.PresetTexturedmsoTextureCanvas

EndIf

EndWith

Next

Page 2289: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ThreeDPropertyReturnsaThreeDFormatobjectthatcontains3-D–effectformattingpropertiesforthespecifiedshape.Read-only.

Page 2290: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedepth,extrusioncolor,extrusiondirection,andlightingdirectionforthe3-DeffectsappliedtoshapeoneonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1).ThreeD

.Visible=True

.Depth=50

'RGBvalueforpurple

.ExtrusionColor.RGB=RGB(255,100,255)

.SetExtrusionDirectionmsoExtrusionTop

.PresetLightingDirection=msoLightingLeft

EndWith

Page 2291: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TimePropertySetsorreturnsaSinglethatrepresentsthetimeatagivenanimationpoint.Read/write.

expression.Time

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2292: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThevalueoftheTimepropertycanbeanyfloating-pointvaluebetween0and1,representingapercentageoftheentiretimelinefrom0%to100%.Forexample,avalueof0.2wouldcorrespondtoapointintimeat20%oftheentiretimelinedurationfromlefttoright.

Page 2293: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleinsertsthreefillcoloranimationpointsinthemainsequenceanimationtimelineonthefirstslide.

SubBuildTimeLine()

DimshpFirstAsShape

DimeffMainAsEffect

DimtmlMainAsTimeLine

DimaniBhvrAsAnimationBehavior

DimaniPointAsAnimationPoint

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SettmlMain=ActivePresentation.Slides(1).TimeLine

SeteffMain=tmlMain.MainSequence.AddEffect(Shape:=shpFirst,_

EffectId:=msoAnimEffectBlinds)

SetaniBhvr=tmlMain.MainSequence(1).Behaviors.Add_

(Type:=msoAnimTypeProperty)

WithaniBhvr.PropertyEffect

.Property=msoAnimShapeFillColor

SetaniPoint=.Points.Add

aniPoint.Time=0.2

aniPoint.Value=RGB(0,0,0)

SetaniPoint=.Points.Add

aniPoint.Time=0.5

aniPoint.Value=RGB(0,255,0)

SetaniPoint=.Points.Add

aniPoint.Time=1

aniPoint.Value=RGB(0,255,255)

EndWith

EndSub

Page 2294: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TimeLinePropertyReturnsaTimeLineobjectrepresentingtheanimationtimelinefortheslide.

expression.TimeLine

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2295: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsabouncinganimationtothefirstshapeonthefirstslide.

SubNewTimeLineEffect()

DimsldFirstAsSlide

DimshpFirstAsShape

SetsldFirst=ActivePresentation.Slides(1)

SetshpFirst=sldFirst.Shapes(1)

sldFirst.TimeLine.MainSequence.AddEffect_

Shape:=shpFirst,EffectId:=msoAnimEffectBounce

EndSub

Page 2296: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TimingPropertyReturnsaTimingobjectthatrepresentsthetimingpropertiesforananimationsequence.

expression.Timing

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2297: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetsthedurationofthefirstanimationsequenceonthefirstslide.

SubSetTiming()

ActivePresentation.Slides(1).TimeLine_

.MainSequence(1).Timing.Duration=1

EndSub

Page 2298: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TintAndShadePropertyReturnsaSinglethatrepresentsthelighteningordarkeningofthethecolorofaspecifiedshape.Read/write.

expression.TintAndShade

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2299: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Youcanenteravaluefrom-1(darkest)to1(lightest)fortheTintAndShadeproperty,0(zero)beingneutral.

Page 2300: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesanewshapeintheactivedocument,setsthefillcolor,andlightensthecolorshade.

SubPrinterPlate()

DimshpHeartAsShape

SetshpHeart=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeHeart,Left:=150,_

Top:=150,Width:=250,Height:=250)

WithshpHeart.Fill.ForeColor

.CMYK=16111872

.TintAndShade=0.3

.OverPrint=msoTrue

.Ink(Index:=1)=0

.Ink(Index:=2)=1

.Ink(Index:=3)=1

.Ink(Index:=4)=0

EndWith

EndSub

Page 2301: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TitlePropertyReturnsaShapeobjectthatrepresentstheslidetitle.Read-only.

Page 2302: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucanalsousetheItemmethodoftheShapesorPlaceholderscollectiontoreturntheslidetitle.

Page 2303: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthetitletextonmyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.Title.TextFrame.TextRange.Text="Welcome!"

Page 2304: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TitleMasterPropertyReturnsaMasterobjectthatrepresentsthetitlemasterforthespecifiedpresentation.Ifthepresentationdoesn'thaveatitlemaster,anerroroccurs.

expression.TitleMaster

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2305: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheAddTitleMastermethodtoaddatitlemastertoapresentation.

Page 2306: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Iftheactivepresentationhasatitlemaster,thisexamplesetsthefootertextforthetitlemaster.

WithApplication.ActivePresentation

If.HasTitleMasterThen

.TitleMaster.HeadersFooters.Footer.Text="Introduction"

EndIf

EndWith

Page 2307: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2308: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ToPropertyTopropertyasitappliestotheColorEffectobject.

SetsorreturnsaColorFormatobjectthatrepresentstheRGBcolorvalueofananimationbehavior.Read/write.

expression.To

expressionRequired.AnexpressionthatreturnsaColorEffectobject.

Page 2309: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsethispropertyinconjunctionwiththeFrompropertytotransitionfromonecolortoanother.

TopropertyasitappliestotheRotationEffectobject.

SetsorreturnsaSinglethatrepresentstheendingrotationofanobjectindegrees,specifiedrelativetothescreen(forexample,90degreesiscompletelyhorizontal).Read/write.

expression.To

expressionRequired.AnexpressionthatreturnsaRotationEffectobject.

Page 2310: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsethispropertyinconjunctionwiththeFrompropertytotransitionfromonerotationangletoanother.

ThedefaultvalueisEmptyinwhichcasethecurrentpositionoftheobjectisused.

TopropertyasitappliestothePropertyEffectobject.

SetsorreturnsaVariantthatrepresentstheendingvalueofanobject’sproperty.Read/write.

expression.To

expressionRequired.AnexpressionthatreturnsaPropertyEffectobject.

Page 2311: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueisEmpty,inwhichcasethecurrentpositionoftheobjectisused.

TopropertyasitappliestotheSetEffectobject.

SetsorreturnsaVariantthatrepresentsthevalueorendingvalueoftheSetEffectobject'sTypeproperty.Read/write.

expression.To

expressionRequired.AnexpressionthatreturnsaSetEffectobject.

Page 2312: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

DonotconfusethispropertywiththeToXorToYpropertiesoftheScaleEffectandMotionEffectobjects,whichareonlyusedforscalingormotioneffects.

Page 2313: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheColorEffectobject.

Thefollowingexampleaddsacoloreffectandchangesitscolorfromalightbluishgreentoyellow.

SubAddAndChangeColorEffect()

DimeffBlindsAsEffect

DimtmlTimingAsTimeLine

DimshpRectangleAsShape

DimanimColorAsAnimationBehavior

DimclrEffectAsColorEffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SettmlTiming=ActivePresentation.Slides(1).TimeLine

SeteffBlinds=tmlTiming.MainSequence.AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectBlinds)

SetanimColor=tmlTiming.MainSequence(1).Behaviors_

.Add(Type:=msoAnimTypeColor)

SetclrEffect=animColor.ColorEffect

clrEffect.From.RGB=RGB(Red:=255,Green:=255,Blue:=0)

clrEffect.To.RGB=RGB(Red:=0,Green:=255,Blue:=255)

EndSub

AsitappliestotheRotationEffectobject.

Thefollowingexampleaddsarotationeffectandimmediatelychangesitsrotationanglefrom90degreesto270degrees.

SubAddAndChangeRotationEffect()

DimeffBlindsAsEffect

DimtmlTimingAsTimeLine

DimshpRectangleAsShape

DimanimColorAsAnimationBehavior

DimrtnEffectAsRotationEffect

SetshpRectangle=ActivePresentation.Slides(1).Shapes(1)

SettmlTiming=ActivePresentation.Slides(1).TimeLine

SeteffBlinds=tmlTiming.MainSequence.AddEffect(Shape:=shpRectangle,_

Page 2314: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

effectId:=msoAnimEffectBlinds)

SetanimColor=tmlTiming.MainSequence(1).Behaviors.Add(Type:=msoAnimTypeRotation)

SetrtnEffect=animColor.RotationEffect

rtnEffect.From=90

rtnEffect.To=270

EndSub

Page 2315: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2316: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TopPropertyToppropertyasitappliestotheApplication,DocumentWindow,Shape,

ShapeRange,andSlideShowWindowobjects.

Application,DocumentWindowandSlideShowWindowobjects:ReturnsorsetsaSinglethatrepresentsthedistanceinpointsfromthetopedgeofthedocument,application,andslideshowwindowtothetopedgeoftheapplicationwindow'sclientarea.Settingthispropertytoaverylargepositiveornegativevaluemaypositionthewindowcompletelyoffthedesktop.Read/write.

Shapeobject:ReturnsorsetsaSinglethatrepresentsthedistancefromthetopedgeoftheshape'sboundingboxtothetopedgeofthedocument.Read/write.

ShapeRangeobject:ReturnsorsetsaSinglethatrepresentsthedistancefromthetopedgeofthetopmostshapeintheshaperangetothetopedgeofthedocument.Read/write.

expression.Top

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

ToppropertyasitappliestotheCommentobject.

Commentobject:ReturnsaSinglethatrepresentsthedistanceinpointsfromtheleftedgeofthecommenttotheleftedgeoftheslide.Read-only.

expression.Top

expressionRequired.AnexpressionthatreturnsaCommentobject.

Page 2317: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheApplication,DocumentWindow,Shape,ShapeRange,andSlideShowWindowobjects.

Thisexamplearrangeswindowsoneandtwohorizontally;inotherwords,eachwindowoccupieshalftheavailableverticalspaceandalltheavailablehorizontalspaceintheapplicationwindow'sclientarea.Forthisexampletowork,theremustbeonlytwodocumentwindowsopen.

Windows.ArrangeppArrangeTiled

sngHeight=Windows(1).Height'availableheight

sngWidth=Windows(1).Width+Windows(2).Width'availablewidth

WithWindows(1)

.Width=sngWidth

.Height=sngHeight/2

.Left=0

EndWith

WithWindows(2)

.Width=sngWidth

.Height=sngHeight/2

.Top=sngHeight/2

.Left=0

EndWith

Page 2318: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ToXPropertySetsorreturnsaSinglethatrepresentstheendingwidthorhorizontalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentofthescreenwidth.Read/write.

expression.ToX

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2319: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.

UsethispropertyinconjunctionwiththeFromXpropertytoresizeorjumpfromonepositiontoanother.

DonotconfusethispropertywiththeTopropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.

Page 2320: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsananimationpathandsetsthestartingandendinghorizontalandverticalpositions.

SubAddMotionPath()

DimeffCustomAsEffect

DimanimMotionAsAnimationBehavior

DimshpRectangleAsShape

'Addsshapeandsetseffectandanimationproperties

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffCustom=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectCustom)

SetanimMotion=effCustom.Behaviors.Add(msoAnimTypeMotion)

'Setsstartingandendinghorizontalandverticalpositions

WithanimMotion.MotionEffect

.FromX=0

.FromY=0

.ToX=50

.ToY=50

EndWith

EndSub

Page 2321: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ToYPropertyReturnsorsetsaSinglethatrepresentstheendingheightorverticalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentageofthescreenwidth.Read/write.

expression.ToY

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2322: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.

UsethispropertyinconjunctionwiththeFromYpropertytoresizeorjumpfromonepositiontoanother.

DonotconfusethispropertywiththeTopropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.

Page 2323: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsananimationpathandsetsthestartingandendinghorizontalandverticalpositions.

SubAddMotionPath()

DimeffCustomAsEffect

DimanimMotionAsAnimationBehavior

DimshpRectangleAsShape

'Addsshapeandsetseffectandanimationproperties

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffCustom=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectCustom)

SetanimMotion=effCustom.Behaviors.Add(msoAnimTypeMotion)

'Setsstartingandendinghorizontalandverticalpositions

WithanimMotion.MotionEffect

.FromX=0

.FromY=0

.ToX=50

.ToY=50

EndWith

EndSub

Page 2324: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TrackingPropertyReturnsorsetstheratioofthehorizontalspaceallottedtoeachcharacterinthespecifiedWordArttothewidthofthecharacter.Canbeavaluefrom0(zero)through5.(Largevaluesforthispropertyspecifyamplespacebetweencharacters;valueslessthan1canproducecharacteroverlap.)Read/writeSingle.

ThefollowingtablegivesthevaluesoftheTrackingpropertythatcorrespondtothesettingsavailableintheuserinterface.

Userinterfacesetting EquivalentTrackingpropertyvalueVeryTight 0.8Tight 0.9Normal 1.0Loose 1.2VeryLoose 1.5

Page 2325: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsWordArtthatcontainsthetext"Test"tomyDocumentandspecifiesthatthecharactersbeverytightlyspaced.

SetmyDocument=ActivePresentation.Slides(1)

SetnewWordArt=myDocument.Shapes.AddTextEffect_

(PresetTextEffect:=msoTextEffect1,Text:="Test",_

FontName:="ArialBlack",FontSize:=36,_

FontBold:=False,FontItalic:=False,Left:=100,Top:=100)

newWordArt.TextEffect.Tracking=0.8

Page 2326: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TransparencyPropertyReturnsorsetsthedegreeoftransparencyofthespecifiedfill,shadow,orlineasavaluebetween0.0(opaque)and1.0(clear).Read/writeSingle.

Page 2327: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Thevalueofthispropertyaffectstheappearanceofsolid-coloredfillsandlinesonly;ithasnoeffectontheappearanceofpatternedlinesorpatterned,gradient,picture,ortexturedfills.

Page 2328: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetstheshadowforshapethreeonmyDocumenttosemitransparentred.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Shadow

.Visible=True

.ForeColor.RGB=RGB(255,0,0)

.Transparency=0.5

EndWith

Page 2329: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2330: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TransparencyColorPropertyReturnsorsetsthetransparentcolorforthespecifiedpictureasared-green-blue(RGB)value.Forthispropertytotakeeffect,theTransparentBackgroundpropertymustbesettoTrue.Appliestobitmapsonly.Read/writeLong.

Page 2331: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyouwanttobeabletoseethroughthetransparentpartsofthepictureallthewaytotheobjectsbehindthepicture,youmustsettheVisiblepropertyofthepicture'sFillFormatobjecttoFalse.IfyourpicturehasatransparentcolorandtheVisiblepropertyofthepicture'sFillFormatobjectissettoTrue,thepicture'sfillwillbevisiblethroughthetransparentcolor,butobjectsbehindthepicturewillbeobscured.

Page 2332: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthecolorthathastheRGBvaluereturnedbythefunctionRGB(0,0,255)asthetransparentcolorforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeabitmap.

blueScreen=RGB(0,0,255)

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1)

With.PictureFormat

.TransparentBackground=True

.TransparencyColor=blueScreen

EndWith

.Fill.Visible=False

EndWith

Page 2333: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2334: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TransparentBackgroundPropertyDetermineswhetherpartsofthepicturethatarethecolordefinedasthetransparentcolorappeartransparent.Read/writeMsoTriState.Appliestobitmapsonly.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTruePartsofthepicturethatarethecolordefinedasthetransparentcolorappeartransparent.

Page 2335: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

UsetheTransparencyColorpropertytosetthetransparentcolor.

Ifyouwanttobeabletoseethroughthetransparentpartsofthepictureallthewaytotheobjectsbehindthepicture,youmustsettheVisiblepropertyofthepicture'sFillFormatobjecttomsoFalse.IfyourpicturehasatransparentcolorandtheVisiblepropertyofthepicture'sFillFormatobjectissettomsoTrue,thepicture'sfillwillbevisiblethroughthetransparentcolor,butobjectsbehindthepicturewillbeobscured.

Page 2336: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthecolorthathastheRGBvaluereturnedbythefunctionRGB(0,24,240)asthetransparentcolorforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeabitmap.

blueScreen=RGB(0,0,255)

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1)

With.PictureFormat

.TransparentBackground=msoTrue

.TransparencyColor=blueScreen

EndWith

.Fill.Visible=msoFalse

EndWith

Page 2337: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TriggerDelayTimePropertySetsorreturnsaSinglethatrepresentsthedelay,inseconds,fromwhenananimationtriggerisenabled.Read/write.

expression.TriggerDelayTime

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2338: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetoaslide,addsananimationtotheshape,andinstructstheshapetobegintheanimationthreesecondsafteritisclicked.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

WitheffDiamond.Timing

.Duration=5

.TriggerShape=shpRectangle

.TriggerType=msoAnimTriggerOnShapeClick

.TriggerDelayTime=3

EndWith

EndSub

Page 2339: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TriggerShapePropertySetsorreturnsaShapeobjectthatrepresentstheshapeassociatedwithananimationtrigger.Read/write.

expression.TriggerShape

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2340: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddstwoshapestoaslide,addsananimationtoashape,andbeginstheanimationwhentheothershapeisclicked.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

SetshpOval=_

ActivePresentation.Slides(1).Shapes._

AddShape(Type:=msoShapeOval,Left:=400,Top:=100,Width:=100,Height:=50)

SetshpRectangle=ActivePresentation.Slides(1).Shapes._

AddShape(Type:=msoShapeRectangle,Left:=100,Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine._

InteractiveSequences.Add().AddEffect(Shape:=shpRectangle,_

effectId:=msoAnimEffectPathDiamond,trigger:=msoAnimTriggerOnShapeClick)

WitheffDiamond.Timing

.Duration=5

.TriggerShape=shpOval

EndWith

EndSub

Page 2341: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2342: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TriggerTypePropertySetsorreturnsanMsoAnimTriggerTypeconstantthatrepresentsthetriggerthatstartsananimation.Read/write.

MsoAnimTriggerTypecanbeoneoftheseMsoAnimTriggerTypeconstants.msoAnimTriggerAfterPreviousmsoAnimTriggerMixedmsoAnimTriggerNonemsoAnimTriggerOnPageClickDefault.msoAnimTriggerOnShapeClickmsoAnimTriggerWithPrevious

expression.TriggerType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2343: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexampleaddsashapetoaslide,addsananimationtotheshape,andinstructstheshapetobegintheanimationthreesecondsafteritisclicked.

SubAddShapeSetTiming()

DimeffDiamondAsEffect

DimshpRectangleAsShape

SetshpRectangle=ActivePresentation.Slides(1).Shapes_

.AddShape(Type:=msoShapeRectangle,Left:=100,_

Top:=100,Width:=50,Height:=50)

SeteffDiamond=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpRectangle,effectId:=msoAnimEffectPathDiamond)

WitheffDiamond.Timing

.Duration=5

.TriggerType=msoAnimTriggerOnShapeClick

.TriggerDelayTime=3

EndWith

EndSub

Page 2344: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2345: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

TypePropertyTypepropertyasitappliestotheAnimationBehaviorobject.

ReturnsorsetsanMsoAnimTypeconstantthatrepresentsthetypeofanimation.Read/write.

MsoAnimTypecanbeoneoftheseMsoAnimTypeconstants.MsoAnimTypeColorMsoAnimTypeMixedMsoAnimTypeMotionMsoAnimTypeNoneMsoAnimTypePropertyMsoAnimTypeRoatationMsoAnimTypeScaleMsoAnimTypeTransition

expression.Type

expressionRequired.AnexpressionthatreturnsanAnimationBehaviorobject.

TypepropertyasitappliestotheBulletFormatobject.

ReturnsorsetsaPpBulletTypeconstantthatrepresentsthetypeofbullet.Read/write.

PpBulletTypecanbeoneofthesePpBulletTypeconstants.ppBulletMixedppBulletNoneppBulletNumberedppBulletPictureppBulletUnnumbered

Page 2346: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expression.Type

expressionRequired.AnexpressionthatreturnsaBulletFormatobject.

TypepropertyasitappliestotheCalloutFormatobject.

ReturnsorsetsanMsoCalloutTypeconstantthatrepresentsthetypeofcallout.Read/write.

MsoCalloutTypecanbeoneoftheseMsoCalloutTypeconstants.msoCalloutFourmsoCalloutMixedmsoCalloutOnemsoCalloutThreemsoCalloutTwo

expression.Type

expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.

TypepropertyasitappliestotheColorFormatobject.

ReturnstheMsoColorTypeconstantthatrepresentsthetypeofcolor.Read-only.

MsoColorTypecanbeoneoftheseMsoColorTypeconstants.msoColorTypeCMSmsoColorTypeCMYKmsoColorTypeInkmsoColorTypeMixedmsoColorTypeRGBmsoColorTypeScheme

expression.Type

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

TypepropertyasitappliestotheConnectorFormatobject.

Page 2347: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturnsorsetsanMsoConnectorTypeconstantthatrepresentsthetypeofconnector.Read/write.

MsoConnectorTypecanbeoneoftheseMsoConnectorTypeconstants.msoConnectorCurvemsoConnectorElbowmsoConnectorStraightmsoConnectorTypeMixed

expression.Type

expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.

TypepropertyasitappliestotheDiagramobject.

ReturnsanMsoDiagramTypeconstantthatrepresentsthetypeofdiagram.Read-only.

MsoDiagramTypecanbeoneoftheseMsoDiagramTypeconstants.msoDiagramCyclemsoDiagramMixedmsoDiagramOrgChartmsoDiagramPyramidmsoDiagramRadialmsoDiagramTargetmsoDiagramVenn

expression.Type

expressionRequired.AnexpressionthatreturnsaDiagramobject.

TypepropertyasitappliestotheFillFormatobject.

ReturnsanMsoFillTypeconstantthatrepresentthetypeoffill.Read-only.

MsoFillTypecanbeoneoftheseMsoFillTypeconstants.msoFillBackground

Page 2348: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoFillGradientmsoFillMixedmsoFillPatternedmsoFillPicturemsoFillSolidmsoFillTextured

expression.Type

expressionRequired.AnexpressionthatreturnsaFillFormatobject.

TypepropertyasitappliestotheHyperlinkobject.

ReturnsanMsoHyperlinkTypeconstantthatrepresentsthetypeofhyperlink.Read-only.

MsoHyperlinkTypecanbeoneoftheseMsoHyperlinkTypeconstants.msoHyperlinkInlineShapeForuseinMicrosoftWordonly.msoHyperlinkRangemsoHyperlinkShape

expression.Type

expressionRequired.AnexpressionthatreturnsaHyperlinkobject.

TypepropertyasitappliestothePlaceholderFormatobject.

ReturnsaPpPlaceholderTypeconstantthatrepresentsthetypeofplaceholder.Read-only.

PpPlaceholderTypecanbeoneofthesePpPlaceholderTypeconstants.ppPlaceholderBitmapppPlaceholderBodyppPlaceholderCenterTitleppPlaceholderChartppPlaceholderDate

Page 2349: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppPlaceholderFooterppPlaceholderHeaderppPlaceholderMediaClipppPlaceholderMixedppPlaceholderObjectppPlaceholderOrgChartppPlaceholderSlideNumberppPlaceholderSubtitleppPlaceholderTableppPlaceholderTitleppPlaceholderVerticalBodyppPlaceholderVerticalTitle

expression.Type

expressionRequired.AnexpressionthatreturnsaPlaceholderFormatobject.

TypepropertyasitappliestotheSelectionobject.

ReturnsaPpSelectionTypeconstantthatrepresentsthetypeofobjectsinaselection.Read-only.

PpSelectionTypecanbeoneofthesePpSelectionTypeconstants.ppSelectionNoneppSelectionShapesppSelectionSlidesppSelectionText

expression.Type

expressionRequired.AnexpressionthatreturnsaSelectionobject.

TypepropertyasitappliestotheShadowFormatobject.

ReturnsorsetsanMsoShadowTypeconstantthatrepresentsthetypeofshadow.Read/write.

Page 2350: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

MsoShadowTypecanbeoneoftheseMsoShadowTypeconstants.msoShadow1msoShadow10msoShadow11msoShadow12msoShadow13msoShadow14msoShadow15msoShadow16msoShadow17msoShadow18msoShadow19msoShadow2msoShadow20msoShadow3msoShadow4msoShadow5msoShadow6msoShadow7msoShadow8msoShadow9msoShadowMixed

expression.Type

expressionRequired.AnexpressionthatreturnsaShadowFormatobject.

TypepropertyasitappliestotheShapeandShapeRangeobjects.

ReturnsanMsoShapeTypeconstantthatrepresentsthetypeofshapeorshapesinarangeofshapes.Read-only.

MsoShapeTypecanbeoneoftheseMsoShapeTypeconstants.msoAutoShapemsoCallout

Page 2351: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoCanvasmsoChartmsoCommentmsoDiagrammsoEmbeddedOLEObjectmsoFormControlmsoFreeformmsoGroupmsoLinemsoLinkedOLEObjectmsoLinkedPicturemsoMediamsoOLEControlObjectmsoPicturemsoPlaceholdermsoScriptAnchormsoShapeTypeMixedmsoTablemsoTextBoxmsoTextEffect

expression.Type

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

TypepropertyasitappliestotheSoundEffectobject.

ReturnsorsetsaPpSoundEffectTypeconstantthatrepresentsthetypeofsoundeffect.Read/write.

PpSoundEffectTypecanbeoneofthesePpSoundEffectTypeconstants.ppSoundEffectsMixedppSoundFileppSoundNoneppSoundStopPrevious

Page 2352: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

expression.Type

expressionRequired.AnexpressionthatreturnsaSoundEffectobject.

TypepropertyasitappliestotheTabStopobject.

ReturnsorsetsaPpTabStopTypeconstantthatrepresentstheformattingofatabstop.Read/write.

PpTabStopTypecanbeoneofthesePpTabStopTypeconstants.ppTabStopCenterppTabStopDecimalppTabStopLeftppTabStopMixedppTabStopRight

expression.Type

expressionRequired.AnexpressionthatreturnsaTabStopobject.

TypepropertyasitappliestotheViewobject.

ReturnsaPpViewTypeconstantthatrepresentsthetypeofview.Read-only.

PpViewTypecanbeoneofthesePpViewTypeconstants.ppViewHandoutMasterppViewMasterThumbnailsppViewNormalppViewNotesMasterppViewNotesPageppViewOutlineppViewPrintPreviewppViewSlideppViewSlideMasterppViewSlideSorter

Page 2353: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppViewThumbnailsppViewTitleMaster

expression.Type

expressionRequired.AnexpressionthatreturnsaViewobject.

Page 2354: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheShapeobject.

ThisexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.

ForEachsldInActivePresentation.Slides

ForEachshInsld.Shapes

Ifsh.Type=msoLinkedOLEObjectThen

Ifsh.OLEFormat.ProgID="Excel.Sheet"Then

sh.LinkFormat.AutoUpdate=ppUpdateOptionManual

EndIf

EndIf

Next

Next

Page 2355: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2356: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UnderlinePropertyDetermineswhetherthespecifiedtext(fortheFontobject)orthefontstyle(fortheFontInfoobject)isunderlined.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedtext(orfontstyle)isn'tunderlined.msoTriStateMixedSomecharactersareunderlined(forthespecifiedtext)andsomearen't.msoTriStateTogglemsoTrueThespecifiedtext(orfontstyle)isunderlined.

expression.Underline

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2357: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetstheformattingforthetextinshapetwoonslideoneintheactivepresentation.

WithApplication.ActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.Font

.Size=32

.Name="Palatino"

.Underline=msoTrue

EndWith

EndWith

Page 2358: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2359: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UpdateLinksOnSavePropertyDetermineswhetherhyperlinksandpathstoallsupportingfilesareautomaticallyupdatedbeforeyousaveorpublishthepresentationasaWebpage.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseHyperlinksandpathstoallsupportingfilesarenotautomaticallyupdatedbeforeyousaveorpublishthepresentationasaWebpage.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.HyperlinksandpathstoallsupportingfilesareautomaticallyupdatedbeforeyousaveorpublishthepresentationasaWebpage,ensuringthatthelinksareup-to-dateatthetimethepresentationissaved.

Page 2360: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoushouldsetthispropertytoFalseifthelocationwherethepresentationissavedisdifferentfromthefinallocationontheWebserverandthesupportingfilesarenotavailableatthefirstlocation.

Page 2361: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplespecifiesthatlinksarenotupdatedbeforethepresentationissaved.

Application.DefaultWebOptions.UpdateLinksOnSave=msoFalse

Page 2362: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2363: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UseFormatPropertyDetermineswhetherthedateandtimeobjectcontainsautomaticallyupdatedinformation.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThedateandtimeobjectisafixedstring.msoTriStateMixedmsoTriStateTogglemsoTrueThedateandtimeobjectcontainsautomaticallyupdatedinformation.

Page 2364: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThispropertyappliesonlytoaHeaderFooterobjectthatrepresentsadateandtime(returnedbytheDateAndTimeproperty).SettheUseFormatpropertyofadateandtimeHeaderFooterobjecttoTruewhenyouwanttosetorreturnthedateandtimeformatbyusingtheFormatproperty.SettheUseFormatpropertytomsoFalsewhenyouwanttosetorreturnthetextstringforthefixeddateandtime.

Page 2365: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthedateandtimefortheslidemasteroftheactivepresentationtobeupdatedautomaticallyandthenitsetsthedateandtimeformattoshowhours,minutes,andseconds.

SetmyPres=Application.ActivePresentation

WithmyPres.SlideMaster.HeadersFooters.DateAndTime

.UseFormat=msoTrue

.Format=ppDateTimeHmmss

EndWith

Page 2366: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2367: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UseLongFileNamesPropertyDetermineswhetherlongfilenamesareused.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLongfilenamesarenotusedandtheDOSfilenameformat(8.3)isused.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.LongfilenamesareusedwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.

Page 2368: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ifyoudon'tuselongfilenamesandyourpresentationhassupportingfiles,MicrosoftPowerPointautomaticallyorganizesthosefilesinaseparatefolder.Otherwise,usetheOrganizeInFolderpropertytodeterminewhethersupportingfilesareorganizedinaseparatefolder.

Page 2369: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisallowstheuseoflongfilenamesastheglobaldefaultfortheapplication.

Application.DefaultWebOptions.UseLongFileNames=msoFalse

Page 2370: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2371: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UseTextColorPropertyDetermineswhetherthespecifiedbulletsaresettothecolorofthefirsttextcharacterintheparagraph.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedbulletsaresettoanyothercolor.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedbulletsaresettothecolorofthefirsttextcharacterintheparagraph.

Page 2372: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucannotexplicitlysetthispropertytomsoFalse.Settingthebulletformatcolor(usingtheColorpropertyoftheFontobject)setsthispropertytomsoFalse.WhenUseTextColorismsoFalse,youcansetittomsoTruetoresetthebulletformattothedefaultcolor.

Page 2373: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleresetsbulletsinshapetwoonslideoneintheactivepresentationtotheirdefaultcharacter,font,andcolor.

WithActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat.Bullet

.RelativeSize=1

.UseTextColor=msoTrue

.UseTextFont=msoTrue

.Character=8226

EndWith

EndWith

Page 2374: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2375: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UseTextFontPropertyDetermineswhetherthespecifiedbulletsaresettothefontofthefirsttextcharacterintheparagraph.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedbulletsaresettoacustomfont.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedbulletsaresettothefontofthefirsttextcharacterintheparagraph.

Page 2376: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

YoucannotexplicitlysetthispropertytomsoFalse.Settingthebulletformatfont(usingtheNamepropertyoftheFontobject)setsthispropertytomsoFalse.WhenUseTextFontismsoFalse,youcansetittomsoTruetoresetthebulletformattothedefaultfont.

Page 2377: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleresetsbulletsinshapetwoonslideoneintheactivepresentationtotheirdefaultcharacter,font,andcolor.

WithActivePresentation.Slides(1).Shapes(2)

With.TextFrame.TextRange.ParagraphFormat.Bullet

.RelativeSize=1

.UseTextColor=msoTrue

.UseTextFont=msoTrue

.Character=8226

EndWith

EndWith

Page 2378: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ValuePropertySetsorreturnsaVariantthatrepresentsthevalueofapropertyforananimationpoint.

expression.Value

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2379: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleinsertsthreefillcoloranimationpointsinthemainsequenceanimationtimelineonthefirstslide.

SubBuildTimeLine()

DimshpFirstAsShape

DimeffMainAsEffect

DimtmlMainAsTimeLine

DimaniBhvrAsAnimationBehavior

DimaniPointAsAnimationPoint

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SettmlMain=ActivePresentation.Slides(1).TimeLine

SeteffMain=tmlMain.MainSequence.AddEffect(Shape:=shpFirst,_

EffectId:=msoAnimEffectBlinds)

SetaniBhvr=tmlMain.MainSequence(1).Behaviors.Add_

(Type:=msoAnimTypeProperty)

WithaniBhvr.PropertyEffect

.Property=msoAnimShapeFillColor

SetaniPoint=.Points.Add

aniPoint.Time=0.2

aniPoint.Value=RGB(0,0,0)

SetaniPoint=.Points.Add

aniPoint.Time=0.5

aniPoint.Value=RGB(0,255,0)

SetaniPoint=.Points.Add

aniPoint.Time=1

aniPoint.Value=RGB(0,255,255)

EndWith

EndSub

Page 2380: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2381: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VBASignedPropertyDetermineswhethertheVisualBasicforApplications(VBA)projectforthespecifieddocumenthasbeendigitallysigned.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheVBAprojectforthespecifieddocumenthasbeendigitallysigned.

Page 2382: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleloadsapresentationcalledMyPres.pptandteststoseewhetherornotithasadigitalsignature.Ifthere'snodigitalsignature,thecodedisplaysawarningmessage.

Presentations.OpenFileName:="c:\MyDocuments\MyPres.ppt",_

ReadOnly:=msoFalse,WithWindow:=msoTrue

WithActivePresentation

If.VBASigned=msoFalseAnd_

.VBProject.VBComponents.Count>0Then

MsgBox"Warning!TheVisualBasicprojectfor"_

&vbCrLf&"thispresentationhasnot"_

&vbCrLf&"beendigitallysigned."_

,vbCritical,"DigitalSignatureWarning"

EndIf

EndWith

Page 2383: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VBEPropertyReturnsaVBEobjectthatrepresentstheVisualBasicEditor.Read-only.

Page 2384: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthenameoftheactiveprojectintheVisualBasicEditor.

Application.VBE.ActiveVBProject.Name="TestProject"

Page 2385: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VBProjectPropertyReturnsaVBProjectobjectthatrepresentstheindividualVisualBasicprojectforthepresentation.Read-only.

Page 2386: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplechangesthenameoftheVisualBasicprojectfortheactivepresentation.

ActivePresentation.VBProject.Name="TestProject"

Page 2387: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VersionPropertyReturnsthePowerPointversionnumber.Read-onlyString.

Page 2388: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledisplaysamessageboxthatcontainsthePowerPointversionnumberandbuildnumber,andthenameoftheoperatingsystem.

WithApplication

MsgBox"WelcometoPowerPointversion"&.Version&_

",build"&.Build&",runningon"&.OperatingSystem&"!"

EndWith

Page 2389: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2390: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VerticalAnchorPropertyReturnsorsetstheverticalalignmentoftextinatextframe.Read/writeMsoVerticalAnchor.

MsoVerticalAnchorcanbeoneoftheseMsoVerticalAnchorconstants.msoAnchorBottommsoAnchorBottomBaseLineAnchorsthebottomofthetextstringtothecurrentpositionregardlessoftheresizingoftext.Whenyouresizetextwithoutbaselineanchoring,thetextcentersitselfonthepreviousposition.msoAnchorMiddlemsoAnchorTopmsoAnchorTopBaselineAnchorsthebottomofthetextstringtothecurrentpositionregardlessoftheresizingoftext.Whenyouresizetextwithoutbaselineanchoring,thetextcentersitselfonthepreviousposition.msoVerticalAnchorMixedRead-only.Returnedwhentwoormoretextboxeswithinashaperangehavethispropertysettodifferentvalues.

expression.VerticalAnchor

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2391: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthealignmentofthetextinshapeoneonmyDocumenttotopcentered.

SetmyDocument=ActivePresentation.SlideMaster

WithmyDocument.Shapes(1)

.TextFrame.HorizontalAnchor=msoAnchorCenter

.TextFrame.VerticalAnchor=msoAnchorTop

EndWith

Page 2392: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2393: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VerticalFlipPropertyDetermineswhetherthespecifiedshapeisflippedaroundtheverticalaxis.Read-onlyMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisflippedaroundtheverticalaxis.

Page 2394: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplerestoreseachshapeonmyDocumenttoitsoriginalstateifit'sbeenflippedhorizontallyorvertically.

SetmyDocument=ActivePresentation.Slides(1)

ForEachsInmyDocument.Shapes

Ifs.HorizontalFlipThens.FlipmsoFlipHorizontal

Ifs.VerticalFlipThens.FlipmsoFlipVertical

Next

Page 2395: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2396: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VerticesPropertyReturnsthecoordinatesofthespecifiedfreeformdrawing'svertices(andcontrolpointsforBéziercurves)asaseriesofcoordinatepairs.YoucanusethearrayreturnedbythispropertyasanargumenttotheAddCurvemethodorAddPolylinemethod.Read-onlyVariant.

ThefollowingtableshowshowtheVerticespropertyassociatesthevaluesinthearrayvertArray()withthecoordinatesofatriangle'svertices.

VertArrayelement Contains

VertArray(1,

1)

Thehorizontaldistancefromthefirstvertextotheleftsideoftheslide

VertArray(1,

2)

Theverticaldistancefromthefirstvertextothetopoftheslide

VertArray(2,

1)

Thehorizontaldistancefromthesecondvertextotheleftsideoftheslide

VertArray(2,

2)

Theverticaldistancefromthesecondvertextothetopoftheslide

VertArray(3,

1)

Thehorizontaldistancefromthethirdvertextotheleftsideoftheslide

VertArray(3,

2)

Theverticaldistancefromthethirdvertextothetopoftheslide

Page 2397: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleassignsthevertexcoordinatesforshapeoneonmyDocumenttothearrayvariablevertArray()anddisplaysthecoordinatesforthefirstvertex.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(1)

vertArray=.Vertices

x1=vertArray(1,1)

y1=vertArray(1,2)

MsgBox"Firstvertexcoordinates:"&x1&","&y1

EndWith

ThisexamplecreatesacurvethathasthesamegeometricdescriptionasshapeoneonmyDocument.Shapeonemustcontain3n+1verticesforthisexampletosucceed.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes

.AddCurve.Item(1).Vertices

EndWith

Page 2398: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2399: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ViewPropertyViewpropertyasitappliestotheSlideShowWindowobject.

ReturnsaSlideShowViewobject.Read-only.

expression.View

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

ViewpropertyasitappliestotheDocumentWindowobject.

ReturnsaViewobjectthatrepresentstheviewinthespecifieddocumentwindow.Read-only.

expression.View

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2400: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheSlideShowWindowobject.

ThisexampleusestheViewpropertytoexitthecurrentslideshow,setstheviewintheactivewindowtoslideview,andthendisplaysslidethree.

Application.SlideShowWindows(1).View.Exit

WithApplication.ActiveWindow

.ViewType=ppViewSlide

.View.GotoSlide3

EndWith

Page 2401: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2402: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ViewTypePropertyViewTypepropertyasitappliestotheDocumentWindowobject.

Returnsorsetsthetypeoftheviewcontainedinthespecifieddocumentwindow.Read/writePpViewType.

PpViewTypecanbeoneofthesePpViewTypeconstants.ppViewHandoutMasterppViewMasterThumbnailsppViewNormalppViewNotesMasterppViewNotesPageppViewOutlineppViewPrintPreviewppViewSlideppViewSlideMasterppViewSlideSorterppViewThumbnailsppViewTitleMaster

expression.ViewType

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

ViewTypepropertyasitappliestothePaneobject.

nanyviewwithpanes,returnsthetypeofviewforthespecifiedpane.Whenreferencingaviewwithoutpanes,returnsthetypeofviewfortheparentDocumentWindowobject.Read-onlyPpViewType.

PpViewTypecanbeoneofthesePpViewTypeconstants.ppViewHandoutMasterppViewMasterThumbnails

Page 2403: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppViewNormalppViewNotesMasterppViewNotesPageppViewOutlineppViewPrintPreviewppViewSlideppViewSlideMasterppViewSlideSorterppViewThumbnailsppViewTitleMaster

expression.ViewType

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2404: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheDocumentWindowobject.

Thisexamplechangestheviewintheactivewindowtoslidesorterviewifthewindowiscurrentlydisplayedinnormalview.

WithApplication.ActiveWindow

If.ViewType=ppViewNormalThen

.ViewType=ppViewSlideSorter

EndIf

EndWith

AsitappliestothePaneobject.

Iftheviewintheactivepaneisslideview,thisexamplemakesthenotespanetheactivepane.ThenotespaneisthethirdmemberofthePanescollection.

WithActiveWindow

If.ActivePane.ViewType=ppViewSlideThen

.Panes(3).Activate

EndIf

EndWith

Page 2405: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2406: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

VisiblePropertyReturnsorsetsthevisibilityofthespecifiedobjectortheformattingappliedtothespecifiedobject.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedobjectorobjectformattingisvisible.

Page 2407: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthehorizontalandverticaloffsetsfortheshadowofshapethreeonthefirstslideintheactivepresentation.Theshadowisoffset5pointstotherightoftheshapeand3pointsaboveit.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes(3).Shadow

.Visible=msoTrue

.OffsetX=5

.OffsetY=-3

EndWith

Page 2408: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WebOptionsPropertyReturnstheWebOptionsobject,whichcontainspresentation-levelattributesusedbyMicrosoftPowerPointwhenyousaveorpublishacompleteorpartialpresentationasaWebpageoropenaWebpage.Read-only.

Page 2409: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplespecifiesthatwhensavingorpublishingtheactivepresentationasaWebpage,PortableNetworkGraphics(PNG)areallowed,andthetextcolorfortheoutlinepaneiswhiteandthebackgroundcolorfortheoutlineandslidepanesisblack.

WithActivePresentation.WebOptions

.FrameColors=ppFrameColorsWhiteTextOnBlack

.AllowPNG=True

EndWith

Page 2410: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WeightPropertyReturnsorsetsthethicknessofthespecifiedline,inpoints.Read/writeSingle.

Page 2411: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsagreendashedlinetwopointsthicktomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddLine(10,10,250,250).Line

.DashStyle=msoLineDashDotDot

.ForeColor.RGB=RGB(0,255,255)

.Weight=2

EndWith

Page 2412: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WidthPropertyReturnsorsetsthewidthofthespecifiedobject,inpoints.Read-onlySinglefortheMasterobject,read/writeSingleforallotherobjects.

Page 2413: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplearrangeswindowsoneandtwohorizontally;inotherwords,eachwindowoccupieshalftheavailableverticalspaceandalltheavailablehorizontalspaceintheapplicationwindow'sclientarea.Forthisexampletowork,theremustbeonlytwodocumentwindowsopen.

Windows.ArrangeppArrangeTiled

ah=Windows(1).Height'availableheight

aw=Windows(1).Width+Windows(2).Width'availablewidth

WithWindows(1)

.Width=aw

.Height=ah/2

.Left=0

EndWith

WithWindows(2)

.Width=aw

.Height=ah/2

.Top=ah/2

.Left=0

EndWith

Thisexamplesetsthewidthforcolumnoneinthespecifiedtableto80points(72pointsperinch).

ActivePresentation.Slides(2).Shapes(5).Table.Columns(1).Width=80

Page 2414: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2415: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WindowsPropertyWindowspropertyasitappliestotheApplicationobject.

ReturnsaDocumentWindowscollectionthatrepresentsallopendocumentwindows.Read-only.

WindowspropertyasitappliestothePresentationobject.

ReturnsaDocumentWindowscollectionthatrepresentsalldocumentwindowsassociatedwiththespecifiedpresentation.Thispropertydoesn'treturnanyslideshowwindowsassociatedwiththepresentation.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 2416: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheApplicationobject.

Thisexampleclosesallwindowsexcepttheactivewindow.

WithApplication.Windows

Fori=.CountTo2Step-1

.Item(i).Close

Next

EndWith

Page 2417: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2418: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WindowStatePropertyReturnsorsetsthestateofthespecifiedwindow.Read/writePpWindowState.

PpWindowStatecanbeoneofthesePpWindowStateconstants.ppWindowMaximizedppWindowMinimizedppWindowNormal

expression.WindowState

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2419: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

WhenthestateofthewindowisppWindowNormal,thewindowisneithermaximizednorminimized.

Page 2420: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemaximizestheactivewindow.

Application.ActiveWindow.WindowState=ppWindowMaximized

Page 2421: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2422: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WordWrapPropertyWordWrappropertyasitappliestotheTextFrameobject.

Determineswhetherlinesbreakautomaticallytofitinsidetheshape.Read/writeMsoTriState.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueLinesbreakautomaticallytofitinsidetheshape.

expression.WordWrap

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

WordWrappropertyasitappliestotheParagraphFormatobject.

UsedonlywithKanjicharacters.Read/writeLong.

Page 2423: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheTextFrameobject.

ThisexampleaddsarectanglethatcontainstexttomyDocument,andthenturnsoffwordwrappinginthenewrectangle.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeRectangle,_

0,0,100,300).TextFrame

.TextRange.Text=_

"Hereissometesttextthatistoolongforthisbox"

.WordWrap=False

EndWith

Page 2424: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WritePasswordPropertySetsorreturnsaStringthatrepresentsapasswordforsavingchangestothespecifieddocument.Read/write.

expression.WritePassword

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2425: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplesetsthepasswordforsavingchangestotheactivepresentation.

SubSetSavePassword()

ActivePresentation.WritePassword=complexstrPWD'globalvariable

EndSub

Page 2426: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2427: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ZoomPropertyZoompropertyasitappliestotheViewobject.

Returnsorsetsthezoomsettingofthespecifiedviewasapercentageofnormalsize.Canbeavaluefrom10to400percent.Read/writeInteger.

expression.Zoom

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

ZoompropertyasitappliestotheSlideShowViewobject.

Returnsthezoomsettingofthespecifiedslideshowwindowviewasapercentageofnormalsize.Canbeavaluefrom10to400percent.Read-onlyInteger.

expression.Zoom

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 2428: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

AsitappliestotheViewobject.

Thefollowingexamplesetsthezoomto30percentfortheviewindocumentwindowone.

Windows(1).View.Zoom=30

Page 2429: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2430: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ZoomToFitPropertyDetermineswhethertheviewiszoomedtofitthedimensionsofthedocumentwindoweverytimethedocumentwindowisresized.Read/writeMsoTriState.Thispropertyappliesonlytoslideview,notespageview,ormasterview.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheviewiszoomedtofitthedimensionsofthedocumentwindoweverytimethedocumentwindowisresized.

Page 2431: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

WhenthevalueoftheZoompropertyisexplicitlyset,thevalueoftheZoomToFitpropertyisautomaticallysettomsoFalse.

Page 2432: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thefollowingexamplesetstheviewindocumentwindowonetoslideview,withthezoomautomaticallysettofitthedimensionsofthewindow.

WithWindows(1)

.ViewType=ppViewSlide

.View.ZoomToFit=msoTrue

EndWith

Page 2433: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ZOrderPositionPropertyReturnsthepositionofthespecifiedshapeinthez-order.Shapes(1)returnstheshapeatthebackofthez-order,andShapes(Shapes.Count)returnstheshapeatthefrontofthez-order.Read-onlyLong.

Thispropertyisread-only.Tosettheshape'spositioninthez-order,usetheZOrdermethod.

Page 2434: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Ashape'spositioninthez-ordercorrespondstotheshape'sindexnumberintheShapescollection.Forexample,iftherearefourshapesontheslide,theexpressionmyDocument.Shapes(1)returnstheshapeatthebackofthez-order,andtheexpressionmyDocument.Shapes(4)returnstheshapeatthefrontofthez-order.

Wheneveryouaddanewshapetoacollection,it'saddedtothefrontofthez-orderbydefault.

Page 2435: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsanovaltomyDocumentandthenplacestheovalsecondfromthebackinthez-orderifthereisatleastoneothershapeontheslide.

SetmyDocument=ActivePresentation.Slides(1)

WithmyDocument.Shapes.AddShape(msoShapeOval,100,100,100,300)

While.ZOrderPosition>2

.ZOrdermsoSendBackward

Wend

EndWith

Page 2436: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2437: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AfterNewPresentationEventOccursafterapresentationiscreated.

expression.AfterNewPresentation(Pres)

expressionRequired.AnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresRequiredPresentation.Thepresentationthatiscreated.

Page 2438: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleusestheRGBfunctiontosettheslidemasterbackgroundcolorforthenewpresentationtosalmonpink,andthenappliesthethirdcolorschemetothenewpresentation.

PrivateSubApp_AfterNewPresentation(ByValPresAsPresentation)

WithPres

SetCS3=.ColorSchemes(3)

CS3.Colors(ppBackground).RGB=RGB(240,115,100)

.SlideMaster.ColorScheme=CS3

EndWith

EndSub

Page 2439: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2440: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AfterPresentationOpenEventOccursafteranexistingpresentationisopened.

expression.AfterPresentationOpen(Pres)

expressionRequired.AnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresRequiredPresentation.Thepresentationthatisopened.

Page 2441: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemodifiesthebackgroundcolorforcolorschemethree,appliesthemodifiedcolorschemetothepresentationthatwasopened,anddisplaysthepresentationinSlideview.

PrivateSubApp_AfterPresentationOpen(ByValPresAsPresentation)

WithPres

SetCS3=.ColorSchemes(3)

CS3.Colors(ppBackground).RGB=RGB(240,115,100)

WithWindows(1)

.Selection.SlideRange.ColorScheme=CS3

.ViewType=ppViewSlide

EndWith

EndWith

EndSub

Page 2442: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ColorSchemeChangedEventOccursafteracolorschemeischanged.

PrivateSubobject_ColorSchemeChanged(ByValSldRangeAsSlideRange)

objectAvariablethatreferencesanobjectoftypeApplicationdeclaredwitheventsinaclassmodule.

SldRangeTherangeofslidesaffectedbythechange.

Page 2443: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

Actionswhichtriggerthiseventwouldincludeactionssuchasmodifyingaslide'sorslidemaster'scolorscheme,orapplyingatemplate.

ToaccesstheApplicationevents,declareanApplicationvariableintheGeneralDeclarationssectionofyourcode.ThensetthevariableequaltotheApplicationobjectforwhichyouwanttoaccessevents.ForinformationaboutusingeventswiththeMicrosoftPowerPointApplicationobject,seeUsingEventswiththeApplicationObject.

Page 2444: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysamessagewhenthecolorschemefortheselectedslideorslidesischanged.ThisexampleassumesanApplicationobjectcalledPPTApphasbeendeclaredusingtheWithEventskeyword.

PrivateSubPPTApp_ColorSchemeChanged(ByValSldRangeAsSlideRange)

IfSldRange.Count=1Then

MsgBox"You'vechangedthecolorschemefor"_

&SldRange.Name&"."

Else

MsgBox"You'vechangedthecolorschemefor"_

&SldRange.Count&"slides."

EndIf

EndSub

Page 2445: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2446: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NewPresentationEventOccursafterapresentationiscreated,asitisaddedtothePresentationscollection.

PrivateSubapplication_NewPresentation(ByValPresAsPresentation)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThenewpresentation.

Page 2447: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleusestheRGBfunctiontosettheslidemasterbackgroundcolorforthenewpresentationtosalmonpink,andthenappliesthethirdcolorschemetothenewpresentation.

PrivateSubApp_NewPresentation(ByValPresAsPresentation)

WithPres

SetCS3=.ColorSchemes(3)

CS3.Colors(ppBackground).RGB=RGB(240,115,100)

.SlideMaster.ColorScheme=CS3

EndWith

EndSub

Page 2448: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationBeforeSaveEventOccursbeforeapresentationissaved.

PrivateSubobject_PresentationBeforeSave(ByValPresAsPresentation,CancelAsBoolean)

objectAvariablethatreferencesanobjectoftypeApplicationdeclaredwitheventsinaclassmodule.

PresThepresentationbeingsaved.

CancelTruetocancelthesaveprocess.

Page 2449: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ThiseventistriggeredastheSaveAsdialogboxappears.

ToaccesstheApplicationevents,declareanApplicationvariableintheGeneralDeclarationssectionofyourcode.ThensetthevariableequaltotheApplicationobjectforwhichyouwanttoaccessevents.ForinformationaboutusingeventswiththeMicrosoftPowerPointApplicationobject,seeUsingEventswiththeApplicationObject.

Page 2450: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplechecksiftherearerevisionsinapresentationand,ifthereare,askswhethertosavethepresentation.Ifauser'sresponseisno,thesaveprocessiscancelled.ThisexampleassumesanApplicationobjectcalledPPTApphasbeendeclaredusingtheWithEventskeyword.

PrivateSubPPTApp_PresentationBeforeSave(ByValPresAsPresentation,_

CancelAsBoolean)

DimintResponseAsInteger

SetPres=ActivePresentation

IfPres.HasRevisionInfoThen

intResponse=MsgBox(Prompt:="Thepresentationcontainsrevisions."&_

"Doyouwanttoaccepttherevisionsbeforesaving?",Buttons:=vbYesNo)

IfintResponse=vbYesThen

Cancel=True

MsgBox"Yourpresentationwasnotsaved."

EndIf

EndIf

EndSub

Page 2451: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2452: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationCloseEventOccursimmediatelybeforeanyopenpresentationcloses,asitisremovedfromthePresentationscollection.

PrivateSubapplication_PresentationClose(ByValPresAsPresentation)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThepresentationthatisbeingclosed.

Page 2453: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesavesacopyoftheactivepresentationasanHTMLfile,withthesamenameandwithinthesamefolder.

PrivateSubApp_PresentationClose(ByValPresAsPresentation)

FindNum=InStr(1,Pres.FullName,".")

HTMLName=Mid(Pres.FullName,1,FindNum-1)_

&".htm"

Pres.SaveCopyAsHTMLName,ppSaveAsHTML

EndSub

Page 2454: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2455: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationNewSlideEventOccurswhenanewslideiscreatedinanyopenpresentation,astheslideisaddedtotheSlidescollection.

PrivateSubapplication_PresentationNewSlide(ByValSldAsSlide)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

SldThenewslide.

Page 2456: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemodifiesthebackgroundcolorforcolorschemethreeandthenappliesthemodifiedcolorschemetothenewslide.Next,itaddsdefaulttexttoshapeoneifithasatextframe.

PrivateSubApp_PresentationNewSlide(ByValSldAsSlide)

WithActivePresentation

SetCS3=.ColorSchemes(3)

CS3.Colors(ppBackground).RGB=RGB(240,115,100)

Windows(1).Selection.SlideRange.ColorScheme=CS3

EndWith

IfSld.Layout<>ppLayoutBlankThen

WithSld.Shapes(1)

If.HasTextFrame=msoTrueThen

.TextFrame.TextRange.Text="KingSalmon"

EndIf

EndWith

EndIf

EndSub

Page 2457: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2458: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationOpenEventOccursafteranexistingpresentationisopened,asitisaddedtothePresentationscollection.

PrivateSubapplication_PresentationOpen(ByValPresAsPresentation)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThepresentationthatisopened.

Page 2459: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplemodifiesthebackgroundcolorforcolorschemethree,appliesthemodifiedcolorschemetothepresentationthatwasjustopened,anddisplaysthepresentationinslideview.

PrivateSubApp_PresentationOpen(ByValPresAsPresentation)

WithPres

SetCS3=.ColorSchemes(3)

CS3.Colors(ppBackground).RGB=RGB(240,115,100)

WithWindows(1)

.Selection.SlideRange.ColorScheme=CS3

.ViewType=ppViewSlide

EndWith

EndWith

EndSub

Page 2460: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2461: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationPrintEventOccursbeforeapresentationisprinted.

PrivateSubapplication_PresentationPrint(ByValPresAsPresentation)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThepresentationtobeprinted.

Page 2462: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesetsthePrintHiddenSlidespropertytoTruesothateverytimetheactivepresentationisprinted,thehiddenslidesareprintedaswell.

PrivateSubApp_PresentationPrint(ByValPresAsPresentation)

Pres.PrintOptions.PrintHiddenSlides=True

EndSub

Page 2463: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2464: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationSaveEventOccursbeforeanyopenpresentationissaved.

PrivateSubapplication_PresentationSave(ByValPresAsPresentation)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThepresentationtobesaved.

Page 2465: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexamplesavesthecurrentpresentationasanHTMLversion4.0filewiththename"mallard.htm."ItthendisplaysamessageindicatingthatthecurrentnamedpresentationisbeingsavedinbothPowerPointandHTMLformats.

PrivateSubApp_PresentationSave(ByValPresAsPresentation)

WithPres.PublishObjects(1)

PresName=.SlideShowName

.SourceType=ppPublishAll

.FileName="C:\HTMLPres\mallard.htm"

.HTMLVersion=ppHTMLVersion4

MsgBox("Savingpresentation"&"'"_

&PresName&"'"&"inPowerPoint"_

&Chr(10)&Chr(13)_

&"formatandHTMLversion4.0format")

.Publish

EndWith

EndSub

Page 2466: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2467: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PresentationSyncEventOccurswhenthelocalcopyofapresentationthatispartofaDocumentWorkspaceissynchronizedwiththecopyontheserver.Providesimportantstatusinformationregardingthesuccessorfailureofthesynchronizationofthepresentation.

expression.PresentationSync(Pres,SyncEventType)

expressionRequired.AnexpressionthatreturnstheApplicationobject.

PresThepresentationthatisbeingsynchronized.

SyncEventTypeAnmsoSyncEventTypevalue.Thestatusofthesynchronization.

MsoSyncEventTypecanbeoneofthefollowingmsoSyncEventTypeconstants.msoSyncEventDownloadInitiated(0)msoSyncEventDownloadSucceeded(1)msoSyncEventDownloadFailed(2)msoSyncEventUploadInitiated(3)msoSyncEventUploadSucceeded(4)msoSyncEventUploadFailed(5)msoSyncEventDownloadNoChange(6)msoSyncEventOffline(7)

Page 2468: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThefollowingexampledisplaysamessageifthesynchronizationofapresentationinaDocumentWorkspacefails.

PrivateSubapp_PresentationSync(ByValPresAsPresentation,_

ByValSyncEventTypeAsOffice.MsoSyncEventType)

IfSyncEventType=msoSyncEventDownloadFailedOr_

SyncEventType=msoSyncEventUploadFailedThen

MsgBox"Synchronizationfailed."&_

"Pleasecontactyouradministrator,"&vbCrLf&_

"ortryagainlater."

EndIf

EndSub

Page 2469: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideSelectionChangedEventThiseventoccursatdifferenttimesdependingonthecurrentview.

View DescriptionNormal,Master Occurswhentheslideintheslidepanechanges.SlideSorter Occurswhentheselectionchanges.Slide,Notes Occurswhentheslidechanges.Outline Doesnotoccur.

PrivateSubobject_SlideSelectionChanged(ByValSldRangeAsSlideRange)

objectAvariablethatreferencesanobjectoftypeApplicationdeclaredwitheventsinaclassmodule.

SldRangeTheselectionofslides.Inmostcasesthiswouldbeasingleslide(forexample,inSlideViewyounavigatetothenextslide),butinsomecasesthiscouldbemultipleslides(forexample,amarqueeselectioninSlideSorterView).

Page 2470: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

ToaccesstheApplicationevents,declareanApplicationvariableintheGeneralDeclarationssectionofyourcode.ThensetthevariableequaltotheApplicationobjectforwhichyouwanttoaccessevents.ForinformationaboutusingeventswiththeMicrosoftPowerPointApplicationobject,seeUsingEventswiththeApplicationObject.

Page 2471: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledisplaysamessageeverytimeauserselectsadifferentslide.ThisexampleassumesanApplicationobjectcalledPPTApphasbeendeclaredusingtheWithEventskeyword.

PrivateSubPPTApp_SlideSelectionChanged(ByValSldRangeAsSlideRange)

MsgBox"Slideselectionchanged."

EndSub

Page 2472: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2473: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowBeginEventOccurswhenyoustartaslideshow.MicrosoftPowerPointcreatestheslideshowwindowandpassesittothisevent.Ifoneslideshowbranchestoanother,theSlideShowBegineventdoesnotoccuragainwhenthesecondslideshowbegins.

PrivateSubapplication_SlideShowBegin(ByValWnAsSlideShowWindow)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

WnTheslideshowwindowinitializedpriortothisevent.

Page 2474: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleadjuststhesizeandpositionoftheslideshowwindowandthenreactivatesit.

PrivateSubApp_SlideShowBegin(ByValWnAsSlideShowWindow)

WithWn

.Height=325

.Width=400

.Left=100

.Activate

EndWith

EndSub

Page 2475: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2476: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowEndEventOccursafteraslideshowends—immediatelyafterthelastSlideShowNextSlideeventoccurs.

PrivateSubapplication_SlideShowEnd(ByValPresAsPresentation)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThepresentationclosedwhenthiseventoccurs.

Page 2477: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Remarks

TheSlideShowEndeventalwaysoccursbeforeaslideshowendsiftheSlideShowBegineventhasoccurred.YoucanusetheSlideShowEndeventtoreturnanypropertysettingsandvariableinitializationsthatoccurintheSlideShowBegineventtotheiroriginalsettings.

Page 2478: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleturnsofftheentryeffectandautomaticadvancetimingslideshowtransitioneffectsforslidesonethroughfourattheendoftheslideshow.Italsosetstheslidestoadvancemanually.

PrivateSubApp_SlideShowEnd(ByValPresAsPresentation)

WithPres.Slides.Range(Array(1,4))_

.SlideShowTransition

.EntryEffect=ppEffectNone

.AdvanceOnTime=msoFalse

EndWith

WithPres.SlideShowSettings

.AdvanceMode=ppSlideShowManualAdvance

EndWith

EndSub

Page 2479: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2480: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowNextBuildEventOccursuponmouse-clickortiminganimation,butbeforetheanimatedobjectbecomesvisible.

PrivateSubapplication_SlideShowNextBuild(ByValWnAsSlideShowWindow)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

WnTheactiveslideshowwindow.

Page 2481: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Ifthecurrentshapeonslideoneisamovie,thisexampleplaysthemoviecontinuouslyuntilstoppedmanuallybythepresenter.ThiscodeisdesignedtobeusedwiththesecondSlideShowNextSlideeventexample.

PrivateSubApp_SlideShowNextBuild(ByValWnAsSlideShowWindow)

IfEvtCounter<>0Then

WithActivePresentation.Slides(1)_

.Shapes(shpAnimArray(2,EvtCounter))

If.Type=msoMediaThen

If.MediaType=ppMediaTypeMovie

.AnimationSettings.PlaySettings_

.LoopUntilStopped

EndIf

EndIf

EndWith

EndIf

EvtCounter=EvtCounter+1

EndSub

Page 2482: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2483: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowNextClickEventOccursonthenextclickontheslide.

PrivateSubapplication_SlideShowNextClick(ByValWnAsSlideShowWindow,ByValnEffectAsEffect)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

WnTheslideshowwindowinitializedpriortothisevent.

nEffectTheeffecttoanimateonnextclick.

Page 2484: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2485: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SlideShowNextSlideEventOccursimmediatelybeforethetransitiontothenextslide.Forthefirstslide,occursimmediatelyaftertheSlideShowBeginevent.

PrivateSubapplication_SlideShowNextSlide(ByValWnAsSlideShowWindow)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

WnTheactiveslideshowwindow.

Page 2486: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampledeterminestheslidepositionfortheslidefollowingtheSlideShowNextSlideevent.Ifthenextslideisslidethree,theexamplechangesthetypeofpointertoapenandthepencolortored.

PrivateSubApp_SlideShowNextSlide(ByValWnAsSlideShowWindow)

DimShowposAsInteger

Showpos=Wn.View.CurrentShowPosition+1

IfShowpos=3Then

WithActivePresentation.SlideShowSettings.Run.View

.PointerColor.RGB=RGB(255,0,0)

.PointerType=ppSlideShowPointerPen

EndWith

Else

WithActivePresentation.SlideShowSettings.Run.View

.PointerColor.RGB=RGB(0,0,0)

.PointerType=ppSlideShowPointerArrow

EndWith

EndIf

EndSub

Thisexamplesetsaglobalcountervariabletozero.Thenitcalculatesthenumberofshapesontheslidefollowingthisevent,determineswhichshapeshaveanimation,andfillsaglobalarraywiththeanimationorderandthenumberofeachshape.

NoteThearraycreatedinthisexampleisalsousedintheSlideShowNextBuildeventexample.

PrivateSubApp_SlideShowNextSlide(ByValWnAsSlideShowWindow)

DimiasInteger,jasInteger,numShapesAsInteger

DimobjSldAsSlide

SetobjSld=ActivePresentation.Slides_

(ActivePresentation.SlideShowWindow.View_

.CurrentShowPosition+1)

WithobjSld.Shapes

Page 2487: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

numShapes=.Count

IfnumShapes>0Then

j=1

ReDimshpAnimArray(1To2,1TonumShapes)

Fori=1TonumShapes

If.Item(i).AnimationSettings.AnimateThen

shpAnimArray(1,j)=_

.Item(i).AnimationSettings.AnimationOrder

shpAnimArray(2,j)=i

j=j+1

EndIf

Next

EndIf

EndWith

EndSub

Page 2488: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2489: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WindowActivateEventOccurswhentheapplicationwindoworanydocumentwindowisactivated.

PrivateSubapplication_WindowActivate(ByValPresAsPresentation,ByValWnAsDocumentWindow)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThepresentationdisplayedintheactivatedwindow.

WnTheactivateddocumentwindow.

Page 2490: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampleopenseveryactivatedpresentationinslidesorterview.

PrivateSubApp_WindowActivate_(ByValPresAsPresentation,ByValWnAsDocumentWindow)

Wn.ViewType=ppViewSlideSorter

EndSub

Page 2491: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2492: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WindowBeforeDoubleClickEventOccurswhenyoudouble-clicktheitemsintheviewslistedinthefollowingtable.

View ItemNormalorslideview ShapeSlidesorterview SlideNotespageview Slideimage

Thedefaultdouble-clickactionoccursafterthiseventunlesstheCancelargumentissettoTrue.

PrivateSubapplication_WindowBeforeDoubleClick(ByValSelAsSelection,ByValCancelAsBoolean)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

SelTheselectionbelowthemousepointerwhenthedouble-clickoccurs.

CancelFalsewhentheeventoccurs.IftheeventproceduresetsthisargumenttoTrue,thedefaultdouble-clickactionisn'tperformedwhentheprocedureisfinished.

Page 2493: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Inslidesorterview,thedefaultdouble-clickeventforanyslideistochangetoslideview.Inthisexample,iftheactivepresentationisdisplayedinslidesorterview,thedefaultactionispreemptedbytheWindowBeforeDoubleClickevent.TheeventprocedurechangestheviewtonormalviewandthencancelsthechangetoslideviewbysettingtheCancelargumenttoTrue.

PrivateSubApp_WindowBeforeDoubleClick_(ByValSelAsSelection,ByValCancelAsBoolean)

WithApplication.ActiveWindow

If.ViewType=ppViewSlideSorterThen

.ViewType=ppViewNormal

Cancel=True

EndIf

EndWith

EndSub

Page 2494: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2495: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WindowBeforeRightClickEventOccurswhenyouright-clickashape,aslide,anotespage,orsometext.ThiseventistriggeredbytheMouseUpevent.

PrivateSubapplication_WindowBeforeRightClick(ByValSelAsSelection,ByValCancelAsBoolean)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

SelTheselectionbelowthemousepointerwhentheright-clickoccurred.

CancelFalsewhentheeventoccurs.IftheeventproceduresetsthisargumenttoTrue,thedefaultcontextmenudoesnotappearwhentheprocedureisfinished.

Page 2496: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplecreatesaduplicateoftheselectedshape.Iftheshapehasatextframe,itaddsthetext"DuplicateShape"tothenewshape.SettingtheCancelargumenttoTruethenpreventsthedefaultcontextmenufromappearing.

PrivateSubApp_WindowBeforeRightClick_(ByValSelAsSelection,ByValCancelAsBoolean)

WithActivePresentation.Selection.ShapeRange

If.HasTextFrameThen

.Duplicate.TextFrame.TextRange.Text="DuplicateShape"

Else

.Duplicate

EndIf

Cancel=True

EndWith

EndSub

Page 2497: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2498: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WindowDeactivateEventOccurswhentheapplicationwindoworanydocumentwindowisdeactivated.

PrivateSubapplication_WindowDeactivate(ByValPresAsPresentation,ByValWnAsDocumentWindow)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

PresThepresentationdisplayedinthedeactivatedwindow.

WnThedeactivateddocumentwindow.

Page 2499: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexamplefindsthefilename(withoutitsextension)forthepresentationinthewindowthatisbeingdeactivated.Itthenappendsthe.htmextensiontothefilenameandsavesitasaWebpageinthesamefolderasthepresentation.

PrivateSubApp_WindowDeactivate_(ByValPresAsPresentation,ByValWnAsDocumentWindow)

FindNum=InStr(1,Wn.Presentation.FullName,".")

IfFindNum=0Then

HTMLName=Wn.Presentation.FullName&".htm"

Else

HTMLName=Mid(Wn.Presentation.FullName,1,FindNum-1)_

&".htm"

EndIf

Wn.Presentation.SaveCopyAsHTMLName,ppSaveAsHTML

MsgBox"PresentationbeingsavedinHTMLformatas"_

&HTMLName&"."

EndSub

Page 2500: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2501: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

WindowSelectionChangeEventOccurswhentheselectionoftext,ashape,oraslideintheactivedocumentwindowchanges,whetherthroughtheuserinterfaceorthroughcode.

PrivateSubapplication_WindowSelectionChange(ByValSelAsSelection)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.

SelRepresentstheobjectselected.

Page 2502: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

Thisexampledetermineswhenadifferentslideisbeingselectedandchangesthebackgroundcolorofthenewlyselectedslide.

PrivateSubApp_WindowSelectionChange(ByValSelAsSelection)

WithSel

If.Type=ppSelectionNoneThen

With.SlideRange(1)

.ColorScheme.Colors(ppBackground).RGB=_

RGB(240,115,100)

EndWith

EndIf

EndWith

EndSub

Page 2503: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2504: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PowerPointConstantsThistopicprovidesalistofallconstantsinthePowerPointobjectmodel.

MsoAnimAccumulate

Constant ValuemsoAnimAccumulateAlways 2msoAnimAccumulateNone 1

MsoAnimAdditive

Constant ValuemsoAnimAdditiveAddBase 1msoAnimAdditiveAddSum 2

MsoAnimAfterEffect

Constant ValuemsoAnimAfterEffectDim 1msoAnimAfterEffectHide 2msoAnimAfterEffectHideOnNextClick 3msoAnimAfterEffectMixed -1msoAnimAfterEffectNone 0

MsoAnimateByLevel

Constant ValuemsoAnimateChartAllAtOnce 7msoAnimateChartByCategory 8msoAnimateChartByCategoryElements 9msoAnimateChartBySeries 10msoAnimateChartBySeriesElements 11

Page 2505: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimateDiagramAllAtOnce 12msoAnimateDiagramBreadthByLevel 16msoAnimateDiagramBreadthByNode 15msoAnimateDiagramClockwise 17msoAnimateDiagramClockwiseIn 18msoAnimateDiagramClockwiseOut 19msoAnimateDiagramCounterClockwise 20msoAnimateDiagramCounterClockwiseIn 21msoAnimateDiagramCounterClockwiseOut 22msoAnimateDiagramDepthByBranch 14msoAnimateDiagramDepthByNode 13msoAnimateDiagramDown 26msoAnimateDiagramInByRing 23msoAnimateDiagramOutByRing 24msoAnimateDiagramUp 25msoAnimateLevelMixed -1msoAnimateLevelNone 0msoAnimateTextByAllLevels 1msoAnimateTextByFifthLevel 6msoAnimateTextByFirstLevel 2msoAnimateTextByFourthLevel 5msoAnimateTextBySecondLevel 3msoAnimateTextByThirdLevel 4

MsoAnimCommandType

Constant ValuemsoAnimCommandTypeCall 1msoAnimCommandTypeEvent 0msoAnimCommandTypeVerb 2

MsoAnimDirection

Page 2506: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Constant ValuemsoAnimDirectionAcross 18msoAnimDirectionBottom 11msoAnimDirectionBottomLeft 15msoAnimDirectionBottomRight 14msoAnimDirectionCenter 28msoAnimDirectionClockwise 21msoAnimDirectionCounterclockwise 22msoAnimDirectionCycleClockwise 43msoAnimDirectionCycleCounterclockwise 44msoAnimDirectionDown 3msoAnimDirectionDownLeft 9msoAnimDirectionDownRight 8msoAnimDirectionFontAllCaps 40msoAnimDirectionFontBold 35msoAnimDirectionFontItalic 36msoAnimDirectionFontShadow 39msoAnimDirectionFontStrikethrough 38msoAnimDirectionFontUnderline 37msoAnimDirectionGradual 42msoAnimDirectionHorizontal 16msoAnimDirectionHorizontalIn 23msoAnimDirectionHorizontalOut 24msoAnimDirectionIn 19msoAnimDirectionInBottom 31msoAnimDirectionInCenter 30msoAnimDirectionInSlightly 29msoAnimDirectionInstant 41msoAnimDirectionLeft 4msoAnimDirectionNone 0msoAnimDirectionOrdinalMask 5msoAnimDirectionOut 20msoAnimDirectionOutBottom 34

Page 2507: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimDirectionOutCenter 33msoAnimDirectionOutSlightly 32msoAnimDirectionRight 2msoAnimDirectionSlightly 27msoAnimDirectionTop 10msoAnimDirectionTopLeft 12msoAnimDirectionTopRight 13msoAnimDirectionUp 1msoAnimDirectionUpLeft 6msoAnimDirectionUpRight 7msoAnimDirectionVertical 17msoAnimDirectionVerticalIn 25msoAnimDirectionVerticalOut 26

MsoAnimEffect

Constant ValuemsoAnimEffectAppear 1msoAnimEffectArcUp 47msoAnimEffectAscend 39msoAnimEffectBlast 64msoAnimEffectBlinds 3msoAnimEffectBoldFlash 63msoAnimEffectBoldReveal 65msoAnimEffectBoomerang 25msoAnimEffectBounce 26msoAnimEffectBox 4msoAnimEffectBrushOnColor 66msoAnimEffectBrushOnUnderline 67msoAnimEffectCenterRevolve 40msoAnimEffectChangeFillColor 54msoAnimEffectChangeFont 55msoAnimEffectChangeFontColor 56

Page 2508: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectChangeFontSize 57msoAnimEffectChangeFontStyle 58msoAnimEffectChangeLineColor 60msoAnimEffectCheckerboard 5msoAnimEffectCircle 6msoAnimEffectColorBlend 68msoAnimEffectColorReveal 27msoAnimEffectColorWave 69msoAnimEffectComplementaryColor 70msoAnimEffectComplementaryColor2 71msoAnimEffectContrastingColor 72msoAnimEffectCrawl 7msoAnimEffectCredits 28msoAnimEffectCustom 0msoAnimEffectDarken 73msoAnimEffectDesaturate 74msoAnimEffectDescend 42msoAnimEffectDiamond 8msoAnimEffectDissolve 9msoAnimEffectEaseIn 29msoAnimEffectExpand 50msoAnimEffectFade 10msoAnimEffectFadedSwivel 41msoAnimEffectFadedZoom 48msoAnimEffectFlashBulb 75msoAnimEffectFlashOnce 11msoAnimEffectFlicker 76msoAnimEffectFlip 51msoAnimEffectFloat 30msoAnimEffectFly 2msoAnimEffectFold 53msoAnimEffectGlide 49msoAnimEffectGrowAndTurn 31

Page 2509: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectGrowShrink 59msoAnimEffectGrowWithColor 77msoAnimEffectLighten 78msoAnimEffectLightSpeed 32msoAnimEffectMediaPause 84msoAnimEffectMediaPlay 83msoAnimEffectMediaStop 85msoAnimEffectPath4PointStar 101msoAnimEffectPath5PointStar 90msoAnimEffectPath6PointStar 96msoAnimEffectPath8PointStar 102msoAnimEffectPathArcDown 122msoAnimEffectPathArcLeft 136msoAnimEffectPathArcRight 143msoAnimEffectPathArcUp 129msoAnimEffectPathBean 116msoAnimEffectPathBounceLeft 126msoAnimEffectPathBounceRight 139msoAnimEffectPathBuzzsaw 110msoAnimEffectPathCircle 86msoAnimEffectPathCrescentMoon 91msoAnimEffectPathCurvedSquare 105msoAnimEffectPathCurvedX 106msoAnimEffectPathCurvyLeft 133msoAnimEffectPathCurvyRight 146msoAnimEffectPathCurvyStar 108msoAnimEffectPathDecayingWave 145msoAnimEffectPathDiagonalDownRight 134msoAnimEffectPathDiagonalUpRight 141msoAnimEffectPathDiamond 88msoAnimEffectPathDown 127msoAnimEffectPathEqualTriangle 98msoAnimEffectPathFigure8Four 113

Page 2510: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectPathFootball 97msoAnimEffectPathFunnel 137msoAnimEffectPathHeart 94msoAnimEffectPathHeartbeat 130msoAnimEffectPathHexagon 89msoAnimEffectPathHorizontalFigure8 111msoAnimEffectPathInvertedSquare 119msoAnimEffectPathInvertedTriangle 118msoAnimEffectPathLeft 120msoAnimEffectPathLoopdeLoop 109msoAnimEffectPathNeutron 114msoAnimEffectPathOctagon 95msoAnimEffectPathParallelogram 99msoAnimEffectPathPeanut 112msoAnimEffectPathPentagon 100msoAnimEffectPathPlus 117msoAnimEffectPathPointyStar 104msoAnimEffectPathRight 149msoAnimEffectPathRightTriangle 87msoAnimEffectPathSCurve1 144msoAnimEffectPathSCurve2 124msoAnimEffectPathSineWave 125msoAnimEffectPathSpiralLeft 140msoAnimEffectPathSpiralRight 131msoAnimEffectPathSpring 138msoAnimEffectPathSquare 92msoAnimEffectPathStairsDown 147msoAnimEffectPathSwoosh 115msoAnimEffectPathTeardrop 103msoAnimEffectPathTrapezoid 93msoAnimEffectPathTurnDown 135msoAnimEffectPathTurnRight 121msoAnimEffectPathTurnUp 128

Page 2511: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectPathTurnUpRight 142msoAnimEffectPathUp 148msoAnimEffectPathVerticalFigure8 107msoAnimEffectPathWave 132msoAnimEffectPathZigzag 123msoAnimEffectPeek 12msoAnimEffectPinwheel 33msoAnimEffectPlus 13msoAnimEffectRandomBars 14msoAnimEffectRandomEffects 24msoAnimEffectRiseUp 34msoAnimEffectShimmer 52msoAnimEffectSling 43msoAnimEffectSpin 61msoAnimEffectSpinner 44msoAnimEffectSpiral 15msoAnimEffectSplit 16msoAnimEffectStretch 17msoAnimEffectStretchy 45msoAnimEffectStrips 18msoAnimEffectStyleEmphasis 79msoAnimEffectSwish 35msoAnimEffectSwivel 19msoAnimEffectTeeter 80msoAnimEffectThinLine 36msoAnimEffectTransparency 62msoAnimEffectUnfold 37msoAnimEffectVerticalGrow 81msoAnimEffectWave 82msoAnimEffectWedge 20msoAnimEffectWheel 21msoAnimEffectWhip 38msoAnimEffectWipe 22

Page 2512: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimEffectZip 46msoAnimEffectZoom 23

MsoAnimEffectAfter

Constant ValuemsoAnimEffectAfterFreeze 1msoAnimEffectAfterHold 3msoAnimEffectAfterRemove 2msoAnimEffectAfterTransition 4

MsoAnimEffectRestart

Constant ValuemsoAnimEffectRestartAlways 1msoAnimEffectRestartNever 3msoAnimEffectRestartWhenOff 2

MsoAnimFilterEffectSubtype

Constant ValuemsoAnimFilterEffectSubtypeAcross 9msoAnimFilterEffectSubtypeDown 25msoAnimFilterEffectSubtypeDownLeft 14msoAnimFilterEffectSubtypeDownRight 16msoAnimFilterEffectSubtypeFromBottom 13msoAnimFilterEffectSubtypeFromLeft 10msoAnimFilterEffectSubtypeFromRight 11msoAnimFilterEffectSubtypeFromTop 12msoAnimFilterEffectSubtypeHorizontal 5msoAnimFilterEffectSubtypeIn 7msoAnimFilterEffectSubtypeInHorizontal 3msoAnimFilterEffectSubtypeInVertical 1msoAnimFilterEffectSubtypeLeft 23

Page 2513: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimFilterEffectSubtypeNone 0msoAnimFilterEffectSubtypeOut 8msoAnimFilterEffectSubtypeOutHorizontal 4msoAnimFilterEffectSubtypeOutVertical 2msoAnimFilterEffectSubtypeRight 24msoAnimFilterEffectSubtypeSpokes1 18msoAnimFilterEffectSubtypeSpokes2 19msoAnimFilterEffectSubtypeSpokes3 20msoAnimFilterEffectSubtypeSpokes4 21msoAnimFilterEffectSubtypeSpokes8 22msoAnimFilterEffectSubtypeUp 26msoAnimFilterEffectSubtypeUpLeft 15msoAnimFilterEffectSubtypeUpRight 17msoAnimFilterEffectSubtypeVertical 6

MsoAnimFilterEffectType

Constant ValuemsoAnimFilterEffectTypeBarn 1msoAnimFilterEffectTypeBlinds 2msoAnimFilterEffectTypeBox 3msoAnimFilterEffectTypeCheckerboard 4msoAnimFilterEffectTypeCircle 5msoAnimFilterEffectTypeDiamond 6msoAnimFilterEffectTypeDissolve 7msoAnimFilterEffectTypeFade 8msoAnimFilterEffectTypeImage 9msoAnimFilterEffectTypeNone 0msoAnimFilterEffectTypePixelate 10msoAnimFilterEffectTypePlus 11msoAnimFilterEffectTypeRandomBar 12msoAnimFilterEffectTypeSlide 13msoAnimFilterEffectTypeStretch 14

Page 2514: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimFilterEffectTypeStrips 15msoAnimFilterEffectTypeWedge 16msoAnimFilterEffectTypeWheel 17msoAnimFilterEffectTypeWipe 18

MsoAnimProperty

Constant ValuemsoAnimColor 7msoAnimHeight 4msoAnimHeigth 4msoAnimNone 0msoAnimOpacity 5msoAnimRotation 6msoAnimShapeFillBackColor 1007msoAnimShapeFillColor 1005msoAnimShapeFillOn 1004msoAnimShapeFillOpacity 1006msoAnimShapeLineColor 1009msoAnimShapeLineOn 1008msoAnimShapePictureBrightness 1001msoAnimShapePictureContrast 1000msoAnimShapePictureCropFromBottom 1001msoAnimShapePictureCropFromLeft 1002msoAnimShapePictureCropFromRight 1003msoAnimShapePictureCropFromTop 1000msoAnimShapePictureGamma 1002msoAnimShapePictureGrayscale 1003msoAnimShapeShadowColor 1012msoAnimShapeShadowOffsetX 1014msoAnimShapeShadowOffsetY 1015msoAnimShapeShadowOn 1010msoAnimShapeShadowOpacity 1013

Page 2515: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

msoAnimShapeShadowType 1011msoAnimTextBulletCharacter 111msoAnimTextBulletColor 114msoAnimTextBulletFontName 112msoAnimTextBulletNumber 113msoAnimTextBulletRelativeSize 115msoAnimTextBulletStyle 116msoAnimTextBulletType 117msoAnimTextFontBold 100msoAnimTextFontColor 101msoAnimTextFontEmboss 102msoAnimTextFontItalic 103msoAnimTextFontName 104msoAnimTextFontShadow 105msoAnimTextFontSize 106msoAnimTextFontStrikeThrough 110msoAnimTextFontSubscript 107msoAnimTextFontSuperscript 108msoAnimTextFontUnderline 109msoAnimVisibility 8msoAnimWidth 3msoAnimX 1msoAnimY 2

MsoAnimTextUnitEffect

Constant ValuemsoAnimTextUnitEffectByCharacter 1msoAnimTextUnitEffectByParagraph 0msoAnimTextUnitEffectByWord 2msoAnimTextUnitEffectMixed -1

MsoAnimTriggerType

Page 2516: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Constant ValuemsoAnimTriggerAfterPrevious 3msoAnimTriggerMixed -1msoAnimTriggerNone 0msoAnimTriggerOnPageClick 1msoAnimTriggerOnShapeClick 4msoAnimTriggerWithPrevious 2

MsoAnimType

Constant ValuemsoAnimTypeColor 2msoAnimTypeCommand 6msoAnimTypeFilter 7msoAnimTypeMixed -2msoAnimTypeMotion 1msoAnimTypeNone 0msoAnimTypeProperty 5msoAnimTypeRotation 4msoAnimTypeScale 3msoAnimTypeSet 8

PpActionType

Constant ValueppActionEndShow 6ppActionFirstSlide 3ppActionHyperlink 7ppActionLastSlide 4ppActionLastSlideViewed 5ppActionMixed -2ppActionNamedSlideShow 10ppActionNextSlide 1ppActionNone 0

Page 2517: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppActionOLEVerb 11ppActionPlay 12ppActionPreviousSlide 2ppActionRunMacro 8ppActionRunProgram 9

PpAdvanceMode

Constant ValueppAdvanceModeMixed -2ppAdvanceOnClick 1ppAdvanceOnTime 2

PpAfterEffect

Constant ValueppAfterEffectDim 2ppAfterEffectHide 1ppAfterEffectHideOnClick 3ppAfterEffectMixed -2ppAfterEffectNothing 0

PpAlertLevel

Constant ValueppAlertsAll 2ppAlertsNone 1

PpArrangeStyle

Constant ValueppArrangeCascade 2ppArrangeTiled 1

Page 2518: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PpAutoSize

Constant ValueppAutoSizeMixed -2ppAutoSizeNone 0ppAutoSizeShapeToFitText 1

PpBaselineAlignment

Constant ValueppBaselineAlignBaseline 1ppBaselineAlignCenter 3ppBaselineAlignFarEast50 4ppBaselineAlignMixed -2ppBaselineAlignTop 2

PpBorderType

Constant ValueppBorderBottom 3ppBorderDiagonalDown 5ppBorderDiagonalUp 6ppBorderLeft 2ppBorderRight 4ppBorderTop 1

PpBulletType

Constant ValueppBulletMixed -2ppBulletNone 0ppBulletNumbered 2ppBulletPicture 3ppBulletUnnumbered 1

Page 2519: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PpChangeCase

Constant ValueppCaseLower 2ppCaseSentence 1ppCaseTitle 4ppCaseToggle 5ppCaseUpper 3

PpChartUnitEffect

Constant ValueppAnimateByCategory 2ppAnimateByCategoryElements 4ppAnimateBySeries 1ppAnimateBySeriesElements 3ppAnimateChartAllAtOnce 5ppAnimateChartMixed -2

PpColorSchemeIndex

Constant ValueppAccent1 6ppAccent2 7ppAccent3 8ppBackground 1ppFill 5ppForeground 2ppNotSchemeColor 0ppSchemeColorMixed -2ppShadow 3ppTitle 4

PpDateTimeFormat

Page 2520: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Constant ValueppDateTimeddddMMMMddyyyy 2ppDateTimedMMMMyyyy 3ppDateTimedMMMyy 5ppDateTimeFigureOut 14ppDateTimeFormatMixed -2ppDateTimeHmm 10ppDateTimehmmAMPM 12ppDateTimeHmmss 11ppDateTimehmmssAMPM 13ppDateTimeMdyy 1ppDateTimeMMddyyHmm 8ppDateTimeMMddyyhmmAMPM 9ppDateTimeMMMMdyyyy 4ppDateTimeMMMMyy 6ppDateTimeMMyy 7

PpDirection

Constant ValueppDirectionLeftToRight 1ppDirectionMixed -2ppDirectionRightToLeft 2

PpEntryEffect

Constant ValueppEffectAppear 3844ppEffectBlindsHorizontal 769ppEffectBlindsVertical 770ppEffectBoxIn 3074ppEffectBoxOut 3073ppEffectCheckerboardAcross 1025

Page 2521: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppEffectCheckerboardDown 1026ppEffectCircleOut 3845ppEffectCombHorizontal 3847ppEffectCombVertical 3848ppEffectCoverDown 1284ppEffectCoverLeft 1281ppEffectCoverLeftDown 1287ppEffectCoverLeftUp 1285ppEffectCoverRight 1283ppEffectCoverRightDown 1288ppEffectCoverRightUp 1286ppEffectCoverUp 1282ppEffectCrawlFromDown 3344ppEffectCrawlFromLeft 3341ppEffectCrawlFromRight 3343ppEffectCrawlFromUp 3342ppEffectCut 257ppEffectCutThroughBlack 258ppEffectDiamondOut 3846ppEffectDissolve 1537ppEffectFade 1793ppEffectFadeSmoothly 3849ppEffectFlashOnceFast 3841ppEffectFlashOnceMedium 3842ppEffectFlashOnceSlow 3843ppEffectFlyFromBottom 3332ppEffectFlyFromBottomLeft 3335ppEffectFlyFromBottomRight 3336ppEffectFlyFromLeft 3329ppEffectFlyFromRight 3331ppEffectFlyFromTop 3330ppEffectFlyFromTopLeft 3333ppEffectFlyFromTopRight 3334

Page 2522: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppEffectMixed -2ppEffectNewsflash 3850ppEffectNone 0ppEffectPeekFromDown 3338ppEffectPeekFromLeft 3337ppEffectPeekFromRight 3339ppEffectPeekFromUp 3340ppEffectPlusOut 3851ppEffectPushDown 3852ppEffectPushLeft 3853ppEffectPushRight 3854ppEffectPushUp 3855ppEffectRandom 513ppEffectRandomBarsHorizontal 2305ppEffectRandomBarsVertical 2306ppEffectSpiral 3357ppEffectSplitHorizontalIn 3586ppEffectSplitHorizontalOut 3585ppEffectSplitVerticalIn 3588ppEffectSplitVerticalOut 3587ppEffectStretchAcross 3351ppEffectStretchDown 3355ppEffectStretchLeft 3352ppEffectStretchRight 3354ppEffectStretchUp 3353ppEffectStripsDownLeft 2563ppEffectStripsDownRight 2564ppEffectStripsLeftDown 2567ppEffectStripsLeftUp 2565ppEffectStripsRightDown 2568ppEffectStripsRightUp 2566ppEffectStripsUpLeft 2561ppEffectStripsUpRight 2562

Page 2523: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppEffectSwivel 3356ppEffectUncoverDown 2052ppEffectUncoverLeft 2049ppEffectUncoverLeftDown 2055ppEffectUncoverLeftUp 2053ppEffectUncoverRight 2051ppEffectUncoverRightDown 2056ppEffectUncoverRightUp 2054ppEffectUncoverUp 2050ppEffectWedge 3856ppEffectWheel1Spoke 3857ppEffectWheel2Spokes 3858ppEffectWheel3Spokes 3859ppEffectWheel4Spokes 3860ppEffectWheel8Spokes 3861ppEffectWipeDown 2820ppEffectWipeLeft 2817ppEffectWipeRight 2819ppEffectWipeUp 2818ppEffectZoomBottom 3350ppEffectZoomCenter 3349ppEffectZoomIn 3345ppEffectZoomInSlightly 3346ppEffectZoomOut 3347ppEffectZoomOutSlightly 3348

PpFarEastLineBreakLevel

Constant ValueppFarEastLineBreakLevelCustom 3ppFarEastLineBreakLevelNormal 1ppFarEastLineBreakLevelStrict 2

Page 2524: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

PpFollowColors

Constant ValueppFollowColorsMixed -2ppFollowColorsNone 0ppFollowColorsScheme 1ppFollowColorsTextAndBackground 2

PpFrameColors

Constant ValueppFrameColorsBlackTextOnWhite 5ppFrameColorsBrowserColors 1ppFrameColorsPresentationSchemeAccentColor 3ppFrameColorsPresentationSchemeTextColor 2ppFrameColorsWhiteTextOnBlack 4

PpHTMLVersion

Constant ValueppHTMLAutodetect 4ppHTMLDual 3ppHTMLv3 1ppHTMLv4 2

PpIndentControl

Constant ValueppIndentControlMixed -2ppIndentKeepAttr 2ppIndentReplaceAttr 1

PpMediaType

Page 2525: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Constant ValueppMediaTypeMixed -2ppMediaTypeMovie 3ppMediaTypeOther 1ppMediaTypeSound 2

PpMouseActivation

Constant ValueppMouseClick 1ppMouseOver 2

PpNumberedBulletStyle

Constant ValueppBulletAlphaLCParenBoth 8ppBulletAlphaLCParenRight 9ppBulletAlphaLCPeriod 0ppBulletAlphaUCParenBoth 10ppBulletAlphaUCParenRight 11ppBulletAlphaUCPeriod 1ppBulletArabicAbjadDash 24ppBulletArabicAlphaDash 23ppBulletArabicDBPeriod 29ppBulletArabicDBPlain 28ppBulletArabicParenBoth 12ppBulletArabicParenRight 2ppBulletArabicPeriod 3ppBulletArabicPlain 13ppBulletCircleNumDBPlain 18ppBulletCircleNumWDBlackPlain 20ppBulletCircleNumWDWhitePlain 19ppBulletHebrewAlphaDash 25ppBulletHindiAlpha1Period 40

Page 2526: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppBulletHindiAlphaPeriod 36ppBulletHindiNumParenRight 39ppBulletHindiNumPeriod 37ppBulletKanjiKoreanPeriod 27ppBulletKanjiKoreanPlain 26ppBulletKanjiSimpChinDBPeriod 38ppBulletRomanLCParenBoth 4ppBulletRomanLCParenRight 5ppBulletRomanLCPeriod 6ppBulletRomanUCParenBoth 14ppBulletRomanUCParenRight 15ppBulletRomanUCPeriod 7ppBulletSimpChinPeriod 17ppBulletSimpChinPlain 16ppBulletStyleMixed -2ppBulletThaiAlphaParenBoth 32ppBulletThaiAlphaParenRight 31ppBulletThaiAlphaPeriod 30ppBulletThaiNumParenBoth 35ppBulletThaiNumParenRight 34ppBulletThaiNumPeriod 33ppBulletTradChinPeriod 22ppBulletTradChinPlain 21

PpParagraphAlignment

Constant ValueppAlignCenter 2ppAlignDistribute 5ppAlignJustify 4ppAlignJustifyLow 7ppAlignLeft 1ppAlignmentMixed -2

Page 2527: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppAlignRight 3ppAlignThaiDistribute 6

PpPasteDataType

Constant ValueppPasteBitmap 1ppPasteDefault 0ppPasteEnhancedMetafile 2ppPasteGIF 4ppPasteHTML 8ppPasteJPG 5ppPasteMetafilePicture 3ppPasteOLEObject 10ppPastePNG 6ppPasteRTF 9ppPasteShape 11ppPasteText 7

PpPlaceholderType

Constant ValueppPlaceholderBitmap 9ppPlaceholderBody 2ppPlaceholderCenterTitle 3ppPlaceholderChart 8ppPlaceholderDate 16ppPlaceholderFooter 15ppPlaceholderHeader 14ppPlaceholderMediaClip 10ppPlaceholderMixed -2ppPlaceholderObject 7ppPlaceholderOrgChart 11ppPlaceholderSlideNumber 13

Page 2528: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppPlaceholderSubtitle 4ppPlaceholderTable 12ppPlaceholderTitle 1ppPlaceholderVerticalBody 6ppPlaceholderVerticalTitle 5

PpPrintColorType

Constant ValueppPrintBlackAndWhite 2ppPrintColor 1ppPrintPureBlackAndWhite 3

PpPrintHandoutOrder

Constant ValueppPrintHandoutHorizontalFirst 2ppPrintHandoutVerticalFirst 1

PpPrintOutputType

Constant ValueppPrintOutputBuildSlides 7ppPrintOutputFourSlideHandouts 8ppPrintOutputNineSlideHandouts 9ppPrintOutputNotesPages 5ppPrintOutputOneSlideHandouts 10ppPrintOutputOutline 6ppPrintOutputSixSlideHandouts 4ppPrintOutputSlides 1ppPrintOutputThreeSlideHandouts 3ppPrintOutputTwoSlideHandouts 2

PpPrintRangeType

Page 2529: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Constant ValueppPrintAll 1ppPrintCurrent 3ppPrintNamedSlideShow 5ppPrintSelection 2ppPrintSlideRange 4

PpPublishSourceType

Constant ValueppPublishAll 1ppPublishNamedSlideShow 3ppPublishSlideRange 2

PpRevisionInfo

Constant ValueppRevisionInfoBaseline 1ppRevisionInfoMerged 2ppRevisionInfoNone 0

PpSaveAsFileType

Constant ValueppSaveAsAddIn 8ppSaveAsBMP 19ppSaveAsDefault 11ppSaveAsEMF 23ppSaveAsGIF 16ppSaveAsHTML 12ppSaveAsHTMLDual 14ppSaveAsHTMLv3 13ppSaveAsJPG 17ppSaveAsMetaFile 15

Page 2530: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppSaveAsPNG 18ppSaveAsPowerPoint3 4ppSaveAsPowerPoint4 3ppSaveAsPowerPoint4FarEast 10ppSaveAsPowerPoint7 2ppSaveAsPresentation 1ppSaveAsPresForReview 22ppSaveAsRTF 6ppSaveAsShow 7ppSaveAsTemplate 5ppSaveAsTIF 21ppSaveAsWebArchive 20

PpSelectionType

Constant ValueppSelectionNone 0ppSelectionShapes 2ppSelectionSlides 1ppSelectionText 3

PpSlideLayout

Constant ValueppLayoutBlank 12ppLayoutChart 8ppLayoutChartAndText 6ppLayoutClipartAndText 10ppLayoutClipArtAndVerticalText 26ppLayoutFourObjects 24ppLayoutLargeObject 15ppLayoutMediaClipAndText 18ppLayoutMixed -2ppLayoutObject 16

Page 2531: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppLayoutObjectAndText 14ppLayoutObjectAndTwoObjects 30ppLayoutObjectOverText 19ppLayoutOrgchart 7ppLayoutTable 4ppLayoutText 2ppLayoutTextAndChart 5ppLayoutTextAndClipart 9ppLayoutTextAndMediaClip 17ppLayoutTextAndObject 13ppLayoutTextAndTwoObjects 21ppLayoutTextOverObject 20ppLayoutTitle 1ppLayoutTitleOnly 11ppLayoutTwoColumnText 3ppLayoutTwoObjects 29ppLayoutTwoObjectsAndObject 31ppLayoutTwoObjectsAndText 22ppLayoutTwoObjectsOverText 23ppLayoutVerticalText 25ppLayoutVerticalTitleAndText 27ppLayoutVerticalTitleAndTextOverChart 28

PpSlideShowAdvanceMode

Constant ValueppSlideShowManualAdvance 1ppSlideShowRehearseNewTimings 3ppSlideShowUseSlideTimings 2

PpSlideShowPointerType

Constant ValueppSlideShowPointerAlwaysHidden 3

Page 2532: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppSlideShowPointerArrow 1ppSlideShowPointerAutoArrow 4ppSlideShowPointerEraser 5ppSlideShowPointerNone 0ppSlideShowPointerPen 2

PpSlideShowRangeType

Constant ValueppShowAll 1ppShowNamedSlideShow 3ppShowSlideRange 2

PpSlideShowState

Constant ValueppSlideShowBlackScreen 3ppSlideShowDone 5ppSlideShowPaused 2ppSlideShowRunning 1ppSlideShowWhiteScreen 4

PpSlideShowType

Constant ValueppShowTypeKiosk 3ppShowTypeSpeaker 1ppShowTypeWindow 2

PpSlideSizeType

Constant ValueppSlideSize35MM 4ppSlideSizeA3Paper 9

Page 2533: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppSlideSizeA4Paper 3ppSlideSizeB4ISOPaper 10ppSlideSizeB4JISPaper 12ppSlideSizeB5ISOPaper 11ppSlideSizeB5JISPaper 13ppSlideSizeBanner 6ppSlideSizeCustom 7ppSlideSizeHagakiCard 14ppSlideSizeLedgerPaper 8ppSlideSizeLetterPaper 2ppSlideSizeOnScreen 1ppSlideSizeOverhead 5

PpSoundEffectType

Constant ValueppSoundEffectsMixed -2ppSoundFile 2ppSoundNone 0ppSoundStopPrevious 1

PpSoundFormatType

Constant ValueppSoundFormatCDAudio 3ppSoundFormatMIDI 2ppSoundFormatMixed -2ppSoundFormatNone 0ppSoundFormatWAV 1

PpTabStopType

Constant ValueppTabStopCenter 2

Page 2534: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppTabStopDecimal 4ppTabStopLeft 1ppTabStopMixed -2ppTabStopRight 3

PpTextLevelEffect

Constant ValueppAnimateByAllLevels 16ppAnimateByFifthLevel 5ppAnimateByFirstLevel 1ppAnimateByFourthLevel 4ppAnimateBySecondLevel 2ppAnimateByThirdLevel 3ppAnimateLevelMixed -2ppAnimateLevelNone 0

PpTextStyleType

Constant ValueppBodyStyle 3ppDefaultStyle 1ppTitleStyle 2

PpTextUnitEffect

Constant ValueppAnimateByCharacter 2ppAnimateByParagraph 0ppAnimateByWord 1ppAnimateUnitMixed -2

PpTransitionSpeed

Page 2535: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Constant ValueppTransitionSpeedFast 3ppTransitionSpeedMedium 2ppTransitionSpeedMixed -2ppTransitionSpeedSlow 1

PpUpdateOption

Constant ValueppUpdateOptionAutomatic 2ppUpdateOptionManual 1ppUpdateOptionMixed -2

PpViewType

Constant ValueppViewHandoutMaster 4ppViewMasterThumbnails 12ppViewNormal 9ppViewNotesMaster 5ppViewNotesPage 3ppViewOutline 6ppViewPrintPreview 10ppViewSlide 1ppViewSlideMaster 2ppViewSlideSorter 7ppViewThumbnails 11ppViewTitleMaster 8

PpWindowState

Constant ValueppWindowMaximized 3ppWindowMinimized 2

Page 2536: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ppWindowNormal 1

Page 2537: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2538: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddingcontrolstoadocumentToaddcontrolstoadocument,displaytheControlToolbox,clickthecontrolyouwanttoadd,andthenclickonthedocument.Draganadjustmenthandleofthecontroluntilthecontrol'soutlineisthesizeandshapeyouwant.

NoteDraggingacontrol(oranumberof"grouped"controls)fromtheformbacktotheControlToolboxcreatesatemplateofthatcontrol,whichcanbereused.Thisisausefulfeatureforimplementingastandard"lookandfeel"foryourapplications.

Page 2539: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2540: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

SettingcontrolpropertiesYoucansetsomecontrolpropertiesatdesigntime(beforeanymacroisrunning).Indesignmode,right-clickacontrolandclickPropertiestodisplaythePropertieswindow.Propertynamesareshownintheleftcolumninthewindow,propertyvaluesintherightcolumn.Yousetapropertyvaluebyenteringthenewvaluetotherightofthepropertyname.

Page 2541: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2542: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

InitializingcontrolpropertiesYoucaninitializecontrolsatruntimebyusingVisualBasiccodeinamacro.Forexample,youcouldfillalistbox,settextvalues,orsetoptionbuttons.

ThefollowingexampleusestheAddItemmethodtoadddatatoalistbox.Thenitsetsthevalueofatextboxanddisplaystheform.

PrivateSubGetUserName()

WithUserForm1

.lstRegions.AddItem"North"

.lstRegions.AddItem"South"

.lstRegions.AddItem"East"

.lstRegions.AddItem"West"

.txtSalesPersonID.Text="00000"

.Show

'...

EndWith

EndSub

YoucanalsousecodeintheInitializeeventofaformtosetinitialvaluesforcontrolsontheform.AnadvantagetosettinginitialcontrolvaluesintheInitializeeventisthattheinitializationcodestayswiththeform.Youcancopytheformtoanotherproject,andwhenyouruntheShowmethodtodisplaythedialogbox,thecontrolswillbeinitialized.

PrivateSubUserForm_Initialize()

WithUserForm1

With.lstRegions

.AddItem"North"

.AddItem"South"

.AddItem"East"

.AddItem"West"

EndWith

.txtSalesPersonID.Text="00000"

EndWith

EndSub

Page 2543: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 2544: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2545: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ControlanddialogboxeventsAfteryouhaveaddedcontrolstoyourdialogboxordocument,youaddeventprocedurestodeterminehowthecontrolsrespondtouseractions.

UserFormsandcontrolshaveapredefinedsetofevents.Forexample,acommandbuttonhasaClickeventthatoccurswhentheuserclicksthecommandbutton,andUserFormshaveanInitializeeventthatrunswhentheformisloaded.

Towriteacontrolorformeventprocedure,openamodulebydouble-clickingtheformorcontrol,andselecttheeventfromtheProceduredrop-downlistbox.

Eventproceduresincludethenameofthecontrol.Forexample,thenameoftheClickeventprocedureforacommandbuttonnamedCommand1isCommand1_Click.

Ifyouaddcodetoaneventprocedureandthenchangethenameofthecontrol,yourcoderemainsinprocedureswiththepreviousname.

Forexample,assumeyouaddcodetotheClickeventforCommmand1andthenrenamethecontroltoCommand2.Whenyoudouble-clickCommand2,youwillnotseeanycodeintheClickeventprocedure.YouwillneedtomovecodefromCommand1_ClicktoCommand2_Click.

Tosimplifydevelopment,itisagoodpracticetonameyourcontrolsbeforewritingcode.

Page 2546: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2547: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingcontrolvalueswhilecodeisrunningSomecontrolpropertiescanbesetandreturnedwhileVisualBasiccodeisrunning.ThefollowingexamplesetstheTextpropertyofatextboxto"Hello."

TextBox1.Text="Hello"

Thedataenteredonaformbyauserislostwhentheformisclosed.Ifyoureturnthevaluesofcontrolsonaformaftertheformhasbeenunloaded,yougettheinitialvaluesforthecontrolsratherthanthevaluestheuserentered.

Ifyouwanttosavethedataenteredonaform,youcansavetheinformationtomodule-levelvariableswhiletheformisstillrunning.Thefollowingexampledisplaysaformandsavestheformdata.

'Codeinmoduletodeclarepublicvariables

PublicstrRegionAsString

PublicintSalesPersonIDAsInteger

PublicblnCancelledAsBoolean

'Codeinform

PrivateSubcmdCancel_Click()

Module1.blnCancelled=True

UnloadMe

EndSub

PrivateSubcmdOK_Click()

'Savedata

intSalesPersonID=txtSalesPersonID.Text

strRegion=lstRegions.List(lstRegions.ListIndex)

Module1.blnCancelled=False

UnloadMe

EndSub

PrivateSubUserForm_Initialize()

Module1.blnCancelled=True

EndSub

'Codeinmoduletodisplayform

SubLaunchSalesPersonForm()

Page 2548: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

frmSalesPeople.Show

IfblnCancelled=TrueThen

MsgBox"OperationCancelled!",vbExclamation

Else

MsgBox"TheSalesperson'sIDis:"&

intSalesPersonID&_

"TheRegionis:"&strRegion

EndIf

EndSub

Page 2549: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

CreatingaUserFormTocreateacustomdialogbox,youmustcreateaUserForm.TocreateaUserForm,clickUserFormontheInsertmenuintheVisualBasicEditor.

UsethePropertieswindowtochangethename,behavior,andappearanceoftheform.Forexample,tochangethecaptiononaform,settheCaptionproperty.

Page 2550: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2551: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddingcontrolstoaUserFormToaddcontrolstoauserform,findthecontrolyouwanttoaddintheToolbox,dragthecontrolontotheform,andthendraganadjustmenthandleonthecontroluntilthecontrol'soutlineisthesizeandshapeyouwant.

NoteDraggingacontrol(oranumberof"grouped"controls)fromtheformbacktotheToolboxcreatesatemplateofthatcontrol,whichcanbereused.Thisisausefulfeatureforimplementingastandard"lookandfeel"foryourapplications.

Whenyou'veaddedcontrolstotheform,usethecommandsontheFormatmenuintheVisualBasicEditortoadjustthecontrolalignmentandspacing.

Page 2552: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

DisplayingacustomdialogboxTotestyourdialogboxintheVisualBasicEditor,clickRunSub/UserFormontheRunmenuintheVisualBasicEditor.

TodisplayadialogboxfromVisualBasic,usetheShowmethod.ThefollowingexampledisplaysthedialogboxnamedUserForm1.

PrivateSubGetUserName()

UserForm1.Show

EndSub

Page 2553: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2554: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

AddOLEObjectMethodCreatesanOLEobject.ReturnsaShapeobjectthatrepresentsthenewOLEobject.

expression.AddOLEObject(Left,Top,Width,Height,ClassName,FileName,DisplayAsIcon,IconFileName,IconIndex,IconLabel,Link)

expressionRequired.AnexpressionthatreturnsaShapesobject.

Left,TopOptionalFloat.Theposition(inpoints)oftheupper-leftcornerofthenewobjectrelativetotheupper-leftcorneroftheslide.Thedefaultvalueis0(zero).

Width,HeightOptionalFloat.TheinitialdimensionsoftheOLEobject,inpoints.

ClassNameOptionalString.TheOLElongclassnameortheProgIDfortheobjectthat'stobecreated.YoumustspecifyeithertheClassNameorFileNameargumentfortheobject,butnotboth.

FileNameOptionalString.Thefilefromwhichtheobjectistobecreated.Ifthepathisn'tspecified,thecurrentworkingfolderisused.YoumustspecifyeithertheClassNameorFileNameargumentfortheobject,butnotboth.

DisplayAsIconOptionalMsoTriState.DetermineswhethertheOLEobjectwillbedisplayedasanicon.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueDisplaystheOLEobjectasanicon.

IconFileNameOptionalString.Thefilethatcontainstheicontobedisplayed.

Page 2555: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

IconIndexOptionalInteger.TheindexoftheiconwithinIconFileName.TheorderoficonsinthespecifiedfilecorrespondstotheorderinwhichtheiconsappearintheChangeIcondialogbox(accessedfromtheInsertObjectdialogboxwhentheDisplayasiconcheckboxisselected).Thefirsticoninthefilehastheindexnumber0(zero).Ifaniconwiththegivenindexnumberdoesn'texistinIconFileName,theiconwiththeindexnumber1(thesecondiconinthefile)isused.Thedefaultvalueis0(zero).

IconLabelOptionalString.Alabel(caption)tobedisplayedbeneaththeicon.

LinkOptionalMsoTriState.DetermineswhethertheOLEobjectwillbelinkedtothefilefromwhichitwascreated.IfyouspecifiedavalueforClassName,thisargumentmustbemsoFalse.

MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.MakestheOLEobjectanindependentcopyofthefile.msoTriStateMixedmsoTriStateTogglemsoTrueLinkstheOLEobjecttothefilefromwhichitwascreated.

Page 2556: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

Example

ThisexampleaddsalinkedWorddocumenttomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddOLEObjectLeft:=100,Top:=100,_

Width:=200,Height:=300,_

FileName:="c:\mydocuments\testing.doc",Link:=msoTrue

ThisexampleaddsanewMicrosoftExcelworksheettomyDocument.Theworksheetwillbedisplayedasanicon.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddOLEObjectLeft:=100,Top:=100,_

Width:=200,Height:=300,_

ClassName:="Excel.Sheet",DisplayAsIcon:=True

ThisexampleaddsacommandbuttontomyDocument.

SetmyDocument=ActivePresentation.Slides(1)

myDocument.Shapes.AddOLEObjectLeft:=100,Top:=100,_

Width:=150,Height:=50,ClassName:="Forms.CommandButton.1"

Page 2557: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HyperlinkObjectMultipleobjects Hyperlinks

Hyperlink

Representsahyperlinkassociatedwithanon-placeholdershapeortext.YoucanuseahyperlinktojumptoanInternetorintranetsite,toanotherfile,ortoaslidewithintheactivepresentation.TheHyperlinkobjectisamemberoftheHyperlinkscollection.TheHyperlinkscollectioncontainsallthehyperlinksonaslideoramaster.

Page 2558: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheHyperlinkObject

UsetheHyperlinkpropertytoreturnahyperlinkforashape.Ashapecanhavetwodifferenthyperlinksassignedtoit:onethat'sfollowedwhentheuserclickstheshapeduringaslideshow,andanotherthat'sfollowedwhentheuserpassesthemousepointerovertheshapeduringaslideshow.Forthehyperlinktobeactiveduringaslideshow,theActionpropertymustbesettoppActionHyperlink.Thefollowingexamplesetsthemouse-clickactionforshapethreeonslideoneintheactivepresentationtoanInternetlink.

WithActivePresentation.Slides(1).Shapes(3)_

.ActionSettings(ppMouseClick)

.Action=ppActionHyperlink

.Hyperlink.Address="http://www.microsoft.com"

EndWith

Aslidecancontainmorethanonehyperlink.Eachnon-placeholdershapecanhaveahyperlink;thetextwithinashapecanhaveitsownhyperlink;andeachindividualcharactercanhaveitsownhyperlink.UseHyperlinks(index),whereindexisthehyperlinknumber,toreturnasingleHyperlinkobject.Thefollowingexampleaddstheshapethreemouse-clickhyperlinktotheFavoritesfolder.

ActivePresentation.Slides(1).Shapes(3)_

.ActionSettings(ppMouseClick).Hyperlink.AddToFavorites

NoteWhenyouusethismethodtoaddahyperlinktotheMicrosoftInternetExplorerFavoritesfolder,aniconisaddedtotheFavoritesmenuwithoutacorrespondingname.YoumustaddthenamefromwithinInternetExplorer.

Page 2559: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ShowAll

Page 2560: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ReturninganObjectfromaCollectionTheItemmethodreturnsasingleobjectfromacollection.ThefollowingexamplesetsthefirstPresvariabletoaPresentationobjectthatrepresentspresentationone.

SetfirstPres=Presentations.Item(1)

TheItemmethodisthedefaultmethodformostcollections,soyoucanwritethesamestatementmoreconciselybyomittingtheItemkeyword.

SetfirstPres=Presentations(1)

Formoreinformationaboutaspecificcollection,seetheHelptopicforthatcollectionortheItemmethodforthecollection.

Page 2561: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

NamedObjects

AlthoughyoucanusuallyspecifyanintegervaluewiththeItemmethod,itmaybemoreconvenienttoreturnanobjectbyname.Manyobjectsaregivenautomaticallygeneratednameswhentheyarecreated.Forexample,thefirstslideyoucreatewillbeautomaticallynamed"Slide1."Ifthefirsttwoshapesyoucreatearearectangleandanoval,theirdefaultnameswillbe"Rectangle1"and"Oval2".Youmaywanttogiveanobjectamoremeaningfulnametomakeiteasiertorefertolater.Mostoften,thisisdonebysettingtheobject'sNameproperty.Thefollowingexamplesetsameaningfulnameforaslideasitisadded.Thenamecanthenbeusedinsteadoftheindexnumbertorefertotheslide.

ActivePresentation.Slides.Add(1,1).Name="HomePageSlide"

WithActivePresentation.Slides("HomePageSlide")

.FollowMasterBackground=False

.Background.Fill.PresetGradient_

msoGradientDiagonalDown,1,msoGradientBrass

EndWith

PredefinedIndexValues

Somecollectionshavepredefinedindexvaluesyoucanusetoreturnsingleobjects.Eachpredefinedindexvalueisrepresentedbyaconstant.Forexample,youspecifyaPpTextStyleTypeconstantwiththeItemmethodoftheTextStylescollectiontoreturnasingletextstyle.

Thefollowingexamplesetsthemarginsforthebodyareaonslidesintheactivepresentation.

WithActivePresentation.SlideMaster_

.TextStyles(ppBodyStyle).TextFrame

.MarginBottom=50

.MarginLeft=50

.MarginRight=50

.MarginTop=50

EndWith

Page 2562: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 2563: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

ScaleEffectObjectAnimationBehavior ScaleEffect

RepresentsascalingeffectforanAnimationBehaviorobject.

Page 2564: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheScaleEffectobject

UsetheScaleEffectpropertyoftheAnimationBehaviorobjecttoreturnaScaleEffectobject.Thefollowingexamplereferstothescaleeffectforagivenanimationbehavior.

ActivePresentation.Slides(1).TimeLine.MainSequence.Item.Behaviors(1).ScaleEffect

UsetheByX,ByY,FromX,FromY,ToX,andToYpropertiesoftheScaleEffectobjecttomanipulateanobject'sscale.Thisexamplescalesthefirstshapeonthefirstslidestartingatzeroincreasinginsizeuntilitreaches100percentofitsoriginalsize.Thisexampleassumesthatthereisashapeonthefirstslide.

SubChangeScale()

DimshpFirstAsShape

DimeffNewAsEffect

DimaniScaleAsAnimationBehavior

SetshpFirst=ActivePresentation.Slides(1).Shapes(1)

SeteffNew=ActivePresentation.Slides(1).TimeLine.MainSequence_

.AddEffect(Shape:=shpFirst,effectId:=msoAnimEffectCustom)

SetaniScale=effNew.Behaviors.Add(msoAnimTypeScale)

WithaniScale.ScaleEffect

'Startingsize

.FromX=0

.FromY=0

'Sizeafterscaleeffect

.ToX=100

.ToY=100

EndWith

EndSub

Page 2565: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any
Page 2566: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

HyperlinksCollectionObjectMultipleobjects Hyperlinks

Hyperlink

AcollectionofalltheHyperlinkobjectsonaslideormaster.

Page 2567: Microsoft Office PowerPoint 2003 Visual Basic ReferenceIn Visual Basic, there are two ways to apply properties and methods to a set of shapes. These two ways allow you to perform any

UsingtheHyperlinksCollection

UsetheHyperlinkspropertytoreturntheHyperlinkscollection.Thefollowingexampleupdatesallhyperlinksonslideoneintheactivepresentationthathavethespecifiedaddress.

ForEachhlInActivePresentation.Slides(1).Hyperlinks

Ifhl.Address="c:\currentwork\sales.ppt"Then

hl.Address="c:\new\newsales.ppt"

EndIf

Next

UsetheHyperlinkpropertytocreateahyperlinkandaddittotheHyperlinkscollection.Thefollowingexamplesetsahyperlinkthatwillbefollowedwhentheuserclicksshapethreeonslideoneintheactivepresentationduringaslideshowandaddsthenewhyperlinktothecollection.Notethatifshapethreealreadyhasamouse-clickhyperlinkdefined,thefollowingexamplewilldeletethishyperlinkfromthecollectionwhenitaddsthenewone,sothenumberofitemsintheHyperlinkscollectionwon'tchange.

WithActivePresentation.Slides(1).Shapes(3)_

.ActionSettings(ppMouseClick)

.Action=ppActionHyperlink

.Hyperlink.Address="http://www.microsoft.com"

EndWith