microsoft office powerpoint 2003 visual basic referencein visual basic, there are two ways to apply...
TRANSCRIPT
NewObjectsVisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.
NonewobjectsareaddedtotheOfficePowerPoint2003objectmodel.
NewProperties(AlphabeticalList)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.
ThefollowingtablelistspropertiesaddedtotheOfficePowerPoint2003objectmodel(sortedalphabetically).
NewProperty Object(s)DocumentLibraryVersions PresentationPermission PresentationSharedWorkspace PresentationSync Presentation
NewProperties(byObject)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.
ThefollowingtablelistspropertiesaddedtotheOfficePowerPoint2003objectmodel(sortedbyobjectname).
Object NewProperties
Presentation DocumentLibraryVersions,Permission,SharedWorkspace,Sync
NewMethodsVisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.
ThefollowingtablelistsmethodsaddedtotheOfficePowerPoint2003objectmodel.
NewMethod ObjectPresentation SendFaxOverInternet
NewEventsVisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithOfficePowerPoint2003,includingproductnews,technicalarticles,downloads,andsamples.
ThefollowingtablelistseventsaddedtotheOfficePowerPoint2003objectmodel.
NewEvent ObjectPresentationSync Application
UsingEventswiththeApplicationObjectTocreateaneventhandlerforaneventoftheApplicationobject,youneedtocompletethefollowingthreesteps:
1. Declareanobjectvariableinaclassmoduletorespondtotheevents.2. Writethespecificeventprocedures.3. Initializethedeclaredobjectfromanothermodule.
DeclaretheObjectVariable
BeforeyoucanwriteproceduresfortheeventsoftheApplicationobject,youmustcreateanewclassmoduleanddeclareanobjectoftypeApplicationwithevents.Forexample,assumethatanewclassmoduleiscreatedandcalledEventClassModule.Thenewclassmodulecontainsthefollowingcode.
PublicWithEventsAppAsApplication
WritetheEventProcedures
Afterthenewobjecthasbeendeclaredwithevents,itappearsintheObjectlistintheclassmodule,andyoucanwriteeventproceduresforthenewobject.(WhenyouselectthenewobjectintheObjectlist,thevalideventsforthatobjectarelistedintheProcedurelist.)SelectaneventfromtheProcedurelist;anemptyprocedureisaddedtotheclassmodule.
PrivateSubApp_NewPresentation()
EndSub
InitializingtheDeclaredObject
Beforetheprocedurewillrun,youmustconnectthedeclaredobjectintheclassmodule(Appinthisexample)withtheApplicationobject.Youcandothiswiththefollowingcodefromanymodule.
DimXAsNewEventClassModule
SubInitializeApp()
SetX.App=Application
EndSub
RuntheInitializeAppprocedure.Aftertheprocedureisrun,theAppobjectintheclassmodulepointstotheMicrosoftPowerPointApplicationobject,andtheeventproceduresintheclassmodulewillrunwhentheeventsoccur.
Workingwithshapes(drawingobjects)Shapes,ordrawingobjects,arerepresentedbythreedifferentobjects:theShapescollection,theShapeRangecollection,andtheShapeobject.Ingeneral,youusetheShapescollectiontocreateshapesandwhenyouwanttoiteratethroughalltheshapesonaslide;youusetheShapeobjectwhenyouwanttomodifyasingleshape;andyouusetheShapeRangecollectionwhenyouwanttomodifymultipleshapesthesamewayyoucanworkwithmultipleselectedshapesintheuserinterface.
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)
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.
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).
TheprecedingguidelinesalsoapplywhenyouaresettingpropertiesofshapesthataregroupedundersecondaryobjectsoftheShapeRangecollection,suchastheFillFormatobject.Ifthesecondaryobjectrepresentsoperationsthatcanbeperformedonmultipleselectedobjectsintheuserinterface,youwillbeabletoreturntheobjectfromaShapeRangecollectionandsetitsproperties.Forexample,youcanusetheFillpropertytoreturntheFillFormatobjectthatrepresentsthefillsofalltheshapesintheShapeRangecollection.SettingthepropertiesofthisFillFormatobjectwillsetthesamepropertiesforalltheindividualshapesintheShapeRangecollection.
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
Aligning,distributing,andgroupingshapesinashaperange
UsetheAlignandDistributemethodstopositionasetofshapesrelativetooneanotherorrelativetothedocumentthatcontainsthem.UsetheGroupmethodortheRegroupmethodtoformasinglegroupedshapefromasetofshapes.
WorkingwithPanesandViews
ChangingtheActiveView
YoucanreturnorsetthecurrentviewintheactivedocumentwindowwiththeViewTypeproperty.Thisexamplechangestheviewintheactivedocumentwindowtoslideview.
ActiveWindow.ViewType=ppViewSlide
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
Resizingpanes
YoucanusetheSplitHorizontalandtheSplitVerticalpropertiestorepositionthepanedividersinnormalviewtothespecifiedpercentageoftheavailabledocumentwindow.Thisresizesthepanesoneithersideofthedivider.Themaximumvalueofthesepropertiesisalwayslessthan100%becausetheslidepanehasaminimumsizethatdependsona10%zoomlevel.Thisexamplesetsthepercentageoftheavailabledocumentwindowheightthattheslidepaneoccupiesto65percent,leavingthenotespaneat35percent.
ActiveWindow.SplitVertical=65
PublishingaWebPresentationInMicrosoftPowerPoint,youcanpublishapresentationdirectlytoaWebserverandyoucaneditHTMLdocumentsdirectlyinPowerPoint.
SavingaPresentationasaWebPage
SavingapresentationasaWebpageistheprocessofcreatingandsavinganHTMLversionofapresentation.Todothis,usetheSaveAsmethod,asshowninthefollowingexamplewhichsavesthecurrentpresentationasc:\myfile.htm.
ActivePresentation.SaveAs"c:\myfile.htm",ppSaveAsHTMLv3,msoTrue
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
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
OpeninganHTMLdocumentinPowerPoint
ToeditanHTMLdocumentinPowerPoint,opentheHTMLdocumentusingtheOpenmethod.Thisexampleopensthefile"myfile.htm"forediting.
Presentations.OpenFilename:="c:\Windows\myfile.htm"
ShowAll
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.
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
ShowAll
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.
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.
ShowAll
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
5. Whenyouaredoneworkingwiththeotherapplication,usetheQuitmethodtocloseit,asshowninthefollowingexample.
appWd.Quit
OLEProgrammaticIdentifiersYoucanuseanOLEprogrammaticidentifier(sometimescalledaProgID)tocreateanAutomationobject.ThefollowingtableslistOLEprogrammaticidentifiersforActiveXcontrols,MicrosoftOfficeapplications,andMicrosoftOfficeWebComponents.
ActiveXControls
MicrosoftAccess
MicrosoftExcel
MicrosoftGraph
MicrosoftOfficeWebComponents
MicrosoftOutlook
MicrosoftPowerPoint
MicrosoftWord
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
MicrosoftAccess
TocreatetheMicrosoftAccessobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofAccessavailableonthemachinewherethemacroisrunning.
Tocreatethisobject UseoneoftheseidentifiersApplication Access.ApplicationCurrentData Access.CodeData,Access.CurrentDataCurrentProject Access.CodeProject,Access.CurrentProjectDefaultWebOptions Access.DefaultWebOptions
MicrosoftExcel
TocreatetheMicrosoftExcelobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofExcelavailableonthemachinewherethemacroisrunning.
Tocreatethisobject
Useoneoftheseidentifiers Comments
Application Excel.ApplicationWorkbook Excel.AddIn
Workbook Excel.ChartReturnsaworkbookcontainingtwoworksheets;oneforthechartandoneforitsdata.Thechartworksheetistheactiveworksheet.
Workbook Excel.Sheet Returnsaworkbookwithoneworksheet.
MicrosoftGraph
TocreatetheMicrosoftGraphobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofGraphavailableonthemachinewherethemacroisrunning.
Tocreatethisobject UseoneoftheseidentifiersApplication MSGraph.ApplicationChart MSGraph.Chart
MicrosoftOfficeWebComponents
TocreatetheMicrosoftOfficeWebComponentsobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofMicrosoftOfficeWebComponentsavailableonthemachinewherethemacroisrunning.
Tocreatethisobject UseoneoftheseidentifiersChartSpace OWC10.ChartDataSourceControl OWC10.DataSourceControlExpandControl OWC.ExpandControlPivotTable OWC10.PivotTableRecordNavigationControlOWC10.RecordNavigationControlSpreadsheet OWC10.Spreadsheet
MicrosoftOutlook
TocreatetheMicrosoftOutlookobjectgiveninthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofOutlookavailableonthemachinewherethemacroisrunning.
Tocreatethisobject UseoneoftheseidentifiersApplication Outlook.Application
MicrosoftPowerPoint
TocreatetheMicrosoftPowerPointobjectgiveninthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofPowerPointavailableonthemachinewherethemacroisrunning.
Tocreatethisobject UseoneoftheseidentifiersApplication PowerPoint.Application
MicrosoftWord
TocreatetheMicrosoftWordobjectslistedinthefollowingtable,useoneofthecorrespondingOLEprogrammaticidentifiers.Ifyouuseanidentifierwithoutaversionnumbersuffix,youcreateanobjectinthemostrecentversionofWordavailableonthemachinewherethemacroisrunning.
Tocreatethisobject UseoneoftheseidentifiersApplication Word.ApplicationDocument Word.Document,Word.TemplateGlobal Word.Global
ActionSettingsCollectionObjectMultipleobjects ActionSettings
ActionSettingMultipleobjects
AcollectionthatcontainsthetwoActionSettingobjectsforashapeortextrange.OneActionSettingobjectrepresentshowthespecifiedobjectreactswhentheuserclicksitduringaslideshow,andtheotherActionSettingobjectrepresentshowthespecifiedobjectreactswhentheusermovesthemousepointeroveritduringaslideshow.
UsingtheActionSettingsCollection
UsetheActionSettingspropertytoreturntheActionSettingscollection.UseActionSettings(index),whereindexiseitherppMouseClickorppMouseOver,toreturnasingleActionSettingobject.ThefollowingexamplespecifiesthattheCalculateTotalmacroberunwheneverthemousepointerpassesovertheshapeduringaslideshow.
WithActivePresentation.Slides(1).Shapes(3)_
.ActionSettings(ppMouseOver)
.Action=ppActionRunMacro
.Run="CalculateTotal"
.AnimateAction=True
EndWith
ShowAll
AddInsCollectionObjectApplication AddIns
AddIn
AcollectionofAddInobjectsthatrepresentalltheMicrosoftPowerPoint-specificadd-insavailabletoPowerPoint,regardlessofwhetherornotthey'reloaded.ThisdoesnotincludeComponentObjectModel(COM)add-ins.
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.
AdjustmentsObject
Multipleobjects Adjustments
ContainsacollectionofadjustmentvaluesforthespecifiedAutoShape,WordArtobject,orconnector.Eachadjustmentvaluerepresentsonewayanadjustmenthandlecanbeadjusted.Becausesomeadjustmenthandlescanbeadjustedintwoways—forinstance,somehandlescanbeadjustedbothhorizontallyandvertically—ashapecanhavemoreadjustmentvaluesthanithasadjustmenthandles.Ashapecanhaveuptoeightadjustments.
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
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
AnimationBehaviorsCollectionEffect AnimationBehaviors
AnimationBehaviorMultipleobjects
RepresentsacollectionofAnimationBehaviorobjects.
UsingtheAnimationBehaviorscollection
UsetheAddmethodtoaddananimationbehavior.Thefollowingexampleaddsafive-secondanimatedrotationbehaviortothemainanimationsequenceonthefirstslide.
SubAnimationObject()
DimtimeMainAsTimeLine
'Referencethemainanimationtimeline
SettimeMain=ActivePresentation.Slides(1).TimeLine
'Addafive-secondanimatedrotationbehavior
'asthefirstanimationinthemainanimationsequence
timeMain.MainSequence(1).Behaviors.AddType:=msoAnimTypeRotation,Index:=1
EndSub
AnimationPointsCollectionPropertyEffect AnimationPoints
AnimationPoint
RepresentsacollectionofanimationpointsforaPropertyEffectobject.
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
ShowAll
BordersCollectionObjectMultipleobjects Borders
LineFormatColorFormat
AcollectionofLineFormatobjectsthatrepresentthebordersanddiagonallinesofacellorrangeofcellsinatable.
UsingtheBordersCollection
EachCellobjectorCellRangecollectionhassixelementsintheBorderscollection.YoucannotaddobjectstotheBorderscollection.
UseBorders(index),whereindexidentifiesthecellborderordiagonalline,toreturnasingleBorderobject.IndexcanbeanyPPBorderTypeconstant.
PPBorderTypecanbeoneofthesePPBorderTypeconstants.ppBorderBottomppBorderLeftppBorderRightppBorderTopppBorderDiagonalDownppBorderDiagonalUp
UsetheDashStylepropertytoapplyadashedlinestyletoaBorderobject.Thisexampleselectsthesecondrowfromthetableandappliesadashedlinestyletothebottomborder.
ActiveWindow.Selection.ShapeRange.Table.Rows(2)_
.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash
CellRangeCollectionObjectMultipleobjects CellRange
Borders
AcollectionofCellobjectsinatablecolumnorrow.TheCellRangecollectionrepresentsallthecellsinthespecifiedcolumnorrow.TousetheCellRangecollection,usetheCellskeyword.
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
Remarks
AlthoughthecollectionobjectisnamedCellRangeandisshownintheObjectBrowser,thiskeywordisnotusedinprogrammingthePowerPointobjectmodel.ThekeywordCellsisusedinstead.
YoucannotprogrammaticallyaddcellstoordeletecellsfromaPowerPointtable.UsetheAddTablemethodwiththeTableobjecttoaddanewtable.UsetheAddmethodoftheColumnsorRowscollectionstoaddacolumnorrowtoatable.UsetheDeletemethodoftheColumnsorRowscollectionstodeleteacolumnorrowfromatable.
ColorSchemesCollectionObjectPresentation ColorSchemes
ColorScheme
AcollectionofalltheColorSchemeobjectsinthespecifiedpresentation.EachColorSchemeobjectrepresentsacolorscheme,whichisasetofcolorsthatareusedtogetheronaslide.
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
ColumnsCollectionObjectTable Columns
ColumnCellRange
AcollectionofColumnobjectsthatrepresentthecolumnsinatable.
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
CommentsCollectionMultipleobjects Comments
Comment
RepresentsacollectionofCommentobjects.
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
DesignsCollectionPresentation Designs
Design
Representsacollectionofslidedesigntemplates.
UsingtheDesignscollection
UsetheDesignspropertyofthePresentationobjecttoreferenceadesigntemplate.
Toaddorcloneanindividualdesigntemplate,usetheDesignscollection'sAddorClonemethods,respectively.Torefertoanindividualdesigntemplate,usetheItemmethod.
Toloadadesigntemplate,usetheLoadmethod.
ThefollowingexampleaddsanewdesigntemplatetotheDesignscollectionandconfirmsitwasaddedcorrectly.
SubAddDesignMaster()
WithActivePresentation.Designs
.AdddesignName:="MyDesignName"
MsgBox.Item("MyDesignName").Name
EndWith
EndSub
DiagramNodesCollectionDiagram DiagramNodes
DiagramNodeMultipleobjects
AcollectionofDiagramNodeobjectsthatrepresentsallthenodesinadiagram.
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
DocumentWindowsCollectionObjectMultipleobjects DocumentWindows
DocumentWindowMultipleobjects
AcollectionofalltheDocumentWindowobjectsthatarecurrentlyopeninPowerPoint.Thiscollectiondoesn'tincludeopenslideshowwindows,whichareincludedintheSlideShowWindowscollection.
UsingtheDocumentWindowsCollection
UsetheWindowspropertytoreturntheDocumentWindowscollection.Thefollowingexampletilestheopendocumentwindows.
Windows.ArrangeppArrangeTiled
UsetheNewWindowmethodtocreateadocumentwindowandaddittotheDocumentWindowscollection.Thefollowingexamplecreatesanewwindowfortheactivepresentation.
ActivePresentation.NewWindow
UseWindows(index),whereindexisthewindowindexnumber,toreturnasingleDocumentWindowobject.Thefollowingexampleclosesdocumentwindowtwo.
Windows(2).Close
FontsCollectionObjectPresentation Fonts
FontColorFormat
AcollectionofalltheFontobjectsinthespecifiedpresentation.EachFontobjectrepresentsafontthat'susedinthepresentation.
TheFontscollectionisusedbytheGeniWizardtodeterminewhetheranyofthefontsinthespecifiedpresentationwon'tbesupportedwhenGenigraphicsimagestheslides.Ifyoujustwanttosetcharacterformattingforaparticularbulletortextrange,usetheFontpropertytoreturntheFontobjectforthebulletortextrange.
TheGenigraphicswizardenablesuserstotransmittheirpresentationsdirectlytoGenigraphicsforconversionintofilmslides,overheadtransparencies,orotherspecializedmediaformats.FormoreinformationabouttheservicesGenigraphicsprovides,visittheGenigraphicsWebsiteathttp://www.genigraphics.com/.ThisservicemaynotbeavailableoutsidetheUnitedStates.
UsingtheFontsObject
UsetheFontspropertytoreturntheFontscollection.Thefollowingexampledisplaysthenumberoffontsusedintheactivepresentation.
MsgBoxActivePresentation.Fonts.Count
UseFonts(index),whereindexisthefont'snameorindexnumber,toreturnasingleFontobject.Thefollowingexamplecheckstoseewhetherfontoneintheactivepresentationisembeddedinthepresentation.
IfActivePresentation.Fonts(1).Embedded=TrueThen
MsgBox"Font1isembedded"
HeadersFootersObjectMultipleobjects HeadersFooters
HeaderFooter
ContainsalltheHeaderFooterobjectsonthespecifiedslide,notespage,handout,ormaster.EachHeaderFooterobjectrepresentsaheader,footer,dateandtime,orslidenumber.
NoteHeaderFooterobjectsaren'tavailableforSlideobjectsthatrepresentnotespages.TheHeaderFooterobjectthatrepresentsaheaderisavailableonlyforanotesmasterorhandoutmaster.
UsingtheHeaderFootersObject
UsetheHeadersFooterspropertytoreturntheHeadersFootersobject.UsetheDateAndTime,Footer,Header,orSlideNumberpropertytoreturnanindividualHeaderFooterobject.Thefollowingexamplesetsthefootertextforslideoneintheactivepresentation.
ActivePresentation.Slides(1).HeadersFooters.Footer_
.Text="VolcanoCoffee"
NamedSlideShowsCollectionObjectSlideShowSettings NamedSlideShows
NamedSlideShow
AcollectionofalltheNamedSlideShowobjectsinthepresentation.EachNamedSlideShowobjectrepresentsacustomslideshow.
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
PanesCollectionObjectDocumentWindow Panes
Pane
AcollectionofPaneobjectsthatrepresenttheslide,outline,andnotespanesinthedocumentwindowfornormalview,orthesinglepaneofanyotherviewinthedocumentwindow.
UsingthePanesCollection
UsethePanespropertytoreturnthePanescollection.Thefollowingexampletestsforthenumberofpanesintheactivewindow.Ifthevalueisone,indicatinganyviewotherthatnormalview,thennormalviewisactivatedandtheverticalpanedividerissettodividethedocumentwindowat15%outlinepaneand85%slidepane.
WithActiveWindow
If.Panes.Count=1Then
.ViewType=ppViewNormal
.SplitHorizontal=15
EndIf
EndWith
Remarks
Innormalview,thePanescollectioncontainsthreemembers.Allotherdocumentwindowviewshaveonlyasinglepane,resultinginaPanescollectionwithonemember.
ShowAll
PlaceholdersCollectionObjectShapes Placeholders
ShapeMultipleobjects
AcollectionofalltheShapeobjectsthatrepresentplaceholdersonthespecifiedslide.EachShapeobjectinthePlaceholderscollectionrepresentsaplaceholderfortext,achart,atable,anorganizationalchart,orsomeothertypeofobject.Iftheslidehasatitle,thetitleisthefirstplaceholderinthecollection.
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.
PresentationsCollectionObjectApplication Presentations
PresentationMultipleobjects
AcollectionofallthePresentationobjectsinPowerPoint.EachPresentationobjectrepresentsapresentationthat'scurrentlyopeninPowerPoint.
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
Remarks
ThePresentationscollectiondoesn'tincludeopenadd-ins,whichareaspecialkindofhiddenpresentation.Youcan,however,returnasingleopenadd-inifyouknowitsfilename.ForexamplePresentations("oscar.ppa")willreturntheopenadd-innamed"Oscar.ppa"asaPresentationobject.However,itisrecommendedthattheAddInscollectionbeusedtoreturnopenadd-ins.
PrintRangesCollectionObjectPrintOptions PrintRanges
PrintRange
AcollectionofallthePrintRangeobjectsinthespecifiedpresentation.EachPrintRangeobjectrepresentsarangeofconsecutiveslidesorpagestobeprinted.
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
PublishObjectsCollectionObjectPresentation PublishObjects
PublishObject
AcollectionofPublishObjectobjectsrepresentingthesetofcompleteorpartialloadedpresentationsthatareavailableforpublishingtoHTML.
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
Remarks
YoucanspecifythecontentandattributesofthepublishedpresentationbysettingvariouspropertiesofthePublishObjectobject.Forexample,theSourceTypepropertydefinestheportionofaloadedpresentationtobepublished.TheRangeStartpropertyandtheRangeEndpropertyspecifytherangeofslidestopublish,andtheSpeakerNotespropertydesignateswhetherornottopublishthespeaker'snotes.
YoucannotaddtothePublishObjectscollection.
RowsCollectionObjectTable Rows
RowCellRange
AcollectionofRowobjectsthatrepresenttherowsinatable.
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
RulerLevelsCollectionObjectRuler RulerLevels
RulerLevel
AcollectionofalltheRulerLevelobjectsonthespecifiedruler.EachRulerLevelobjectrepresentsthefirst-lineandleftindentfortextataparticularoutlinelevel.Thiscollectionalwayscontainsfivemembers—oneforeachoftheavailableoutlinelevels.
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
SequenceCollectionTimeLine Sequence
EffectMultipleobjects
RepresentsacollectionofEffectobjectsforaslide'sinteractiveanimationsequences.TheSequencecollectionisamemberoftheSequencescollection.
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
SequencesCollectionTimeLine Sequences
Sequence
RepresentsacollectionofSequenceobjects.UseaSequenceobjecttoadd,find,modify,andcloneanimationeffects.
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
ShapeNodesCollectionObjectMultipleobjects ShapeNodes
ShapeNode
AcollectionofalltheShapeNodeobjectsinthespecifiedfreeform.EachShapeNodeobjectrepresentseitheranodebetweensegmentsinafreeformoracontrolpointforacurvedsegmentofafreeform.YoucancreateafreeformmanuallyorbyusingtheBuildFreeformandConvertToShapemethods.
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
ShapesCollectionObjectMultipleobjects Shapes
Multipleobjects
AcollectionofalltheShapeobjectsonthespecifiedslide.EachShapeobjectrepresentsanobjectinthedrawinglayer,suchasanAutoShape,freeform,OLEobject,orpicture.
NoteIfyouwanttoworkwithasubsetoftheshapesonadocument—forexample,todosomethingtoonlytheAutoShapesonthedocumentortoonlytheselectedshapes—youmustconstructaShapeRangecollectionthatcontainstheshapesyouwanttoworkwith.Foranoverviewofhowtoworkeitherwithasingleshapeorwithmorethanoneshapeatatime,seeWorkingwithShapes(DrawingObjects).
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.
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
SlideRangeCollectionObjectMultipleobjects SlideRange
Multipleobjects
Acollectionthatrepresentsanotespageorasliderange,whichisasetofslidesthatcancontainaslittleasasingleslideorasmuchasalltheslidesinapresentation.Youcanincludewhicheverslidesyouwant—chosenfromalltheslidesinthepresentationorfromalltheslidesintheselection—toconstructasliderange.Forexample,youcouldconstructaSlideRangecollectionthatcontainsthefirstthreeslidesinapresentation,alltheselectedslidesinthepresentation,orallthetitleslidesinthepresentation.
UsingtheSlideRangeCollection
Thissectiondescribeshowto:
ReturnasetofslidesthatyouspecifybynameorindexnumberReturnallorsomeoftheselectedslidesinapresentationReturnanotespageApplypropertiesandmethodstoasliderange
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).
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
Returninganotespage
UsetheNotesPagepropertytoreturnaSlideRangecollectionthatrepresentsthespecifiednotespage.Thefollowingexampleinsertstextintoplaceholdertwo(thenotesarea)onthenotespageforslideoneintheactivepresentation.
ActivePresentation.Slides(1).NotesPage.Shapes_
.Placeholders(2).TextFrame.TextRange.InsertAfter"AddedText"
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
example,usingtheNamepropertyonaSlideRangeobjectthatcontainsmultipleslideswillgenerateanerrorbecauseeachslidehasadifferentvalueforitsNameproperty.Someformattingpropertiesofslidesaren'tsetbypropertiesandmethodsthatapplydirectlytotheSlideRangecollection,butbypropertiesandmethodsthatapplytoanobjectcontainedintheSlideRangecollection,suchastheColorSchemeobject.Ifthecontainedobjectrepresentsoperationsthatcanbeperformedonmultipleobjectsintheuserinterface,you'llbeabletoreturntheobjectfromaSlideRangecollectionthatcontainsmorethanoneslide,anditspropertiesandmethodswillfollowtheprecedingrules.Forexample,youcanusetheColorSchemepropertytoreturntheColorSchemeobjectthatrepresentsthecolorschemesusedonalltheslidesinthespecifiedSlideRangecollection.SettingpropertiesforthisColorSchemeobjectwillalsosetthesepropertiesfortheColorSchemeobjectsonalltheindividualslidesintheSlideRangecollection.
SlidesCollectionObjectPresentation Slides
SlideMultipleobjects
AcollectionofalltheSlideobjectsinthespecifiedpresentation.
UsingtheSlidesCollection
Thissectiondescribeshowto:
CreateaslideandaddittothecollectionReturnasingleslidethatyouspecifybyname,indexnumber,orslideIDnumberReturnasubsetoftheslidesinthepresentationApplyapropertyormethodtoalltheslidesinthepresentationatthesametime
Creatingaslideandaddingittothecollection
UsetheSlidespropertytoreturnaSlidescollection.UsetheAddmethodtocreateanewslideandaddittothecollection.Thefollowingexampleaddsanewslidetotheactivepresentation.
ActivePresentation.Slides.Add2,ppLayoutBlank
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
Returningasubsetoftheslidesinthepresentation
UseSlides.Range(index),whereindexistheslideindexnumberornameoranarrayofslideindexnumbersoranarrayofslidenames,toreturnaSlideRangeobjectthatrepresentsasubsetoftheSlidescollection.Thefollowingexamplesetsthebackgroundfillforslidesoneandthreeintheactivepresentation.
WithActivePresentation.Slides.Range(Array(1,3))
.FollowMasterBackground=False
.Background.Fill.PresetGradientmsoGradientHorizontal,_
1,msoGradientLateSunset
EndWith
Applyingapropertyormethodtoalltheslidesinthepresentationatthesametime
Ifyouwanttodosomethingtoalltheslidesinyourpresentationatthesametime(suchasdeleteallofthemorsetapropertyforallofthem),useSlides.RangewithnoargumenttoconstructaSlideRangecollectionthatcontainsalltheslidesintheSlidescollection,andthenapplytheappropriatepropertyormethodtotheSlideRangecollection.Thefollowingexamplesetsthebackgroundfillforalltheslidesintheactivepresentation
WithActivePresentation.Slides.Range
.FollowMasterBackground=False
.Background.Fill.PresetGradientmsoGradientHorizontal,_
1,msoGradientLateSunset
EndWith
SlideShowWindowsCollectionObjectApplication SlideShowWindows
SlideShowWindowMultipleobjects
AcollectionofalltheSlideShowWindowobjectsthatrepresenttheopenslideshowsinPowerPoint.
UsingtheSlideShowWindowsCollection
UsetheSlideShowWindowspropertytoreturntheSlideShowWindowscollection.UseSlideShowWindows(index),whereindexisthewindowindexnumber,toreturnasingleSlideShowWindowobject.Thefollowingexamplereducestheheightofslideshowwindowoneifit'safull-screenwindow.
WithSlideShowWindows(1)
If.IsFullScreenThen
.Height=.Height-20
EndIf
EndWith
UsetheRunmethodtocreateanewslideshowwindowandaddittotheSlideShowWindowscollection.Thefollowingexamplerunsaslideshowoftheactivepresentation.
ActivePresentation.SlideShowSettings.Run
TabStopsCollectionObjectRuler TabStops
TabStop
AcollectionofalltheTabStopobjectsononeruler.
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
TextStyleLevelsCollectionObjectTextStyle TextStyleLevels
TextStyleLevelMultipleobjects
Acollectionofalltheoutlinetextlevels.Thiscollectionalwayscontainsfivemembers,eachofwhichisrepresentedbyaTextStyleLevelobject.
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
TextStylesCollectionObjectMaster TextStyles
TextStyleMultipleobjects
Acollectionofthreetextstyles titletext,bodytext,anddefaulttext eachofwhichisrepresentedbyaTextStyleobject.EachtextstylecontainsaTextFrameobjectthatdescribeshowtextisplacedwithinthetextboundingbox,aRulerobjectthatcontainstabstopsandoutlineindentformattinginformation,andaTextStyleLevelscollectionthatcontainsoutlinetextformattinginformation.
UsingtheTextStylesCollection
UseTextStyles(index),whereindexiseitherppBodyStyle,ppDefaultStyle,orppTitleStyle,toreturnasingleTextStyleobject.Thisexamplesetsthemarginsforthenotesbodyareaonallthenotespagesintheactivepresentation.
WithActivePresentation.NotesMaster_
.TextStyles(ppBodyStyle).TextFrame
.MarginBottom=50
.MarginLeft=50
.MarginRight=50
.MarginTop=50
EndWith
ActionSettingObjectActionSettings ActionSetting
Multipleobjects
Containsinformationabouthowthespecifiedshapeortextrangereactstomouseactionsduringaslideshow.TheActionSettingobjectisamemberoftheActionSettingscollection.TheActionSettingscollectioncontainsoneActionSettingobjectthatrepresentshowthespecifiedobjectreactswhentheuserclicksitduringaslideshowandoneActionSettingobjectthatrepresentshowthespecifiedobjectreactswhentheusermovesthemousepointeroveritduringaslideshow.
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
Remarks
Ifyou'vesetpropertiesoftheActionSettingobjectthatdon'tseemtobetakingeffect,makesurethatyou'vesettheActionpropertytotheappropriatevalue.
ShowAll
AddInObjectAddIns AddIn
Representsasingleadd-in,eitherloadedornotloaded.TheAddInobjectisamemberoftheAddInscollection.TheAddInscollectioncontainsallofthePowerPoint-specificadd-insavailable,regardlessofwhetherornotthey'reloaded.ThecollectiondoesnotincludeComponentObjectModel(COM)add-ins.
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
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
AnimationBehaviorObjectAnimationBehaviors AnimationBehavior
Multipleobjects
Representsthebehaviorofananimationeffect,themainanimationsequence,oraninteractiveanimationsequence.TheAnimationBehaviorobjectisamemberoftheAnimationBehaviorscollection.
UsingtheAnimationBehaviorobject
UseBehaviors(index),whereindexisthenumberofthebehaviorinthesequenceofbehaviors,toreturnasingleAnimationBehaviorobject.Thefollowingexamplesetsthepositionsofthearotation'sstartingandendingpoints.ThisexampleassumesthatthefirstbehaviorforthemainanimationsequenceisaRotationEffectobject.
SubChange()
WithActivePresentation.Slides(1).TimeLine.MainSequence(1)_
.Behaviors(1).RotationEffect
.From=1
.To=180
EndWith
EndSub
AnimationPointObjectAnimationPoints AnimationPoint
Representsanindividualanimationpointforananimationbehavior.TheAnimationPointobjectisamemberoftheAnimationPointscollection.TheAnimationPointscollectioncontainsalltheanimationpointsforananimationbehavior.
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
AnimationSettingsObjectMultipleobjects AnimationSettings
Multipleobjects
Representsthespecialeffectsappliedtotheanimationforthespecifiedshapeduringaslideshow.
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
ApplicationObjectApplication Multipleobjects
RepresentstheentireMicrosoftPowerPointapplication.TheApplicationobjectcontains:
Application-widesettingsandoptions(thenameoftheactiveprinter,forexample).Propertiesthatreturntop-levelobjects,suchasActivePresentation,Windows,andsoon.
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"
Remarks
WhenyouarewritingcodethatwillrunfromPowerPoint,thefollowingpropertiesoftheApplicationobjectcanbeusedwithouttheobjectqualifier:ActivePresentation,ActiveWindow,AddIns,Assistant,CommandBars,Presentations,SlideShowWindows,Windows.Forexample,insteadofwritingApplication.ActiveWindow.Height=200,youcanwriteActiveWindow.Height=200.
AutoCorrectObjectApplication AutoCorrect
RepresentstheAutoCorrectfunctionalityinMicrosoftPowerPoint.
UsingtheAutoCorrectobject
UsetheAutoCorrectpropertytoreturnanAutoCorrectobject.ThefollowingexampledisablesdisplayingtheAutoCorrectoptionsbuttons.
SubHideAutoCorrectOpButton()
WithApplication.AutoCorrect
.DisplayAutoCorrectOptions=msoFalse
.DisplayAutoLayoutOptions=msoFalse
EndWith
EndSub
BulletFormatObjectParagraphFormat BulletFormat
Font
Representsbulletformatting.
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
CalloutFormatObjectMultipleobjects CalloutFormat
Containspropertiesandmethodsthatapplytolinecallouts.
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
CellObjectCellRange Cell
Multipleobjects
Representsatablecell.TheCellobjectisamemberoftheCellRangecollection.TheCellRangecollectionrepresentsallthecellsinthespecifiedcolumnorrow.TousetheCellRangecollection,usetheCellskeyword.
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
Remarks
YoucannotprogrammaticallyaddcellstoordeletecellsfromaPowerPointtable.UsetheAddmethodoftheColumnsorRowscollectionstoaddacolumnorrowtoatable.UsetheDeletemethodoftheColumnsorRowscollectionstodeleteacolumnorrowfromatable.
ColorEffectObjectAnimationBehavior ColorEffect
ColorFormat
Representsacoloreffectforananimationbehavior.
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
ColorFormatObject
Multipleobjects ColorFormat
Representsthecolorofaone-colorobject,theforegroundorbackgroundcolorofanobjectwithagradientorpatternedfill,orthepointercolor.Youcansetcolorstoanexplicitred-green-bluevalue(byusingtheRGBproperty)ortoacolorinthecolorscheme(byusingtheSchemeColorproperty).
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.
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
ColorSchemeObjectMultipleobjects ColorScheme
Representsacolorscheme,whichisasetofeightcolorsusedforthedifferentelementsofaslide,notespage,orhandout,suchasthetitleorbackground.(Notethatthecolorschemesforslides,notespages,andhandoutsinapresentationcanbesetindependently.)EachcolorisrepresentedbyanRGBColorobject.TheColorSchemeobjectisamemberoftheColorSchemescollection.TheColorSchemescollectioncontainsallthecolorschemesinapresentation.
UsingtheColorSchemeObject
Thissectiondescribeshowtodothefollowing:
ReturnaColorSchemeobjectfromthecollectionofallthecolorschemesinthepresentationReturntheColorSchemeobjectattachedtoaspecificslideormasterReturnthecolorofasingleslideelementfromaColorSchemeobject
ReturningaColorSchemeobjectfromthecollectionofallthecolorschemesinthepresentation
UseColorSchemes(index),whereindexisthecolorschemeindexnumber,toreturnasingleColorSchemeobject.Thefollowingexampledeletescolorschemetwofromtheactivepresentation.
ActivePresentation.ColorSchemes(2).Delete
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
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
ColumnObjectColumns Column
CellRange
Representsatablecolumn.TheColumnobjectisamemberoftheColumnscollection.TheColumnscollectionincludesallthecolumnsinatable.
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
Remarks
UsetheCellspropertytomodifytheindividualcellsinaColumnobject.Thisexampleselectsthefirstcolumninthetableandappliesadashedlinestyletothebottomborder.
ActiveWindow.Selection.ShapeRange.Table.Columns(1)_
.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash
CommandEffectObjectAnimationBehavior CommandEffect
Representsacommandeffectforananimationbehavior.Youcansendevents,callfunctions,andsendOLEverbstoembeddedobjectsusingthisobject.
UsingtheCommandEffectObject
UsetheCommandEffectpropertyoftheAnimationBehaviorobjecttoreturnaCommandEffectobject.CommandeffectscanbechangedusingtheCommandEffectobject'sCommandandTypeproperties.
Example
Thefollowingexampleshowshowtosetacommandeffectanimationbehavior.
SetbhvEffect=effectNew.Behaviors.Add(msoAnimTypeCommand)
WithbhvEffect.CommandEffect
.Type=msoAnimCommandTypeVerb
.Command=Play
EndWith
CommentObject
Comments Comment
Representsacommentonagivenslideorsliderange.TheCommentobjectisamemberoftheCommentscollectionobject.
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&_
cmtExisting.DateTime&vbTab&cmtExisting.Text&vbLf
Next
MsgBox"Thecommentsinyourdocumentareasfollows:"&vbLf_
&strComments
Else
MsgBox"Thisslidedoesn'thaveanycomments."
EndIf
EndSub
ConnectorFormatObject
Multipleobjects ConnectorFormatShape
Containspropertiesandmethodsthatapplytoconnectors.Aconnectorisalinethatattachestwoothershapesatpointscalledconnectionsites.Ifyourearrangeshapesthatareconnected,thegeometryoftheconnectorwillbeautomaticallyadjustedsothattheshapesremainconnected.
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
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
DefaultWebOptionsObjectApplication DefaultWebOptions
Containsglobalapplication-levelattributesusedbyMicrosoftPowerPointwhenyoupublishorsaveacompleteorpartialpresentationasaWebpageorwhenyouopenaWebpage.Youcanreturnorsetattributeseitherattheapplication(global)leveloratthepresentationlevel.(Notethatattributevaluescanbedifferentfromonepresentationtoanother,dependingontheattributevalueatthetimethepresentationwassaved.)Presentation-levelattributesettingsoverrideapplication-levelattributesettings.Presentation-levelattributesarecontainedintheWebOptionsobject.
UsingtheDefaultWebOptionsObject
UsetheDefaultWebOptionspropertytoreturntheDefaultWebOptionsobject.ThefollowingexamplecheckstoseewhetherPNG(PortableNetworkGraphics)areallowedasanimageformat,andthensetsthestrImageFileTypevariableaccordingly.
SetobjAppWebOptions=Application.DefaultWebOptions
WithobjAppWebOptions
If.AllowPNG=TrueThen
strImageFileType="PNG"
Else
strImageFileType="JPG"
EndIf
EndWith
DesignObjectMultipleobjects Design
Representsanindividualslidedesigntemplate.TheDesignobjectisamemberoftheDesignsandSlideRangecollectionsandtheMasterandSlideobjects.
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
DiagramObjectMultipleobjects Diagram
DiagramNodes
Representsasinglediagraminadocument.TheDiagramobjectisamemberoftheDiagramNodeandShapeobjectsandtheShapeRangecollection.
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.
DiagramNodeObjectMultipleobjects DiagramNode
Multipleobjects
Representsanodeinadiagram.
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
DiagramNodeChildrenCollectionDiagramNode DiagramNodeChildren
DiagramNode
AcollectionofDiagramNodeobjectsthatrepresentschildnodesinadiagram.
UsingtheDiagramNodeChildrencollection
UsetheChildrenpropertyoftheDiagramNodeobjecttoreturnaDiagamNodeChildrencollection.Toaddanindividualchilddiagramnodetothecollection,usetheAddNodemethod.Toreturnindividualchilddiagramnodesinthecollection,usetheFirstChildorLastChildpropertiesortheItemmethod.
Thisexampledeletesthefirstchildofthesecondnodeinthefirstdiagraminthedocument.Thisexampleassumesthatthefirstshapeintheactivedocumentisadiagramwithatleasttwonodes,onewithchildnodes.
SubDiagramNodeChild()
ActiveDocument.Shapes(1).Diagram.Nodes.Item(2)_
.Children.FirstChild.Delete
EndSub
DocumentWindowObjectMultipleobjects DocumentWindows
DocumentWindowMultipleobjects
Representsadocumentwindow.TheDocumentWindowobjectisamemberoftheDocumentWindowscollection.TheDocumentWindowscollectioncontainsalltheopendocumentwindows.
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.
UsetheSplitVerticalpropertytoreturnthepercentageofthescreenheightthattheslidepaneoccupiesinnormalview.
UsetheViewpropertytoreturntheviewinthespecifieddocumentwindow.
EffectObjectSequence Effect
Multipleobjects
Representstiminginformationaboutaslideanimation.
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
ThereisalwaysatleastoneEffectobjectineachslideregardlessofwhethertheslidehasanimationsornot.
EffectInformationObjectEffect EffectInformation
Multipleobjects
RepresentsvariousanimationoptionsforanEffectobject.
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
EffectParametersObjectEffect EffectParameters
ColorFormat
RepresentsvariousanimationparametersforanEffectobject,suchascolors,fonts,sizes,anddirections.
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
ShowAll
ExtraColorsObjectPresentation ExtraColors
Representstheextracolorsinapresentation.Theobjectcancontainuptoeightcolors,eachofwhichisrepresentedbyanred-green-blue(RGB)value.
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)
FillFormatObjectMultipleobjects FillFormat
ColorFormat
Representsfillformattingforashape.Ashapecanhaveasolid,gradient,texture,pattern,picture,orsemi-transparentfill.
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
Remarks
ManyofthepropertiesoftheFillFormatobjectareread-only.Tosetoneoftheseproperties,youhavetoapplythecorrespondingmethod.
FilterEffectObjectAnimationBehavior FilterEffect
Representsafiltereffectforananimationbehavior.
UsingtheFilterEffectObject
UsetheFilterEffectpropertyoftheAnimationBehaviorobjecttoreturnaFilterEffectobject.FiltereffectscanbechangedusingtheFilterEffectobject'sReveal,SubType,andTypeproperties.
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
FontObjectMultipleobjects Font
ColorFormat
Representscharacterformattingfortextorabullet.TheFontobjectisamemberoftheFontscollection.TheFontscollectioncontainsallthefontsusedinapresentation.
UsingtheFontObject
Thissectiondescribeshowtodothefollowing:
ReturntheFontobjectthatrepresentsthefontattributesofaspecifiedbullet,aspecifiedrangeoftext,oralltextataspecifiedoutlinelevelReturnaFontobjectfromthecollectionofallthefontsusedinthepresentation
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
ReturningaFontobjectfromthecollectionofallthefontsusedinthepresentation
UseFonts(index),whereindexisthefont'snameorindexnumber,toreturnasingleFontobject.Thefollowingexamplecheckstoseewhetherfontoneintheactivepresentationisembeddedinthepresentation.
IfActivePresentation.Fonts(1).Embedded=_
TrueThenMsgBox"Font1isembedded"
FreeformBuilderObjectFreeformBuilder
Representsthegeometryofafreeformwhileit'sbeingbuilt.
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
GroupShapesCollectionObjectMultipleobjects GroupShapes
Representstheindividualshapeswithinagroupedshape.EachshapeisrepresentedbyaShapeobject.UsingtheItemmethodwiththisobject,youcanworkwithsingleshapeswithinagroupwithouthavingtoungroupthem.
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
HeaderFooterObject
HeadersFooters HeaderFooter
Representsaheader,footer,dateandtime,slidenumber,orpagenumberonaslideormaster.AlltheHeaderFooterobjectsforaslideormasterarecontainedinaHeadersFootersobject.
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
.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
LineFormatObjectMultipleobjects LineFormat
ColorFormat
Representslineandarrowheadformatting.Foraline,theLineFormatobjectcontainsformattinginformationforthelineitself;forashapewithaborder,thisobjectcontainsformattinginformationfortheshape'sborder.
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
LinkFormatObjectMultipleobjects LinkFormat
ContainspropertiesandmethodsthatapplytolinkedOLEobjects.TheOLEFormatobjectcontainspropertiesandmethodsthatapplytoOLEobjectswhetherornotthey'relinked.ThePictureFormatobjectcontainspropertiesandmethodsthatapplytopicturesandOLEobjects.
UsingtheLinkFormatObject
UsetheLinkFormatpropertytoreturnaLinkFormatobject.ThefollowingexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.
ForEachsldInActivePresentation.Slides
ForEachshInsld.Shapes
Ifsh.Type=msoLinkedOLEObjectThen
Ifsh.OLEFormat.ProgID="Excel.Sheet"Then
sh.LinkFormat.AutoUpdate=ppUpdateOptionManual
EndIf
EndIf
Next
Next
MasterObjectMaster Multipleobjects
Representsaslidemaster,titlemaster,handoutmaster,notesmaster,ordesignmaster.
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
MotionEffectObjectAnimationBehavior MotionEffect
RepresentsamotioneffectforanAnimationBehaviorobject.
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
NamedSlideShowObjectNamedSlideShows NamedSlideShow
Representsacustomslideshow,whichisanamedsubsetofslidesinapresentation.TheNamedSlideShowobjectisamemberoftheNamedSlideShowscollection.TheNamedSlideShowscollectioncontainsallthenamedslideshowsinthepresentation.
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
ObjectVerbsObjectOLEFormat ObjectVerbs
RepresentsthecollectionofOLEverbsforthespecifiedOLEobject.OLEverbsaretheoperationssupportedbyanOLEobject.CommonlyusedOLEverbsare"play"and"edit."
UsingtheObjectVerbsObject
UsetheObjectVerbspropertytoreturnanObjectVerbsobject.ThefollowingexampledisplaysalltheavailableverbsfortheOLEobjectcontainedinshapeoneonslidetwointheactivepresentation.Forthisexampletowork,shapeonemustcontainanOLEobject.
WithActivePresentation.Slides(2).Shapes(1).OLEFormat
ForEachvIn.ObjectVerbs
MsgBoxv
Next
EndWith
OLEFormatObjectMultipleobjects OLEFormat
ObjectVerbs
ContainspropertiesandmethodsthatapplytoOLEobjects.TheLinkFormatobjectcontainspropertiesandmethodsthatapplytolinkedOLEobjectsonly.ThePictureFormatobjectcontainspropertiesandmethodsthatapplytopicturesandOLEobjects.
UsingtheOLEFormatObject
UsetheOLEFormatpropertytoreturnanOLEFormatobject.ThefollowingexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.
ForEachsldInActivePresentation.Slides
ForEachshInsld.Shapes
Ifsh.Type=msoLinkedOLEObjectThen
Ifsh.OLEFormat.ProgID="Excel.Sheet"Then
sh.LinkFormat.AutoUpdate=ppUpdateOptionManual
EndIf
EndIf
Next
Next
OptionsObjectApplication Options
RepresentsapplicationoptionsinMicrosoftPowerPoint.
UsingtheOptionsobject
UsetheOptionspropertytoreturnanOptionsobject.ThefollowingexamplesetsthreeapplicationoptionsforPowerPoint.
SubTogglePasteOptionsButton()
WithApplication.Options
If.DisplayPasteOptions=FalseThen
.DisplayPasteOptions=True
EndIf
EndWith
EndSub
PageSetupObjectPresentation PageSetup
Containsinformationaboutthepagesetupforslides,notespages,handouts,andoutlinesinapresentation.
UsingthePageSetupObject
UsethePageSetuppropertytoreturnthePageSetupobject.Thefollowingexamplesetsallslidesintheactivepresentationtobe11incheswideand8.5incheshighandsetstheslidenumberingforthepresentationtostartat17.
WithActivePresentation.PageSetup
.SlideWidth=11*72
.SlideHeight=8.5*72
.FirstSlideNumber=17
EndWith
ShowAll
PaneObject
DocumentWindow PanesPane
Anobjectrepresentingoneofthethreepanesinnormalvieworthesinglepaneofanyotherviewinthedocumentwindow.
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
Remarks
Normalviewistheonlyviewwithmultiplepanes.Allotherdocumentwindowviewshaveonlyasinglepane,whichisthedocumentwindow.
ParagraphFormatObjectMultipleobjects ParagraphFormat
BulletFormat
Representstheparagraphformattingofatextrange.
UsingtheParagraphFormatObject
UsetheParagraphFormatpropertytoreturntheParagraphFormatobject.Thefollowingexampleleftalignstheparagraphsinshapetwoonslideoneintheactivepresentation.
ActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange_
.ParagraphFormat.Alignment=ppAlignLeft
PictureFormatObjectMultipleobjects PictureFormat
ContainspropertiesandmethodsthatapplytopicturesandOLEobjects.TheLinkFormatobjectcontainspropertiesandmethodsthatapplytolinkedOLEobjectsonly.TheOLEFormatobjectcontainspropertiesandmethodsthatapplytoOLEobjectswhetherornotthey'relinked.
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
PlaceholderFormatObjectMultipleobjects PlaceholderFormat
Containspropertiesthatapplyspecificallytoplaceholders,suchasplaceholdertype.
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
PlaySettingsObjectMultipleobjects PlaySettings
Containsinformationabouthowthespecifiedmediaclipwillbeplayedduringaslideshow.
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
PresentationObjectMultipleobjects Presentation
Multipleobjects
RepresentsaPowerPointpresentation.ThePresentationobjectisamemberofthePresentationscollection.ThePresentationscollectioncontainsallthePresentationobjectsthatrepresentopenpresentationsinPowerPoint.
UsingthePresentationObject
Thissectiondescribeshowto:
ReturnapresentationthatyouspecifybynameorindexnumberReturnthepresentationintheactivewindowReturnthepresentationinanydocumentwindoworslideshowwindowyouspecify
Returningapresentationthatyouspecifybynameorindexnumber
UsePresentations(index),whereindexisthepresentation'snameorindexnumber,toreturnasinglePresentationobject.Thenameofthepresentationisthefilename,withorwithoutthefilenameextension,andwithoutthepath.ThefollowingexampleaddsaslidetothebeginningofSamplePresentation.
Presentations("SamplePresentation").Slides.Add1,1
Notethatifmultiplepresentationswiththesamenameareopen,thefirstpresentationinthecollectionwiththespecifiednameisreturned.
Returningthepresentationintheactivewindow
UsetheActivePresentationpropertytoreturnthepresentationintheactivewindow.Thefollowingexamplesavestheactivepresentation.
ActivePresentation.Save
Notethatifanembeddedpresentationisin-placeactive,theActivePresentationpropertyreturnstheembeddedpresentation.
Returningthepresentationinanydocumentwindoworslideshowwindowyouspecify
UsethePresentationpropertytoreturnthepresentationthat'sinthespecifieddocumentwindoworslideshowwindow.Thefollowingexampledisplaysthenameoftheslideshowrunninginslideshowwindowone.
MsgBoxSlideShowWindows(1).Presentation.Name
PrintOptionsObjectMultipleobjects PrintOptions
PrintRanges
Containsprintoptionsforapresentation.
NoteSpecifyingtheoptionalargumentsFrom,To,Copies,andCollateforthePrintOutmethodwillsetthecorrespondingpropertiesofthePrintOptionsobject.
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
PrintRangeObjectPrintRanges PrintRange
Representsasinglerangeofconsecutiveslidesorpagestobeprinted.ThePrintRangeobjectisamemberofthePrintRangescollection.ThePrintRangescollectioncontainsalltheprintrangesthathavebeendefinedforthespecifiedpresentation.
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
Remarks
YoucansetprintrangesinthePrintRangescollectionindependentoftheRangeTypesetting;theserangesareretainedaslongasthepresentationthey'recontainedinisloaded.TherangesinthePrintRangescollectionareappliedwhentheRangeTypepropertyissettoppPrintSlideRange.
PropertyEffectObjectAnimationBehavior PropertyEffect
AnimationPoints
RepresentsapropertyeffectforanAnimationBehaviorobject.
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
PublishObjectObjectPublishObjects PublishObject
RepresentsacompleteorpartialloadedpresentationthatisavailableforpublishingtoHTML.ThePublishObjectobjectisamemberofthePublishObjectscollection.
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
Remarks
YoucanspecifythecontentandattributesofthepublishedpresentationbysettingvariouspropertiesofthePublishObjectobject.Forexample,theSourceTypepropertydefinestheportionofaloadedpresentationtobepublished.TheRangeStartpropertyandtheRangeEndpropertyspecifytherangeofslidestopublish,andtheSpeakerNotespropertydesignateswhetherornottopublishthespeaker'snotes.
RGBColorObjectRGBColor
Representsasinglecolorinacolorscheme.
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
RotationEffectObjectAnimationBehavior RotationEffect
RepresentsarotationeffectforanAnimationBehaviorobject.
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
RowObjectRows Row
CellRange
Representsarowinatable.TheRowobjectisamemberoftheRowscollection.TheRowscollectionincludesalltherowsinthespecifiedtable.
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
Remarks
UsetheCellspropertytomodifytheindividualcellsinaRowobject.Thisexampleselectsthesecondrowinthetableandappliesadashedlinestyletothebottomborder.
ActiveWindow.Selection.ShapeRange.Table.Rows(2)_
.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash
RulerObjectMultipleobjects Ruler
Multipleobjects
Representstherulerforthetextinthespecifiedshapeorforalltextinthespecifiedtextstyle.Containstabstopsandtheindentationsettingsfortextoutlinelevels.
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
RulerLevelObjectRulerLevels RulerLevel
Containsfirst-lineindentandhangingindentinformationforanoutlinelevel.TheRulerLevelobjectisamemberoftheRulerLevelscollection.TheRulerLevelscollectioncontainsaRulerLevelobjectforeachofthefiveavailableoutlinelevels.
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
SelectionObjectDocumentWindow Selection
Multipleobjects
Representstheselectioninthespecifieddocumentwindow.
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
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
Remarks
TheSelectionobjectisdeletedwheneveryouchangeslidesinanactiveslideview(theTypepropertywillreturnppSelectionNone).
SetEffectObjectAnimationBehavior SetEffect
Representsaseteffectforananimationbehavior.YoucanusetheSetEffectobjecttosetthevalueofaproperty.
UsingtheSetEffectObject
UsetheSetEffectpropertyoftheAnimationBehaviorobjecttoreturnaSetEffectobject.SeteffectscanbechangedusingtheSetEffectobject'sPropertyandToproperties.
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
ShadowFormatObjectMultipleobjects ShadowFormat
ColorFormat
Representsshadowformattingforashape.
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
ShowAll
ShapeObjectMultipleobjects Shape
Multipleobjects
Representsanobjectinthedrawinglayer,suchasanAutoShape,freeform,OLEobject,orpicture.
NoteTherearethreeobjectsthatrepresentshapes:theShapescollection,whichrepresentsalltheshapesonadocument;theShapeRangecollection,whichrepresentsaspecifiedsubsetoftheshapesonadocument(forexample,aShapeRangeobjectcouldrepresentshapesoneandfouronthedocument,oritcouldrepresentalltheselectedshapesonthedocument);theShapeobject,whichrepresentsasingleshapeonadocument.Ifyouwanttoworkwithseveralshapeatthesametimeorwithshapeswithintheselection,useaShapeRangecollection.Foranoverviewofhowtoworkwitheitherasingleshapeorwithmorethanoneshapeatatime,seeWorkingwithShapes(DrawingObjects).
UsingtheShapeObject
Thissectiondescribeshowto:
Returnanexistingshapeonaslide,indexedbynameornumber.Returnanewlycreatedshapeonaslide.Returnashapewithintheselection.Returntheslidetitleandotherplaceholdersonaslide.Returntheshapesattachedtotheendsofaconnector.Returnthedefaultshapeforapresentation.Returnanewlycreatedfreeform.Returnasingleshapefromwithinagroup.Returnanewlyformedgroupofshapes.
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
ReturningaNewlyCreatedShapeonaSlide
ToaddashapetoaslideandreturnaShapeobjectthatrepresentsthenewlycreatedshape,useoneofthefollowingmethodsoftheShapescollection:AddCallout,AddComment,AddConnector,AddCurve,AddLabel,AddLine,AddMediaObject,AddOLEObject,AddPicture,AddPlaceholder,AddPolyline,AddShape,AddTable,AddTextbox,AddTextEffect,AddTitle.
ReturningaShapeWithintheSelection
UseSelection.ShapeRange(index),whereindexistheshapenameortheindexnumber,toreturnaShapeobjectthatrepresentsashapewithintheselection.Thefollowingexamplesetsthefillforthefirstshapeintheselectionintheactivewindow,assumingthatthere'satleastoneshapeintheselection.
ActiveWindow.Selection.ShapeRange(1).Fill_
.ForeColor.RGB=RGB(255,0,0)
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
ReturningtheShapesAttachedtotheEndsofaConnector
ToreturnaShapeobjectthatrepresentsoneoftheshapesattachedbyaconnector,usetheBeginConnectedShapeorEndConnectedShapeproperty.
ReturningtheDefaultShapeforaPresentation
ToreturnaShapeobjectthatrepresentsthedefaultshapeforapresentation,usetheDefaultShapeproperty.
Returninganewlycreatedfreeform
UsetheBuildFreeformandAddNodesmethodstodefinethegeometryofanewfreeform,andusetheConvertToShapemethodtocreatethefreeformandreturntheShapeobjectthatrepresentsit.
ReturningaSingleShapefromWithinaGroup
UseGroupItems(index),whereindexistheshapenameortheindexnumberwithinthegroup,toreturnaShapeobjectthatrepresentsasingleshapeinagroupedshape.
ReturningaNewlyFormedGroupofShapes
UsetheGrouporRegroupmethodtogrouparangeofshapesandreturnasingleShapeobjectthatrepresentsthenewlyformedgroup.Afteragrouphasbeenformed,youcanworkwiththegroupthesamewayyouworkwithanyothershape.
ShapeNodeObjectShapeNodes ShapeNode
Representsthegeometryandthegeometry-editingpropertiesofthenodesinauser-definedfreeform.Nodesincludetheverticesbetweenthesegmentsofthefreeformandthecontrolpointsforcurvedsegments.TheShapeNodeobjectisamemberoftheShapeNodescollection.TheShapeNodescollectioncontainsallthenodesinafreeform.
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
ShapeRangeCollectionObjectMultipleobjects ShapeRange
Multipleobjects
Representsashaperange,whichisasetofshapesonadocument.Ashaperangecancontainasfewasasingleshapeorasmanyasalltheshapesonthedocument.Youcanincludewhichevershapesyouwant—chosenfromamongalltheshapesonthedocumentoralltheshapesintheselection—toconstructashaperange.Forexample,youcouldconstructaShapeRangecollectionthatcontainsthefirstthreeshapesonadocument,alltheselectedshapesonadocument,orallthefreeformsonadocument.
Foranoverviewofhowtoworkwitheitherasingleshapeorwithmorethanoneshapeatatime,seeWorkingwithShapes(DrawingObjects).
UsingtheShapeRangeCollection
Thissectiondescribeshowto:
Returnasetofshapesyouspecifybynameorindexnumber.Returnallorsomeoftheselectedshapesonadocument.
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).
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)
SlideObjectMultipleobjects SlideRange
SlideMultipleobjects
Representsaslide.TheSlidescollectioncontainsalltheSlideobjectsinapresentation.
NoteDon'tbeconfusedifyou'retryingtoreturnareferencetoasingleslidebutyouendupwithaSlideRangeobject.AsingleslidecanberepresentedeitherbyaSlideobjectorbyaSlideRangecollectionthatcontainsonlyoneslide,dependingonhowyoureturnareferencetotheslide.Forexample,ifyoucreateandreturnareferencetoaslidebyusingtheAddmethod,theslideisrepresentedbyaSlideobject.However,ifyoucreateandreturnareferencetoaslidebyusingtheDuplicatemethod,theslideisrepresentedbyaSlideRangecollectionthatcontainsasingleslide.BecauseallthepropertiesandmethodsthatapplytoaSlideobjectalsoapplytoaSlideRangecollectionthatcontainsasingleslide,youcanworkwiththereturnedslideinthesameway,regardlessofwhetherit'srepresentedbyaSlideobjectoraSlideRangecollection.
UsingtheSlideObject
Thissectiondescribeshowto:
Returnaslidethatyouspecifybyname,indexnumber,orslideIDnumberReturnaslideintheselectionReturntheslidethat'scurrentlydisplayedinanydocumentwindoworslideshowwindowyouspecifyCreateanewslide
Returningaslidethatyouspecifybyname,indexnumber,orslideIDnumber
UseSlides(index),whereindexistheslidenameorindexnumber,oruseSlides.FindBySlideID(index),whereindexistheslideIDnumber,toreturnasingleSlideobject.Thefollowingexamplesetsthelayoutforslideoneintheactivepresentation.
ActivePresentation.Slides(1).Layout=ppLayoutTitle
ThefollowingexamplesetsthelayoutfortheslidewiththeIDnumber265.
ActivePresentation.Slides.FindBySlideID(265).Layout=ppLayoutTitle
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
Returningtheslidethat'scurrentlydisplayedinanydocumentwindoworslideshowwindowyouspecify
UsetheSlidepropertytoreturntheslidethat'scurrentlydisplayedinthespecifieddocumentwindoworslideshowwindowview.Thefollowingexamplecopiestheslidethat'scurrentlydisplayedindocumentwindowtwototheClipboard.
Windows(2).View.Slide.Copy
Creatinganewslide
UsetheAddmethodtocreateanewslideandaddittothepresentation.Thefollowingexampleaddsatitleslidetothebeginningoftheactivepresentation.
ActivePresentation.Slides.Add1,ppLayoutTitleOnly
SlideShowSettingsObjectPresentation SlideShowSettings
Multipleobjects
Representstheslideshowsetupforapresentation.
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
SlideShowTransitionObjectMultipleobjects SlideShowTransition
SoundEffect
Containsinformationabouthowthespecifiedslideadvancesduringaslideshow.
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
ShowAll
SlideShowViewObjectSlideShowWindow SlideShowView
Multipleobjects
Representstheviewinaslideshowwindow.
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
SlideShowWindowObjectApplication SlideShowWindows
SlideShowWindowMultipleobjects
Representsawindowinwhichaslideshowruns.
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
SoundEffectObjectMultipleobjects SoundEffect
Representsthesoundeffectthataccompaniesananimationorslidetransitioninaslideshow.
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"
TableObjectMultipleobjects Table
Multipleobjects
Representsatableshapeonaslide.TheTableobjectisamemberoftheShapescollection.TheTableobjectcontainstheColumnscollectionandtheRowscollection.
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)
TabStopObjectTabStops TabStop
Representsasingletabstop.TheTabStopobjectisamemberoftheTabStopscollection.TheTabStopscollectionrepresentsallthetabstopsononeruler.
UsingTheTabstopObject
UseTabStops(index),whereindexisthetabstopindexnumber,toreturnasingleTabStopobject.Thefollowingexampleclearstabstoponeforthetextinshapetwoonslideoneintheactivepresentation.
ActivePresentation.Slides(1).Shapes(2).TextFrame_
.Ruler.TabStops(1).Clear
TagsObjectMultipleobjects Tags
Representsatagoracustompropertythatyoucancreateforashape,slide,orpresentation.EachTagsobjectcontainsthenameofacustompropertyandavalueforthatproperty.
Createtagswhenyouwanttobeabletoselectivelyworkwithspecificmembersofacollection,basedonanattributethatisn'talreadyrepresentedbyabuilt-inproperty.Forexample,ifyouwanttobeabletocategorizeslidesinapresentationbasedonwhatregionofthecountry/regiontheyapplyto,youcouldcreateaRegiontagandassignaRegionvaluetoeachslideinthepresentation.Youcouldthenselectivelyperformanoperationonsomeoftheslides,basedonthevaluesoftheirRegiontags,suchashidingalltheslideswiththeRegionvalue"East."
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
TextEffectFormatObjectMultipleobjects TextEffectFormat
ContainspropertiesandmethodsthatapplytoWordArtobjects.
UsingtheTextEffectFormatObject
UsetheTextEffectpropertytoreturnaTextEffectFormatobject.ThefollowingexamplesetsthefontnameandformattingforshapeoneonmyDocument.Forthisexampletowork,shapeonemustbeaWordArtobject.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).TextEffect
.FontName="CourierNew"
.FontBold=True
.FontItalic=True
EndWith
ShowAll
TextFrameObjectMultipleobjects TextFrame
Multipleobjects
RepresentsthetextframeinaShapeobject.Containsthetextinthetextframeaswellasthepropertiesandmethodsthatcontrolthealignmentandanchoringofthetextframe.
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
TextRangeObjectMultipleobjects TextRange
Multipleobjects
Containsthetextthat'sattachedtoashape,aswellaspropertiesandmethodsformanipulatingthetext.
UsingtheTextRangeObject
Thissectiondescribeshowto:
Returnthetextrangeinanyshapeyouspecify.Returnatextrangefromtheselection.Returnparticularcharacters,words,lines,sentences,orparagraphsfromatextrange.Findandreplacetextinatextrange.Inserttext,thedateandtime,ortheslidenumberintoatextrange.Positiontheinsertionpointwhereveryouwantinatextrange.
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.
ReturningaTextRangefromtheSelection
UsetheTextRangepropertyoftheSelectionobjecttoreturnthecurrentlyselectedtext.ThefollowingexamplecopiestheselectiontotheClipboard.
ActiveWindow.Selection.TextRange.Copy
ReturningParticularCharacters,Words,Lines,Sentences,orParagraphsfromaTextRange
UseoneofthefollowingmethodstoreturnaportionofthetextofaTextRangeobject:Characters,Lines,Paragraphs,Runs,Sentences,orWords.
FindingandReplacingTextinaTextRange
UsetheFindandReplacemethodstofindandreplacetextinatextrange.
InsertingText,theDateandTime,ortheSlideNumberintoaTextRange
UseoneofthefollowingmethodstoinsertcharactersintoaTextRangeobject:InsertAfter,InsertBefore,InsertDateTime,InsertSlideNumber,orInsertSymbol.
TextStyleObjectTextStyles TextStyle
Multipleobjects
Representsoneofthreetextstyles:titletext,bodytext,ordefaulttext.EachtextstylecontainsaTextFrameobjectthatdescribeshowtextisplacedwithinthetextboundingbox,aRulerobjectthatcontainstabstopsandoutlineindentformattinginformation,andaTextStyleLevelscollectionthatcontainsoutlinetextformattinginformation.TheTextStyleobjectisamemberoftheTextStylescollection.
UsingtheTextStyleObject
UseTextStyles(index),whereindexiseitherppBodyStyle,ppDefaultStyle,orppTitleStyle,toreturnasingleTextStyleobject.Thefollowingexamplesetsthefontnameandfontsizeforlevel-onebodytextonalltheslidesintheactivepresentation.
WithActivePresentation.SlideMaster_
.TextStyles(ppBodyStyle).Levels(1)
With.Font
.Name="Arial"
.Size=36
EndWith
EndWith
TextStyleLevelObjectTextStyleLevels TextStyleLevel
Multipleobjects
Containscharacterandparagraphformattinginformationforanoutlinelevel.TheTextStyleLevelobjectisamemberoftheTextStyleLevelscollection.TheTextStyleLevelscollectioncontainsoneTextStyleLevelobjectforeachofthefiveoutlinelevels
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
ThreeDFormatObjectMultipleobjects ThreeDFormat
ColorFormat
Representsashape'sthree-dimensionalformatting.
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
Remarks
Youcannotapplythree-dimensionalformattingtosomekindsofshapes,suchasbeveledshapesormultiple-disjointpaths.MostofthepropertiesandmethodsoftheThreeDFormatobjectforsuchashapewillfail.
TimeLineObjectMultipleobjects TimeLine
Multipleobjects
StoresanimationinformationforaMaster,SlideorSlideRangeobject.
UsingtheTimeLineobject
UsetheTimeLinepropertyoftheMaster,Slide,orSlideRangeobjecttoreturnaTimeLineobject.
TheTimeLineobject'sMainSequencepropertygainsaccesstothemainanimationsequence,whiletheInteractiveSequencespropertygainsaccesstothecollectionofinteractiveanimationsequencesofaslideorsliderange.Toreferenceatimelineobject,usesyntaxsimilartothesecodeexamples:
ActivePresentation.Slides(1).TimeLine.MainSequence
ActivePresentation.SlideMaster.TimeLine.InteractiveSequences
ActiveWindow.Selection.SlideRange.TimeLine.InteractiveSequences
TimingObject
Multipleobjects TimingShape
Representstimingpropertiesforananimationeffect.
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
ShowAll
ViewObjectDocumentWindow View
PrintOptions
Representsthecurrenteditingviewinthespecifieddocumentwindow.
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.
WebOptionsObjectPresentation WebOptions
Containspresentation-levelattributesusedbyMicrosoftPowerPointwhenyousaveorpublishacompleteorpartialpresentationasaWebpageoropenaWebpage.Youcanreturnorsetattributeseitherattheapplication(global)leveloratthepresentationlevel.(Notethatattributevaluescanbedifferentfromonepresentationtoanother,dependingontheattributevalueatthetimethepresentationwassaved.)Presentation-levelattributesettingsoverrideapplication-levelattributesettings.Application-levelattributesarecontainedintheDefaultWebOptionsobject.
UsingtheWebOptionsObject
UsetheWebOptionspropertytoreturntheWebOptionsobject.ThefollowingexamplecheckstoseewhetherPortableNetworkGraphics(PNG)isallowedasanimageformatforpresentationone.IfPNGisallowed,itsetsthetextcolorfortheoutlinepanetowhiteandthebackgroundcolorfortheoutlineandslidepanestoblack.
SetobjAppWebOptions=Presentations(1).WebOptions
WithobjAppWebOptions
If.AllowPNG=TrueThen
.FrameColors=ppFrameColorsWhiteTextOnBlack
EndIf
EndWith
ActivateMethodActivatesthespecifiedobject.
expression.Activate
expressionRequired.AnexpressionthatreturnsaDocumentWindow,Pane,OLEFormat,Application,orSlideShowWindowobject.
Example
Thisexampleactivatesthedocumentwindowimmediatelyfollowingtheactivewindowinthedocumentwindoworder.
Windows(2).Activate
ShowAll
AddMethodAddmethodasitappliestotheAddInsobject.
ReturnsanAddInobjectthatrepresentsanadd-infileaddedtothelistofadd-ins.
expression.Add(Filename)
expressionRequired.AnexpressionthatreturnsanAddInsobject.
FilenameRequiredString.Thefullnameofthefile(includingthepathandfilenameextension)thatcontainstheadd-inyouwanttoaddtothelistofadd-ins.
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.
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.
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
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
showsinthespecifiedpresentation.ReturnsaNamedSlideShowobjectthatrepresentsthenewnamedslideshow.
expression.Add(Name,SafeArrayOfSlideIDs)
expressionRequired.AnexpressionthatreturnsaNamedSlideShowsobject.
NameRequiredString.Thenameoftheslideshow.
SafeArrayOfSlideIDsRequiredVariant.ContainstheuniqueslideIDsoftheslidestobedisplayedinaslideshow.
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
greaterthanorequaltothevalueoftheStartargument.
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
setto1,thenewslidebecomesthefirstslideinthepresentation.
LayoutRequiredPpSlideLayout.Thetypeofslidetocreate.
PpSlideLayoutcanbeoneofthesePpSlideLayoutconstants.ppLayoutBlankppLayoutChartppLayoutChartAndTextppLayoutClipartAndTextppLayoutClipArtAndVerticalTextppLayoutFourObjectsppLayoutLargeObjectppLayoutMediaClipAndTextppLayoutMixedppLayoutObjectppLayoutObjectAndTextppLayoutObjectOverTextppLayoutOrgchartppLayoutTableppLayoutTextppLayoutTextAndChartppLayoutTextAndClipartppLayoutTextAndMediaClipppLayoutTextAndObjectppLayoutTextAndTwoObjectsppLayoutTextOverObjectppLayoutTitleppLayoutTitleOnlyppLayoutTwoColumnTextppLayoutTwoObjectsAndTextppLayoutTwoObjectsOverTextppLayoutVerticalTextppLayoutVerticalTitleAndTextppLayoutVerticalTitleAndTextOverChart
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.
ValueRequiredString.Thenewtagvalue.
Remarks
TheTagsobjectcontainsapairofstrings—thetagnameandthetagvalue—foreachtag.UsetheAddmethodtocreateatag,andusetheNameandValuemethodstoreturnatag'snameandvaluecomponents.
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
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
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
AsitappliestotheExtraColorsobject.
Thisexampleaddsanextracolortotheactivepresentation(ifthecolorhasn'talreadybeenadded).
ActivePresentation.ExtraColors.AddRGB(Red:=69,Green:=32,Blue:=155)
AddBaselineMethodAddsabaselinetoapresentationtoallowtrackingofchangesforalatermerge.
expression.AddBaseline(FileName)
expressionRequired.AnexpressionthatreturnsaPresentationobject.
FileNameOptionalString.Thefullpathofafiletouseasthebaselineforthispresentation.IfFileNameisnotspecified,thenthepresentationrepresentedbyexpressionisusedasitsownbaseline.
Remarks
Thismethodgeneratesanerrorifthepresentationalreadyhasabaseline,orisamergedauthordocument.
Example
Thefollowinglineofcodeaddsabaselinetotheactivepresentation.
SubSetBaseline()
ActivePresentation.AddBaseline
EndSub
ShowAll
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.
Remarks
YoucaninsertagreatervarietyofcalloutsbyusingtheAddShapemethod.
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
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.
Example
Thisexampleaddsacommentthatcontainsthetext"TestComment"tomyDocument.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes.AddComment(100,100,150,150)
.TextFrame.TextRange.Text=.TextFrame_
.TextRange.Text+"TestComment"
EndWith
ShowAll
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.
Remarks
Whenyouattachaconnectortoashape,thesizeandpositionoftheconnectorareautomaticallyadjusted,ifnecessary.Therefore,ifyou'regoingtoattachaconnectortoothershapes,thepositionanddimensionsyouspecifywhenaddingtheconnectorareirrelevant.
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
ShowAll
AddCurveMethodCreatesaBéziercurve.ReturnsaShapeobjectthatrepresentsthenewcurve.
expression.AddCurve(SafeArrayOfPoints)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
SafeArrayOfPointsRequiredVariant.Anarrayofcoordinatepairsthatspecifiestheverticesandcontrolpointsofthecurve.Thefirstpointyouspecifyisthestartingvertex,andthenexttwopointsarecontrolpointsforthefirstBéziersegment.Then,foreachadditionalsegmentofthecurve,youspecifyavertexandtwocontrolpoints.Thelastpointyouspecifyistheendingvertexforthecurve.Notethatyoumustalwaysspecify3n+1points,wherenisthenumberofsegmentsinthecurve.
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
ShowAll
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.
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
ShowAll
AddEffectMethodReturnsanEffectobjectthatrepresentsanewanimationeffectaddedtoasequenceofanimationeffects.
expression.AddEffect(Shape,effectId,Level,trigger,Index)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
ShapeRequiredShapeobject.Theshapetowhichtheanimationeffectisadded.
effectIdRequiredMsoAnimEffect.Theanimationeffecttobeapplied.
MsoAnimEffectcanbeoneoftheseMsoAnimEffectconstants.msoAnimEffectAppearmsoAnimEffectArcUpmsoAnimEffectAscendmsoAnimEffectBlastmsoAnimEffectBlindsmsoAnimEffectBoldFlashmsoAnimEffectBoldRevealmsoAnimEffectBoomerangmsoAnimEffectBouncemsoAnimEffectBoxmsoAnimEffectBrushOnColormsoAnimEffectBrushOnUnderlinemsoAnimEffectCenterRevolvemsoAnimEffectChangeFillColormsoAnimEffectChangeFontmsoAnimEffectChangeFontColormsoAnimEffectChangeFontSizemsoAnimEffectChangeFontStyle
msoAnimEffectChangeLineColormsoAnimEffectCheckerboardmsoAnimEffectCirclemsoAnimEffectColorBlendmsoAnimEffectColorRevealmsoAnimEffectColorWavemsoAnimEffectComplementaryColormsoAnimEffectComplementaryColor2msoAnimEffectContrastingColormsoAnimEffectCrawlmsoAnimEffectCreditsmsoAnimEffectCustommsoAnimEffectDarkenmsoAnimEffectDesaturatemsoAnimEffectDescendmsoAnimEffectDiamondmsoAnimEffectDissolvemsoAnimEffectEaseInmsoAnimEffectExpandmsoAnimEffectFademsoAnimEffectFadedAscendmsoAnimEffectFadedSwivelmsoAnimEffectFadedZoommsoAnimEffectFlashBulbmsoAnimEffectFlashOncemsoAnimEffectFlickermsoAnimEffectFlipmsoAnimEffectFloatmsoAnimEffectFlymsoAnimEffectFoldmsoAnimEffectGlidemsoAnimEffectGrowAndTurnmsoAnimEffectGrowShrink
msoAnimEffectGrowWithColormsoAnimEffectLightenmsoAnimEffectLightSpeedmsoAnimEffectMediaPausemsoAnimEffectMediaPlaymsoAnimEffectMediaStopmsoAnimEffectPath4PointStarmsoAnimEffectPath5PointStarmsoAnimEffectPath6PointStarmsoAnimEffectPath8PointStarmsoAnimEffectPathArcDownmsoAnimEffectPathArcLeftmsoAnimEffectPathArcRightmsoAnimEffectPathArcUpmsoAnimEffectPathBeanmsoAnimEffectPathBounceLeftmsoAnimEffectPathBounceRightmsoAnimEffectPathBuzzsawmsoAnimEffectPathCirclemsoAnimEffectPathCrescentMoonmsoAnimEffectPathCurvedSquaremsoAnimEffectPathCurvedXmsoAnimEffectPathCurvyLeftmsoAnimEffectPathCurvyRightmsoAnimEffectPathCurvyStarmsoAnimEffectPathDecayingWavemsoAnimEffectPathDiagonalDownRightmsoAnimEffectPathDiagonalUpRightmsoAnimEffectPathDiamondmsoAnimEffectPathDownmsoAnimEffectPathEqualTrianglemsoAnimEffectPathFigure8FourmsoAnimEffectPathFootball
msoAnimEffectPathFunnelmsoAnimEffectPathHeartmsoAnimEffectPathHeartbeatmsoAnimEffectPathHexagonmsoAnimEffectPathHorizontalFigure8msoAnimEffectPathInvertedSquaremsoAnimEffectPathInvertedTrianglemsoAnimEffectPathLeftmsoAnimEffectPathLoopdeLoopmsoAnimEffectPathNeutronmsoAnimEffectPathOctagonmsoAnimEffectPathParallelogrammsoAnimEffectPathPeanutmsoAnimEffectPathPentagonmsoAnimEffectPathPlusmsoAnimEffectPathPointyStarmsoAnimEffectPathRightTrianglemsoAnimEffectPathSCurve1msoAnimEffectPathSCurve2msoAnimEffectPathSineWavemsoAnimEffectPathSpiralLeftmsoAnimEffectPathSpiralRightmsoAnimEffectPathSpringmsoAnimEffectPathSquaremsoAnimEffectPathStairsDownmsoAnimEffectPathSwooshmsoAnimEffectPathTeardropmsoAnimEffectPathTrapezoidmsoAnimEffectPathTurnDownmsoAnimEffectPathTurnRightmsoAnimEffectPathTurnUpmsoAnimEffectPathTurnUpRightmsoAnimEffectPathVerticalFigure8
msoAnimEffectPathWavemsoAnimEffectPathZigzagmsoAnimEffectPeekmsoAnimEffectPinwheelmsoAnimEffectPlusmsoAnimEffectRandomBarsmsoAnimEffectRandomEffectsmsoAnimEffectRiseUpmsoAnimEffectShimmermsoAnimEffectSlingmsoAnimEffectSpinmsoAnimEffectSpinnermsoAnimEffectSpiralmsoAnimEffectSplitmsoAnimEffectStretchmsoAnimEffectStretchymsoAnimEffectStripsmsoAnimEffectStyleEmphasismsoAnimEffectSwishmsoAnimEffectSwivelmsoAnimEffectTeetermsoAnimEffectThinLinemsoAnimEffectTransparencymsoAnimEffectUnfoldmsoAnimEffectVerticalGrowmsoAnimEffectWavemsoAnimEffectWedgemsoAnimEffectWheelmsoAnimEffectWhipmsoAnimEffectWipemsoAnimEffectZipmsoAnimEffectZoom
LevelOptionalMsoAnimateByLevel.Forcharts,diagrams,ortext,theleveltowhichtheanimationeffectwillbeapplied.ThedefaultvalueismsoAnimationLevelNone.
MsoAnimateByLevelcanbeoneoftheseMsoAnimateByLevelconstants.msoAnimateChartAllAtOncemsoAnimateChartByCategorymsoAnimateChartByCategoryElementsmsoAnimateChartBySeriesmsoAnimateChartBySeriesElementsmsoAnimateDiagramAllAtOncemsoAnimateDiagramBreadthByLevelmsoAnimateDiagramBreadthByNodemsoAnimateDiagramClockwisemsoAnimateDiagramClockwiseInmsoAnimateDiagramClockwiseOutmsoAnimateDiagramCounterClockwisemsoAnimateDiagramCounterClockwiseInmsoAnimateDiagramCounterClockwiseOutmsoAnimateDiagramDepthByBranchmsoAnimateDiagramDepthByNodemsoAnimateDiagramDownmsoAnimateDiagramInByRingmsoAnimateDiagramOutByRingmsoAnimateDiagramUpmsoAnimateLevelMixedmsoAnimateTextByAllLevelsmsoAnimateTextByFifthLevelmsoAnimateTextByFirstLevelmsoAnimateTextByFourthLevelmsoAnimateTextBySecondLevelmsoAnimateTextByThirdLevelmsoAnimationLevelNone
triggerOptionalMsoAnimTriggerType.Theactionthattriggerstheanimationeffect.ThedefaultvalueismsoAnimTriggerOnPageClick.
MsoAnimTriggerTypecanbeoneoftheseMsoAnimTriggerTypeconstants.msoAnimTriggerAfterPreviousmsoAnimTriggerMixedmsoAnimTriggerNonemsoAnimTriggerOnPageClickmsoAnimTriggerOnShapeClickmsoAnimTriggerWithPrevious
IndexOptionalLong.Thepositionatwhichtheeffectwillbeplacedinthecollectionofanimationeffects.Thedefaultvalueis-1(addedtotheend).
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
ShowAll
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.
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"
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.
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
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.
Example
Thisexampleaddsthemovienamed"Clock.avi"tomyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.AddMediaObjectFileName:="C:\WINNT\clock.avi",_
Left:=5,Top:=5,Width:=100,Height:=100
ShowAll
AddNodeMethodAddNodemethodasitappliestotheDiagramNodeChildrenobject.
AddsaDiagramNodeobjecttoacollectionofchilddiagramnodes.
expression.AddNode(Index)
expressionRequired.AnexpressionthatreturnsaDiagramNodeChildrenobject.
IndexOptionalVariant.Theindexlocationofwheretoaddthenewdiagramnode;0addsbeforeallnodes;-1addsafterallnodes;anyotherIndexwilladdafterthatnodeinthecollection.
AddNodemethodasitappliestotheDiagramNodeobject.
ReturnsaDiagramNodeobjectthatrepresentsanodeaddedtoadiagram.
expression.AddNode(Pos)
expressionRequired.AnexpressionthatreturnsaDiagramNodeobject.
PosOptionalMsoRelativeNodePosition.Specifieswherethenodewillbeadded,relativetothecallingnode.
MsoRelativeNodePositioncanbeoneoftheseMsoRelativeNodePositionconstants.msoAfterLastSiblingmsoAfterNodedefaultmsoBeforeFirstSiblingmsoBeforeNode
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
ShowAll
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
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.
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
AddPeriodsMethodAddsaperiodattheendofeachparagraphinthespecifiedtext.
expression.AddPeriods
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
Remarks
Thismethoddoesn'taddanotherperiodattheendofaparagraphthatalreadyendswithaperiod.
Example
Thisexampleaddsaperiodattheendofeachparagraphinshapetwoonslideoneintheactivepresentation.
Application.ActivePresentation.Slides(1).Shapes(2).TextFrame_
.TextRange.AddPeriods
ShowAll
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.
LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeofthepicturerelativetotheleftedgeoftheslide.
TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeofthepicturerelativetothetopedgeoftheslide.
WidthOptionalSingle.Thewidthofthepicture,measuredinpoints.
HeightOptionalSingle.Theheightofthepicture,measuredinpoints.
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
ShowAll
AddPlaceholderMethodRestoresapreviouslydeletedplaceholderonaslide.ReturnsaShapeobjectthatrepresentstherestoredplaceholder.
NoteIfyouhaven'tpreviouslydeletedthespecifiedplaceholder,thismethodcausesanerror.
expression.AddPlaceholder(Type,Left,Top,Width,Height)
expressionRequired.AnexpressionthatreturnsaShapesobject.
TypeRequiredPpPlaceholderType.Thetypeofplaceholder.PlaceholdersoftypeppPlaceholderVerticalBodyorppPlaceholderVerticalTitlearefoundonlyonslidesoflayouttypeppLayoutVerticalText,ppLayoutClipArtAndVerticalText,ppLayoutVerticalTitleAndText,orppLayoutVerticalTitleAndTextOverChart.Youcannotcreateslideswithanyoftheselayoutsfromtheuserinterface;youmustcreatethemprogrammaticallybyusingtheAddmethodorbysettingtheLayoutpropertyofanexistingslide.
PpPlaceholderTypecanbeoneofthesePpPlaceholderTypeconstants.ppPlaceholderBitmapppPlaceholderBodyppPlaceholderCenterTitleppPlaceholderChartppPlaceholderDateppPlaceholderFooterppPlaceholderHeaderppPlaceholderMediaClipppPlaceholderMixedppPlaceholderObjectppPlaceholderOrgChartppPlaceholderSlideNumberppPlaceholderSubtitle
ppPlaceholderTableppPlaceholderTitleppPlaceholderVerticalBodyppPlaceholderVerticalTitle
Left,TopOptionalSingle.Theposition(inpoints)oftheupper-leftcorneroftheplaceholderrelativetotheupper-leftcornerofthedocument.
Width,HeightOptionalSingle.Thewidthandheightoftheplaceholder,inpoints.
Remarks
Ifmorethanoneplaceholderofaspecifiedtypehasbeendeletedfromtheslide,theAddPlaceholdermethodwilladdthembacktotheslide,onebyone,startingwiththeplaceholderthathasthelowestoriginalindexnumber.
Example
Supposethatslidetwointheactivepresentationoriginallyhadatitleatthetopoftheslidethat'sbeendeleted,eithermanuallyorwiththefollowinglineofcode.
ActivePresentation.Slides(2).Shapes.Placeholders(1).Delete
Thisexamplerestoresthedeletedplaceholdertoslidetwo.
Application.ActivePresentation.Slides(2)_
.Shapes.AddPlaceholderppPlaceholderTitle
ShowAll
AddPolylineMethodCreatesanopenpolylineoraclosedpolygondrawing.ReturnsaShapeobjectthatrepresentsthenewpolylineorpolygon.
expression.AddPolyline(SafeArrayOfPoints)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
SafeArrayOfPointsRequiredVariant.Anarrayofcoordinatepairsthatspecifiesthepolylinedrawing'svertices.
Remarks
Toformaclosedpolygon,assignthesamecoordinatestothefirstandlastverticesinthepolylinedrawing.
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
ShowAll
AddShapeMethodCreatesanAutoShape.ReturnsaShapeobjectthatrepresentsthenewAutoShape.
expression.AddShape(Type,Left,Top,Width,Height)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
TypeRequiredMsoAutoShapeType.SpecifiesthetypeofAutoShapetocreate.
MsoAutoShapeTypecanbeoneoftheseMsoAutoShapeTypeconstants.msoShapeFlowchartConnectormsoShapeFlowchartDatamsoShapeFlowchartDecisionmsoShapeFlowchartDelaymsoShapeFlowchartDirectAccessStoragemsoShapeFlowchartDisplaymsoShapeFlowchartDocumentmsoShapeFlowchartExtractmsoShapeFlowchartInternalStoragemsoShapeFlowchartMagneticDiskmsoShapeFlowchartManualInputmsoShapeFlowchartManualOperationmsoShapeFlowchartMergemsoShapeFlowchartMultidocumentmsoShapeFlowchartOffpageConnectormsoShapeFlowchartOrmsoShapeFlowchartPredefinedProcessmsoShapeFlowchartPreparationmsoShapeFlowchartProcess
msoShapeFlowchartPunchedTapemsoShapeFlowchartSequentialAccessStoragemsoShapeFlowchartSortmsoShapeFlowchartStoredDatamsoShapeFlowchartSummingJunctionmsoShapeFlowchartTerminatormsoShapeFoldedCornermsoShapeHeartmsoShapeHexagonmsoShapeHorizontalScrollmsoShapeIsoscelesTrianglemsoShapeLeftArrowmsoShapeLeftArrowCalloutmsoShapeLeftBracemsoShapeLeftBracketmsoShapeLeftRightArrowmsoShapeLeftRightArrowCalloutmsoShapeLeftRightUpArrowmsoShapeLeftUpArrowmsoShapeLightningBoltmsoShapeLineCallout1msoShapeLineCallout1AccentBarmsoShapeLineCallout1BorderandAccentBarmsoShapeLineCallout1NoBordermsoShapeLineCallout2msoShapeLineCallout2AccentBarmsoShapeLineCallout2BorderandAccentBarmsoShapeLineCallout2NoBordermsoShapeLineCallout3msoShapeLineCallout3AccentBarmsoShapeLineCallout3BorderandAccentBarmsoShapeLineCallout3NoBordermsoShapeLineCallout4
msoShapeLineCallout4AccentBarmsoShapeLineCallout4BorderandAccentBarmsoShapeLineCallout4NoBordermsoShapeMixedmsoShapeMoonmsoShapeNoSymbolmsoShapeNotchedRightArrowmsoShapeNotPrimitivemsoShapeOctagonmsoShapeOvalmsoShapeOvalCalloutmsoShapeParallelogrammsoShapePentagonmsoShapePlaquemsoShapeQuadArrowmsoShapeQuadArrowCalloutmsoShapeRectanglemsoShapeRectangularCalloutmsoShapeRegularPentagonmsoShapeRightArrowmsoShapeRightArrowCalloutmsoShapeRightBracemsoShapeRightBracketmsoShapeRightTrianglemsoShapeRoundedRectanglemsoShapeRoundedRectangularCalloutmsoShapeSmileyFacemsoShapeStripedRightArrowmsoShapeSunmsoShapeTrapezoidmsoShapeUpArrowmsoShapeUpArrowCalloutmsoShapeUpDownArrow
msoShapeUpDownArrowCalloutmsoShapeUpRibbonmsoShapeUTurnArrowmsoShapeVerticalScrollmsoShapeWavemsoShapeFlowchartCollatemsoShape16pointStarmsoShape24pointStarmsoShape32pointStarmsoShape4pointStarmsoShape5pointStarmsoShape8pointStarmsoShapeActionButtonBackorPreviousmsoShapeActionButtonBeginningmsoShapeActionButtonCustommsoShapeActionButtonDocumentmsoShapeActionButtonEndmsoShapeActionButtonForwardorNextmsoShapeActionButtonHelpmsoShapeActionButtonHomemsoShapeActionButtonInformationmsoShapeActionButtonMoviemsoShapeActionButtonReturnmsoShapeActionButtonSoundmsoShapeArcmsoShapeBalloonmsoShapeBentArrowmsoShapeBentUpArrowmsoShapeBevelmsoShapeBlockArcmsoShapeCanmsoShapeChevronmsoShapeCircularArrow
msoShapeCloudCalloutmsoShapeCrossmsoShapeCubemsoShapeCurvedDownArrowmsoShapeCurvedDownRibbonmsoShapeCurvedLeftArrowmsoShapeCurvedRightArrowmsoShapeCurvedUpArrowmsoShapeCurvedUpRibbonmsoShapeDiamondmsoShapeDonutmsoShapeDoubleBracemsoShapeDoubleBracketmsoShapeDoubleWavemsoShapeDownArrowmsoShapeDownArrowCalloutmsoShapeDownRibbonmsoShapeExplosion1msoShapeExplosion2msoShapeFlowchartAlternateProcessmsoShapeFlowchartCard
LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeoftheAutoShaperelativetotheleftedgeoftheslide.
TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeoftheAutoShaperelativetothetopedgeoftheslide.
WidthRequiredSingle.ThewidthoftheAutoShape,measuredinpoints.
HeightRequiredSingle.TheheightoftheAutoShape,measuredinpoints.
Remarks
TochangethetypeofanAutoShapethatyou'veadded,settheAutoShapeTypeproperty.
Example
ThisexampleaddsarectangletomyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.AddShapeType:=msoShapeRectangle,_
Left:=50,Top:=50,Width:=100,Height:=200
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.
Example
Thisexamplecreatesanewtableonslidetwooftheactivepresentation.Thetablehasthreerowsandfourcolumns.Itis10pointsfromtheleftedgeoftheslide,and10pointsfromthetopedge.Thewidthofthenewtableis288points,whichmakeseachofthefourcolumnsoneinchwide(thereare72pointsperinch).Theheightissetto216points,whichmakeseachofthethreerowsoneinchtall.
ActivePresentation.Slides(2).Shapes_
.AddTable(3,4,10,10,288,216)
ShowAll
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.
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"
ShowAll
AddTextEffectMethodCreatesaWordArtobject.ReturnsaShapeobjectthatrepresentsthenewWordArtobject.
expression.AddTextEffect(PresetTextEffect,Text,FontName,FontSize,FontBold,FontItalic,Left,Top)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
PresetTextEffectRequiredMsoPresetTextEffect.Thepresettexteffect.
MsoPresetTextEffectcanbeoneoftheseMsoPresetTextEffectconstants.msoTextEffect1msoTextEffect2msoTextEffect3msoTextEffect4msoTextEffect5msoTextEffect6msoTextEffect7msoTextEffect8msoTextEffect9msoTextEffect10msoTextEffect11msoTextEffect12msoTextEffect13msoTextEffect14msoTextEffect15msoTextEffect16msoTextEffect17msoTextEffect18msoTextEffect19
msoTextEffect20msoTextEffect21msoTextEffect22msoTextEffect23msoTextEffect24msoTextEffect25msoTextEffect26msoTextEffect27msoTextEffect28msoTextEffect29msoTextEffect30msoTextEffectMixed
TextRequiredString.ThetextintheWordArt.
FontNameRequiredString.ThenameofthefontusedintheWordArt.
FontSizeRequiredSingle.Thesize(inpoints)ofthefontusedintheWordArt.
FontBoldRequiredMsoTriState.DetermineswhetherthefontusedintheWordArtissettobold.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueSetsthefontusedintheWordArttobold.
FontItalicRequiredMsoTriState.DetermineswhetherthefontusedintheWordArtissettoitalic.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixed
msoTriStateTogglemsoTrueSetsthefontusedintheWordArttoitalic.
LeftRequiredSingle.Theposition,measuredinpoints,oftheleftedgeoftheWordArt'sboundingboxrelativetotheleftedgeoftheslide.
TopRequiredSingle.Theposition,measuredinpoints,ofthetopedgeoftheWordArt'sboundingboxrelativetothetopedgeoftheslide.
Remarks
WhenyouaddWordArttoadocument,theheightandwidthoftheWordArtareautomaticallysetbasedonthesizeandamountoftextyouspecify.
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)
AddTitleMethodRestoresapreviouslydeletedtitleplaceholdertoaslide.ReturnsaShapeobjectthatrepresentstherestoredtitle.
NoteThismethodwillcauseanerrorifyouhaven'tpreviouslydeletedthetitleplaceholderfromthespecifiedslide.UsetheHasTitlepropertytodeterminewhetherthetitleplaceholderhasbeendeleted.
expression.AddTitle
expressionRequired.AnexpressionthatreturnsaShapesobject.
Example
Thisexamplerestoresthetitleplaceholdertoslideoneintheactivepresentationifthisplaceholderhasbeendeleted.Thetextoftherestoredtitleis"Restoredtitle."
WithActivePresentation.Slides(1)
If.Layout<>ppLayoutBlankThen
With.Shapes
IfNot.HasTitleThen
.AddTitle.TextFrame.TextRange_
.Text="Restoredtitle"
EndIf
EndWith
EndIf
EndWith
AddTitleMasterMethodAddsatitlemastertothespecifiedpresentation.ReturnsaMasterobjectthatrepresentsthetitlemaster.Ifthepresentationalreadyhasatitlemaster,anerroroccurs.
expression.AddTitleMaster
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampleaddsatitlemastertotheactivepresentationifitdoesn'talreadyhaveone.
WithApplication.ActivePresentation
IfNot.HasTitleMasterThen.AddTitleMaster
EndWith
AddToFavoritesMethodAddsashortcuttotheFavoritesfolderintheWindowsprogramfolderrepresentingeitherthecurrentselectioninthespecifiedpresentation(forthePresentationobject)orthespecifiedhyperlink'stargetdocument(fortheHyperlinkobject).
expression.AddToFavorites
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Theshortcutnameisthefriendlynameofthedocument,ifthat'savailable;otherwise,theshortcutnameisascalculatedinHLINK.DLL.
Example
ThisexampleaddsahyperlinktotheactivepresentationtotheFavoritesfolderintheWindowsprogramfolder.
Application.ActivePresentation.AddToFavorites
ShowAll
AlignMethodAlignstheshapesinthespecifiedrangeofshapes.
expression.Align(AlignCmd,RelativeTo)
expressionRequired.AnexpressionthatreturnsaShapeRangeobject.
AlignCmdRequiredMsoAlignCmd.Specifiesthewaytheshapesinthespecifiedshaperangearetobealigned.
MsoAlignCmdcanbeoneoftheseMsoAlignCmdconstants.msoAlignBottomsmsoAlignCentersmsoAlignLeftsmsoAlignMiddlesmsoAlignRightsmsoAlignTops
RelativeToRequiredMsoTriState.Determineswhethershapesarealignedrelativetotheedgeoftheslide.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseAlignsshapesrelativetooneanother.msoTriStateMixedmsoTriStateTogglemsoTrueAlignsshapesrelativetotheedgeoftheslide.
Example
ThisexamplealignstheleftedgesofalltheshapesinthespecifiedrangeinmyDocumentwiththeleftedgeoftheleftmostshapeintherange.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.Range.AlignmsoAlignLefts,msoFalse
ApplyMethodAppliestothespecifiedshapeformattingthat'sbeencopiedbyusingthePickUpmethod.
expression.Apply
expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.
Example
ThisexamplecopiestheformattingofshapeoneonmyDocument,andthenappliesthecopiedformattingtoshapetwo.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument
.Shapes(1).PickUp
.Shapes(2).Apply
EndWith
ApplyTemplateMethodAppliesadesigntemplatetothespecifiedpresentation.
expression.ApplyTemplate(FileName)
expressionRequired.AnexpressionthatreturnsaPresentationobject.
FileNameRequiredString.Specifiesthenameofthedesigntemplate.
NoteIfyourefertoanuninstalledpresentationdesigntemplateinastring,arun-timeerrorisgenerated.ThetemplateisnotinstalledautomaticallyregardlessofyourFeatureInstallpropertysetting.TousetheApplyTemplatemethodforatemplatethatisnotcurrentlyinstalled,youfirstmustinstalltheadditionaldesigntemplates.Todoso,installtheAdditionalDesignTemplatesforPowerPointbyrunningtheMicrosoftOfficeinstallationprogram(availablethroughtheAdd/RemoveProgramsiconinWindowsControlPanel).
Example
Thisexampleappliesthe"Professional"designtemplatetotheactivepresentation.
Application.ActivePresentation.ApplyTemplate_
"c:\programfiles\microsoftoffice\templates"&_
"\presentationdesigns\professional.pot"
ShowAll
ArrangeMethodArrangesallopendocumentwindowsintheworkspace.
expression.Arrange(arrangeStyle)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
arrangeStyleOptionalPpArrangeStyle.Specifieswhethertocascadeortilethewindows.
PpArrangeStylecanbeoneofthesePpArrangeStyleconstants.ppArrangeCascadeppArrangeTileddefault
Example
Thisexamplecreatesanewwindowandthenarrangesallopendocumentwindows.
Application.ActiveWindow.NewWindow
Windows.ArrangeppArrangeCascade
AutomaticLengthMethodSpecifiesthatthefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox)bescaledautomaticallywhenthecalloutismoved.UsetheCustomLengthmethodtospecifythatthefirstsegmentofthecalloutlineretainthefixedlengthreturnedbytheLengthpropertywheneverthecalloutismoved.Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).
expression.AutomaticLength
expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.
Remarks
ApplyingthismethodsetstheAutoLengthpropertytoTrue.
Example
ThisexampletogglesbetweenanautomaticallyscalingfirstsegmentandonewithafixedlengthforthecalloutlineforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).Callout
If.AutoLengthThen
.CustomLength50
Else
.AutomaticLength
EndIf
EndWith
BackgroundMethodSpecifiesthattheshape'sfillshouldmatchtheslidebackground.Ifyouchangetheslidebackgroundafterapplyingthismethodtoafill,thefillwillalsochange.
Remarks
NotethatapplyingtheBackgroundmethodtoashape'sfillisn'tthesameassettingatransparentfillfortheshape,norisitalwaysthesameasapplyingthesamefilltotheshapeasyouapplytothebackground.Thesecondexampledemonstratesthis.
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
BeginConnectMethodAttachesthebeginningofthespecifiedconnectortoaspecifiedshape.Ifthere'salreadyaconnectionbetweenthebeginningoftheconnectorandanothershape,thatconnectionisbroken.Ifthebeginningoftheconnectorisn'talreadypositionedatthespecifiedconnectingsite,thismethodmovesthebeginningoftheconnectortotheconnectingsiteandadjuststhesizeandpositionoftheconnector.UsetheEndConnectmethodtoattachtheendoftheconnectortoashape.
expression.BeginConnect(ConnectedShape,ConnectionSite)
expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.
ConnectedShapeRequiredShapeobject.Theshapetoattachthebeginningoftheconnectorto.ThespecifiedShapeobjectmustbeinthesameShapescollectionastheconnector.
ConnectionSiteRequiredLong.AconnectionsiteontheshapespecifiedbyConnectedShape.Mustbeanintegerbetween1andtheintegerreturnedbytheConnectionSiteCountpropertyofthespecifiedshape.Ifyouwanttheconnectortoautomaticallyfindtheshortestpathbetweenthetwoshapesitconnects,specifyanyvalidintegerforthisargumentandthenusetheRerouteConnectionsmethodaftertheconnectorisattachedtoshapesatbothends.
Remarks
Whenyouattachaconnectortoanobject,thesizeandpositionoftheconnectorareautomaticallyadjusted,ifnecessary.
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
BeginDisconnectMethodDetachesthebeginningofthespecifiedconnectorfromtheshapeit'sattachedto.Thismethoddoesn'talterthesizeorpositionoftheconnector:thebeginningoftheconnectorremainspositionedataconnectionsitebutisnolongerconnected.UsetheEndDisconnectmethodtodetachtheendoftheconnectorfromashape.
expression.BeginDisconnect
expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.
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
ShowAll
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.
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
CanCheckInMethodTrueifMicrosoftPowerPointcancheckinaspecifiedpresentationtoaserver.Read/writeBoolean.
expression.CanCheckIn
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
TotakeadvantageofthecollaborationfeaturesbuiltintoPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.
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
CanCheckOutMethodTrueifMicrosoftPowerPointcancheckoutaspecifiedpresentationfromaserver.Read/writeBoolean.
expression.CanCheckOut(FileName)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
FileNameRequiredString.Theserverpathandnameofthepresentation.
Remarks
TotakeadvantageofthecollaborationfeaturesbuiltintoPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.
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
CellMethodReturnsaCellobjectthatrepresentsacellinatable.
expression.Cell(Row,Column)
expressionRequired.AnexpressionthatreturnsaTableobject.
RowRequiredLong.Thenumberoftherowinthetabletoreturn.Canbeanintegerbetween1andthenumberofrowsinthetable.
ColumnRequiredLong.Thenumberofthecolumninthetabletoreturn.Canbeanintegerbetween1andthenumberofcolumnsinthetable.
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
ShowAll
ChangeCaseMethodChangesthecaseofthespecifiedtext.
expression.ChangeCase(Type)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
TypeRequiredPpChangeCase.Specifiesthewaythecasewillbechanged.
PpChangeCasecanbeoneofthesePpChangeCaseconstants.ppCaseLowerppCaseSentenceppCaseTitleppCaseToggleppCaseUpper
Example
Thisexamplesetstitlecasecapitalizationforthetitleonslideoneinthetheactivepresentation.
Application.ActivePresentation.Slides(1).Shapes.Title.TextFrame_
.TextRange.ChangeCaseppCaseTitle
CharactersMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextcharacters.Forinformationaboutcountingorloopingthroughthecharactersinatextrange,seetheTextRangeobject.
expression.Characters(Start,Length)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
StartOptionalLong.Thefirstcharacterinthereturnedrange.
LengthOptionalLong.Thenumberofcharacterstobereturned.
Remarks
IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstcharacterandendswiththelastparagraphinthespecifiedrange.
IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsonecharacter.
IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstcharacterinthespecifiedrange.
IfStartisgreaterthanthenumberofcharactersinthespecifiedtext,thereturnedrangestartswiththelastcharacterinthespecifiedrange.
IfLengthisgreaterthanthenumberofcharactersfromthespecifiedstartingcharactertotheendofthetext,thereturnedrangecontainsallthosecharacters.
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
CheckInMethodReturnsapresentationfromalocalcomputertoaserver,andsetsthelocalfiletoread-onlysothatitcannotbeeditedlocally.
expression.CheckIn(SaveChanges,Comments,MakePublic)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
SaveChangesOptionalBoolean.Truesavesthepresentationtotheserverlocation.ThedefaultvalueisFalse.
CommentsOptionalVariant.Commentsfortherevisionofthepresentationbeingcheckedin(onlyappliesifSaveChangesequalsTrue).
MakePublicOptionalVariant.Trueallowstheusertoperformapublishonthepresentationafterbeingcheckedin.Thissubmitsthedocumentfortheapprovalprocess,whichcaneventuallyresultinaversionofthepresentationbeingpublishedtouserswithread-onlyrightstothepresentation(onlyappliesifSaveChangesequalsTrue).
Remarks
TotakeadvantageofthecollaborationfeaturesbuiltintoMicrosoftPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.
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
CheckOutMethodCopiesaspecifiedpresentationfromaservertoalocalcomputerforediting.ReturnsaStringthatrepresentsthelocalpathandfilenameofthepresentationcheckedout.
expression.CheckOut(FileName)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
FileNameRequiredString.Theserverpathandnameofthepresentation.
Remarks
TotakeadvantageofthecollaborationfeaturesbuiltintoMicrosoftPowerPoint,presentationsmustbestoredonaMicrosoftSharePointPortalServer.
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
ClearMethodClearsthespecifiedtabstopfromtheruleranddeletesitfromtheTabStopscollection.
Example
Thisexampleclearsalltabstopsforthetextinshapetwoonslideoneintheactivepresentation.
WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame_
.Ruler.TabStops
Fori=.CountTo1Step-1
.Item(i).Clear
Next
EndWith
ClearAllMethodClearsalltheprintrangesfromthePrintRangescollection.UsetheAddmethodofthePrintRangescollectiontoaddprintrangestothecollection.
expression.ClearAll
expressionRequired.AnexpressionthatreturnsaPrintRangeobject.
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
ShowAll
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).
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
ShowAll
CloneNodeMethodClonesadiagramnode.
expression.CloneNode(CopyChildren,TargetNode,Pos)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
CopyChildrenRequiredBoolean.Truetoincludethediagramnode'schildren.
TargetNodeRequiredDiagramNodeobject.AnexpressionthatreturnsaDiagramNodethatwillbethesourceforthecloneddiagramnode.
PosOptionalMsoRelativeNodePosition.IfTargetNodeisspecified,wherethenodewillbeadded,relativetoTargetNode.
MsoRelativeNodePositioncanbeoneoftheseMsoRelativeNodePositionconstants.msoAfterLastSiblingmsoAfterNodedefaultmsoBeforeFirstSiblingmsoBeforeNode
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
CloseMethodClosesthespecifieddocumentwindow,presentation,oropenfreeformdrawing.
CautionWhenyouusethismethod,PowerPointwillcloseanopenpresentationwithoutpromptingtheusertosavetheirwork.Topreventthelossofwork,usetheSavemethodortheSaveAsmethodbeforeyouusetheClosemethod.
expression.Close
expressionRequired.AnexpressionthatreturnsaDocumentWindoworPresentationobject.
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
ShowAll
ColorsMethodReturnsanRGBColorobjectthatrepresentsasinglecolorinacolorscheme.
expression.Colors(SchemeColor)
expressionRequired.AnexpressionthatreturnsaColorSchemeobject.
SchemeColorRequiredPpColorSchemeIndex.Theindividualcolorinthespecifiedcolorscheme.
PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppNotSchemeColorppSchemeColorMixedppShadowppTitle
Example
Thisexamplesetsthetitlecolorforslidesoneandthreeintheactivepresentation.
SetmySlides=ActivePresentation.Slides.Range(Array(1,3))
mySlides.ColorScheme.Colors(ppTitle).RGB=RGB(0,255,0)
ShowAll
ConvertMethodConvertsadiagramtoadifferentdiagramtype.
expression.Convert(Type)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
TypeRequiredMsoDiagramType.Thetypeofdiagramtoconvertto.
MsoDiagramTypecanbeoneoftheseMsoDiagramTypeconstants.msoDiagramCyclemsoDiagramMixedmsoDiagramOrgChartmsoDiagramPyramidmsoDiagramRadialmsoDiagramTargetmsoDiagramVenn
Remarks
Thismethodgeneratesanerrorifthevalueofthetargetdiagram'sTypepropertyisanorganizationchart(msoDiagramTypeOrgChart).
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
ShowAll
ConvertToAfterEffectMethodSpecifieswhataneffectshoulddoafteritisfinished.ReturnsanEffectobjectthatrepresentsanaftereffect.
expression.ConvertToAfterEffect(Effect,After,DimColor,DimSchemeColor)
expressionRequired.AnexpressionthatreturnsaSequenceobject.
EffectRequiredEffectobject.Theeffecttowhichtheaftereffectwillbeadded.
AfterRequiredMsoAnimAfterEffect.Thebehavioroftheaftereffect.
MsoAnimAfterEffectcanbeoneoftheseMsoAnimAfterEffectconstants.msoAnimAfterEffectDimmsoAnimAfterEffectHidemsoAnimAfterEffectHideOnNextClickmsoAnimAfterEffectMixedmsoAnimAfterEffectNone
DimColorOptionalMsoRGBType.Asinglecolortoapplytheaftereffect.
DimSchemeColorOptionalPpColorSchemeIndex.Apredefinedcolorschemetoapplytotheaftereffect.
PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppNotSchemeColordefaultppSchemeColorMixed
ppShadowppTitle
Remarks
DonotuseboththeDimColorandDimSchemeColorargumentsinthesamecalltothismethod.Anaftereffectmayhaveonecolor,oruseapredefinedcolorscheme,butnotboth.
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
ShowAll
ConvertToAnimateBackgroundMethodDetermineswhetherthebackgroundwillanimateseparatelyfrom,orinadditionto,itsaccompanyingtext.ReturnsanEffectobjectrepresentingthenewly-modifiedanimationeffect.
expression.ConvertToAnimateBackground(Effect,AnimateBackground)
expressionRequired.AnexpressionthatreturnsaSequenceobject.
EffectRequiredEffectobject.Theanimationeffecttobeappliedtothebackground.
AnimateBackgroundRequiredMsoTriState.Determineswhetherthetextwillanimateseparatelyfromthebackground.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseAnimatestextseparatelyfromthebackground.msoTriStateMixedmsoTriStateTogglemsoTrueAnimatestextalongwiththebackground.
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
ShowAll
ConvertToAnimateInReverseMethodDetermineswhethertextwillbeanimatedinreverseorder.ReturnsanEffectobjectrepresentingthetextanimation.
expression.ConvertToAnimateInReverse(Effect,animateInReverse)
expressionRequired.AnexpressionthatreturnsaSequenceobject.
EffectRequiredEffectobject.Theanimationeffecttowhichthereversalwillapply.
animateInReverseRequiredMsoTriState.Determinesthetextanimationorder.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThetextanimatesinnormalorder.msoTriStateMixedmsoTriStateTogglemsoTrueThetextanimatesinreverseorder.
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
ShowAll
ConvertToBuildLevelMethodChangesthebuildlevelinformationforaspecifiedanimationeffect.ReturnsanEffectobjectthatrepresentsthebuildlevelinformation.
expression.ConvertToBuildLevel(Effect,Level)
expressionRequired.AnexpressionthatreturnsaSequenceobject.
EffectRequiredEffectobject.Thespecifiedanimationeffect.
LevelRequiredMsoAnimateByLevel.Theanimationbuildlevel.
MsoAnimateByLevelcanbeoneoftheseMsoAnimateByLevelconstants.msoAnimateChartAllAtOncemsoAnimateChartByCategorymsoAnimateChartByCategoryElementsmsoAnimateChartBySeriesmsoAnimateChartBySeriesElementsmsoAnimateDiagramAllAtOncemsoAnimateDiagramBreadthByLevelmsoAnimateDiagramBreadthByNodemsoAnimateDiagramClockwisemsoAnimateDiagramClockwiseInmsoAnimateDiagramClockwiseOutmsoAnimateDiagramCounterClockwisemsoAnimateDiagramCounterClockwiseInmsoAnimateDiagramCounterClockwiseOutmsoAnimateDiagramDepthByBranchmsoAnimateDiagramDepthByNodemsoAnimateDiagramDownmsoAnimateDiagramInByRingmsoAnimateDiagramOutByRing
msoAnimateDiagramUpmsoAnimateLevelMixedmsoAnimateTextByAllLevelsmsoAnimateTextByFifthLevelmsoAnimateTextByFirstLevelmsoAnimateTextByFourthLevelmsoAnimateTextBySecondLevelmsoAnimateTextByThirdLevelmsoAnimationLevelNone
Remarks
Changingbuildlevelinformationforaneffectinvalidatesanyexistingeffects.
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
ConvertToShapeMethodCreatesashapethathasthegeometriccharacteristicsofthespecifiedFreeformBuilderobject.ReturnsaShapeobjectthatrepresentsthenewshape.
NoteYoumustapplytheAddNodesmethodtoaFreeformBuilderobjectatleastoncebeforeyouusetheConvertToShapemethod.
expression.ConvertToShape
expressionRequired.AnexpressionthatreturnsaFreeformBuilderobject.
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
ShowAll
ConvertToTextUnitEffectMethodReturnsanEffectobjectthatrepresentshowtextshouldanimate.
expression.ConvertToTextUnitEffect(Effect,unitEffect)
expressionRequired.AnexpressionthatreturnsaSequenceobject.
EffectRequiredEffectobject.Theanimationeffecttowhichthetextuniteffectapplies.
unitEffectRequiredMsoAnimTextUnitEffect.Howthetextshouldanimate.
MsoAnimTextUnitEffectcanbeoneoftheseMsoAnimTextUnitEffectconstants.msoAnimTextUnitEffectByCharactermsoAnimTextUnitEffectByParagraphmsoAnimTextUnitEffectByWordmsoAnimTextUnitEffectMixed
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
CopyMethodCopiesthespecifiedobjecttotheClipboard.
expression.Copy
expressionRequired.AnexpressionthatreturnsaSelection,Shape,ShapeRange,Slide,SlideRange,orTextRangeobject.
Remarks
UsethePastemethodtopastethecontentsoftheClipboard.
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
ShowAll
CreateNewDocumentMethodCreatesanewWebpresentationassociatedwiththespecifiedhyperlink.
expression.CreateNewDocument(FileName,EditNow,Overwrite)
expressionRequired.AnexpressionthatreturnsaHyperlinkobject.
FileNameRequiredString.Thepathandfilenameofthedocument.
EditNowRequiredMsoTriState.Determineswhetherthedocumentisopenedimmediatelyinitsassociatededitor.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDonotopenthedocumentimmediately.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Openthedocumentimmediatelyinitsassociatededitortomodifyit.
OverwriteRequiredMsoTriState.Determineswhetheranyexistingfileofthesamenameinthesamefolderisoverwritten.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Preserveanyexistingfileofthesamenameinthesamefolder,requiringanewfilenametobespecifiedintheFileNameargument.msoTriStateMixedmsoTriStateTogglemsoTrueOverwriteanyexistingfileofthesamenameinthesamefolder.
Example
ThisexamplecreatesanewWebpresentationtobeassociatedwithhyperlinkoneonslideone.ThenewpresentationiscalledBrittany.ppt,anditoverwritesanyfileofthesamenameintheHTMLPresfolder.ThenewpresentationdocumentisloadedintoMicrosoftPowerPointimmediatelyforediting.
ActivePresentation.Slides(1).Hyperlinks(1).CreateNewDocument_
FileName:="C:\HTMLPres\Brittany.ppt",_
EditNow:=msoTrue,_
Overwrite:=msoTrue
CustomDropMethodSetstheverticaldistance(inpoints)fromtheedgeofthetextboundingboxtotheplacewherethecalloutlineattachestothetextbox.ThisdistanceismeasuredfromthetopofthetextboxunlesstheAutoAttachpropertyissettoTrueandthetextboxistotheleftoftheoriginofthecalloutline(theplacethatthecalloutpointsto).Inthiscasethedropdistanceismeasuredfromthebottomofthetextbox.
expression.CustomDrop(Drop)
expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.
DropRequiredSingle.Thedropdistance,inpoints.
Example
Thisexamplesetsthecustomdropdistanceto14points,andspecifiesthatthedropdistancealwaysbemeasuredfromthetop.Fortheexampletowork,shapethreemustbeacallout.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).Callout
.CustomDrop14
.AutoAttach=False
EndWith
CustomLengthMethodSpecifiesthatthefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox)retainafixedlengthwheneverthecalloutismoved.UsetheAutomaticLengthmethodtospecifythatthefirstsegmentofthecalloutlinebescaledautomaticallywheneverthecalloutismoved.Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).
expression.CustomLength(Length)
expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.
LengthRequiredSingle.Thelengthofthefirstsegmentofthecallout,inpoints.
Remarks
ApplyingthismethodsetstheAutoLengthpropertytoFalseandsetstheLengthpropertytothevaluespecifiedfortheLengthargument.
Example
ThisexampletogglesbetweenanautomaticallyscalingfirstsegmentandonewithafixedlengthforthecalloutlineforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).Callout
If.AutoLengthThen
.CustomLength50
Else
.AutomaticLength
EndIf
EndWith
CutMethodDeletesthespecifiedobjectandplacesitontheClipboard.
expression.Cut
expressionRequired.AnexpressionthatreturnsaSelection,Shape,ShapeRange,Slide,SlideRange,orTextRangeobject.
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
ShowAll
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.
Remarks
Attemptingtodeletetheonlyexistingroworcolumninatablewillresultinarun-timeerror.
Example
AsitappliestotheShapeobject.
Thisexampledeletesallfreeformshapesfromslideoneintheactivepresentation.
WithApplication.ActivePresentation.Slides(1).Shapes
ForintShape=.CountTo1Step-1
With.Item(intShape)
If.Type=msoFreeformThen.Delete
EndWith
Next
EndWith
DeleteTextMethodDeletesthetextassociatedwiththespecifiedshape.
expression.DeleteText
expressionRequired.AnexpressionthatreturnsaTextFrameobject.
Example
IfshapetwoonmyDocumentcontainstext,thisexampledeletesthetext.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(2).TextFrame.DeleteText
ShowAll
DistributeMethodEvenlydistributestheshapesinthespecifiedrangeofshapes.Youcanspecifywhetheryouwanttodistributetheshapeshorizontallyorverticallyandwhetheryouwanttodistributethemovertheentireslideorjustoverthespacetheyoriginallyoccupy.
expression.Distribute(DistributeCmd,RelativeTo)
expressionRequired.AnexpressionthatreturnsaShapeRangeobject.
DistributeCmdRequiredMsoDistributeCmd.Specifieswhethershapesintherangearetobedistributedhorizontallyorvertically.
MsoDistributeCmdcanbeoneoftheseMsoDistributeCmdconstants.msoDistributeHorizontallymsoDistributeVertically
RelativeToRequiredMsoTriState.Determineswhethershapesaredistributedevenlyovertheentirehorizontalorverticalspaceontheslide.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDistributestheshapeswithinthehorizontalorverticalspacethattherangeofshapesoriginallyoccupies.msoTriStateMixedmsoTriStateTogglemsoTrueDistributestheshapesevenlyovertheentirehorizontalorverticalspaceontheslide.
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
ShowAll
DoVerbMethodRequeststhatanOLEobjectperformoneofitsverbs.UsetheObjectVerbspropertytodeterminetheavailableverbsforanOLEobject.
expression.DoVerb(Index)
expressionRequired.AnexpressionthatreturnsanOLEFormatobject.
IndexOptionalInteger.Theverbtoperform.Ifthisargumentisomitted,thedefaultverbisperformed.
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
DrawLineMethodDrawsalineinthespecifiedslideshowview.
expression.DrawLine(BeginX,BeginY,EndX,Height)
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
BeginX,BeginYRequiredSingle.Theposition(inpoints)oftheline'sstartingpointrelativetotheupper-leftcorneroftheslide.
EndX,EndYRequiredSingle.Theposition(inpoints)oftheline'sendingpointrelativetotheupper-leftcorneroftheslide.
Example
Thisexampledrawsalineinslideshowwindowone.
SlideShowWindows(1).View.DrawLine5,5,250,250
ShowAll
DuplicateMethodDuplicatemethodasitappliestotheShapeandShapeRangeobjects.
CreatesaduplicateofthespecifiedShapeorShapeRangeobject,addsthenewshapeorrangeofshapestotheShapescollectionimmediatelyaftertheshapeorrangeofshapesspecifiedoriginally,andthenreturnsthenewShapeorShapeRangeobject.
expression.Duplicate
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
DuplicatemethodasitappliestotheSlideandSlideRangeobjects.
CreatesaduplicateofthespecifiedSlideorSlideRangeobject,addsthenewslideorrangeofslidestotheSlidescollectionimmediatelyaftertheslideorsliderangespecifiedoriginally,andthenreturnsaSlideorSlideRangeobjectthatrepresentstheduplicateslideorslides.
expression.Duplicate
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
EndConnectMethodAttachestheendofthespecifiedconnectortoaspecifiedshape.Ifthere'salreadyaconnectionbetweentheendoftheconnectorandanothershape,thatconnectionisbroken.Iftheendoftheconnectorisn'talreadypositionedatthespecifiedconnectingsite,thismethodmovestheendoftheconnectortotheconnectingsiteandadjuststhesizeandpositionoftheconnector.UsetheBeginConnectmethodtoattachthebeginningoftheconnectortoashape.
expression.EndConnect(ConnectedShape,ConnectionSite)
expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.
ConnectedShapeRequiredShapeobject.Theshapetoattachtheendoftheconnectorto.ThespecifiedShapeobjectmustbeinthesameShapescollectionastheconnector.
ConnectionSiteRequiredLong.AconnectionsiteontheshapespecifiedbyConnectedShape.Mustbeanintegerbetween1andtheintegerreturnedbytheConnectionSiteCountpropertyofthespecifiedshape.Ifyouwanttheconnectortoautomaticallyfindtheshortestpathbetweenthetwoshapesitconnects,specifyanyvalidintegerforthisargumentandthenusetheRerouteConnectionsmethodaftertheconnectorisattachedtoshapesatbothends.
Remarks
Whenyouattachaconnectortoanobject,thesizeandpositionoftheconnectorareautomaticallyadjusted,ifnecessary.
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
EndDisconnectMethodDetachestheendofthespecifiedconnectorfromtheshapeit'sattachedto.Thismethoddoesn'talterthesizeorpositionoftheconnector:theendoftheconnectorremainspositionedataconnectionsitebutisnolongerconnected.UsetheBeginDisconnectmethodtodetachthebeginningoftheconnectorfromashape.
expression.EndDisconnect
expressionRequired.AnexpressionthatreturnsaConnectorFormatobject.
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
EndNamedShowMethodSwitchesfromrunningacustom,ornamed,slideshowtorunningtheentirepresentationofwhichthecustomshowisasubset.Whentheslideshowadvancesfromthecurrentslide,thenextslidedisplayedwillbethenextoneintheentirepresentation,notthenextoneinthecustomslideshow.
expression.EndNamedShow
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
Example
Ifacustomslideshowiscurrentlyrunninginslideshowwindowone,thisexampleredefinestheslideshowtoincludealltheslidesinthepresentationfromwhichtheslidesinthecustomshowwereselected.
SlideShowWindows(1).View.EndNamedShow
EndReviewMethodTerminatesareviewofafilethathasbeensentforreviewusingtheSendForReviewmethodorthathasbeenautomaticallyplacedinareviewcycle.
expression.EndReview
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampleterminatesthereviewoftheactivepresentation.Whenexecuted,thisproceduredisplaysamessageaskingifyouwanttoendthereview.Thisexampleassumestheactivepresentationisinareviewcycle.
SubEndPPTRev()
ActivePresentation.EndReview
EndSub
EraseDrawingMethodRemoveslinesdrawnduringaslideshowusingeithertheDrawLinemethodorthepentool.
expression.EraseDrawing
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
Example
ThisexampleerasesanylinesthathavebeendrawninslideshowwindowoneusingeithertheDrawLinemethodorthepentool.
SlideShowWindows(1).View.EraseDrawing
ExitMethodEndsthespecifiedslideshow.
expression.Exit
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
Example
Thisexampleendstheslideshowthat'srunninginslideshowwindowone.
SlideShowWindows(1).View.Exit
ShowAll
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.
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.
Remarks
Exportingapresentationdoesn'tsettheSavedpropertyofapresentationtoTrue.
PowerPointusesthespecifiedgraphicsfiltertosaveeachindividualslideinthepresentation.ThenamesoftheslidesexportedandsavedtodiskaredeterminedbyPowerPoint.They'retypicallysavedasSlide1.wmf,Slide2.wmf,andsoon.ThepathofthesavedfilesisspecifiedinthePathargument.
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
ShowAll
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
msoTriStateTogglemsoTrueSearchfindsonlywholewords,notpartsoflargerwords.
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
FindBySlideIDMethodReturnsaSlideobjectthatrepresentstheslidewiththespecifiedslideIDnumber.EachslideisautomaticallyassignedauniqueslideIDnumberwhenit'screated.UsetheSlideIDpropertytoreturnaslide'sIDnumber.
expression.FindBySlideID(SlideID)
expressionRequired.AnexpressionthatreturnsaSlidescollection.
SlideIDRequiredLong.SpecifiestheIDnumberoftheslideyouwanttoreturn.PowerPointassignsthisnumberwhentheslideiscreated.
Remarks
UnliketheSlideIndexproperty,theSlideIDpropertyofaSlideobjectwon'tchangewhenyouaddslidestothepresentationorrearrangetheslidesinthepresentation.Therefore,usingtheFindBySlideIDmethodwiththeslideIDnumbercanbeamorereliablewaytoreturnaspecificSlideobjectfromaSlidescollectionthanusingtheItemmethodwiththeslide'sindexnumber.
Example
ThisexampledemonstrateshowtoretrievetheuniqueIDnumberforaSlideobjectandthenusethisnumbertoreturnthatSlideobjectfromtheSlidescollection.
Setgslides=ActivePresentation.Slides
'GetslideID
graphSlideID=gslides.Add(2,ppLayoutChart).SlideID
gslides.FindBySlideID(graphSlideID)_
.SlideShowTransition.EntryEffect=_
ppEffectCoverLeft'UseIDtoreturnspecificslide
FindFirstAnimationForMethodReturnsanEffectobjectthatrepresentsthefirstanimationforagivenshape.
expression.FindFirstAnimationFor(Shape)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
ShapeRequiredShapeobject.Theshapeforwhichtofindthefirstanimation.
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
FindFirstAnimationForClickMethodReturnsanEffectobjectthatrepresentsthefirstanimationstartedbythespecifiedclicknumber.
expression.FindFirstAnimationForClick(Click)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
ClickRequiredLong.Thespecifiedclicknumber.
Example
Thefollowingexamplefindsthefirstanimationforthefirstclickonthefirstslideandchangestheeffecttoabounce.
SubFindFirstAnimationClick()
DimsldFirstAsSlide
DimeffClickAsEffect
SetsldFirst=ActivePresentation.Slides(1)
SeteffClick=sldFirst.TimeLine.MainSequence_
.FindFirstAnimationForClick(Click:=1)
effClick.EffectType=msoAnimEffectBounce
EndSub
FirstMethodSetsthespecifiedslideshowviewtodisplaythefirstslideinthepresentation.
expression.First
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
Remarks
IfyouusetheFirstmethodtoswitchfromoneslidetoanotherduringaslideshow,whenyoureturntotheoriginalslide,itsanimationpicksupwhereitleftoff.
Example
Thisexamplesetsslideshowwindowonetodisplaythefirstslideinthepresentation.
SlideShowWindows(1).View.First
FitToPageMethodAdjuststhesizeofthespecifieddocumentwindowtoaccommodatetheinformationthat'scurrentlydisplayed.
expression.FitToPage
expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.
Example
Thisexampleexitsthecurrentslideshow,setstheviewintheactivewindowtoslideview,setsthezoomto25percent,andadjuststhesizeofthewindowtofittheslidedisplayedthere.
Application.SlideShowWindows(1).View.Exit
WithApplication.ActiveWindow
.ViewType=ppViewSlide
.View.Zoom=25
.FitToPage
EndWith
ShowAll
FlipMethodFlipsthespecifiedshapearoundit'shorizontalorverticalaxis.
expression.Flip(FlipCmd)
expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.
FlipCmdRequiredMsoFlipCmd.Specifieswhethertheshapeistobeflippedhorizontallyorvertically.
MsoFlipCmdcanbeoneoftheseMsoFlipCmdconstants.msoFlipHorizontalmsoFlipVertical
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
FollowMethodDisplaystheHTMLdocumentassociatedwiththespecifiedhyperlinkinanewWebbrowserwindow.
expression.Follow
expressionRequired.AnexpressionthatreturnsaHyperlinkobject.
Example
ThisexampleloadsthedocumentassociatedwiththefirsthyperlinkonslideoneinanewinstanceoftheWebbrowser.
ActivePresentation.Slides(1).Hyperlinks(1).Follow
ShowAll
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
&"string2".ThespecifiedstringisautomaticallyconvertedintoANSIcharacters.NotethattheHeaderInfoargumentmayoverwritedefaultHTTPheaderfields.
Example
Thisexampleloadsthedocumentatexample.microsoft.cominanewwindowandaddsittothehistoryfolder.
ActivePresentation.FollowHyperlink_
Address:="http://example.microsoft.com",_
NewWindow:=True,AddHistory:=True
GotoNamedShowMethodSwitchestothespecifiedcustom,ornamed,slideshowduringanotherslideshow.Whentheslideshowadvancesfromthecurrentslide,thenextslidedisplayedwillbethenextoneinthespecifiedcustomslideshow,notthenextoneincurrentslideshow.
expression.GotoNamedShow(SlideShowName)
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
SlideShowNameRequiredString.Thenameofthecustomslideshowtobeswitchedto.
Example
Thisexampleredefinestheslideshowrunninginslideshowwindowonetoincludeonlytheslidesinthecustomslideshownamed"QuickShow."
SlideShowWindows(1).View.GotoNamedShow"QuickShow"
ShowAll
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.
Example
Thisexampleswitchesfromthecurrentslidetotheslidethreeinslideshowwindowone.Ifyouswitchbacktothecurrentslideduringtheslideshow,itsentireanimationwillstartover.
WithSlideShowWindows(1).View
.GotoSlide3
EndWith
Thisexampleswitchesfromthecurrentslidetotheslidethreeinslideshowwindowone.Ifyouswitchbacktothecurrentslideduringtheslideshow,itsanimationwillpickupwhereitleftoff.
WithSlideShowWindows(1).View
.GotoSlide3,msoFalse
EndWith
GroupMethodGroupstheshapesinthespecifiedrange.ReturnsthegroupedshapesasasingleShapeobject.
expression.Group
expressionRequired.AnexpressionthatreturnsaShapeRangeobject.
Remarks
Becauseagroupofshapesistreatedasasingleshape,groupingandungroupingshapeschangesthenumberofitemsintheShapescollectionandchangestheindexnumbersofitemsthatcomeaftertheaffecteditemsinthecollection.
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
HelpMethodDisplaysaHelptopic.
expression.Help(HelpFile,ContextID)
expressionRequired.AnexpressionthatreturnsanApplicationobject.
HelpFileOptionalString.ThenameoftheHelpfileyouwanttodisplay.Canbeeithera.chmoran.hlpfile.Ifthisargumentisn'tspecified,MicrosoftPowerPointHelpisused.
ContextIDOptionalLong.ThecontextIDnumberfortheHelptopic.Ifthisargumentisn'tspecifiedorifitspecifiesacontextIDnumberthatisnotassociatedwithaHelptopic,theHelpTopicsdialogboxisdisplayed.
Example
Thisexampledisplaystopicnumber65527intheHelpfileMyHelpFile.chm.
Application.Help"MyHelpFile.chm",65527
ImportFromFileMethodSpecifiesthesoundthatwillbeplayedwheneverthespecifiedshapeisclickedoranimatedorwheneverthespecifiedslidetransitionoccurs.
expression.ImportFromFile(FullName)
expressionRequired.AnexpressionthatreturnsaSoundEffectobject.
FullNameRequiredString.Thenameofthespecifiedsoundfile.
Example
ThisexamplespecifiesthatthefileDudududu.wavwillstarttoplayatthetransitiontoslidetwointheactivepresentationandwillcontinuetoplayuntilthenextsoundstarts.
WithActivePresentation.Slides(2).SlideShowTransition
.SoundEffect.ImportFromFile"c:\sndsys\dudududu.wav"
.LoopSoundUntilNext=True
EndWith
IncrementBrightnessMethodChangesthebrightnessofthepicturebythespecifiedamount.UsetheBrightnesspropertytosettheabsolutebrightnessofthepicture.
expression.IncrementBrightness(Increment)
expressionRequired.AnexpressionthatreturnsaPictureFormatobject.
IncrementRequiredSingle.SpecifieshowmuchtochangethevalueoftheBrightnesspropertyforthepicture.Apositivevaluemakesthepicturebrighter;anegativevaluemakesthepicturedarker.
Remarks
YoucannotadjustthebrightnessofapicturepasttheupperorlowerlimitfortheBrightnessproperty.Forexample,iftheBrightnesspropertyisinitiallysetto0.9andyouspecify0.3fortheIncrementargument,theresultingbrightnesslevelwillbe1.0,whichistheupperlimitfortheBrightnessproperty,insteadof1.2.
Example
ThisexamplecreatesaduplicateofshapeoneonmyDocumentandthenmovesanddarkenstheduplicate.Fortheexampletowork,shapeonemustbeeitherapictureoranOLEobject.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).Duplicate
.PictureFormat.IncrementBrightness-0.2
.IncrementLeft50
.IncrementTop50
EndWith
IncrementContrastMethodChangesthecontrastofthepicturebythespecifiedamount.UsetheContrastpropertytosettheabsolutecontrastforthepicture.
expression.IncrementContrast(Increment)
expressionRequired.AnexpressionthatreturnsaPictureFormatobject.
IncrementRequiredSingle.SpecifieshowmuchtochangethevalueoftheContrastpropertyforthepicture.Apositivevalueincreasesthecontrast;anegativevaluedecreasesthecontrast.
Remarks
YoucannotadjustthecontrastofapicturepasttheupperorlowerlimitfortheContrastproperty.Forexample,iftheContrastpropertyisinitiallysetto0.9andyouspecify0.3fortheIncrementargument,theresultingcontrastlevelwillbe1.0,whichistheupperlimitfortheContrastproperty,insteadof1.2.
Example
ThisexampleincreasesthecontrastforallpicturesonmyDocumentthataren'talreadysettomaximumcontrast.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Ifs.Type=msoPictureThen
s.PictureFormat.IncrementContrast0.1
EndIf
Next
IncrementLeftMethodMovesthespecifiedshapehorizontallybythespecifiednumberofpoints.
expression.IncrementLeft(Increment)
expressionRequired.AnexpressionthatreturnsaShapeobject.
IncrementRequiredSingle.Specifieshowfartheshapeistobemovedhorizontally,inpoints.Apositivevaluemovestheshapetotheright;anegativevaluemovesittotheleft.
Example
ThisexampleduplicatesshapeoneonmyDocument,setsthefillfortheduplicate,movesit70pointstotherightand50pointsup,androtatesit30degreesclockwise.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).Duplicate
.Fill.PresetTexturedmsoTextureGranite
.IncrementLeft70
.IncrementTop-50
.IncrementRotation30
EndWith
IncrementOffsetXMethodChangesthehorizontaloffsetoftheshadowbythespecifiednumberofpoints.UsetheOffsetXpropertytosettheabsolutehorizontalshadowoffset.
expression.IncrementOffsetX(Increment)
expressionRequired.AnexpressionthatreturnsaShadowFormatobject.
IncrementRequiredSingle.Specifieshowfartheshadowoffsetistobemovedhorizontally,inpoints.Apositivevaluemovestheshadowtotheright;anegativevaluemovesittotheleft.
Example
ThisexamplemovestheshadowforshapethreeonmyDocumenttotheleftby3points.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(3).Shadow.IncrementOffsetX-3
IncrementOffsetYMethodChangestheverticaloffsetoftheshadowbythespecifiednumberofpoints.UsetheOffsetYpropertytosettheabsoluteverticalshadowoffset.
expression.IncrementOffsetY(Increment)
expressionRequired.AnexpressionthatreturnsaShadowFormatobject.
IncrementRequiredSingle.Specifieshowfartheshadowoffsetistobemovedvertically,inpoints.Apositivevaluemovestheshadowdown;anegativevaluemovesitup.
Example
ThisexamplemovestheshadowforshapethreeonmyDocumentupby3points.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(3).Shadow.IncrementOffsetY-3
ShowAll
IncrementRotationMethodChangestherotationofthespecifiedshapearoundthez-axis.bythespecifiednumberofdegrees.UsetheRotationpropertytosettheabsoluterotationoftheshape.
expression.IncrementRotation(Increment)
expressionRequired.AnexpressionthatreturnsaShapeobject.
IncrementRequiredSingle.Specifieshowfartheshapeistoberotatedhorizontally,indegrees.Apositivevaluerotatestheshapeclockwise;anegativevaluerotatesitcounterclockwise.
Remarks
Torotateathree-dimensionalshapearoundthex-axisorthey-axis,usetheIncrementRotationXmethodortheIncrementRotationYmethod.
Example
ThisexampleduplicatesshapeoneonmyDocument,setsthefillfortheduplicate,movesit70pointstotherightand50pointsup,androtatesit30degreesclockwise.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).Duplicate
.Fill.PresetTexturedmsoTextureGranite
.IncrementLeft70
.IncrementTop-50
.IncrementRotation30
EndWith
ShowAll
IncrementRotationXMethodChangestherotationofthespecifiedshapearoundthex-axisbythespecifiednumberofdegrees.UsetheRotationXpropertytosettheabsoluterotationoftheshapearoundthex-axis.
expression.IncrementRotationX(Increment)
expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.
IncrementRequiredSingle.Specifieshowmuch(indegrees)therotationoftheshapearoundthex-axisistobechanged.Canbeavaluefrom–90through90.Apositivevaluetiltstheshapeup;anegativevaluetiltsitdown.
Remarks
Youcannotadjusttherotationaroundthex-axisofthespecifiedshapepasttheupperorlowerlimitfortheRotationXproperty(90degreesto–90degrees).Forexample,iftheRotationXpropertyisinitiallysetto80andyouspecify40fortheIncrementargument,theresultingrotationwillbe90(theupperlimitfortheRotationXproperty)insteadof120.
Tochangetherotationofashapearoundthey-axis,usetheIncrementRotationYmethod.Tochangetherotationaroundthez-axis,usetheIncrementRotationmethod.
Example
ThisexampletiltsshapeoneonmyDocumentup10degrees.Shapeonemustbeanextrudedshapeforyoutoseetheeffectofthiscode.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).ThreeD.IncrementRotationX10
ShowAll
IncrementRotationYMethodChangestherotationofthespecifiedshapearoundthey-axisbythespecifiednumberofdegrees.UsetheRotationYpropertytosettheabsoluterotationoftheshapearoundthey-axis.
expression.IncrementRotationY(Increment)
expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.
IncrementRequiredSingle.Specifieshowmuch(indegrees)therotationoftheshapearoundthey-axisistobechanged.Canbeavaluefrom–90through90.Apositivevaluetiltstheshapetotheleft;anegativevaluetiltsittotheright.
Remarks
Tochangetherotationofashapearoundthex-axis,usetheIncrementRotationXmethod.Tochangetherotationaroundthez-axis,usetheIncrementRotationmethod.
Youcannotadjusttherotationaroundthey-axisofthespecifiedshapepasttheupperorlowerlimitfortheRotationYproperty(90degreesto–90degrees).Forexample,iftheRotationYpropertyisinitiallysetto80andyouspecify40fortheIncrementargument,theresultingrotationwillbe90(theupperlimitfortheRotationYproperty)insteadof120.
Example
ThisexampletiltsshapeoneonmyDocument10degreestotheright.Shapeonemustbeanextrudedshapeforyoutoseetheeffectofthiscode.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).ThreeD.IncrementRotationY-10
IncrementTopMethodMovesthespecifiedshapeverticallybythespecifiednumberofpoints.
expression.IncrementTop(Increment)
expressionRequired.AnexpressionthatreturnsaShapeobject.
IncrementRequiredSingle.Specifieshowfartheshapeobjectistobemovedvertically,inpoints.Apositivevaluemovestheshapedown;anegativevaluemovesitup.
Example
ThisexampleduplicatesshapeoneonmyDocument,setsthefillfortheduplicate,movesit70pointstotherightand50pointsup,androtatesit30degreesclockwise.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).Duplicate
.Fill.PresetTexturedmsoTextureGranite
.IncrementLeft70
.IncrementTop-50
.IncrementRotation30
EndWith
ShowAll
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.
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.
Example
ThisexampleaddsasmoothnodewithacurvedsegmentafternodefourinshapethreeonmyDocument.Shapethreemustbeafreeformdrawingwithatleastfournodes.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).Nodes
.InsertIndex:=4,SegmentType:=msoSegmentCurve,_
EditingType:=msoEditingSmooth,X1:=210,Y1:=100
EndWith
InsertAfterMethodAppendsastringtotheendofthespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheappendedtext.Whenusedwithoutanargument,thismethodreturnsazero-lengthstringattheendofthespecifiedrange.
expression.InsertAfter(NewText)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
NewTextOptionalString.Thetexttobeinserted.Thedefaultvalueisanemptystring.
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
InsertBeforeMethodAppendsastringtothebeginningofthespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheappendedtext.Whenusedwithoutanargument,thismethodreturnsazero-lengthstringattheendofthespecifiedrange.
expression.InsertBefore(NewText)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
NewTextOptionalString.Thetexttobeappended.Thedefaultvalueisanemptystring.
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
ShowAll
InsertDateTimeMethodInsertsthedateandtimeinthespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheinsertedtext.
expression.InsertDateTime(DateTimeFormat,InsertAsField)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
DateTimeFormatRequiredPpDateTimeFormat.Aformatforthedateandtime.
PpDateTimeFormatcanbeoneofthesePpDateTimeFormatconstants.ppDateTimeddddMMMMddyyyyppDateTimedMMMMyyyyppDateTimedMMMyyppDateTimeFormatMixedppDateTimeHmmppDateTimehmmAMPMppDateTimeHmmssppDateTimehmmssAMPMppDateTimeMdyyppDateTimeMMddyyHmmppDateTimeMMddyyhmmAMPMppDateTimeMMMMdyyyyppDateTimeMMMMyyppDateTimeMMyy
InsertAsFieldOptionalMsoTriState.Determineswhethertheinserteddateandtimewillbeupdatedeachtimethepresentationisopened.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.
msoTriStateMixedmsoTriStateTogglemsoTrueUpdatestheinserteddateandtimeeachtimethepresentationisopened.
Example
Thisexampleinsertsthedateandtimeafterthefirstsentenceofthefirstparagraphinshapetwoonslideoneintheactivepresentation.
Setsh=Application.ActivePresentation.Slides(1).Shapes(2)
SetsentOne=sh.TextFrame.TextRange.Paragraphs(1).Sentences(1)
sentOne.InsertAfter.InsertDateTimeppDateTimeMdyy
InsertFromFileMethodInsertsslidesfromafileintoapresentation,atthespecifiedlocation.Returnsanintegerthatrepresentsthenumberofslidesinserted.
expression.InsertFromFile(FileName,Index,SlideStart,SlideEnd)
expressionRequired.AnexpressionthatreturnsaSlidescollection.
FileNameRequiredString.Thenameofthefilethatcontainstheslidesyouwanttoinsert.
IndexRequiredLong.TheindexnumberoftheSlideobjectinthespecifiedSlidescollectionyouwanttoinsertthenewslidesafter.
SlideStartOptionalLong.TheindexnumberofthefirstSlideobjectintheSlidescollectioninthefiledenotedbyFileName.
SlideEndOptionalLong.TheindexnumberofthelastSlideobjectintheSlidescollectioninthefiledenotedbyFileName.
Example
ThisexampleinsertsslidesthreethroughsixfromC:\Ppt\Sales.pptafterslidetwointheactivepresentation.
ActivePresentation.Slides.InsertFromFile_
"c:\ppt\sales.ppt",2,3,6
InsertSlideNumberMethodInsertstheslidenumberofthecurrentslideintothespecifiedtextrange.ReturnsaTextRangeobjectthatrepresentstheslidenumber.
expression.InsertSlideNumber
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
Remarks
Theinsertedslidenumberisautomaticallyupdatedwhentheslidenumberofthecurrentslidechanges.
Example
Thisexampleinsertstheslidenumberofthecurrentslideafterthefirstsentenceofthefirstparagraphinshapetwoonslideoneintheactivepresentation.
Setsh=Application.ActivePresentation.Slides(1).Shapes(2)
SetsentOne=sh.TextFrame.TextRange.Paragraphs(1).Sentences(1)
sentOne.InsertAfter.InsertSlideNumber
ShowAll
InsertSymbolMethodReturnsaTextRangeobjectthatrepresentsasymbolinsertedintothespecifiedtextrange.
expression.InsertSymbol(FontName,CharNumber,UniCode)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
FontNameRequiredString.Thefontname.
CharNumberRequiredLong.TheUnicodeorASCIIcharacternumber.
UnicodeOptionalMsoTriState.SpecifieswhethertheCharNumberargumentrepresentsanASCIIorUnicodecharacter.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothismethod.msoFalseDefault.TheCharNumberargumentrepresentsanASCIIcharacternumber.msoTriStateMixedDoesn'tapplytothismethod.msoTriStateToggleDoesn'tapplytothismethod.msoTrueTheCharNumberargumentrepresentsaUnicodecharacter.
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
ShowAll
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,
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.
NameRequiredString.Thenameofthesingletaginthecollectiontobereturned.
ItemmethodasitappliestotheTextStylesobject.
ReturnsasingletextstylefromthespecifiedTextStylescollection.
expression.Item(Type)
expressionRequired.AnexpressionthatreturnsaTextStylescollection.
TypeRequiredPpTextStyleType.Thetextstyletype.
PpTextStyleTypecanbeoneofthesePpTextStyleTypeconstants.ppBodyStyleppDefaultStyleppTitleStyle
Remarks
TheItemmethodisthedefaultmemberforacollection.Forexample,thefollowingtwolinesofcodeareequivalent:
ActivePresentation.Slides.Item(1)
ActivePresentation.Slides(1)
Formoreinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
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.
ForEachsInActivePresentation.Slides
Ifs.Tags.Item("region")<>"east"Then
s.SlideShowTransition.Hidden=True
EndIf
Next
LargeScrollMethodScrollsthroughthespecifieddocumentwindowbypages.
expression.LargeScroll(Down,Up,ToRight,ToLeft)
expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.
DownOptionalLong.Specifiesthenumberofpagestoscrolldown.
UpOptionalLong.Specifiesthenumberofpagestoscrollup.
ToRightOptionalLong.Specifiesthenumberofpagestoscrollright.
ToLeftOptionalLong.Specifiesthenumberofpagestoscrollleft.
Remarks
Ifnoargumentsarespecified,thismethodscrollsdownonepage.IfDownandUparebothspecified,theireffectsarecombined.Forexample,ifDownis2andUpis4,thismethodscrollsuptwopages.Similarly,ifRightandLeftarebothspecified,theireffectsarecombined.
Anyoftheargumentscanbeanegativenumber.
Example
Thisexamplescrollstheactivewindowdownthreepages.
Application.ActiveWindow.LargeScrollDown:=3
LastMethodSetsthespecifiedslideshowviewtodisplaythelastslideinthepresentation.
expression.Last
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
Remarks
IfyouusetheLastmethodtoswitchfromoneslidetoanotherduringaslideshow,whenyoureturntotheoriginalslide,itsanimationpicksupwhereitleftoff.
Example
Thisexamplesetsslideshowwindowonetodisplaythelastslideinthepresentation.
SlideShowWindows(1).View.Last
LinesMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextlines.Forinformationaboutcountingorloopingthroughthelinesinatextrange,seetheTextRangeobject.
expression.Lines(Start,Length)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
StartOptionalLong.Thefirstlineinthereturnedrange.
LengthOptionalLong.Thenumberoflinestobereturned.
Remarks
IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstlineandendswiththelastparagraphinthespecifiedrange.
IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsoneline.
IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstlineinthespecifiedrange.
IfStartisgreaterthanthenumberoflinesinthespecifiedtext,thereturnedrangestartswiththelastlineinthespecifiedrange.
IfLengthisgreaterthanthenumberoflinesfromthespecifiedstartinglinetotheendofthetext,thereturnedrangecontainsallthoselines.
Example
Thisexampleformatsasitalicthefirsttwolinesofthesecondparagraphinshapetwoonslideoneintheactivepresentation.
Application.ActivePresentation.Slides(1).Shapes(2)_
.TextFrame.TextRange.Paragraphs(2)_
.Lines(1,2).Font.Italic=True
LoadMethodReturnsaDesignobjectthatrepresentsadesignloadedintothemasterlistofthespecifiedpresentation.
expression.Load(TemplateName,Index)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
TemplateNameRequiredString.Thepathtothedesigntemplate.
IndexOptionalLong.Theindexnumberofthedesigntemplateinthecollectionofdesigntemplates.Thedefaultis-1,whichmeansthedesigntemplateisaddedtotheendofthelistofdesignsinthepresentation.
Example
Thisexampleaddadesigntemplatetothebeginningofthecollectionofdesigntemplatesintheactivepresentation.Thisexampleassumesthe"artsy.pot"templateislocatedatthespecifiedpath.
SubLoadDesign()
ActivePresentation.Designs.LoadTemplateName:="C:\ProgramFiles\"&_
"MicrosoftOffice\Templates\PresentationDesigns\Balance.pot",Index:=1
EndSub
LtrRunMethodSetsthedirectionoftextinatextrangetoreadfromlefttoright.
expression.LtrRun
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
Remarks
Thismethodmakesitpossibletousetextfrombothleft-to-rightandright-to-leftlanguagesinthesamepresentation.
Example
Thefollowingexamplefindsalloftheshapesonslideonethatcontaintextandchangesthetexttoreadfromlefttoright.
ActiveWindow.ViewType=ppViewSlide
ForEachshInActivePresentation.Slides(1).Shapes
Ifsh.HasTextFrameThen
sh.TextFrame.TextRange.LtrRun
EndIf
Next
ShowAll
MergeMethodMergemethodasitappliestotheCellobject.
Mergesonetablecellwithanother.Theresultisasingletablecell.
expression.Merge(MergeTo)
expressionRequired.AnexpressionthatreturnsaCellobject.
MergeToRequiredCellobject.Cellobjecttobemergedwith.Usethesyntax.Cell(row,column).
MergemethodasitappliestothePresentationobject.
Mergesonepresentationintoanotherpresentation.
expression.Merge(Path)
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
PathRequiredString.Thefullpathofafiletomergewiththispresentation.
Remarks
Thismethodreturnsanerrorifthefilenamecannotbeopened,orthepresentationhasabaseline.
Example
Thisexamplemergesthefirsttwocellsofrowoneinthespecifiedtable.
WithActivePresentation.Slides(2).Shapes(5).Table
.Cell(1,1).MergeMergeTo:=.Cell(1,2)
EndWith
MoveAfterMethodMovesoneanimationeffecttoafteranotheranimationeffect.
expression.MoveAfter(Effect)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
EffectRequiredEffectobject.Theeffectafterwhichtheeffectinexpressionwillbemoved.
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
MoveBeforeMethodMovesoneanimationeffecttobeforeanotheranimationeffect.
expression.MoveBefore(Effect)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
EffectRequiredEffectobject.Theeffectbeforewhichtheeffectinexpressionwillbemoved.
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
ShowAll
MoveNodeMethodMovesadiagramnode,andanyofitschildnodes,withinadiagram.
expression.MoveNode(TargetNode,Pos)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
TargetNodeRequiredDiagramNodeobject.Thesourcediagramnodeforthemove.
PosRequiredMsoRelativeNodePosition.Specifieswherethenodewillbeadded,relativetoTargetNode.
MsoRelativeNodePositioncanbeoneoftheseMsoRelativeNodePositionconstants.msoAfterLastSiblingmsoAfterNodemsoBeforeFirstSiblingmsoBeforeNode
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
MoveToMethodMovesthespecifiedobjecttoaspecificlocationwithinthesamecollection,renumberingallotheritemsinthecollectionappropriately.
expression.MoveTo(toPos)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
toPosRequiredLong.Theindextowhichtomovetheanimationeffect.
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
NameMethodReturnsthenameofthespecifiedtagasaString.
expression.Name(Index)
expressionRequired.AnexpressionthatreturnsaTagscollection.
IndexRequiredLong.Thetagnumber.
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
NewWindowMethodPresentationobject:Opensanewwindowthatcontainsthespecifiedpresentation.ReturnsaDocumentWindowobjectthatrepresentsthenewwindow.
DocumentWindowobject:Opensanewwindowthatcontainsthesamedocumentthat'sdisplayedinthespecifiedwindow.ReturnsaDocumentWindowobjectthatrepresentsthenewwindow.
expression.NewWindow
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplecreatesanewwindowwiththecontentsoftheactivewindow(thisactivatesthenewwindow)andthenswitchesbacktothefirstwindow.
SetoldW=Application.ActiveWindow
SetnewW=oldW.NewWindow
oldW.Activate
NextMethodDisplaystheslideimmediatelyfollowingtheslidethat'scurrentlydisplayed.Ifthelastslideisdisplayed,theNextmethodclosestheslideshowinspeakermodeandreturnstothefirstslideinkioskmode.UsetheViewpropertyoftheSlideShowWindowobjecttoreturntheSlideShowViewobject.
expression.Next
expressionRequired.AnexpressionthatreturnsoneoftheitemsintheAppliesTolist.
Example
Thisexampleshowstheslideimmediatelyfollowingthecurrentlydisplayedslideonslideshowwindowone.
SlideShowWindows(1).View.Next
NextNodeMethodReturnsaDiagramNodeobjectthatrepresentsthenextdiagramnodeinacollectionofdiagramnodes.
expression.NextNode
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
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).
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
ShowAll
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.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseHidestheopenedpresentation.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Opensthefileinavisiblewindow.
OpenConflictDocumentOptionalMsoTriState.Specifieswhethertoopentheconflictfileforapresentationwithanofflineconflict.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Openstheserverfileandignorestheconflictdocument.msoTriStateMixedmsoTriStateTogglemsoTrueOpenstheconflictfileandoverwritestheserverfile.
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.
Example
Thisexampleopensapresentationwithread-onlystatus.
Presentations.OpenFileName:="c:\MyDocuments\pres1.ppt",_
ReadOnly:=msoTrue
ParagraphsMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextparagraphs.Forinformationaboutcountingorloopingthroughtheparagraphsinatextrange,seetheTextRangeobject.
expression.Paragraphs(Start,Length)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
StartOptionalLong.Thefirstparagraphinthereturnedrange.
LengthOptionalLong.Thenumberofparagraphstobereturned.
Remarks
IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstparagraphandendswiththelastparagraphinthespecifiedrange.
IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsoneparagraph.
IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstparagraphinthespecifiedrange.
IfStartisgreaterthanthenumberofparagraphsinthespecifiedtext,thereturnedrangestartswiththelastparagraphinthespecifiedrange.
IfLengthisgreaterthanthenumberofparagraphsfromthespecifiedstartingparagraphtotheendofthetext,thereturnedrangecontainsallthoseparagraphs.
Example
Thisexampleformatsasitalicthefirsttwolinesofthesecondparagraphinshapetwoonslideoneintheactivepresentation.
Application.ActivePresentation.Slides(1).Shapes(2)_
.TextFrame.TextRange.Paragraphs(2)_
.Lines(1,2).Font.Italic=True
ShowAll
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
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
PastemethodasitappliestotheViewobject.
PastesthecontentsoftheClipboardintotheactiveview.Attemptingtopasteanobjectintoaviewthatwon'tacceptitcausesanerror.Forinformationaboutviewsandtheobjectsyoucanpasteintothem,seethe"Remarks"section.
expression.Paste
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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.
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.
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
ShowAll
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
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
argumentisthetextthatappearsbelowtheicon.Ifthislabelismissing,MicrosoftPowerPointgeneratesaniconlabelbasedontheClipboardcontents.IfDisplayAsIconissettomsoFalse,thenthisargumentisignored.
LinkOptionalMsoTriState.DetermineswhethertocreatealinktothesourcefileoftheClipboardcontents.AnerroroccursiftheClipboardcontentsdonotsupportalink.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesnotapplytothismethod.msoFalsedefaultDoesnotcreatealinktothesourcefileoftheClipboardcontents.msoTriStateMixedDoesnotapplytothismethod.msoTriStateToggleDoesnotapplytothismethod.msoTrueCreatesalinktothesourcefileoftheClipboardcontents.
Remarks
AnerroroccursifthereisnodataontheClipboardwhenthePasteSpecialmethodiscalled.
Example
Thefollowingexamplepastesabitmapimageasaniconintoanotherwindow.Thisexampleassumestherearetwoopenwindows,andabitmapimageinthefirstwindowiscurrentlyselected.
SubPasteOLEObject()
Windows(1).Selection.Copy
Windows(2).View.PasteSpecialDataType:=ppPasteOLEObject,_
DisplayAsIcon:=msoTrue,IconLabel:="NewBitmapImage"
EndSub
ShowAll
PatternedMethodSetsthespecifiedfilltoapattern.
expression.Patterned(Pattern)
expressionRequired.AnexpressionthatreturnsaFillFormatobject.
PatternRequiredMsoPatternType.Thepatterntobeusedforthespecifiedfill.
MsoPatternTypecanbeoneoftheseMsoPatternTypeconstants.msoPattern10PercentmsoPattern20PercentmsoPattern25PercentmsoPattern30PercentmsoPattern40PercentmsoPattern50PercentmsoPattern5PercentmsoPattern60PercentmsoPattern70PercentmsoPattern75PercentmsoPattern80PercentmsoPattern90PercentmsoPatternDarkDownwardDiagonalmsoPatternDarkHorizontalmsoPatternDarkUpwardDiagonalmsoPatternDashedDownwardDiagonalmsoPatternDashedHorizontalmsoPatternDashedUpwardDiagonalmsoPatternDashedVerticalmsoPatternDiagonalBrickmsoPatternDivot
msoPatternDottedDiamondmsoPatternDottedGridmsoPatternHorizontalBrickmsoPatternLargeCheckerBoardmsoPatternLargeConfettimsoPatternLargeGridmsoPatternLightDownwardDiagonalmsoPatternLightHorizontalmsoPatternLightUpwardDiagonalmsoPatternLightVerticalmsoPatternMixedmsoPatternNarrowHorizontalmsoPatternNarrowVerticalmsoPatternOutlinedDiamondmsoPatternPlaidmsoPatternShinglemsoPatternSmallCheckerBoardmsoPatternSmallConfettimsoPatternSmallGridmsoPatternSolidDiamondmsoPatternSpheremsoPatternTrellismsoPatternWavemsoPatternWeavemsoPatternWideDownwardDiagonalmsoPatternWideUpwardDiagonalmsoPatternZigZagmsoPatternDarkVertical
Remarks
UsetheBackColorandForeColorpropertiestosetthecolorsusedinthepattern.
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
PickUpMethodCopiestheformattingofthespecifiedshape.UsetheApplymethodtoapplythecopiedformattingtoanothershape.
expression.PickUp
expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.
Example
ThisexamplecopiestheformattingofshapeoneonmyDocument,andthenappliesthecopiedformattingtoshapetwo.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument
.Shapes(1).PickUp
.Shapes(2).Apply
EndWith
PictureMethodSetsthegraphicsfiletobeusedforbulletsinabulletedlistwhentheTypepropertyoftheBulletFormatobjectissettoppBulletPicture.
expression.Picture(Picture)
expressionRequired.AnexpressionthatreturnsaBulletFormatobjectoftypeppBulletPicture.
PictureRequiredString.Thepathandfilenameofavalidgraphicsfile.
Remarks
Validgraphicsfilesincludefileswiththefollowingextensions:.bmp,.cdr,.cgm,.drw,.dxf,.emf,.eps,.gif,.jpg,.jpeg,.pcd,.pct,.pcx,.pict,.png,.tga,.tiff,.wmf,and.wpg.
Example
Thisexamplesetsthebulletsinthetextboxspecifiedbyshapetwoonslideonetoabitmappictureofabluerivet.
WithActivePresentation.Slides(1).Shapes(2).TextFrame
With.TextRange.ParagraphFormat.Bullet
.Type=ppBulletPicture
.Picture("C:\Windows\BlueRivets.bmp")
EndWith
EndWith
PlayMethodPlaysthespecifiedsoundeffect.
expression.Play
expressionRequired.AnexpressionthatreturnsaSoundEffectobject.
Example
Thisexampleplaysthesoundeffectthat'sbeensetforthetransitiontoslidetwointheactivepresentation.
ActivePresentation.Slides(2).SlideShowTransition.SoundEffect.Play
PointsToScreenPixelsXMethodConvertsahorizontalmeasurementfrompointstopixels.Usedtoreturnahorizontalscreenlocationforatextframeorshape.ReturnstheconvertedmeasurementasaSingle.
expression.PointsToScreenPixelsX(Points)
expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.
PointsRequiredSingle.Thehorizontalmeasurement(inpoints)tobeconvertedtopixels.
Example
Thisexampleconvertsthewidthandheightoftheselectedtextframeboundingboxfrompointstopixels,andreturnsthevaluestomyXparmandmyYparm.
WithActiveWindow
myXparm=.PointsToScreenPixelsX_
(.Selection.TextRange.BoundWidth)
myYparm=.PointsToScreenPixelsY_
(.Selection.TextRange.BoundHeight)
EndWith
PointsToScreenPixelsYMethodConvertsaverticalmeasurementfrompointstopixels.Usedtoreturnaverticalscreenlocationforatextframeorshape.ReturnstheconvertedmeasurementasaSingle.
expression.PointsToScreenPixelsY(Points)
expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.
PointsRequiredSingle.Theverticalmeasurement(inpoints)tobeconvertedtopixels.
Example
Thisexampleconvertsthewidthandheightoftheselectedtextframeboundingboxfrompointstopixels,andreturnsthevaluestomyXparmandmyYparm.
WithActiveWindow
myXparm=.PointsToScreenPixelsX_
(.Selection.TextRange.BoundWidth)
myYparm=.PointsToScreenPixelsY_
(.Selection.TextRange.BoundHeight)
EndWith
ShowAll
PresetDropMethodSpecifieswhetherthecalloutlineattachestothetop,bottom,orcenterofthecallouttextboxorwhetheritattachesatapointthat'saspecifieddistancefromthetoporbottomofthetextbox.
expression.PresetDrop(DropType)
expressionRequired.AnexpressionthatreturnsaCalloutFormatobject.
DropTypeRequiredMsoCalloutDropType.Thestartingpositionofthecalloutlinerelativetothetextboundingbox.
MsoCalloutDropTypecanbeoneoftheseMsoCalloutDropTypeconstants.msoCalloutDropBottommsoCalloutDropCentermsoCalloutDropCustomSpecifyingthisconstantwillcauseyourcodetofail.msoCalloutDropMixedmsoCalloutDropTop
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
ShowAll
PresetGradientMethodSetsthespecifiedfilltoapresetgradient.
expression.PresetGradient(Style,Variant,PresetGradientType)
expressionRequired.AnexpressionthatreturnsaFillFormatobject.
StyleRequiredMsoGradientStyle.Thegradientstyle.
MsoGradientStylecanbeoneoftheseMsoGradientStyleconstants.msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVertical
VariantRequiredInteger.Thegradientvariant.Canbeavaluefrom1to4,correspondingtothefourvariantsontheGradienttabintheFillEffectsdialogbox.IfStyleismsoGradientFromTitleormsoGradientFromCenter,thisargumentcanbeeither1or2.
PresetGradientTypeRequiredMsoPresetGradientType.Thegradienttype.
MsoPresetGradientTypecanbeoneoftheseMsoPresetGradientTypeconstants.msoGradientBrassmsoGradientCalmWatermsoGradientChromemsoGradientChromeIImsoGradientDaybreakmsoGradientDesert
msoGradientEarlySunsetmsoGradientFiremsoGradientFogmsoGradientGoldmsoGradientGoldIImsoGradientHorizonmsoGradientLateSunsetmsoGradientMahoganymsoGradientMossmsoGradientNightfallmsoGradientOceanmsoGradientParchmentmsoGradientPeacockmsoGradientRainbowmsoGradientRainbowIImsoGradientSapphiremsoGradientSilvermsoGradientWheatmsoPresetGradientMixed
Example
ThisexampleaddsarectanglewithapresetgradientfilltomyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.AddShape(msoShapeRectangle,90,90,140,80)_
.Fill.PresetGradientmsoGradientHorizontal,1,msoGradientBrass
ShowAll
PresetTexturedMethodSetsthespecifiedfilltoapresettexture.
expression.PresetTextured(PresetTexture)
expressionRequired.AnexpressionthatreturnsaFillFormatobject.
PresetTextureRequiredMsoPresetTexture.Thepresettexture.
MsoPresetTexturecanbeoneoftheseMsoPresetTextureconstants.msoPresetTextureMixedmsoTextureBlueTissuePapermsoTextureBouquetmsoTextureBrownMarblemsoTextureCanvasmsoTextureCorkmsoTextureDenimmsoTextureFishFossilmsoTextureGranitemsoTextureGreenMarblemsoTextureMediumWoodmsoTextureNewsprintmsoTextureOakmsoTexturePaperBagmsoTexturePapyrusmsoTextureParchmentmsoTexturePinkTissuePapermsoTexturePurpleMeshmsoTextureRecycledPapermsoTextureSandmsoTextureStationerymsoTextureWalnut
msoTextureWaterDropletsmsoTextureWhiteMarblemsoTextureWovenMat
Example
Thisexampleaddsarectanglewithagreen-marbletexturedfilltomyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.AddShape(msoShapeCan,90,90,40,80)_
.Fill.PresetTexturedmsoTextureGreenMarble
PreviousMethodShowtheslideimmediatelyprecedingtheslidethat'scurrentlydisplayed.Ifyouarecurrentlyonthefirstslideinakioskslideshow,thePreviousmethodtakesyoutothelastslideinaslideshow;otherwise,ithasnoeffectifthefirstslideinthepresentationiscurrentlydisplayed.UsetheViewpropertyoftheSlideShowWindowobjecttoreturntheSlideShowViewobject.
expression.Previous
expressionRequired.AnexpressionthatreturnsoneoftheitemsintheAppliesTolist.
Example
Thisexampleshowstheslideimmediatelyprecedingthecurrentlydisplayedslideonslideshowwindowone.
SlideShowWindows(1).View.Previous
PrevNodeMethodReturnsaDiagramNodeobjectthatrepresentsthepreviousdiagramnodeinacollectionofdiagramnodes.
expression.PrevNode
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
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.
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"
PublishMethodCreatesaWebpresentation(HTMLformat)fromanyloadedpresentation.YoucanviewthepublishedpresentationinaWebbrowser.
expression.Publish
expressionRequired.AnexpressionthatreturnsaPublishObjectobject.
Remarks
YoucanspecifythecontentandattributesofthepublishedpresentationbysettingvariouspropertiesofthePublishObjectobject.Forexample,theSourceTypepropertydefinestheportionofaloadedpresentationtobepublished.TheRangeStartpropertyandtheRangeEndpropertyspecifytherangeofslidestopublish,andtheSpeakerNotespropertydesignateswhetherornottopublishthespeaker'snotes.
Example
ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.
WithActivePresentation.PublishObjects(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.Publish
EndWith
QuitMethodQuitsPowerPoint.ThisisequivalenttoclickingExitontheFilemenu.
expression.Quit
expressionRequired.AnexpressionthatreturnsanApplicationobject.
Remarks
Toavoidbeingpromptedtosavechanges,useeithertheSaveorSaveAsmethodtosaveallopenpresentationsbeforecallingtheQuitmethod.
Example
ThisexamplesavesallopenpresentationsandthenquitsPowerPoint.
WithApplication
ForEachwIn.Presentations
w.Save
Nextw
.Quit
EndWith
ShowAll
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)
expressionRequired.AnexpressionthatreturnsaSlidescollectionobject.
IndexOptionalVariant.Theindividualslidesthataretobeincludedintherange.CanbeanIntegerthatspecifiestheindexnumberoftheslide,aStringthatspecifiesthenameoftheslide,oranarraythatcontainseitherintegersorstrings.Ifthisargumentisomitted,theRangemethodreturnsalltheobjectsinthespecifiedcollection.
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)
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
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.
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)
RangeFromPointMethodReturnstheShapeobjectthatislocatedatthepointspecifiedbythescreenpositioncoordinatepair.Ifnoshapeislocatedatthecoordinatepairspecified,thenthemethodreturnsNothing.
expression.RangeFromPoint(x,y)
expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.
xRequiredLong.Thehorizontaldistance(inpixels)fromtheleftedgeofthescreentothepoint.
yRequiredLong.Theverticaldistance(inpixels)fromthetopofthescreentothepoint.
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)
RegroupMethodRegroupsthegroupthatthespecifiedshaperangebelongedtopreviously.ReturnstheregroupedshapesasasingleShapeobject.
expression.Regroup
expressionRequired.AnexpressionthatreturnsaShapeRangeobject.
Remarks
TheRegroupmethodonlyrestoresthegroupforthefirstpreviouslygroupedshapeitfindsinthespecifiedShapeRangecollection.Therefore,ifthespecifiedshaperangecontainsshapesthatpreviouslybelongedtodifferentgroups,onlyoneofthegroupswillberestored.
Notethatbecauseagroupofshapesistreatedasasingleshape,groupingandungroupingshapeschangesthenumberofitemsintheShapescollectionandchangestheindexnumbersofitemsthatcomeaftertheaffecteditemsinthecollection.
Example
Thisexampleregroupstheshapesintheselectionintheactivewindow.Iftheshapeshaven'tbeenpreviouslygroupedandungrouped,thisexamplewillfail.
ActiveWindow.Selection.ShapeRange.Regroup
ShowAll
ReloadAsMethodReloadsapresentationbasedonaspecifiedHTMLdocumentencoding.
expression.ReloadAs(cp)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
cpRequiredMsoEncoding.ThedocumentencodingtousewhenreloadingtheWebpage.
MsoEncodingcanbeoneoftheseMsoEncodingconstants.msoEncodingArabicAutoDetectmsoEncodingAutoDetectmsoEncodingCyrillicAutoDetectmsoEncodingGreekAutoDetectmsoEncodingJapaneseAutoDetectmsoEncodingKoreanAutoDetectmsoEncodingSimplifiedChineseAutoDetectmsoEncodingTraditionalChineseAutoDetect
Example
ThisexamplereloadstheactivepresentationusingWesternencoding.
ActivePresentation.ReloadAs(msoEncodingWestern)
RemoveMethodRemovesanadd-infromthecollectionofadd-ins.
expression.Remove(Index)
expressionRequired.AnexpressionthatreturnsanAddInsobject.
IndexRequiredVariant.Thenameoftheadd-intoberemovedfromthecollection.
Example
Thisexampleremovestheadd-innamed"MyTools"fromthelistofavailableadd-ins.
AddIns.Remove"mytools"
RemoveBaselineMethodRemovesthebaselinefromthepresentation.
expression.RemoveBaseline
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thismethodgeneratesanerrorifthepresentationisanauthorpresentationorifthereisnobaseline.
Example
Thefollowinglineofcoderemovesthebaselinefromtheactivepresentation.
SubRmvBaseline()
ActivePresentation.RemoveBaseline
EndSub
RemovePeriodsMethodRemovestheperiodattheendofeachparagraphinthespecifiedtext.
expression.RemovePeriods
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
Example
Thisexampleremovestheperiodattheendofeachparagraphinshapetwoonslideoneintheactivepresentation.
Application.ActivePresentation.Slides(1)_
.Shapes(2).TextFrame.TextRange_
.RemovePeriods
ShowAll
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.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueFindonlywholewords,andnotpartsoflargerwords.
ReplacemethodasitappliestotheFontsobject.
ReplacesafontintheFontscollection.
expression.Replace(Original,Replacement)
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
OriginalRequiredString.Thenameofthefonttoreplace.
ReplacementRequiredString.Thethenameofthereplacementfont.
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"
ReplaceNodeMethodReplacesatargetdiagramnodewiththesourcediagramnode.Thetargetdiagramnodeisdeleted,andthesourcediagramnode,includinganyofitschildnodes,aremovedtowherethetargetdiagramnodewas.
expression.ReplaceNode(TargetNode)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
TargetNodeRequiredDiagramNodeobject.Thediagramnodetobereplaced.
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
ReplyWithChangesMethodSendsane-mailmessagetotheauthorofapresentationthathasbeensentoutforreview,notifyingthemthatareviewerhascompletedreviewofthepresentation.
expression.ReplyWithChanges(ShowMessage)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
ShowMessageOptionalBoolean.Truetodisplaythemessagepriortosending.Falsetoautomaticallysendthemessagewithoutdisplayingitfirst.ThedefaultisTrue.
Remarks
UsetheSendForReviewmethodtostartacollaborativereviewofapresentation.IftheReplyWithChangesmethodisexecutedonapresentationthatisnotpartofacollaborativereviewcycle,theuserwillreceiveanerrormessage.
Example
Thisexamplesendsamessagetotheauthorofareviewdocumentthatareviewerhascompletedareview,withoutfirstdisplayingthee-mailmessagetothereviewer.Thisexampleassumesthattheactivepresentationispartofacollaborativereviewcycle.
SubReplyMsg()
ActivePresentation.ReplyWithChangesShowMessage:=False
EndSub
RerouteConnectionsMethodReroutesconnectorssothattheytaketheshortestpossiblepathbetweentheshapestheyconnect.Todothis,theRerouteConnectionsmethodmaydetachtheendsofaconnectorandreattachthemtodifferentconnectingsitesontheconnectedshapes.
Thismethodreroutesallconnectorsattachedtothespecifiedshape;ifthespecifiedshapeisaconnector,it'srerouted.
expression.RerouteConnections
expressionRequired.AnexpressionthatreturnsaShapeorShapeRangeobject.
Remarks
Ifthismethodisappliedtoaconnector,onlythatconnectorwillbererouted.Ifthismethodisappliedtoaconnectedshape,allconnectorstothatshapewillbererouted.
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
ResetRotationMethodResetstheextrusionrotationaroundthex-axisandthey-axisto0(zero)sothatthefrontoftheextrusionfacesforward.Thismethoddoesn'tresettherotationaroundthez-axis.
expression.ResetRotation
expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.
Remarks
Tosettheextrusionrotationaroundthex-axisandthey-axistoanythingotherthan0(zero),usetheRotationXandRotationYpropertiesoftheThreeDFormatobject.Tosettheextrusionrotationaroundthez-axis,usetheRotationpropertyoftheShapeobjectthatrepresentstheextrudedshape.
Example
Thisexampleresetstherotationaroundthex-axisandthey-axisto0(zero)fortheextrusionofshapeoneonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).ThreeD.ResetRotation
ResetSlideTimeMethodResetstheelapsedtime(representedbytheSlideElapsedTimeproperty)fortheslidethat'scurrentlydisplayedto0(zero).
expression.ResetSlideTime
expressionRequired.AnexpressionthatreturnsaSlideShowViewobject.
Example
Thisexampleresetstheelapsedtimefortheslidethat'scurrentlydisplayedinslideshowwindowoneto0(zero).
SlideShowWindows(1).View.ResetSlideTime
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.
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
RtlRunMethodSetsthedirectionoftextinatextrangetoreadfromrighttoleft.
expression.RtlRun
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
Remarks
Thismethodmakesitpossibletousetextfrombothleft-to-rightandright-to-leftlanguagesinthesamepresentation.
Example
Thefollowingexamplefindsalloftheshapesonslideonethatcontaintextandchangesthetexttoreadfromrighttoleft.
ActiveWindow.ViewType=ppViewSlide
ForEachshInActivePresentation.Slides(1).Shapes
Ifsh.HasTextFrameThen
sh.TextFrame.TextRange.RtlRun
EndIf
Next
ShowAll
RunMethodRunmethodasitappliestotheSlideShowSettingsobject.
Runsaslideshowofthespecifiedpresentation.ReturnsaSlideShowWindowobject.
expression.Run
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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.
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
RunsMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextruns.Atextrunconsistsofarangeofcharactersthatsharethesamefontattributes.Forinformationaboutcountingorloopingthroughtherunsinatextrange,seetheTextRangeobject.
expression.Runs(Start,Length)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
StartOptionalLong.Thefirstruninthereturnedrange.
LengthOptionalLong.Thenumberofrunstobereturned.
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.
Example
Thisexampleformatsthesecondruninshapetwoonslideoneintheactivepresentationasbolditalicifit'salreadyitalic.
WithApplication.ActivePresentation.Slides(1).Shapes(2)_
.TextFrame.TextRange
With.Runs(2).Font
If.ItalicThen
.Bold=True
EndIf
EndWith
EndWith
SaveMethodSavesthespecifiedpresentation.
expression.Save
expressionRequired.AnexpressionthatreturnsaPresentationobject.
Remarks
UsetheSaveAsmethodtosaveapresentationthathasn'tbeenpreviouslysaved.Todeterminewhetherapresentationhasbeensaved,testforanonemptyvaluefortheFullNameorPathproperty.Ifadocumentwiththesamenameasthespecifiedpresentationalreadyexistsondisk,thatdocumentwillbeoverwritten.Nowarningmessagewillbedisplayed.
Tomarkthepresentationassavedwithoutwritingittodisk,settheSavedpropertytoTrue.
Example
Thisexamplesavestheactivepresentationifit'sbeenchangedsincethelasttimeitwassaved.
WithApplication.ActivePresentation
IfNot.SavedAnd.Path<>""Then.Save
EndWith
ShowAll
SaveAsMethodSavesapresentationthat'sneverbeensaved,orsavesapreviouslysavedpresentationunderadifferentname.
expression.SaveAs(Filename,FileFormat,EmbedFonts)
expressionRequired.AnexpressionthatreturnsaPresentationobject.
FilenameRequiredString.Specifiesthenametosavethefileunder.Ifyoudon'tincludeafullpath,PowerPointsavesthefileinthecurrentfolder.
FileFormatOptionalPpSaveAsFileType.Specifiesthesavedfileformat.Ifthisargumentisomitted,thefileissavedintheformatofapresentationinthecurrentversionofPowerPoint(ppSaveAsPresentation).
PpSaveAsFileTypecanbeoneofthesePpSaveAsFileTypeconstants.ppSaveAsHTMLv3ppSaveAsAddInppSaveAsBMPppSaveAsDefaultppSaveAsGIFppSaveAsHTMLppSaveAsHTMLDualppSaveAsJPGppSaveAsMetaFileppSaveAsPNGppSaveAsPowerPoint3ppSaveAsPowerPoint4ppSaveAsPowerPoint4FarEastppSaveAsPowerPoint7ppSaveAsPresentationDefault.ppSaveAsRTFppSaveAsShow
ppSaveAsTemplateppSaveAsTIFppSaveAsWebArchive
EmbedFontsOptionalMsoTriState.SpecifieswhetherPowerPointembedsTrueTypefontsinthesavedpresentation.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedDefault.msoTriStateTogglemsoTruePowerPointembedsTrueTypefontsinthesavedpresentation.
Example
Thisexamplesavesacopyoftheactivepresentationunderthename"NewFormatCopy.ppt."Bydefault,thiscopyissavedintheformatofapresentationinthecurrentversionofPowerPoint.ThepresentationisthensavedasaPowerPoint4.0filenamed"OldFormatCopy."
WithApplication.ActivePresentation
.SaveCopyAs"NewFormatCopy"
.SaveAs"OldFormatCopy",ppSaveAsPowerPoint4
EndWith
ShowAll
SaveCopyAsMethodSavesacopyofthespecifiedpresentationtoafilewithoutmodifyingtheoriginal.
expression.SaveCopyAs(FileName,FileFormat,EmbedTrueTypeFonts)
expressionRequired.AnexpressionthatreturnsaPresentationobject.
FileNameRequiredString.Specifiesthenametosavethefileunder.Ifyoudon'tincludeafullpath,PowerPointsavesthefileinthecurrentfolder.
FileFormatOptionalPpSaveAsFileType.Thefileformat.
PpSaveAsFileTypecanbeoneofthesePpSaveAsFileTypeconstants.ppSaveAsHTMLv3ppSaveAsAddInppSaveAsBMPppSaveAsDefaultdefaultppSaveAsGIFppSaveAsHTMLppSaveAsHTMLDualppSaveAsJPGppSaveAsMetaFileppSaveAsPNGppSaveAsPowerPoint3ppSaveAsPowerPoint4ppSaveAsPowerPoint4FarEastppSaveAsPowerPoint7ppSaveAsPresentationppSaveAsRTFppSaveAsShowppSaveAsTemplate
ppSaveAsTIFppSaveAsWebArchive
EmbedTrueTypeFontsOptionalMsoTriState.SpecifieswhetherTrueTypefontsareembedded.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixeddefaultmsoTriStateTogglemsoTrue
Example
Thisexamplesavesacopyoftheactivepresentationunderthename"NewFormatCopy.ppt."Bydefault,thiscopyissavedintheformatofapresentationinthecurrentversionofPowerPoint.ThepresentationisthensavedasaPowerPoint4.0filenamed"OldFormatCopy."
WithApplication.ActivePresentation
.SaveCopyAs"NewFormatCopy"
.SaveAs"OldFormatCopy",ppSaveAsPowerPoint4
EndWith
ShowAll
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.
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
ShowAll
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.
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
ShowAll
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.
Remarks
Iftheboundingrectangleislargerthanthedocumentwindow,theStartargumentspecifieswhichendoftherectangledisplaysorgetsinitialfocus.Thismethodcannotbeusedwithoutlineorslidesorterviews.
Example
Thisexamplebringsintoviewa100x200pointareabeginning50pointsfromtheleftedgeoftheslide,and20pointsfromthetopoftheslide.Thetopleftcorneroftherectangleispositionedatthetopleftcorneroftheactivedocumentwindow.
ActiveWindow.ScrollIntoViewLeft:=50,Top:=20,_
Width:=100,Height:=200
ShowAll
SelectMethodSelectmethodasitappliestotheCell,Column,Row,Slide,SlideRange,
andTextRangeobjects.
Selectsthespecifiedobject.
expression.Select
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
SelectmethodasitappliestotheShapeandShapeRangeobjects.
Selectsthespecifiedobject.
expression.Select(Replace)
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
ReplaceOptionalMsoTriState.Specifieswhethertheselectionreplacesanypreviousselection.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheselectionisaddedtothepreviousselection.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Theselectionreplacesanypreviousselection.
Remarks
Ifyoutrytomakeaselectionthatisn'tappropriatefortheview,yourcodewillfail.Forexample,youcanselectaslideinslidesorterviewbutnotinslideview.
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
thepreviousselection.
ActivePresentation.Slides(1).Shapes.Range(Array(2,4)).SelectFalse
SelectAllMethodSelectsallshapes(inaShapescollection)oralldiagramnodes(inaDiagramNodesorDiagramNodeChildrencollection).
expression.SelectAll
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexampleselectsalltheshapesonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.SelectAll
SendFaxOverInternetMethodSendsapresentationasafaxtothespecifiedrecipients.
expression.SendFaxOverInternet(Recipients,Subject,ShowMessage)
expressionRequired.AnexpressionthatreturnsaPresentationobject.
RecipientsOptionalVariant.AStringthatrepresentsthefaxnumbersande-mailaddressesofthepeopletowhomtosendthefax.Separatemultiplerecipientswithasemicolon.
SubjectOptionalVariant.AStringthatrepresentsthesubjectlineforthefaxedpresentation.
ShowMessageOptionalVariant.Truedisplaysthefaxmessagebeforesendingit.Falsesendsthefaxwithoutdisplayingthefaxmessage.
Remarks
UsingtheSendFaxOverInternetmethodrequiresthatthefaxservicebeenabledonauser'scomputer.
TheformatusedforspecifyingfaxnumbersintheRecipientsparameteriseitherrecipientsfaxnumber@usersfaxproviderorrecipientsname@recipientsfaxnumber.Youcanaccesstheuser'sfaxproviderinformationusingthefollowingregistrypath:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Services\Fax
UsetheFaxAddresskeyvalueundertheaboveregistrypathtodeterminetheformattouseforauser.
Example
Thefollowingexamplesendsafaxtothefaxserviceprovider,whowillfaxthemessagetotherecipient.
ActivePresentation.SendFaxOverInternet_
"Foryourreview",True
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.
Remarks
TheSendForReviewmethodstartsacollaborativereviewcycle.UsetheEndReviewmethodtoendareviewcycle.
Example
Thisexampleautomaticallysendstheactivepresentationasanattachmentinane-mailmessagetothespecifiedrecipients.
SubWebReview()
ActivePresentation.SendForReview_
Recipients:="[email protected];DanWilson",_
Subject:="Pleasereviewthisdocument.",_
ShowMessage:=False,_
IncludeAttachment:=True
EndSub
SentencesMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextsentences.Forinformationaboutcountingorloopingthroughthesentencesinatextrange,seetheTextRangeobject.
expression.Sentences(Start,Length)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
StartOptionalLong.Thefirstsentenceinthereturnedrange.
LengthOptionalLong.Thenumberofsentencestobereturned.
Remarks
IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstsentenceandendswiththelastparagraphinthespecifiedrange.
IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsonesentence.
IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstsentenceinthespecifiedrange.
IfStartisgreaterthanthenumberofsentencesinthespecifiedtext,thereturnedrangestartswiththelastsentenceinthespecifiedrange.
IfLengthisgreaterthanthenumberofsentencesfromthespecifiedstartingsentencetotheendofthetext,thereturnedrangecontainsallthosesentences.
Example
Thisexampleformatsasboldthesecondsentenceinthesecondparagraphinshapetwoonslideoneintheactivepresentation.
Application.ActivePresentation.Slides(1).Shapes(2)_
.TextFrame.TextRange.Paragraphs(2).Sentences(2).Font_
.Bold=True
ShowAll
SetEditingTypeMethodSetstheeditingtypeofthenodespecifiedbyIndex.Ifthenodeisacontrolpointforacurvedsegment,thismethodsetstheeditingtypeofthenodeadjacenttoitthatjoinstwosegments.Notethat,dependingontheeditingtype,thismethodmayaffectthepositionofadjacentnodes.
expression.SetEditingType(Index,EditingType)
expressionRequired.AnexpressionthatreturnsaShapeNodesobject.
IndexRequiredLong.Thenodewhoseeditingtypeistobeset.
EditingTypeRequiredMsoEditingType.Theeditingtype.
MsoEditingTypecanbeoneoftheseMsoEditingTypeconstants.msoEditingAutomsoEditingCornermsoEditingSmoothmsoEditingSymmetric
Example
ThisexamplechangesallcornernodestosmoothnodesinshapethreeonmyDocument.Shapethreemustbeafreeformdrawing.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).Nodes
Forn=1to.Count
If.Item(n).EditingType=msoEditingCornerThen
.SetEditingTypen,msoEditingSmooth
EndIf
Next
EndWith
ShowAll
SetExtrusionDirectionMethodSetsthedirectionthattheextrusion'ssweeppathtakesawayfromtheextrudedshape.
expression.SetExtrusionDirection(PresetExtrusionDirection)
expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.
PresetExtrusionDirectionRequiredMsoPresetExtrusionDirection.Specifiestheextrusiondirection.
MsoPresetExtrusionDirectioncanbeoneoftheseMsoPresetExtrusionDirectionconstants.msoExtrusionBottommsoExtrusionBottomLeftmsoExtrusionBottomRightmsoExtrusionLeftmsoExtrusionNonemsoExtrusionRightmsoExtrusionTopmsoExtrusionTopLeftmsoExtrusionTopRightmsoPresetExtrusionDirectionMixed
Remarks
ThismethodsetsthePresetExtrusionDirectionpropertytothedirectionspecifiedbythePresetExtrusionDirectionargument.
Example
ThisexamplespecifiesthattheextrusionforshapeoneonmyDocumentextendtowardthetopoftheshapeandthatthelightingfortheextrusioncomefromtheleft.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).ThreeD
.Visible=True
.SetExtrusionDirectionmsoExtrusionTop
.PresetLightingDirection=msoLightingLeft
EndWith
ShowAll
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
Example
Thisexamplesetsthepasswordencryptionoptionsifthefilepropertiesarenotencryptedforpassword-protecteddocuments.
SubPasswordSettings()
WithActivePresentation
If.PasswordEncryptionFileProperties=msoFalseThen
.SetPasswordEncryptionOptions_
PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_
PasswordEncryptionAlgorithm:="RC4",_
PasswordEncryptionKeyLength:=56,_
PasswordEncryptionFileProperties:=True
EndIf
EndWith
EndSub
SetPositionMethodSetsthelocationofthenodespecifiedbyIndex.Notethat,dependingontheeditingtypeofthenode,thismethodmayaffectthepositionofadjacentnodes.
expression.SetPosition(Index,X1,Y1)
expressionRequired.AnexpressionthatreturnsaShapeNodesobject.
IndexRequiredLong.Thenodewhosepositionistobeset.
X1,Y1RequiredSingle.Theposition(inpoints)ofthenewnoderelativetotheupper-leftcornerofthedocument.
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
ShowAll
SetSegmentTypeMethodSetsthesegmenttypeofthesegmentthatfollowsthenodespecifiedbyIndex.Ifthenodeisacontrolpointforacurvedsegment,thismethodsetsthesegmenttypeforthatcurve.Notethatthismayaffectthetotalnumberofnodesbyinsertingordeletingadjacentnodes.
expression.SetSegmentType(Index,SegmentType)
expressionRequired.AnexpressionthatreturnsaShapeNodesobject.
IndexRequiredLong.Thenodewhosesegmenttypeistobeset.
SegmentTypeRequiredMsoSegmentType.Specifiesifthesegmentisstraightorcurved.
MsoSegmentTypecanbeoneoftheseMsoSegmentTypeconstants.msoSegmentCurvemsoSegmentLine
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
ShowAll
SetShapesDefaultPropertiesMethodAppliestheformattingforthespecifiedshapetothedefaultshape.Shapescreatedafterthismethodhasbeenusedwillhavethisformattingappliedtothembydefault.
expression.SetShapesDefaultProperties
expressionRequired.AnexpressionthatreturnsaShapeobject.
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
ShowAll
SetThreeDFormatMethodSetsthepresetextrusionformat.Eachpresetextrusionformatcontainsasetofpresetvaluesforthevariouspropertiesoftheextrusion.
expression.SetThreeDFormat(PresetThreeDFormat)
expressionRequired.AnexpressionthatreturnsaThreeDFormatobject.
PresetThreeDFormatRequiredMsoPresetThreeDFormat.Specifiesapresetextrusionformatthatcorrespondstooneoftheoptions(numberedfromlefttoright,fromtoptobottom)displayedwhenyouclickthe3-DbuttonontheDrawingtoolbar.
MsoPresetThreeDFormatcanbeoneoftheseMsoPresetThreeDFormatconstants.msoPresetThreeDFormatMixedSpecifyingthisconstantcausesanerror.msoThreeD1msoThreeD2msoThreeD3msoThreeD4msoThreeD5msoThreeD6msoThreeD7msoThreeD8msoThreeD9msoThreeD10msoThreeD11msoThreeD12msoThreeD13msoThreeD14msoThreeD15msoThreeD16
msoThreeD17msoThreeD18msoThreeD19msoThreeD20
Remarks
ThismethodsetsthePresetThreeDFormatpropertytotheformatspecifiedbythePresetThreeDFormatargument.
Example
ThisexampleaddsanovaltomyDocumentandsetsitsextrusionformatto3DStyle12.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes_
.AddShape(msoShapeOval,30,30,50,25).ThreeD
.Visible=True
.SetThreeDFormatmsoThreeD12
EndWith
SmallScrollMethodScrollsthroughthespecifieddocumentwindowbylinesandcolumns.
expression.SmallScroll(Down,Up,ToRight,ToLeft)
expressionRequired.AnexpressionthatreturnsaDocumentWindowobject.
DownOptionalLong.Specifiesthenumberoflinestoscrolldown.
UpOptionalLong.Specifiesthenumberoflinestoscrollup.
ToRightOptionalLong.Specifiesthenumberofcolumnstoscrollright.
ToLeftOptionalLong.Specifiesthenumberofcolumnstoscrollleft.
Remarks
Ifnoargumentsarespecified,thismethodscrollsdownoneline.IfDownandUparebothspecified,theireffectsarecombined.Forexample,ifDownis2andUpis4,thismethodscrollsuptwolines.Similarly,ifRightandLeftarebothspecified,theireffectsarecombined.
Anyoftheargumentscanbeanegativenumber.
Example
Thisexamplescrollsdownthreelinesintheactivewindow.
Application.ActiveWindow.SmallScrollDown:=3
SolidMethodSetsthespecifiedfilltoauniformcolor.Usethismethodtoconvertagradient,textured,patterned,orbackgroundfillbacktoasolidfill.
expression.Solid
expressionRequired.AnexpressionthatreturnsaFillFormatobject.
Example
ThisexampleconvertsallfillsonmyDocumenttouniformredfills.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Withs.Fill
.Solid
.ForeColor.RGB=RGB(255,0,0)
EndWith
Next
SplitMethodSplitsasingletablecellintomultiplecells.
expression.SplitNumRows,NumColumns
expressionRequired.AnexpressionthatreturnsaCellobject.
NumRowsRequiredLong.Numberofrowsthatthecellisbeingsplitinto.
NumColumnsRequiredLong.Numberofcolumnsthatthecellisbeingsplitinto.
Example
Thisexamplesplitsthefirstcellinthereferencedtableintotwocells,onedirectlyabovetheother.
ActivePresentation.Slides(2).Shapes(5).Table.Cell(1,1).Split2,1
SwapNodeMethodSwapsthesourcediagramnodewiththetargetdiagramnode.Anychilddiagramnodesaremovedalongwiththeircorrespondingrootnodesunlessspecifiedotherwise.
expression.SwapNode(TargetNode,SwapChildren)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
TargetNodeRequiredDiagramNodeobject.Thetargetdiagramnode.
SwapChildrenOptionalBoolean.True(default)ifallchilddiagramnodesaremovedalongwiththeircorrespondingtargetorsourcediagramnodes.Falsetoswapjustthetargetandsourcediagramnodes,inheritingtheother'schilddiagramnodes.
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
ToggleVerticalTextMethodSwitchesthetextflowinthespecifiedWordArtfromhorizontaltovertical,orviceversa.
expression.ToggleVerticalText
expressionRequired.AnexpressionthatreturnsaTextEffectFormatobject.
Remarks
UsingtheToggleVerticalTextmethodswapsthevaluesoftheWidthandHeightpropertiesoftheShapeobjectthatrepresentstheWordArtandleavestheLeftandToppropertiesunchanged.
TheFlipmethodandRotationpropertyoftheShapeobjectandtheRotatedCharspropertyandToggleVerticalTextmethodoftheTextEffectFormatobjectallaffectthecharacterorientationandthedirectionoftextflowinaShapeobjectthatrepresentsWordArt.Youmayhavetoexperimenttofindouthowtocombinetheeffectsofthesepropertiesandmethodstogettheresultyouwant.
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
TransferChildrenMethodMovesthechildnodesofonediagramnodetoanotherdiagramnode.
expression.TransferChildren(ReceivingNode)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
ReceivingNodeRequiredDiagramNodeobject.Thetarget(receiving)diagramnode.
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
TrimTextMethodReturnsaTextRangeobjectthatrepresentsthespecifiedtextminusanytrailingspaces.
expression.TrimText
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
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
ShowAll
TwoColorGradientMethodSetsthespecifiedfilltoatwo-colorgradient.
expression.TwoColorGradient(Style,Variant)
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
StyleRequiredMsoGradientStyle.Thegradientstyle.
MsoGradientStylecanbeoneoftheseMsoGradientStyleconstants.msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVertical
VariantRequiredLong.Thegradientvariant.Canbeavaluefrom1to4,correspondingtothefourvariantsontheGradienttabintheFillEffectsdialogbox.IfStyleismsoGradientFromTitleormsoGradientFromCenter,thisargumentcanbeeither1or2.
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
UngroupMethodUngroupsanygroupedshapesinthespecifiedshapeorrangeofshapes.DisassemblespicturesandOLEobjectswithinthespecifiedshapeorrangeofshapes.ReturnstheungroupedshapesasasingleShapeRangeobject.
expression.Ungroup
expressionRequired.AnexpressionthatreturnsaShapeRangeobject.
Remarks
Becauseagroupofshapesistreatedasasingleobject,groupingandungroupingshapeschangesthenumberofitemsintheShapescollectionandchangestheindexnumbersofitemsthatcomeaftertheaffecteditemsinthecollection.
Example
ThisexampleungroupsanygroupedshapesanddisassemblesanypicturesorOLEobjectsonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
s.Ungroup
Next
ThisexampleungroupsanygroupedshapesonmyDocumentwithoutdisassemblingpicturesorOLEobjectsontheslide.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Ifs.Type=msoGroupThens.Ungroup
Next
UnselectMethodCancelsthecurrentselection.
expression.Unselect
expressionRequired.AnexpressionthatreturnsaSelectionobject.
Example
Thisexamplecancelsthecurrentselectioninwindowone.
Windows(1).Selection.Unselect
UpdateMethodUpdatesthespecifiedlinkedOLEobject.Toupdateallthelinksinapresentationatonce,usetheUpdateLinksmethod.
expression.Update
expressionRequired.AnexpressionthatreturnsaLinkFormatobject.
Example
ThisexampleupdatesalllinkedOLEobjectsintheactivepresentation.
ForEachsldInActivePresentation.Slides
ForEachshInsld.Shapes
Ifsh.Type=msoLinkedOLEObjectThen
sh.LinkFormat.Update
EndIf
Next
Next
UpdateLinksMethodUpdateslinkedOLEobjectsinthespecifiedpresentation.
expression.UpdateLinks
expressionRequired.AnexpressionthatreturnsaPresentationobject.
Example
ThisexampleupdatesallOLElinksintheactivepresentation.
ActivePresentation.UpdateLinks
UseDefaultFolderSuffixMethodSetsthefoldersuffixforthespecifiedpresentationtothedefaultsuffixforthelanguagesupportyouhaveselectedorinstalled.
expression.UseDefaultFolderSuffix
expressionAnexpressionthatreturnsaWebOptionsobject.
Remarks
MicrosoftPowerPointusesthefoldersuffixwhenyousaveorpublishacompleteorpartialpresentationasaWebpage,uselongfilenames,andchoosetosavesupportingfilesinaseparatefolder(thatis,iftheUseLongFileNamesandOrganizeInFolderpropertiesaresettoTrue).
Thesuffixappearsinthefoldernameafterthepresentationname.Forexample,ifthepresentationiscalled"Pres1"andthelanguageisEnglish,thefoldernameisPres1_files.ThefoldersuffixesforeachlanguagearelistedintheFolderSuffixpropertytopic.
Example
Thisexamplesetsthefoldersuffixfortheactivepresentationtothedefaultsuffix.
ActivePresentation.WebOptions.UseDefaultFolderSuffix
UserPictureMethodFillsthespecifiedshapewithonelargeimage.Ifyouwanttofilltheshapewithsmalltilesofanimage,usetheUserTexturedmethod.
expression.UserPicture(PictureFile)
expressionRequired.AnexpressionthatreturnsaFillFormatobject.
PictureFileRequiredString.Thenameofthepicturefile.
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
UserTexturedMethodFillsthespecifiedshapewithsmalltilesofanimage.Ifyouwanttofilltheshapewithonelargeimage,usetheUserPicturemethod.
expression.UserTextured(TextureFile)
expressionRequired.AnexpressionthatreturnsaFillFormatobject.
TextureFileRequiredString.Thenameofthepicturefile.
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
ValueMethodReturnsthevalueofthespecifiedtagasaString.
expression.Value(Index)
expressionRequired.AnexpressionthatreturnsaTagscollection.
IndexRequiredLong.Thetagnumber.
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
WebPagePreviewMethodShowsapreviewofthepresentationintheactiveWebbrowser.
expression.WebPagePreview
expressionRequired.AnexpressionthatreturnsaPresentationobject.
Example
ThisexamplepreviewspresentationtwoasaWebpage.
Presentations(2).WebPagePreview
WordsMethodReturnsaTextRangeobjectthatrepresentsthespecifiedsubsetoftextwords.Forinformationaboutcountingorloopingthroughthewordsinatextrange,seetheTextRangeobject.
expression.Words(Start,Length)
expressionRequired.AnexpressionthatreturnsaTextRangeobject.
StartOptionalLong.Thefirstwordinthereturnedrange.
LengthOptionalLong.Thenumberofwordstobereturned.
Remarks
IfbothStartandLengthareomitted,thereturnedrangestartswiththefirstwordandendswiththelastparagraphinthespecifiedrange.
IfStartisspecifiedbutLengthisomitted,thereturnedrangecontainsoneword.
IfLengthisspecifiedbutStartisomitted,thereturnedrangestartswiththefirstwordinthespecifiedrange.
IfStartisgreaterthanthenumberofwordsinthespecifiedtext,thereturnedrangestartswiththelastwordinthespecifiedrange.
IfLengthisgreaterthanthenumberofwordsfromthespecifiedstartingwordtotheendofthetext,thereturnedrangecontainsallthosewords.
Example
Thisexampleformatsasboldthesecond,third,andfourthwordsinthefirstparagraphinshapetwoonslideoneintheactivepresentation.
Application.ActivePresentation.Slides(1).Shapes(2)_
.TextFrame.TextRange.Paragraphs(1).Words(2,3).Font_
.Bold=True
ShowAll
ZOrderMethodMovesthespecifiedshapeinfrontoforbehindothershapesinthecollection(thatis,changestheshape'spositioninthez-order).
expression.ZOrder(ZOrderCmd)
expressionRequired.AnexpressionthatreturnsaShapeobject.
ZOrderCmdRequiredMsoZOrderCmd.Specifieswheretomovethespecifiedshaperelativetotheothershapes.
MsoZOrderCmdcanbeoneoftheseMsoZOrderCmdconstants.msoBringForwardmsoBringInFrontOfTextForuseinMicrosoftWordonly.msoBringToFrontmsoSendBackwardmsoSendBehindTextForuseinMicrosoftWordonly.msoSendToBack
Remarks
UsetheZOrderPositionpropertytodetermineashape'scurrentpositioninthez-order.
Example
ThisexampleaddsanovaltomyDocumentandthenplacestheovalsecondfromthebackinthez-orderifthereisatleastoneothershapeontheslide.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes.AddShape(msoShapeOval,100,100,100,300)
While.ZOrderPosition>2
.ZOrdermsoSendBackward
Wend
EndWith
AcceleratePropertyReturnsorsetsaSinglethatrepresentsthepercentofthedurationoverwhichatimingaccelerationshouldtakeplace.Forexample,avalueof0.9meansthatanaccelerationshouldstartslowerthanthedefaultspeedfor90%ofthetotalanimationtime,withthelast10%oftheanimationatthedefaultspeed.Read/write.
expression.Accelerate
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Toslowdownananimationattheend,usetheDecelerateproperty.
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
ShowAll
AcceleratorsEnabledPropertyDetermineswhethershortcutkeyareenabledduringaslideshow.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.(Ifshortcutkeysaredisabledduringaslideshow,youcanneitherusekeystonavigateintheslideshownorpressF1togetalistofshortcutkeys.YoucanstillusetheESCkeytoexittheslideshow.)msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.Shortcutkeysareenabledduringaslideshow.
expression.AcceleratorsEnabled
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplerunsaslideshowoftheactivepresentationwithshortcutkeysdisabled.
ActivePresentation.SlideShowSettings.Run_
.View.AcceleratorsEnabled=False
ShowAll
AccentPropertyDetermineswhetheraverticalaccentbarseparatesthecallouttextfromthecalloutline.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueAverticalaccentbarseparatesthecallouttextfromthecalloutline.
expression.Accent
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
AccumulatePropertySetsorreturnsanMsoAnimAccumulateconstantthatrepresentswhetheranimationbehaviorsaccumulate.Read/write.
MsoAnimAccumulatecanbeoneoftheseMsoAnimAccumulateconstants.msoAnimAccumulateAlwaysRepetitionsstartwiththecurrentvalue.msoAnimAccumulateNoneDefault.
expression.Accumulate
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsethispropertyinconjunctionwiththeAdditivepropertytocombineanimationeffects.
Example
Thefollowingexampleallowsaspecifiedanimationbehaviortoaccumulatewithotheranimationbehaviors.
SubSetAccumulate()
DimanimBehaviorAsAnimationBehavior
SetanimBehavior=ActiveWindow.Selection.SlideRange(1).TimeLine._
MainSequence(1).Behaviors(1)
animBehavior.Accumulate=msoAnimAccumulateAlways
EndSub
ShowAll
ActionPropertyReturnsorsetsthetypeofactionthatwilloccurwhenthespecifiedshapeisclickedorthemousepointerispositionedovertheshapeduringaslideshow.CanbeoneofthefollowingPpActionTypeconstants.Read/writeLong.
ppActionEndShowppActionFirstSlideppActionHyperlinkppActionLastSlideppActionLastSlideViewedppActionMixedppActionNamedSlideShowppActionNextSlideppActionNoneppActionOLEVerbppActionPlayppActionPreviousSlideppActionRunMacroppActionRunProgram
YoucanusetheActionpropertyinconjunctionwithotherpropertiesoftheActionSettingobject,asshowninthefollowingtable.
IfyousettheActionpropertytothis
value
Usethisproperty Todothis
ppActionHyperlink Hyperlink
Setpropertiesforthehyperlinkthatwillbefollowedinresponsetoamouseactionontheshapeduringaslideshow.Returnorsetthenameoftheprogramtoruninresponsetoa
ppActionRunProgram Run mouseactionontheshapeduringaslideshow.
ppActionRunMacro Run
Returnorsetthenameofthemacrotoruninresponsetoamouseactionontheshapeduringaslideshow.
ppActionOLEVerb ActionVerb
SettheOLEverbthatwillbeinvokedinresponsetoamouseactionontheshapeduringaslideshow.
ppActionNamedSlideShow SlideShowName
Setthenameofthecustomslideshowthatwillruninresponsetoamouseactionontheshapeduringaslideshow.
Example
Thisexamplesetsshapethree(anOLEobject)onslideoneintheactivepresentationtobeplayedwhenthemousepassesoveritduringaslideshow.
WithActivePresentation.Slides(1)_
.Shapes(3).ActionSettings(ppMouseOver)
.ActionVerb="Play"
.Action=ppActionOLEVerb
EndWith
ActionSettingsPropertyReturnsanActionSettingsobjectthatcontainsinformationaboutwhatactionoccurswhentheuserclicksormovesthemouseoverthespecifiedshapeortextrangeduringaslideshow.Read-only.
Example
Thefollowingexamplesetstheactionsforclickingandmovingthemouseovershapeoneonslidetwointheactivepresentation.
SetmyShape=ActivePresentation.Slides(2).Shapes(1)
myShape.ActionSettings(ppMouseClick).Action=ppActionLastSlide
myShape.ActionSettings(ppMouseOver).SoundEffect.Name="applause"
ShowAll
ActionVerbPropertyActionVerbpropertyasitappliestothePlaySettingsobject.
ReturnsorsetsastringthatcontainstheOLEverbthatwillberunwhenthespecifiedOLEobjectisanimatedduringaslideshow.ThedefaultverbspecifiestheactionthattheOLEobjectruns—suchasplayingawavefileordisplayingdatasothattheusercanmodifyit—afterthepreviousanimationorslidetransition.Read/writeString.
ActionVerbpropertyasitappliestotheActionSettingobject.
ReturnsorsetsastringthatcontainstheOLEverbthatwillberunwhentheuserclicksthespecifiedshapeorpassesthemousepointeroveritduringaslideshow.TheActionpropertymustbesettoppActionOLEVerbfirstforthispropertytoaffecttheslideshowaction.Read/writeString.
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
ShowAll
ActivePropertyReturnswhetherthespecifiedpaneorwindowisactive.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedpaneorwindowisactive.
expression.Active
expressionRequired.AnexpressionthatreturnsoftheobjectsintheAppliesTolist.
Example
Thisexamplecheckstoseeifthepresentationfile"test.ppt"isintheactivewindow.Ifnot,itsavesthenameofthepresentationthatiscurrentlyactiveinthevariableoldWinandactivatesthe"test.ppt"presentation.
WithApplication.Presentations("test.ppt").Windows(1)
IfNot.ActiveThen
SetoldWin=Application.ActiveWindow
.Activate
EndIf
EndWith
ActivePanePropertyReturnsaPaneobjectthatrepresentstheactivepaneinthedocumentwindow.Read-only.
Example
Iftheactivepaneistheslidepane,thisexamplemakesthenotespanetheactivepane.ThenotespaneisthethirdmemberofthePanescollection.
WithActiveWindow
If.ActivePane.ViewType=ppViewSlideThen
.Panes(3).Activate
EndIf
EndWith
ActivePresentationPropertyReturnsaPresentationobjectthatrepresentsthepresentationopenintheactivewindow.Read-only.
Notethatifanembeddedpresentationisin-placeactive,theActivePresentationpropertyreturnstheembeddedpresentation.
Example
Thisexamplesavestheloadedpresentationtotheapplicationfolderinafilenamed"TestFile."
MyPath=Application.Path&"\TestFile"
Application.ActivePresentation.SaveAsMyPath
ActivePrinterPropertyReturnsthenameoftheactiveprinter.Read-onlyString.
Example
Thisexampledisplaysthenameoftheactiveprinter.
MsgBox"Thenameoftheactiveprinteris"_
&Application.ActivePrinter
ActiveWindowPropertyReturnsaDocumentWindowobjectthatrepresentstheactivedocumentwindow.Read-only.
Example
Thisexampleminimizestheactivewindow.
Application.ActiveWindow.WindowState=ppWindowMinimized
ShowAll
AddInsPropertyReturnstheprogram-specificAddInscollectionthatrepresentsalltheadd-inslistedintheAdd-Insdialogbox(Toolsmenu).Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Remarks
MicrosoftPowerPoint-specificadd-insareidentifiedbya.ppafilenameextension.ComponentObjectModel(COM)add-inscanbeuseduniversallyacrossMicrosoftprogrammingproductsandhavea.dllor.exefilenameextension.
Example
Thisexampleaddstheadd-innamed"Myaddin.ppa"tothelistintheAdd-Insdialogboxandloadstheadd-inautomatically.
SetmyAddIn=Application.AddIns.Add(FileName:="c:\myaddin.ppa")
myAddIn.Loaded=True
MsgBoxmyAddIn.Name&"hasbeenaddedtothelist"
ShowAll
AdditivePropertySetsorreturnsanMsoAnimAdditiveconstantthatrepresentswhetherthecurrentanimationbehavioriscombinedwithotherrunninganimations.Read/write.
MsoAnimAdditivecanbeoneoftheseMsoAnimAdditiveconstants.msoAnimAdditiveAddBaseDoesnotcombinecurrentanimationwithotheranimations.Default.msoAnimAdditiveAddSumCombinesthecurrentanimationwithotherrunninganimations.
expression.Additive
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Combininganimationbehaviorsparticularlyusefulforrotationeffects.Forexample,ifthecurrentanimationchangesrotationandanotheranimationisalsochangingrotation,thenifthispropertyissettomsoAnimAdditiveAddSum,MicrosoftPowerPointwilladdtogethertherotationsfromboththeanimations.
Example
Thefollowingexampleallowsthecurrentanimationbehaviortobeaddedtoanotheranimationbehavior.
SubSetAdditive()
DimanimBehaviorAsAnimationBehavior
SetanimBehavior=ActiveWindow.Selection.SlideRange(1)_
.TimeLine.MainSequence(1).Behaviors(1)
animBehavior.Additive=msoAnimAdditiveAddSum
EndSub
AddressPropertyReturnsorsetstheInternetaddress(URL)tothetargetdocument.Read/writeString.
Example
ThisexamplescansallshapesonthefirstslidefortheURLtotheMicrosoftWebsite.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Hyperlinks
Ifs.Address="http://www.microsoft.com/"Then
MsgBox"YouhavealinktotheMicrosoftHomePage"
EndIf
Next
AdjustmentsPropertyReturnsanAdjustmentsobjectthatcontainsadjustmentvaluesforalltheadjustmentsinthespecifiedshape.AppliestoanyShapeorShapeRangeobjectthatrepresentsanAutoShape,WordArt,oraconnector.Read-only.
Example
Thisexamplesetsto0.25thevalueofadjustmentoneforshapethreeonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(3).Adjustments(1)=0.25
ShowAll
AdvanceModePropertyAdvanceModepropertyasitappliestotheAnimationSettingsobject.
Returnsorsetsavaluethatindicateswhetherthespecifiedshapeanimationadvancesonlywhenclickedorautomaticallyafteraspecifiedamountoftime.Read/writePpAdvanceMode.Ifyourshapedoesn'tbecomeanimated,makesurethattheTextLevelEffectpropertyissettoavalueotherthanppAnimateLevelNoneandthattheAnimatepropertyissettoTrue.
PpAdvanceModecanbeoneofthesePpAdvanceModeconstants.ppAdvanceModeMixedppAdvanceOnClickppAdvanceOnTime
expression.AdvanceMode
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
AdvanceModepropertyasitappliestotheSlideShowSettingsobject.
Returnsorsetsavaluethatindicateshowtheslideshowadvances.Read/writePpSlideShowAdvanceMode.
PpSlideShowAdvanceModecanbeoneofthesePpSlideShowAdvanceModeconstants.ppSlideShowManualAdvanceppSlideShowRehearseNewTimingsppSlideShowUseSlideTimings
expression.AdvanceMode
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
AdvanceModepropertyasitappliestotheSlideShowViewobject.
Returnsavaluethatindicateshowtheslideshowinthespecifiedviewadvances.Read-onlyPpSlideShowAdvanceMode.
PpSlideShowAdvanceModecanbeoneofthesePpSlideShowAdvanceModeconstants.ppSlideShowManualAdvanceppSlideShowRehearseNewTimingsppSlideShowUseSlideTimings
expression.AdvanceMode
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Example
AsitappliestotheAnimationSettingsobject.
Thisexamplesetsshapetwoonslideoneintheactivepresentationtobecomeanimatedautomaticallyafterfiveseconds.
WithActivePresentation.Slides(1).Shapes(2).AnimationSettings
.AdvanceMode=ppAdvanceOnTime
.AdvanceTime=5
.TextLevelEffect=ppAnimateByAllLevels
.Animate=True
EndWith
ShowAll
AdvanceOnClickPropertyDetermineswhetherthespecifiedslideadvanceswhenit'sclickedduringaslideshow.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideadvanceswhenit'sclickedduringaslideshow.
expression.AdvanceOnClick
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Tosettheslidetoadvanceautomaticallyafteracertainamountoftimeelapses,settheAdvanceOnTimepropertytoTrueandsettheAdvanceTimepropertytotheamountoftimeyouwanttheslidetobeshown.IfyousetboththeAdvanceOnClickandtheAdvanceOnTimepropertiestoTrue,theslidewilladvanceeitherwhenit'sclickedorwhenthespecifiedamountoftimehaselapsed—whichevercomesfirst.
Example
Thisexamplesetsslideoneintheactivepresentationtoadvanceafterfivesecondshavepassedorwhenthemouseisclicked—whicheveroccursfirst.
WithActivePresentation.Slides(1).SlideShowTransition
.AdvanceOnClick=msoTrue
.AdvanceOnTime=msoTrue
.AdvanceTime=5
EndWith
ShowAll
AdvanceOnTimePropertyDetermineswhetherthespecifiedslideadvancesautomaticallyafteraspecifiedamountoftimehaselapsed.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideadvancesautomaticallyafteraspecifiedamountoftimehaselapsed.
expression.AdvanceOnTime
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsetheAdvanceTimepropertytospecifythenumberofsecondsafterwhichtheslidewillautomaticallyadvance.SettheAdvanceModepropertyoftheSlideShowSettingsobjecttoppSlideShowUseSlideTimingstoputtheslideintervalsettingsintoeffectfortheentireslideshow.
Example
Thisexamplesetsslideoneintheactivepresentationtoadvanceafterfivesecondshavepassedorwhenthemouseisclicked—whicheveroccursfirst.
WithActivePresentation.Slides(1).SlideShowTransition
.AdvanceOnClick=msoTrue
.AdvanceOnTime=msoTrue
.AdvanceTime=5
EndWith
ShowAll
AdvanceTimePropertyAsitappliestotheAnimationSettingsobject.
Returnsorsetstheamountoftime,inseconds,afterwhichthespecifiedshapewillbecomeanimated.Read/writeSingle.
AsitappliestotheSlideShowTransitionobject.
Returnsorsetstheamountoftime,inseconds,afterwhichthespecifiedslidetransitionwilloccur.Read/writeSingle.
Remarks
Thespecifiedslideanimationwon'tstartautomaticallyaftertheamountoftimeyou'vespecifiedunlesstheAdvanceModepropertyoftheanimationissettoppAdvanceOnTime.Thespecifiedslidetransitionwon'tadvanceautomaticallyunlesstheAdvanceModepropertyoftheslideshowsettingsissettoppSlideShowUseSlideTimings.
Example
AsitappliestotheAnimationSettingsobject.
Thisexamplesetsshapetwoonslideoneintheactivepresentationtobecomeanimatedautomaticallyafterfiveseconds.
WithActivePresentation.Slides(1).Shapes(2).AnimationSettings
.AdvanceMode=ppAdvanceOnTime
.AdvanceTime=5
.TextLevelEffect=ppAnimateByAllLevels
.Animate=True
EndWith
ShowAll
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.
Remarks
Youwon'tseetheaftereffectyousetforashapeunlesstheshapegetsanimatedandatleastoneothershapeontheslidegetsanimatedafterit.Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNone,ortheEntryEffectpropertymustbesettoaconstantotherthanppEffectNone.Inaddition,theAnimatepropertymustbesettoTrue.Tochangethebuildorderoftheshapesonaslide,usetheAnimationOrderproperty.
Example
Thisexamplespecifiesthatthetitleonslideoneintheactivepresentationistoappeardimmedafterthetitleisbuilt.Ifthetitleisthelastoronlyshapetobebuiltonslideone,thetextwon'tbedimmed.
WithActivePresentation.Slides(1).Shapes.Title.AnimationSettings
.Animate=True
.TextLevelEffect=ppAnimateByAllLevels
.AfterEffect=ppAfterEffectDim
EndWith
ShowAll
AlignmentPropertyAlignmentpropertyasitappliestotheTextEffectFormatobject.
ReturnsorsetsthealignmentforthespecifiedWordArt.Read/writeMsoTextEffectAlignment.
MsoTextEffectAlignmentcanbeoneoftheseMsoTextEffectAlignmentconstants.msoTextEffectAlignmentCenteredmsoTextEffectAlignmentLeftmsoTextEffectAlignmentMixedmsoTextEffectAlignmentRightmsoTextEffectAlignmentStretchJustifymsoTextEffectAlignmentWordJustifymsoTextEffectAlignmentLetterJustify
expression.Alignment
expressionRequired.AnexpressionthatreturnsaTextEffectFormatobject.
AlignmentpropertyasitappliestotheParagraphFormatobject.
Returnsorsetsthealignmentforeachparagraphinthespecifiedparagraphformat.Read/writePpParagraphAlignment.
PpParagraphAlignmentcanbeoneofthesePpParagraphAlignmentconstants.ppAlignCenterppAlignDistributeppAlignJustifyppAlignJustifyLowppAlignLeftppAlignmentMixedppAlignRight
ppAlignThaiDistribute
expression.Alignment
expressionRequired.AnexpressionthatreturnsaParagraphFormatobject.
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
ShowAll
AllowPNGPropertyDetermineswhetherPNG(PortableNetworkGraphics)isallowedasanoutputformatwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.PNGisnotallowedasanoutputformatwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.msoTriStateMixedmsoTriStateTogglemsoTruePNGisallowedasanimageformatwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.
expression.AllowPNG
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
IfyousaveimagesinthePNGformatasopposedtoanyotherfileformat,youmightimprovetheimagequalityorreducethesizeofthoseimagefiles,andthereforedecreasethedownloadtime,assumingthattheWebbrowsersyouaretargetingsupportthePNGformat.
Example
ThisexampleenablesPNGasanoutputformatfortheactivepresentation.
ActivePresentation.WebOptions.AllowPNG=msoTrue
Alternatively,PNGcanbeenabledastheglobaldefaultfortheapplicationfornewlycreatedpresentations.
Application.DefaultWebOptions.AllowPNG=msoTrue
AlternativeTextPropertyReturnsorsetsthealternativetextassociatedwithashapeinaWebpresentation.Read/writeString.
Example
Thefollowingexamplesetsthealternativetextfortheselectedshapeintheactivewindow.Theselectedshapeisapictureofamallardduck.
ActiveWindow.Selection.ShapeRange_
.AlternativeText="Thisisamallardduck."
ShowAll
AlwaysSaveInDefaultEncodingPropertyDetermineswhetherthedefaultencodingisusedwhenyousaveaWebpageorplaintextdocument,independentofthefile'soriginalencodingwhenopened.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.TheoriginalencodingofthefileisusedwhenyousaveaWebpageorplaintextdocument,independentofthefile'soriginalencodingwhenopened.msoTriStateMixedmsoTriStateTogglemsoTrueThedefaultencodingisusedwhenyousaveaWebpageorplaintextdocument,independentofthefile'soriginalencodingwhenopened.
expression.AlwaysSaveInDefaultEncoding
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
TheEncodingpropertycanbeusedtosetthedefaultencoding.
Example
Thisexamplesetstheencodingtothedefaultencoding.TheencodingisusedwhenyousavethedocumentasaWebpage.
Application.DefaultWebOptions.AlwaysSaveInDefaultEncoding=msoTrue
AmountPropertyReturnsorsetsaSinglethatrepresentsthenumberofdegreesananimatedshapeisrotatedaroundthez-axis.Apositivevalueindicatesclockwiserotation;anegativevalueindicatescounterclockwiserotation.Read/write.
expression.Amount
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
AnglePropertyReturnsorsetstheangleofthecalloutline.Ifthecalloutlinecontainsmorethanonelinesegment,thispropertyreturnsorsetstheangleofthesegmentthatisfarthestfromthecallouttextbox.Read/writeMsoCalloutAngleType.
MsoCalloutAngleTypecanbeoneoftheseMsoCalloutAngleTypeconstants.msoCalloutAngle30msoCalloutAngle45msoCalloutAngle60msoCalloutAngle90msoCalloutAngleAutomaticCalloutlinemaintainsafixedangleasyoudragthecallout.msoCalloutAngleMixed
expression.Angle
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsto90degreesthecalloutangleforacalloutnamed"co1"onmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes("co1").Callout.Angle=msoCalloutAngle90
ShowAll
AnimatePropertyDetermineswhetherthespecifiedshapeisanimatedduringaslideshow.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisanimatedduringaslideshow.
expression.Animate
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNone,andeithertheAnimatepropertymustbesettoTrue,ortheEntryEffectpropertymustbesettoaconstantotherthanppEffectNone.
Example
Thisexamplespecifiesthatthetitleonslidetwointheactivepresentationappeardimmedafterthetitleisbuilt.Ifthetitleisthelastoronlyshapetobebuiltonslidetwo,thetextwon'tbedimmed.
WithActivePresentation.Slides(2).Shapes.Title.AnimationSettings
.TextLevelEffect=ppAnimateByAllLevels
.AfterEffect=ppAfterEffectDim
.Animate=msoTrue
EndWith
ShowAll
AnimateActionPropertyMsoTrueifthecolorofthespecifiedshapeismomentarilyinvertedwhenthespecifiedmouseactionoccurs.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.AnimateAction
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsshapethreeonslideoneintheactivepresentationtoplaythesoundofapplauseandtomomentarilyinvertitscolorwhenit'sclickedduringaslideshow.
WithActivePresentation.Slides(1)_
.Shapes(3).ActionSettings(ppMouseClick)
.SoundEffect.Name="applause"
.AnimateAction=msoTrue
EndWith
ShowAll
AnimateBackgroundPropertyAnimateBackgroundpropertyasitappliestotheAnimationSettings
object.
IfthespecifiedobjectisanAutoShape,msoTrueiftheshapeisanimatedseparatelyfromthetextitcontains.Ifthespecifiedshapeisagraphobject,msoTrueifthebackground(theaxesandgridlines)ofthespecifiedgraphobjectisanimated.AppliesonlytoAutoShapeswithtextthatcanbebuiltinmorethanonesteportographobjects.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.AnimateBackground
expressionRequired.AnexpressionthatreturnsanAnimationSettingsobject.
AnimateBackgroundpropertyasitappliestotheEffectInformationobject.
ReturnsMsoTrueifthespecifiedeffectisabackgroundanimation.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.AnimateBackground
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Remarks
UsetheTextLevelEffectandTextUnitEffectpropertiestocontroltheanimationoftextattachedtothespecifiedshape.
IfthispropertyissettoMsoTrueandtheTextLevelEffectpropertyissettoppAnimateByAllLevels,theshapeanditstextwillbeanimatedsimultaneously.IfthispropertyissettoMsoTrueandtheTextLevelEffectpropertyissettoanythingotherthanppAnimateByAllLevels,theshapewillbeanimatedimmediatelybeforethetextisanimated.
Youwon'tseeeffectsofsettingthispropertyunlessthespecifiedshapeisanimated.Forashapetobeanimated,theTextLevelEffectpropertyfortheshapemustbesettosomethingotherthanppAnimateLevelNone,andeithertheAnimatepropertymustbesettoMsoTrue,ortheEntryEffectpropertymustbesettoaconstantotherthanppEffectNone.
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
ShowAll
AnimateTextInReversePropertyDetermineswhetherthespecifiedshapeisbuiltinreverseorder.Appliesonlytoshapes(suchasshapescontaininglists)thatcanbebuiltinmorethanonestep.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisbuiltinreverseorder.
expression.AnimateTextInReverse
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Youwon'tseeeffectsofsettingthispropertyunlessthespecifiedshapegetsanimated.Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNoneandtheAnimatepropertymustbesettoTrue.
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
AnimationOrderPropertyReturnsorsetsanintegerthatrepresentsthepositionofthespecifiedshapewithinthecollectionofshapestobeanimated.Read/writeLong.
Remarks
Youwon'tseeeffectsofsettingthispropertyunlessthespecifiedshapegetsanimated.Forashapetobeanimated,theTextLevelEffectpropertyoftheAnimationSettingsobjectfortheshapemustbesettosomethingotherthanppAnimateLevelNoneandtheAnimatepropertymustbesettoTrue.
NoteSettingtheAnimationOrderpropertytoavaluethatislessthanthegreatestexistingAnimationOrderpropertyvaluecanshifttheanimationorder.
Example
Thisexamplespecifiesthatshapetwoonslidetwointheactivepresentationbeanimatedsecond.
ActivePresentation.Slides(2).Shapes(2)_
.AnimationSettings.AnimationOrder=2
AnimationSettingsPropertyReturnsanAnimationSettingsobjectthatrepresentsallthespecialeffectsyoucanapplytotheanimationofthespecifiedshape.
expression.AnimationSettings
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsshapeoneonslidetwointheactivepresentationtoflyinfromtheleftwhentheslideisbuilt.
WithActivePresentation.Slides(2).Shapes(1).AnimationSettings
.EntryEffect=ppEffectFlyFromLeft
.TextLevelEffect=ppAnimateByAllLevels
EndWith
AnswerWizardPropertyReturnstheAnswerWizardobjectthatcontainsthefilesusedbytheonlineHelpsearchengine.Read-only.
ApplicationPropertyReturnsanApplicationobjectthatrepresentsthecreatorofthespecifiedobject.
expression.Application
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
AssistantPropertySomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.
ReturnsanAssistantobjectthatrepresentstheOfficeAssistant.Read-only.
Example
ThisexampledisplaystheOfficeAssistant.
Application.Assistant.Visible=True
ThisexamplemovestheOfficeAssistanttotheupper-leftregionofthescreen.
Application.Assistant.MovexLeft:=100,yTop:=100
AuthorPropertyReturnsaStringthatrepresentstheauthorasforaspecifiedCommentobject.Read-only.
expression.Author
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thispropertyonlyreturnstheauthor'sname.Toreturntheauthor'sinitials,usetheAuthorInitialsproperty.SpecifytheAuthorofacommentwhenyouaddanewcommenttothepresentation.
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
AuthorIndexPropertyReturnsaLongrepresentingtheindexnumberofacommentforagivenauthor.Thefirstcommentforagivenauthorhasanindexnumberof1,theirsecondcommenthasanindexnumberof2,andsoon.Read-only.
expression.AuthorIndex
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
AuthorInitialsPropertyReturnstheauthor'sinitialsasaread-onlyStringforaspecifiedCommentobject.Read-only.
expression.AuthorInitials
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thispropertyonlyreturnstheauthor'sinitials.Toreturntheauthor'snameusetheAuthorproperty.Specifytheauthor'sinitialswhenyouaddanewcommenttothepresentation.
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
ShowAll
AutoAttachPropertyDetermineswhethertheplacewherethecalloutlineattachestothecallouttextboxchangesdependingonwhethertheoriginofthecalloutline(wherethecalloutpointsto)istotheleftorrightofthecallouttextbox.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheplacewherethecalloutlineattachestothecallouttextboxchangesdependingonwhethertheoriginofthecalloutline(wherethecalloutpointsto)istotheleftorrightofthecallouttextbox.
Remarks
WhenthevalueofthispropertyismsoTrue,thedropvalue(theverticaldistancefromtheedgeofthecallouttextboxtotheplacewherethecalloutlineattaches)ismeasuredfromthetopofthetextboxwhenthetextboxistotherightoftheorigin,andit'smeasuredfromthebottomofthetextboxwhenthetextboxistotheleftoftheorigin.WhenthevalueofthispropertyismsoFalse,thedropvalueisalwaysmeasuredfromthetopofthetextbox,regardlessoftherelativepositionsofthetextboxandtheorigin.UsetheCustomDropmethodtosetthedropvalue,andusetheDroppropertytoreturnthedropvalue.
Settingthispropertyaffectsacalloutonlyifithasanexplicitlysetdropvalue—thatis,ifthevalueoftheDropTypepropertyismsoCalloutDropCustom.Bydefault,calloutshaveexplicitlysetdropvalueswhenthey'recreated.
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
AutoCorrectPropertyReturnsanAutoCorrectobjectthatrepresentstheAutoCorrectfunctionalityinMicrosoftPowerPoint.
expression.AutoCorrect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThefollowingexampledisablesdisplayoftheAutoCorrectOptionsandAutoLayoutOptionsbuttons.
SubHideAutoCorrectOpButton()
WithApplication.AutoCorrect
.DisplayAutoCorrectOptions=msoFalse
.DisplayAutoLayoutOptions=msoFalse
EndWith
EndSub
ShowAll
AutoFormatPropertySetsorreturnsanMsoTriStateconstantthatrepresentsadiagram'sautomaticformattingstate.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseAutomaticformattingisnotenabled.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueAutomaticformattingisenabled.
expression.AutoFormat
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
AutoLayoutPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetheradiagram'scomponentsareautomaticallylaidout.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseThediagram'scomponentsarenotautomaticallylaidout.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThediagram'scomponentsareautomaticallylaidout.
expression.AutoLayout
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
AutoLengthPropertyDetermineswhetherthefirstsegmentofthecalloutretainsthefixedlengthspecifiedbytheLengthproperty,orisscaledautomatically,wheneverthecalloutismoved.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).msoCTruemsoFalseThefirstsegmentofthecalloutretainsthefixedlengthspecifiedbytheLengthpropertywheneverthecalloutismoved.msoTriStateMixedmsoTriStateTogglemsoTrueThefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox)isscaledautomaticallywheneverthecalloutismoved.
Remarks
Thispropertyisread-only.UsetheAutomaticLengthmethodtosetthispropertytomsoTrue,andusetheCustomLengthmethodtosetthispropertytomsoFalse.
Example
ThisexampletogglesbetweenanautomaticallyscalingfirstsegmentandonewithafixedlengthforthecalloutlineforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).Callout
If.AutoLengthThen
.CustomLength50
Else
.AutomaticLength
EndIf
EndWith
ShowAll
AutoLoadPropertyDetermineswhetherthespecifiedadd-inisautomaticallyloadedeachtimePowerPointisstarted.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedadd-inisautomaticallyloadedeachtimePowerPointisstarted.
Remarks
SettingthispropertytomsoTrueautomaticallysetstheRegisteredpropertytomsoTrue.
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
ShowAll
AutomationSecurityPropertyReturnsorsetsanMsoAutomationSecurityconstantthatrepresentsthesecuritymodeMicrosoftPowerPointuseswhenprogrammaticallyopeningfiles.ThispropertyisautomaticallysettomsoAutomationSecurityLowwhentheapplicationisstarted.Therefore,toavoidbreakingsolutionsthatrelyonthedefaultsetting,youshouldbecarefultoresetthispropertytomsoAutomationSecurityLowafterprogrammaticallyopeningafile.Also,thispropertyshouldbesetimmediatelybeforeandafteropeningafileprogrammaticallytoavoidmalicioussubversion.Read/write.
MsoAutomationSecuritycanbeoneoftheseMsoAutomationSecurityconstants.msoAutomationSecurityByUIUsesthesecuritysettingspecifiedintheSecuritydialogbox.msoAutomationSecurityForceDisableDisablesallmacrosinallfilesopenedprogrammaticallywithoutshowinganysecurityalerts.msoAutomationSecurityLowEnablesallmacros.Thisisthedefaultvaluewhentheapplicationisstarted.
expression.AutomationSecurity
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThevalueoftheDisplayAlertspropertywillnotapplytosecuritywarnings.Forexample,iftheusersetstheDisplayAlertspropertyequaltoFalseandtheAutomationSecuritypropertytomsoAutomationSecurityByUI,whiletheuserisonMediumsecuritylevel,thentherewillbesecuritywarningswhilethemacroisrunning.Thisallowsthemacrototrapfileopenerrors,whilestillshowingthesecuritywarningifthefileopensucceeds.
Example
Thisexamplecapturesthecurrentautomationsecuritysetting,changesthesettingtodisablemacros,displaystheOpendialogbox,andafteropeningtheselectedpresentation,setstheautomationsecuritybacktoitsoriginalsetting.
SubSecurity()
DimsecAutomationAsMsoAutomationSecurity
secAutomation=Application.AutomationSecurity
Application.AutomationSecurity=msoAutomationSecurityForceDisable
Application.FileDialog(msoFileDialogOpen).Show
Application.AutomationSecurity=secAutomation
EndSub
ShowAll
AutoReversePropertySetsorreturnsanMsoTriStatethatrepresentswhetheraneffectshouldplayforwardandthenreverse,therebydoublingtheduration.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Theeffectdoesnotplayforwardandthenreverse.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueTheeffectplaysforwardandthenreverse.
expression.AutoReverse
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
AutoRotateNumbersPropertyReturnsorsetslateralcompression.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseHalf-widthnumberswillnotbecompressedinlateralcolumns.msoTriStateMixedmsoTriStateTogglemsoTrueDisplayshalf-widthnumberswithinverticaltextintwo-characterlateralcolumns.
Example
Thisexamplesetsthetextdirectionofshapethreeonthefirstslidetoverticaltext,andsetslateralcolumncompression.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).TextFrame
.Orientation=msoTextOrientationVerticalFarEast
.TextRange.Font.AutoRotateNumbers=msoTrue
EndWith
ShowAll
AutoShapeTypePropertyReturnsorsetstheshapetypeforthespecifiedShapeorShapeRangeobject,whichmustrepresentanAutoShapeotherthanaline,freeformdrawing,orconnector.Read/writeMsoAutoShapeType.
MsoAutoShapeTypecanbeoneoftheseMsoAutoShapeTypeconstants.msoShapeFlowchartConnectormsoShapeFlowchartDatamsoShapeFlowchartDecisionmsoShapeFlowchartDelaymsoShapeFlowchartDirectAccessStoragemsoShapeFlowchartDisplaymsoShapeFlowchartDocumentmsoShapeFlowchartExtractmsoShapeFlowchartInternalStoragemsoShapeFlowchartMagneticDiskmsoShapeFlowchartManualInputmsoShapeFlowchartManualOperationmsoShapeFlowchartMergemsoShapeFlowchartMultidocumentmsoShapeFlowchartOffpageConnectormsoShapeFlowchartOrmsoShapeFlowchartPredefinedProcessmsoShapeFlowchartPreparationmsoShapeFlowchartProcessmsoShapeFlowchartPunchedTapemsoShapeFlowchartSequentialAccessStoragemsoShapeFlowchartSortmsoShapeFlowchartStoredDatamsoShapeFlowchartSummingJunctionmsoShapeFlowchartTerminator
msoShapeFoldedCornermsoShapeHeartmsoShapeHexagonmsoShapeHorizontalScrollmsoShapeIsoscelesTrianglemsoShapeLeftArrowmsoShapeLeftArrowCalloutmsoShapeLeftBracemsoShapeLeftBracketmsoShapeLeftRightArrowmsoShapeLeftRightArrowCalloutmsoShapeLeftRightUpArrowmsoShapeLeftUpArrowmsoShapeLightningBoltmsoShapeLineCallout1msoShapeLineCallout1AccentBarmsoShapeLineCallout1BorderandAccentBarmsoShapeLineCallout1NoBordermsoShapeLineCallout2msoShapeLineCallout2AccentBarmsoShapeLineCallout2BorderandAccentBarmsoShapeLineCallout2NoBordermsoShapeLineCallout3msoShapeLineCallout3AccentBarmsoShapeLineCallout3BorderandAccentBarmsoShapeLineCallout3NoBordermsoShapeLineCallout4msoShapeLineCallout4AccentBarmsoShapeLineCallout4BorderandAccentBarmsoShapeLineCallout4NoBordermsoShapeMixedmsoShapeMoonmsoShapeNoSymbol
msoShapeNotchedRightArrowmsoShapeNotPrimitivemsoShapeOctagonmsoShapeOvalmsoShapeOvalCalloutmsoShapeParallelogrammsoShapePentagonmsoShapePlaquemsoShapeQuadArrowmsoShapeQuadArrowCalloutmsoShapeRectanglemsoShapeRectangularCalloutmsoShapeRegularPentagonmsoShapeRightArrowmsoShapeRightArrowCalloutmsoShapeRightBracemsoShapeRightBracketmsoShapeRightTrianglemsoShapeRoundedRectanglemsoShapeRoundedRectangularCalloutmsoShapeSmileyFacemsoShapeStripedRightArrowmsoShapeSunmsoShapeTrapezoidmsoShapeUpArrowmsoShapeUpArrowCalloutmsoShapeUpDownArrowmsoShapeUpDownArrowCalloutmsoShapeUpRibbonmsoShapeUTurnArrowmsoShapeVerticalScrollmsoShapeWavemsoShapeFlowchartCollate
msoShape16pointStarmsoShape24pointStarmsoShape32pointStarmsoShape4pointStarmsoShape5pointStarmsoShape8pointStarmsoShapeActionButtonBackorPreviousmsoShapeActionButtonBeginningmsoShapeActionButtonCustommsoShapeActionButtonDocumentmsoShapeActionButtonEndmsoShapeActionButtonForwardorNextmsoShapeActionButtonHelpmsoShapeActionButtonHomemsoShapeActionButtonInformationmsoShapeActionButtonMoviemsoShapeActionButtonReturnmsoShapeActionButtonSoundmsoShapeArcmsoShapeBalloonmsoShapeBentArrowmsoShapeBentUpArrowmsoShapeBevelmsoShapeBlockArcmsoShapeCanmsoShapeChevronmsoShapeCircularArrowmsoShapeCloudCalloutmsoShapeCrossmsoShapeCubemsoShapeCurvedDownArrowmsoShapeCurvedDownRibbonmsoShapeCurvedLeftArrow
msoShapeCurvedRightArrowmsoShapeCurvedUpArrowmsoShapeCurvedUpRibbonmsoShapeDiamondmsoShapeDonutmsoShapeDoubleBracemsoShapeDoubleBracketmsoShapeDoubleWavemsoShapeDownArrowmsoShapeDownArrowCalloutmsoShapeDownRibbonmsoShapeExplosion1msoShapeExplosion2msoShapeFlowchartAlternateProcessmsoShapeFlowchartCard
expression.AutoShapeType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.Read/writeLong.
NoteWhenyouchangethetypeofashape,theshaperetainsitssize,color,andotherattributes.
Remarks
UsetheTypepropertyoftheConnectorFormatobjecttosetorreturntheconnectortype.
Example
Thisexamplereplacesall16-pointstarswith32-pointstarsinmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Ifs.AutoShapeType=msoShape16pointStarThen
s.AutoShapeType=msoShape32pointStar
EndIf
Next
ShowAll
AutoSizePropertyReturnsorsetsavaluethatindicateswhetherthesizeofthespecifiedshapeischangedautomaticallytofittextwithinitsboundaries.Read/writePpAutoSize.
PpAutoSizecanbeoneofthesePpAutoSizeconstants.ppAutoSizeMixedppAutoSizeNoneppAutoSizeShapeToFitText
expression.AutoSize
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampleadjuststhesizeofthetitleboundingboxonslideonetofitthetitletext.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1)
If.TextFrame.TextRange.Characters.Count<50Then
.TextFrame.AutoSize=ppAutoSizeShapeToFitText
EndIf
EndWith
ShowAll
AutoUpdatePropertyReturnsorsetsthewaythelinkwillbeupdated.Read/writePpUpdateOption.
PpUpdateOptioncanbeoneofthesePpUpdateOptionconstants.ppUpdateOptionAutomaticLinkwillbeupdatedeachtimethepresentationisopenedorthesourcefilechanges.ppUpdateOptionManualLinkwillbeupdatedonlywhentheuserspecificallyaskstoupdatethepresentation.ppUpdateOptionMixed
expression.AutoUpdate
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.
ForEachsldInActivePresentation.Slides
ForEachshInsld.Shapes
Ifsh.Type=msoLinkedOLEObjectThen
Ifsh.OLEFormat.ProgID="Excel.Sheet"Then
sh.LinkFormat.AutoUpdate=ppUpdateOptionManual
EndIf
EndIf
Next
Next
BackColorPropertyReturnsorsetsaColorFormatobjectthatrepresentsthebackgroundcolorforthespecifiedfillorpatternedline.Read/write.
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
BackgroundPropertyReturnsaShapeRangeobjectthatrepresentstheslidebackground.
expression.Background
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
IfyouusetheBackgroundpropertytosetthebackgroundforanindividualslidewithoutchangingtheslidemaster,theFollowMasterBackgroundpropertyforthatslidemustbesettoFalse.
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
ShowAll
BaseLineAlignmentPropertyReturnsorsetsthebaselinealignmentforthespecifiedparagraph.Read/writePpBaselineAlignment.
PpBaselineAlignmentcanbeoneofthesePpBaselineAlignmentconstants.ppBaselineAlignBaselineppBaselineAlignCenterppBaselineAlignFarEast50ppBaselineAlignMixedppBaselineAlignTop
expression.BaseLineAlignment
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampledisplaysthebaselinealignmentfortheparagraphsinshapetwoonslideoneintheactivepresentation.
MsgBoxActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange_
.ParagraphFormat.BaseLineAlignment
BaselineOffsetPropertyReturnsorsetsthebaselineoffsetforthespecifiedsuperscriptorsubscriptcharacters.Canbeafloating-pointvaluefrom–1through1.Avalueof–1representsanoffsetof–100percent,andavalueof1representsanoffsetof100percent.Read/writeSingle.
Remarks
SettingtheBaselineOffsetpropertytoanegativevalueautomaticallysetstheSubscriptpropertytoTrueandtheSuperscriptpropertytoFalse.
SettingtheBaselineOffsetpropertytoapositivevalueautomaticallysetstheSubscriptpropertytoFalseandtheSuperscriptpropertytoTrue.
SettingtheSubscriptpropertytoTrueautomaticallysetstheBaselineOffsetpropertyto0.3(30percent).
SettingtheSuperscriptpropertytoTrueautomaticallysetstheBaselineOffsetpropertyto–0.25(–25percent).
Example
Thisexamplesetsthetextforshapetwoonslideoneandthenmakesthesecondcharactersubscriptwitha20-percentoffset.
WithApplication.ActivePresentation.Slides(1)_
.Shapes(2).TextFrame.TextRange
.Text="H2O"
.Characters(2,1).Font.BaselineOffset=-0.2
EndWith
ShowAll
BeginArrowheadLengthPropertyReturnsorsetsthelengthofthearrowheadatthebeginningofthespecifiedline.Read/writeMsoArrowheadLength.
MsoArrowheadLengthcanbeoneoftheseMsoArrowheadLengthconstants.msoArrowheadLengthMediummsoArrowheadLengthMixedmsoArrowheadLongmsoArrowheadShort
expression.BeginArrowheadLength
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
BeginArrowheadStylePropertyReturnsorsetsthestyleofthearrowheadatthebeginningofthespecifiedline.Read/writeMsoArrowheadStyle.
MsoArrowheadStylecanbeoneoftheseMsoArrowheadStyleconstants.msoArrowheadDiamondmsoArrowheadNonemsoArrowheadOpenmsoArrowheadOvalmsoArrowheadStealthmsoArrowheadStyleMixedmsoArrowheadTriangle
expression.BeginArrowheadStyle
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
BeginArrowheadWidthPropertyReturnsorsetsthewidthofthearrowheadatthebeginningofthespecifiedline.Read/writeMsoArrowheadWidth.
MsoArrowheadWidthcanbeoneoftheseMsoArrowheadWidthconstants.msoArrowheadNarrowmsoArrowheadWidemsoArrowheadWidthMediummsoArrowheadWidthMixed
expression.BeginArrowheadWidth
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
BeginConnectedPropertyDetermineswhetherthebeginningofthespecifiedconnectorisconnectedtoashape.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThebeginningofthespecifiedconnectorisconnectedtoashape.
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
BeginConnectedShapePropertyReturnsaShapeobjectthatrepresentstheshapethatthebeginningofthespecifiedconnectorisattachedto.Read-only.
NoteIfthebeginningofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.
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
BeginConnectionSitePropertyReturnsanintegerthatspecifiestheconnectionsitethatthebeginningofaconnectorisconnectedto.Read-onlyLong.
NoteIfthebeginningofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.
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
BehaviorsPropertyReturnsaspecifiedslideanimationbehaviorasanAnimationBehaviorscollection.
expression.Behaviors
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ToreturnasingleAnimationBehaviorobjectintheAnimationBehaviorscollection,usetheItemmethodorBehaviors(index),whereindexistheindexnumberoftheAnimationBehaviorobjectintheAnimationBehaviorscollection.
Example
Thefollowingexamplereturnsaspecificanimationbehaviortypeintheactivepresentation.
SubReturnTypeValue
MsgBoxActiveWindow.Selection.SlideRange(1).TimeLine_
.MainSequence(1).Behaviors.Item(1).Type
EndSub
ShowAll
BlackAndWhitePropertyDetermineswhetherthedocumentwindowdisplayisblackandwhite.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueThedocumentwindowdisplayisblackandwhite.
Example
Thisexamplechangesthedisplayinwindowonetoblackandwhite.
Application.Windows(1).BlackAndWhite=msoTrue
ShowAll
BlackWhiteModePropertyReturnsorsetsavaluethatindicateshowthespecifiedshapeappearswhenthepresentationisviewedinblack-and-whitemode.Read/writeMsoBlackWhiteMode.
MsoBlackWhiteModecanbeoneoftheseMsoBlackWhiteModeconstants.msoBlackWhiteAutomaticmsoBlackWhiteBlackmsoBlackWhiteBlackTextAndLinemsoBlackWhiteDontShowmsoBlackWhiteGrayOutlinemsoBlackWhiteGrayScalemsoBlackWhiteHighContrastmsoBlackWhiteInverseGrayScalemsoBlackWhiteLightGrayScalemsoBlackWhiteMixedmsoBlackWhiteWhite
expression.BlackWhiteMode
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsshapeoneonmyDocumenttoappearinblack-and-whitemode.Whenyouviewthepresentationinblack-and-whitemode,shapeonewillappearblack,regardlessofwhatcoloritisincolormode.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).BlackWhiteMode=msoBlackWhiteBlack
ShowAll
BoldPropertyDetermineswhetherthecharacterformatisbold.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThecharacterformatisnotbold.msoTriStateMixedThespecifiedtextrangecontainsbothboldandnonboldcharacters.msoTriStateTogglemsoTrueThecharacterformatisbold.
Example
Thisexamplesetscharactersonethroughfiveinthetitleonslideonetobold.
SetmyT=Application.ActivePresentation.Slides(1).Shapes.Title
myT.TextFrame.TextRange.Characters(1,5).Font.Bold=msoTrue
ShowAll
BorderPropertyDetermineswhetherthetextinthespecifiedcalloutissurroundedbyaborder.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThetextinthespecifiedcalloutissurroundedbyaborder.
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
BordersPropertyReturnsaBorderscollectionthatrepresentsthebordersanddiagonallinesforthespecifiedCellobjectorCellRangecollection.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
Thisexamplesetsthethicknessoftheleftborderforthefirstcellinthesecondrowoftheselectedtabletothreepoints.
ActiveWindow.Selection.ShapeRange.Table.Rows(2)_
.Cells(1).Borders.Item(ppBorderLeft).Weight=3
ShowAll
BoundHeightPropertyReturnstheheight(inpoints)ofthetextboundingboxforthespecifiedtextframe.Read-onlySingle.
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
ShowAll
BoundLeftPropertyReturnsthedistance(inpoints)fromtheleftedgeofthetextboundingboxforthespecifiedtextframetotheleftedgeoftheslide.Read-onlySingle.
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
ShowAll
BoundTopPropertyReturnsthedistance(inpoints)fromthetopoftheofthetextboundingboxforthespecifiedtextframetothetopoftheslide.Read-onlySingle.
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
ShowAll
BoundWidthPropertyReturnsthewidth(inpoints)ofthetextboundingboxforthespecifiedtextframe.Read-onlySingle.
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
BrightnessPropertyReturnsorsetsthebrightnessofthespecifiedpictureorOLEobject.Thevalueforthispropertymustbeanumberfrom0.0(dimmest)to1.0(brightest).Read/writeSingle.
Example
ThisexamplesetsthebrightnessforshapeoneonmyDocument.ShapeonemustbeeitherapictureoranOLEobject.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).PictureFormat.Brightness=0.3
BuildPropertyReturnsthePowerPointbuildnumber.Read-onlyString.
Example
ThisexampledisplaysthePowerPointbuildnumber.
MsgBoxPrompt:=Application.Build,Title:="PowerPointBuild"
ShowAll
BuildByLevelEffectPropertyReturnsanMsoAnimateByLevelconstantthatrepresentstheleveloftheanimationbuildeffect.Read-only.
MsoAnimateByLevelcanbeoneoftheseMsoAnimateByLevelconstants.msoAnimateChartAllAtOncemsoAnimateChartByCategorymsoAnimateChartByCategoryElementsmsoAnimateChartBySeriesmsoAnimateChartBySeriesElementsmsoAnimateDiagramAllAtOncemsoAnimateDiagramBreadthByLevelmsoAnimateDiagramBreadthByNodemsoAnimateDiagramClockwisemsoAnimateDiagramClockwiseInmsoAnimateDiagramClockwiseOutmsoAnimateDiagramCounterClockwisemsoAnimateDiagramCounterClockwiseInmsoAnimateDiagramCounterClockwiseOutmsoAnimateDiagramDepthByBranchmsoAnimateDiagramDepthByNodemsoAnimateDiagramDownmsoAnimateDiagramInByRingmsoAnimateDiagramOutByRingmsoAnimateDiagramUpmsoAnimateLevelMixedmsoAnimateTextByAllLevelsmsoAnimateTextByFifthLevelmsoAnimateTextByFirstLevelmsoAnimateTextByFourthLevelmsoAnimateTextBySecondLevel
msoAnimateTextByThirdLevelmsoAnimationLevelNone
expression.BuildByLevelEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
BuiltInDocumentPropertiesPropertyReturnsaDocumentPropertiescollectionthatrepresentsallthebuilt-indocumentpropertiesforthespecifiedpresentation.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Remarks
UsetheCustomDocumentPropertiespropertytoreturnthecollectionofcustomdocumentproperties.
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
BulletPropertyReturnsaBulletFormatobjectthatrepresentsbulletformattingforthespecifiedparagraphformat.Read-only.
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
ShowAll
ByPropertyBypropertyasitappliestotheColorEffectobject.
ReturnsaColorFormatobjectthatrepresentsachangetothecoloroftheobjectbythespecifiednumber,expressedinRGBformat.
expression.By
expressionRequired.AnexpressionthatreturnsaColorEffectobject.
BypropertyasitappliestotheRotationEffectobject.
SetsorreturnsaSinglethatrepresentstherotationofanobjectbythespecifiednumberofdegrees;forexample,avalueof180meanstorotatetheobjectby180degrees.Read/write.
expression.By
expressionRequired.AnexpressionthatreturnsaRotationEffectobject.
Remarks
Thespecifiedobjectwillberotatedwiththecenteroftheobjectremaininginthesamepositiononthescreen.
IfboththeByandTopropertiesaresetforarotationeffect,thenthevalueoftheBypropertyisignored.
Floatingpointnumbers(forexample,55.5)arevalid,butnegativenumbersarenot.
Remarks
DonotconfusethispropertywiththeByXorByYpropertiesoftheScaleEffectandMotionEffectobjects,whichareonlyusedforscalingormotioneffects.
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
SeteffBlinds=tmlnShape.MainSequence.AddEffect_
(Shape:=shpShape,effectId:=msoAnimEffectBlinds)
'Addsanimationbehaviorandsetsrotationeffect
SetanimBehavior=tmlnShape.MainSequence(1).Behaviors_
.Add(Type:=msoAnimTypeRotation)
SetrtnEffect=animBehavior.RotationEffect
rtnEffect.By=270
EndSub
ByXPropertySetsorreturnsaSinglethatrepresentsscalingormovinganobjecthorizontallybyaspecifiedpercentageofthescreenwidth,dependingonwhetheritusedinconjunctionwithaScaleEffectorMotionEffectobject,respectively.Forexample,avalueof50foramotioneffectmeanstomovetheobjecthalfthescreenwidthtotheright.Read/write.
expression.ByX
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Negativenumbersmovetheobjecthorizontallytotheleft.Floatingpointnumbers(forexample,55.5)areallowed.
Toscaleormoveanobjectvertically,usetheByYproperty.
IfboththeByXandByYpropertiesareset,thentheobjectisscaledormovesbothhorizontallyandvertically.
DonotconfusethispropertywiththeBypropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetcolors,rotations,orotherpropertiesofananimationbehavior,respectively.
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
ByYPropertySetsorreturnsaSinglethatrepresentsscalingormovinganobjectverticallybyaspecifiedpercentageofthescreenwidth,dependingonwhetheritisusedinconjunctionwithaScaleEffectorMotionEffectobject,respectively.Read/write.
expression.ByY
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Negativenumbersmovetheobjecthorizontallytotheleft.Floatingpointnumbers(forexample,55.5)areallowed.
Toscaleormoveanobjecthorizontally,usetheByXproperty.
IfboththeByXandByYpropertiesareset,thentheobjectisscaledormovesbothhorizontallyandvertically.
DonotconfusethispropertywiththeBypropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetcolors,rotations,orotherpropertiesofananimationbehavior,respectively.
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
CalloutPropertyReturnsaCalloutFormatobjectthatcontainscalloutformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentlinecallouts.Read-only.
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
ShowAll
CaptionPropertyCaptionpropertyasitappliestotheApplicationobject.
Returnsthetextthatappearsinthetitlebaroftheapplicationwindow.Read/writeString.
expression.Caption
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
CaptionpropertyasitappliestotheDocumentWindowobject.
Returnsthetextthatappearsinthetitlebarofthedocumentwindow.Read-onlyString.
expression.Caption
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Example
Thisexampledisplaysthecaptionforeachopendocumentwindow.
WithApplication.Windows
Forw=1To.Count
MsgBox"Window"&w&"contains"&.Item(1).Caption
Next
EndWith
CellsPropertyReturnsaCellRangecollectionthatrepresentsthecellsinatablecolumnorrow.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
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
CharacterPropertyReturnsorsetstheUnicodecharactervaluethatisusedforbulletsinthespecifiedtext.Read/writeLong.
Example
Thisexamplesetsthebulletcharacterforshapetwoonslideoneintheactivepresentation.
Setframe2=ActivePresentation.Slides(1).Shapes(2).TextFrame
Withframe2.TextRange.ParagraphFormat.Bullet
.Character=8226
.Visible=True
EndWith
ShowAll
ChartUnitEffectPropertyReturnsorsetsavaluethatindicateswhetherthegraphrangeisanimatedbyseries,category,orelement.Read/writePpChartUnitEffect.
PpChartUnitEffectcanbeoneofthesePpChartUnitEffectconstants.ppAnimateByCategoryppAnimateByCategoryElementsppAnimateBySeriesppAnimateBySeriesElementsppAnimateChartAllAtOnceppAnimateChartMixed
expression.ChartUnitEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Ifyourgraphdoesn'tbecomeanimated,makesurethattheAnimatepropertyissettoTrue
Example
Thisexamplesetsshapetwoonslidethreeintheactivepresentationtobeanimatedbyseries.Shapetwomustbeagraphforthistowork.
WithActivePresentation.Slides(3).Shapes(2)
With.AnimationSettings
.ChartUnitEffect=ppAnimateBySeries
.EntryEffect=ppEffectFlyFromLeft
.Animate=True
EndWith
EndWith
ShowAll
CheckIfOfficeIsHTMLEditorPropertyDetermineswhetherMicrosoftPowerPointcheckstoseewhetheranOfficeapplicationisthedefaultHTMLeditorwhenyoustartPowerPoint.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsePowerPointdoesnotchecktoseewhetheranOfficeapplicationisthedefaultHTMLeditorwhenyoustartPowerPoint.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.PowerPointcheckstoseewhetheranOfficeapplicationisthedefaultHTMLeditorwhenyoustartPowerPoint.
Remarks
ThispropertyisusedonlyiftheWebbrowseryouareusingsupportsHTMLeditingandHTMLeditors.
TouseadifferentHTMLeditor,youmustsetthispropertytoFalseandthenregistertheeditorasthedefaultsystemHTMLeditor.
Example
ThisexamplecausesMicrosoftPowerPointnottocheckwhetheranOfficeapplicationisthedefaultHTMLeditor.
Application.DefaultWebOptions.CheckIfOfficeIsHTMLEditor=msoFalse
ShowAll
ChildPropertyMsoTrueiftheshapeisachildshapeorifallshapesinashaperangearechildshapesofthesameparent.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesnotapplytothisproperty.msoFalseTheshapeisnotachildshapeor,ifashaperange,allchildshapesdonotbelongtothesameparent.msoTriStateMixedDoesnotapplytothisproperty.msoTriStateToggleDoesnotapplytothisproperty.msoTrueTheshapeisachildshapeor,ifashaperange,allchildshapesbelongtothesameparent.
expression.Child
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ChildrenPropertyReturnsaDiagramNodeChildrenobjectthatrepresentsallofthechildrenofthespecifieddiagramnode.
expression.Children
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ChildShapeRangePropertyReturnsaShapeRangeobjectthatrepresentsthechildshapesofaselection.
expression.ChildShapeRange
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
CollatePropertyDetermineswhetheracompletecopyofthespecifiedpresentationisprintedbeforethefirstpageofthenextcopyisprinted.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.Acompletecopyofthespecifiedpresentationisprintedbeforethefirstpageofthenextcopyisprinted.
Remarks
SpecifyingavaluefortheCollateargumentofthePrintOutmethodsetsthevalueofthisproperty.
Example
Thisexampleprintsthreecollatedcopiesoftheactivepresentation.
WithActivePresentation.PrintOptions
.NumberOfCopies=3
.Collate=msoTrue
.Parent.PrintOut
EndWith
ColorPropertyReturnsaColorFormatobjectthatrepresentsthecolorforthespecifiedcharacters.Read-only.
Example
Thisexamplesetsthecolorofcharactersonethroughfiveinthetitleonslideone.
myRed=RGB(255,0,0)
SetmyT=Application.ActivePresentation.Slides(1).Shapes.Title
myT.TextFrame.TextRange.Characters(1,5).Font.Color.RGB=myRed
Color2PropertyReturnsaColorFormatobjectthatrepresentsthecoloronwhichtoendacolor-cycleanimation.
expression.Color2
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ColorEffectPropertyReturnsaColorEffectobjectthatrepresentsthecolorpropertiesforaspecifiedanimationbehavior.
expression.ColorEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ColorSchemePropertyReturnsorsetstheColorSchemeobjectthatrepresentstheschemecolorsforthespecifiedslide,sliderange,orslidemaster.Read/write.
Example
Thisexamplesetsthetitlecolortogreenforslidesoneandthreeintheactivepresentation.
SetmySlides=ActivePresentation.Slides.Range(Array(1,3))
mySlides.ColorScheme.Colors(ppTitle).RGB=RGB(0,255,0)
ColorSchemesPropertyReturnsaColorSchemescollectionthatrepresentsthecolorschemesinthespecifiedpresentation.Read-only.
Example
Thisexamplesetsthebackgroundcolorforcolorschemethreeintheactivepresentationandthenappliesthecolorschemetoallslidesinthepresentationthatarebasedontheslidemaster.
WithActivePresentation
Setcs1=.ColorSchemes(3)
cs1.Colors(ppBackground).RGB=RGB(128,128,0)
.SlideMaster.ColorScheme=cs1
EndWith
ShowAll
ColorTypePropertyReturnsorsetsthetypeofcolortransformationappliedtothespecifiedpictureorOLEobject.Read/writeMsoPictureColorType.
MsoPictureColorTypecanbeoneoftheseMsoPictureColorTypeconstants.msoPictureAutomaticmsoPictureBlackAndWhitemsoPictureGrayscalemsoPictureMixedmsoPictureWatermark
expression.ColorType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsthecolortransformationtograyscaleforshapeoneonmyDocument.ShapeonemustbeeitherapictureoranOLEobject.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).PictureFormat.ColorType=msoPictureGrayScale
ColumnsPropertyReturnsaColumnscollectionthatrepresentsallthecolumnsinatable.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
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
COMAddInsPropertyReturnsareferencetotheComponentObjectModel(COM)add-inscurrentlyloadedinMicrosoftPowerPoint.ThesearelistedintheCOMAdd-Insdialogbox.YoucanaddtheCOMAdd-InscommandtoyourToolsmenubyusingtheCustomizedialogbox.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
CommandPropertySetsorreturnsaStringthatrepresentsthecommandtobeexecutedforthecommandeffect.Read/write.
expression.Command
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
YoucansendOLEverbstoembeddedobjectsusingthisproperty.
IftheshapeisanOLEobject,thentheoleobjectwillexecutethecommandifitunderstandstheverb.
Iftheshapeisamediaobject(sound/video),PowerPointunderstandsthefollowingverbs:play,stop,pause,togglepause,resumeandplayfrom.Anyothercommandsenttotheshapewillbeignored.
Example
Thefollowingexampleshowshowtosetacommandeffectanimationbehavior.
SetbhvEffect=effectNew.Behaviors.Add(msoAnimTypeCommand)
WithbhvEffect.CommandEffect
.Type=msoAnimCommandTypeVerb
.Command=Play
EndWith
ShowAll
CommandBarsPropertyCommandBarspropertyasitappliestotheApplicationobject.
ReturnsaCommandBarscollectionthatrepresentsallthecommandbarsinPowerPoint.Read-only.
CommandBarspropertyasitappliestothePresentationobject.
ReturnsaCommandBarscollectionthatrepresentsthemergedcommandbarsetfromthehostcontainerapplicationandPowerPoint.ThispropertyreturnsavalidobjectonlywhenthecontainerisaDocObjectserver,likeMicrosoftBinder,andPowerPointisactingasanOLEserver.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
AsitappliestotheApplicationobject.
ThisexampleenlargesallcommandbarbuttonsandenablesToolTips.
WithApplication.CommandBars
.LargeButtons=True
.DisplayTooltips=True
EndWith
AsitappliestothePresentationobject.
ThisexampledisplaystheFormattingcommandbarwiththemergedcommandbarsetatthetopoftheapplicationwindow.
WithActivePresentation.CommandBars("Formatting")
.Visible=True
.Position=msoBarTop
EndWith
CommandEffectPropertyReturnsaCommandEffectobjectforthespecifiedanimationbehavior.Read-only.
expression.CommandEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Youcansendevents,callfunctions,andsendOLEverbstoembeddedobjectsusingthisproperty.
Example
Thefollowingexampleshowshowtosetacommandeffectanimationbehavior.
SetbhvEffect=effectNew.Behaviors.Add(msoAnimTypeCommand)
WithbhvEffect.CommandEffect
.Type=msoAnimCommandTypeVerb
.Command=Play
EndWith
CommentsPropertyReturnsaCommentsobjectthatrepresentsacollectionofcomments.
expression.Comments
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thefollowingexampleaddsacommenttoaslide.
SubAddNewComment()
ActivePresentation.Slides(1).Comments.Add_
Left:=0,Top:=0,Author:="JohnDoe",AuthorInitials:="jd",_
Text:="Pleasecheckthisspellingagainbeforethenextdraft."
EndSub
ConnectionSiteCountPropertyReturnsthenumberofconnectionsitesonthespecifiedshape.Read-onlyLong.
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
ShowAll
ConnectorPropertyDetermineswhetherthespecifiedshapeisaconnector.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisaconnector.
Example
ThisexampledeletesallconnectorsonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes
Fori=.CountTo1Step-1
With.Item(i)
If.ConnectorThen.Delete
EndWith
Next
EndWith
ConnectorFormatPropertyReturnsaConnectorFormatobjectthatcontainsconnectorformattingproperties.AppliestoShapeorShapeRangeobjectsthatrepresentconnectors.Read-only.
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
ContainerPropertyReturnstheobjectthatcontainsthespecifiedembeddedpresentation.Read-onlyObject.
NoteIfthecontainerdoesn'tsupportOLEAutomation,orifthespecifiedpresentationisn'tembeddedinaMicrosoftBinderfile,thispropertyfails.
Example
ThisexamplehidesthesecondsectionoftheMicrosoftBinderfilethatcontainstheembeddedactivepresentation.TheContainerpropertyofthepresentationreturnsaSectionobject,andtheParentpropertyoftheSectionobjectreturnsaBinderobject.
Application.ActivePresentation.Container.Parent.Sections(2)_
.Visible=False
ContrastPropertyReturnsorsetsthecontrastforthespecifiedpictureorOLEobject.Thevalueforthispropertymustbeanumberfrom0.0(theleastcontrast)to1.0(thegreatestcontrast).Read/writeSingle.
Example
ThisexamplesetsthecontrastforshapeoneonmyDocument.ShapeonemustbeeitherapictureoranOLEobject.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).PictureFormat.Contrast=0.8
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.
Example
Thisexampleclosesallwindowsexcepttheactivewindow.
WithApplication.Windows
Fori=2To.Count
.Item(2).Close
Next
EndWith
CreatorPropertyReturnsaLongthatrepresentsthefour-charactercreatorcodefortheapplicationinwhichthespecifiedobjectwascreated.Forexample,iftheobjectwascreatedinPowerPoint,thispropertyreturnsthehexadecimalnumber50575054.Read-only.
expression.Creator
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
TheCreatorpropertyisdesignedtobeusedinMicrosoftOfficeapplicationsfortheMacintosh.
Example
ThisexampledisplaysamessageaboutthecreatorofmyObject.
SetmyObject=Application.ActivePresentation.Slides(1).Shapes(1)
IfmyObject.Creator=&h50575054Then
MsgBox"ThisisaPowerPointobject"
Else
MsgBox"ThisisnotaPowerPointobject"
EndIf
CropBottomPropertyReturnsorsetsthenumberofpointsthatarecroppedoffthebottomofthespecifiedpictureorOLEobject.Read/writeSingle.
NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointshigh,rescaleitsothatit's200pointshigh,andthensettheCropBottompropertyto50,100points(not50)willbecroppedoffthebottomofyourpicture.
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
CropLeftPropertyReturnsorsetsthenumberofpointsthatarecroppedofftheleftsideofthespecifiedpictureorOLEobject.Read/writeSingle.
NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointswide,rescaleitsothatit's200pointswide,andthensettheCropLeftpropertyto50,100points(not50)willbecroppedofftheleftsideofyourpicture.
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
CropRightPropertyReturnsorsetsthenumberofpointsthatarecroppedofftherightsideofthespecifiedpictureorOLEobject.Read/writeSingle.
NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointswide,rescaleitsothatit's200pointswide,andthensettheCropRightpropertyto50,100points(not50)willbecroppedofftherightsideofyourpicture.
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
CropTopPropertyReturnsorsetsthenumberofpointsthatarecroppedoffthetopofthespecifiedpictureorOLEobject.Read/writeSingle.
NoteCroppingiscalculatedrelativetotheoriginalsizeofthepicture.Forexample,ifyouinsertapicturethatisoriginally100pointshigh,rescaleitsothatit's200pointshigh,andthensettheCropToppropertyto50,100points(not50)willbecroppedoffthetopofyourpicture.
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
CurrentShowPositionPropertyReturnsthepositionofthecurrentslidewithintheslideshowthatisshowinginthespecifiedview.Read-onlyLong.
Remarks
Ifthespecifiedviewcontainsacustomshow,theCurrentShowPositionpropertyreturnsthepositionofthecurrentslidewithinthecustomshow,notthepositionofthecurrentslidewithintheentirepresentation.
Example
Thisexamplesetsavariabletothepositionofthecurrentslideintheslideshowrunninginslideshowwindowone.
lastSlideSeen=SlideShowWindows(1).View.CurrentShowPosition
CustomDocumentPropertiesPropertyReturnsaDocumentPropertiescollectionthatrepresentsallthecustomdocumentpropertiesforthespecifiedpresentation.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Remarks
UsetheBuiltInDocumentPropertiespropertytoreturnthecollectionofbuilt-indocumentproperties.
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
ShowAll
DashStylePropertyReturnsorsetsthedashstyleforthespecifiedline.Read/writeMsoLineDashStyle.
MsoLineDashStylecanbeoneoftheseMsoLineDashStyleconstants.msoLineDashmsoLineDashDotmsoLineDashDotDotmsoLineDashStyleMixedmsoLineLongDashmsoLineLongDashDotmsoLineRoundDotmsoLineSolidmsoLineSquareDot
expression.DashStyle
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexampleaddsabluedashedlinetomyDocument.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes.AddLine(10,10,250,250).Line
.DashStyle=msoLineDashDotDot
.ForeColor.RGB=RGB(50,0,128)
EndWith
DateAndTimePropertyReturnsaHeaderFooterobjectthatrepresentsthedateandtimeitemthatappearsinthelower-leftcornerofaslideorintheupper-rightcornerofanotespage,handout,oroutline.Read-only.
Example
Thisexamplesetsthedateandtimeformatfortheslidemasterintheactivepresentation.Thissettingwillapplytoallslidesthatarebasedonthismaster.
SetmyPres=Application.ActivePresentation
WithmyPres.SlideMaster.HeadersFooters.DateAndTime
.Format=ppDateTimeMdyy
.UseFormat=True
EndWith
DateTimePropertyReturnsaDaterepresentingthedateandtimeacommentwascreated.
expression.DateTime
expressionRequired.AnexpressionthatreturnsaCommentobject.
Remarks
Don'tconfusethispropertywiththeDateAndTimeproperty,whichappliestotheheadersandfootersofaslide.
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
DeceleratePropertySetsorreturnsaSinglethatrepresentsthepercentofthedurationoverwhichatimingdecelerationshouldtakeplace.Forexample,avalueof0.9meansthatandecelerationshouldstartatthedefaultspeed,andthenstarttoslowdownafterthefirsttenpercentoftheanimation.Read/write.
expression.Decelerate
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
DefaultLanguageIDPropertyReturnsorsetsthedefaultlanguageofapresentation.WhenyousettheDefaultLanguageIDpropertyforapresentation,yousetitforallsubsequentnewpresentationsaswell.Read/writeMsoLanguageID.
MsoLanguageIDcanbeoneoftheseMsoLanguageIDconstants.msoLanguageIDAfrikaansmsoLanguageIDAlbanianmsoLanguageIDAmharicmsoLanguageIDArabicmsoLanguageIDArabicAlgeriamsoLanguageIDArabicBahrainmsoLanguageIDArabicEgyptmsoLanguageIDArabicIraqmsoLanguageIDArabicJordanmsoLanguageIDArabicKuwaitmsoLanguageIDArabicLebanonmsoLanguageIDArabicLibyamsoLanguageIDArabicMoroccomsoLanguageIDArabicOmanmsoLanguageIDArabicQatarmsoLanguageIDArabicSyriamsoLanguageIDArabicTunisiamsoLanguageIDArabicUAEmsoLanguageIDArabicYemenmsoLanguageIDArmenianmsoLanguageIDAssamesemsoLanguageIDAzeriCyrillicmsoLanguageIDAzeriLatinmsoLanguageIDBasquemsoLanguageIDBelgianDutch
msoLanguageIDBelgianFrenchmsoLanguageIDBengalimsoLanguageIDBrazilianPortuguesemsoLanguageIDBulgarianmsoLanguageIDBurmesemsoLanguageIDByelorussianmsoLanguageIDCatalanmsoLanguageIDCherokeemsoLanguageIDChineseHongKongmsoLanguageIDChineseMacaomsoLanguageIDChineseSingaporemsoLanguageIDCroatianmsoLanguageIDCzechmsoLanguageIDDanishmsoLanguageIDDutchmsoLanguageIDEnglishAUSmsoLanguageIDEnglishBelizemsoLanguageIDEnglishCanadianmsoLanguageIDEnglishCaribbeanmsoLanguageIDEnglishIrelandmsoLanguageIDEnglishJamaicamsoLanguageIDEnglishNewZealandmsoLanguageIDEnglishPhilippinesmsoLanguageIDEnglishSouthAfricamsoLanguageIDEnglishTrinidadmsoLanguageIDEnglishUKmsoLanguageIDEnglishUSmsoLanguageIDEnglishZimbabwemsoLanguageIDEstonianmsoLanguageIDFaeroesemsoLanguageIDFarsimsoLanguageIDFinnishmsoLanguageIDFrench
msoLanguageIDFrenchCameroonmsoLanguageIDFrenchCanadianmsoLanguageIDFrenchCotedIvoiremsoLanguageIDFrenchLuxembourgmsoLanguageIDFrenchMalimsoLanguageIDFrenchMonacomsoLanguageIDFrenchReunionmsoLanguageIDFrenchSenegalmsoLanguageIDFrenchWestIndiesmsoLanguageIDFrenchZairemsoLanguageIDFrisianNetherlandsmsoLanguageIDGaelicIrelandmsoLanguageIDGaelicScotlandmsoLanguageIDGalicianmsoLanguageIDGeorgianmsoLanguageIDGermanmsoLanguageIDGermanAustriamsoLanguageIDGermanLiechtensteinmsoLanguageIDGermanLuxembourgmsoLanguageIDGreekmsoLanguageIDGujaratimsoLanguageIDHebrewmsoLanguageIDHindimsoLanguageIDHungarianmsoLanguageIDIcelandicmsoLanguageIDIndonesianmsoLanguageIDInuktitutmsoLanguageIDItalianmsoLanguageIDJapanesemsoLanguageIDKannadamsoLanguageIDKashmirimsoLanguageIDKazakhmsoLanguageIDKhmer
msoLanguageIDKirghizmsoLanguageIDKonkanimsoLanguageIDKoreanmsoLanguageIDLaomsoLanguageIDLatvianmsoLanguageIDLithuanianmsoLanguageIDMacedonianmsoLanguageIDMalayalammsoLanguageIDMalayBruneiDarussalammsoLanguageIDMalaysianmsoLanguageIDMaltesemsoLanguageIDManipurimsoLanguageIDMarathimsoLanguageIDMexicanSpanishmsoLanguageIDMixedmsoLanguageIDMongolianmsoLanguageIDNepalimsoLanguageIDNonemsoLanguageIDNoProofingmsoLanguageIDNorwegianBokmolmsoLanguageIDNorwegianNynorskmsoLanguageIDOriyamsoLanguageIDPolishmsoLanguageIDPunjabimsoLanguageIDRhaetoRomanicmsoLanguageIDRomanianmsoLanguageIDRomanianMoldovamsoLanguageIDRussianmsoLanguageIDRussianMoldovamsoLanguageIDSamiLappishmsoLanguageIDSanskritmsoLanguageIDSerbianCyrillicmsoLanguageIDSerbianLatin
msoLanguageIDSesothomsoLanguageIDSimplifiedChinesemsoLanguageIDSindhimsoLanguageIDSlovakmsoLanguageIDSlovenianmsoLanguageIDSorbianmsoLanguageIDSpanishmsoLanguageIDSpanishArgentinamsoLanguageIDSpanishBoliviamsoLanguageIDSpanishChilemsoLanguageIDSpanishColombiamsoLanguageIDSpanishCostaRicamsoLanguageIDSpanishDominicanRepublicmsoLanguageIDSpanishEcuadormsoLanguageIDSpanishElSalvadormsoLanguageIDSpanishGuatemalamsoLanguageIDSpanishHondurasmsoLanguageIDSpanishModernSortmsoLanguageIDSpanishNicaraguamsoLanguageIDSpanishPanamamsoLanguageIDSpanishParaguaymsoLanguageIDSpanishPerumsoLanguageIDSpanishPuertoRicomsoLanguageIDSpanishUruguaymsoLanguageIDSpanishVenezuelamsoLanguageIDSutumsoLanguageIDSwahilimsoLanguageIDSwedishmsoLanguageIDSwedishFinlandmsoLanguageIDSwissFrenchmsoLanguageIDSwissGermanmsoLanguageIDSwissItalianmsoLanguageIDTajik
msoLanguageIDTamilmsoLanguageIDTatarmsoLanguageIDTelugumsoLanguageIDThaimsoLanguageIDTibetanmsoLanguageIDTraditionalChinesemsoLanguageIDTsongamsoLanguageIDTswanamsoLanguageIDTurkishmsoLanguageIDTurkmenmsoLanguageIDUkrainianmsoLanguageIDUrdumsoLanguageIDUzbekCyrillicmsoLanguageIDUzbekLatinmsoLanguageIDVendamsoLanguageIDVietnamesemsoLanguageIDWelshmsoLanguageIDXhosamsoLanguageIDZulumsoLanguageIDPortuguese
expression.DefaultLanguageID
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
YoucanusetheLanguageIDpropertytosettextrangestodifferentlanguages.Anytextrangenotexplicitlysettoanotherlanguagewillbesettothisdefault.
Example
Thisexamplesetsthedefaultlanguagefortheactivepresentation,andallsubsequentnewpresentations,toGerman.
ActivePresentation.DefaultLanguageID=msoLanguageIDGerman
DefaultShapePropertyReturnsaShapeobjectthatrepresentsthedefaultshapeforthepresentation.Read-only.
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
DefaultSpacingPropertyReturnsorsetsthedefaulttab-stopspacingforthespecifiedtext,inpoints.Read/writeSingle.
Example
Thisexamplesetsthedefaulttab-stopspacingto0.5inch(36points)forthetextinshapetwoonslideoneintheactivepresentation.
Application.ActivePresentation.Slides(1).Shapes(2).TextFrame_
.Ruler.TabStops.DefaultSpacing=36
DefaultWebOptionsPropertyReturnstheDefaultWebOptionsobject,whichcontainsglobalapplication-levelattributesusedbyMicrosoftPowerPointwhenyoupublishorsaveacompleteorpartialpresentationasaWebpageoropenaWebpage.Read-only.
Example
ThisexamplecheckstoseewhetherthedefaultdocumentencodingisWestern.Ifitis,thestringstrDocEncodingissetaccordingly.
SetobjAppWebOptions=Application.DefaultWebOptions
WithobjAppWebOptions
If.Encoding=msoEncodingWesternThen
strDocEncoding="Western"
EndIf
EndWith
DepthPropertyReturnsorsetsthedepthoftheshape'sextrusion.Canbeavaluefrom–600through9600(positivevaluesproduceanextrusionwhosefrontfaceistheoriginalshape;negativevaluesproduceanextrusionwhosebackfaceistheoriginalshape).Read/writeSingle.
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
DesignPropertyReturnsaDesignobjectrepresentingadesign.
expression.Design
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Example
Thefollowingexampleaddsatitlemaster.
SubAddDesignMaster
ActivePresentation.Slides(1).Design.AddTitleMaster
EndSub
DesignsPropertyReturnsaDesignsobject,representingacollectionofdesigns.
expression.Designs
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thefollowingexampledisplaysamessageforeachdesignintheactivepresentation.
SubAddDesignMaster()
DimdesNameAsDesign
WithActivePresentation
ForEachdesNameIn.Designs
MsgBox"Thedesignnameis"&.Designs.Item(desName.Index).Name
Next
EndWith
EndSub
DiagramPropertyReturnsaDiagramobjecttowhichadiagramnodebelongs.
expression.Diagram
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
DiagramNodePropertyReturnsaDiagramNodeobjectthatrepresentsanodeinadiagram.
expression.DiagramNode
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
DimPropertyReturnsaColorFormatobjectthatrepresentsthecolortodimtoafterananimationisfinished.
expression.Dim
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampledisplaysthecolortodimtoaftertheanimation.
SubQueryDimColor()
DimeffDimAsEffect
SeteffDim=ActivePresentation.Slides(1).TimeLine.MainSequence(1)
MsgBoxeffDim.EffectInformation.Dim
EndSub
DimColorPropertyReturnsorsetsaColorFormatobjectthatrepresentsthecolorofthespecifiedshapeafterit'sbeenbuilt.Read-only.
Remarks
Ifyoudon'tgettheeffectyouexpect,checkyourotherbuildsettings.Youwon'tseetheeffectoftheDimColorpropertyunlesstheTextLevelEffectpropertyoftheAnimationSettingsobjectissettosomethingotherthanppAnimateLevelNone,theAfterEffectpropertyissettoppAfterEffectDim,andtheAnimatepropertyissettoTrue.Inaddition,ifthespecifiedshapeistheonlyitemorthelastitemtobebuiltontheslide,theshapewon'tbedimmed.Tochangethebuildorderoftheshapesonaslide,usetheAnimationOrderproperty.
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
ShowAll
DirectionPropertyReturnsanMsoAnimDirectionthatrepresentsthedirectionusedforananimationeffect.Thispropertycanbeusedonlyiftheeffectusesadirection.Read/write.
MsoAnimDirectioncanbeoneoftheseMsoAnimDirectionconstants.msoAnimDirectionAcrossmsoAnimDirectionBottommsoAnimDirectionBottomLeftmsoAnimDirectionBottomRightmsoAnimDirectionCentermsoAnimDirectionClockwisemsoAnimDirectionCounterclockwisemsoAnimDirectionCycleClockwisemsoAnimDirectionCycleCounterclockwisemsoAnimDirectionDownmsoAnimDirectionDownLeftmsoAnimDirectionDownRightmsoAnimDirectionFontAllCapsmsoAnimDirectionFontBoldmsoAnimDirectionFontItalicmsoAnimDirectionFontShadowmsoAnimDirectionFontStrikethroughmsoAnimDirectionFontUnderlinemsoAnimDirectionGradualmsoAnimDirectionHorizontalmsoAnimDirectionHorizontalInmsoAnimDirectionHorizontalOutmsoAnimDirectionInmsoAnimDirectionInBottommsoAnimDirectionInCenter
msoAnimDirectionInSlightlymsoAnimDirectionInstantmsoAnimDirectionLeftmsoAnimDirectionNonemsoAnimDirectionOrdinalMaskmsoAnimDirectionOutmsoAnimDirectionOutBottommsoAnimDirectionOutCentermsoAnimDirectionOutSlightlymsoAnimDirectionRightmsoAnimDirectionSlightlymsoAnimDirectionTopmsoAnimDirectionTopLeftmsoAnimDirectionTopRightmsoAnimDirectionUpmsoAnimDirectionUpLeftmsoAnimDirectionUpRightmsoAnimDirectionVerticalmsoAnimDirectionVerticalInmsoAnimDirectionVerticalOut
expression.Direction
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
DisplayAlertsPropertySetsorreturnsaPpAlertLevelconstantthatrepresentswhetherMicrosoftPowerPointdisplaysalertswhilerunningamacro.Read/write.
PpAlertLevelcanbeoneofthesePpAlertLevelconstants.ppAlertsAllAllmessageboxesandalertsaredisplayed;errorsarereturnedtothemacro.ppAlertsNoneDefault.Noalertsormessageboxesaredisplayed.Ifamacroencountersamessagebox,thedefaultvalueischosenandthemacrocontinues.
expression.DisplayAlerts
expressionRequired.AnexpressionthatreturnsanApplicationobject.
Remarks
ThevalueoftheDisplayAlertspropertyisnotresetonceamacrostopsrunning;itismaintainedthroughoutasession.Itisnotstoredacrosssessions,sowhenPowerPointbegins,itresettoppAlertsNone.
Example
ThefollowinglineofcodeinstructsPowerPointtodisplayallmessageboxesandalerts,returningerrorstothemacro.
SubSetAlert
Application.DisplayAlerts=ppAlertsAll
EndSub
ShowAll
DisplayAutoCorrectOptionsPropertyMsoTrueforMicrosoftPowerPointtodisplaytheAutoCorrectOptionsbutton.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.DisplayAutoCorrectOptions
expressionRequired.AnexpressionthatreturnsanAutoCorrectobject.
Example
ThisexampledisablesdisplayoftheAutoCorrectOptionsandAutoLayoutOptionsbuttons.
SubHideAutoCorrectOpButton()
WithApplication.AutoCorrect
.DisplayAutoCorrectOptions=msoFalse
.DisplayAutoLayoutOptions=msoFalse
EndWith
EndSub
ShowAll
DisplayAutoLayoutOptionsPropertyMsoTrueforMicrosoftPowerPointtodisplaytheAutoLayoutOptionsbutton.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.DisplayAutoLayoutOptions
expressionRequired.AnexpressionthatreturnsanAutoCorrectobject.
Example
ThisexampledisablesdisplayoftheAutoCorrectOptionsandAutoLayoutOptionsbuttons.
SubHideAutoCorrectOpButton()
WithApplication.AutoCorrect
.DisplayAutoCorrectOptions=msoFalse
.DisplayAutoLayoutOptions=msoFalse
EndWith
EndSub
ShowAll
DisplayCommentsPropertyDetermineswhethercommentsaredisplayedinthespecifiedpresentation.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueCommentsaredisplayedinthespecifiedpresentation.
Example
Thisexamplehidescommentsintheactivepresentation.
ActivePresentation.DisplayComments=msoFalse
ShowAll
DisplayGridLinesPropertyMsoTruetodisplaygridlinesinMicrosoftPowerPoint.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.DisplayGridLines
expressionRequired.AnexpressionthatreturnsanApplicationobject.
Example
ThisexampletogglesthedisplayofthegridlinesinPowerPoint.
SubToggleGridLines()
WithApplication
If.DisplayGridLines=msoTrueThen
.DisplayGridLines=msoFalse
Else
.DisplayGridLines=msoTrue
EndIf
EndWith
EndSub
ShowAll
DisplayMasterShapesPropertyDetermineswhetherthespecifiedslideorrangeofslidesdisplaysthebackgroundobjectsontheslidemaster.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideorrangeofslidesdisplaysthebackgroundobjectsontheslidemaster.Thesebackgroundobjectscanincludetext,drawings,OLEobjects,andclipartyouaddtotheslidemaster.Headersandfootersaren'tincluded.
Remarks
Whenyoucreateanewslide,thedefaultvalueforthispropertyismsoTrue.Ifyoucopyaslidefromanotherpresentation,itretainsthesettingithadintheoriginalpresentation.Thatis,iftheslideomittedslidemasterbackgroundobjectsintheoriginalpresentation,itwillomittheminthenewpresentationaswell.
Notethatthelookoftheslide'sbackgroundisdeterminedbythecolorschemeandbackgroundaswellasbythebackgroundobjects.IfsettingtheDisplayMasterShapespropertyalonedoesn'tgiveyoutheresultsyouwant,trysettingtheFollowMasterBackgroundandColorSchemepropertiesaswell.
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
DisplayNamePropertyReturnsaStringthatrepresentsthenameofananimationeffect.Read-only.
expression.DisplayName
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampledisplaysthenameforthefirstanimationsequenceofthefirstslide'smainanimationsequencetimeline.
SubDisplayEffectName()
DimeffMainAsEffect
SeteffMain=ActivePresentation.Slides(1).TimeLine.MainSequence(1)
MsgBoxeffMain.DisplayName
EndSub
ShowAll
DisplayOnTitleSlidePropertyDetermineswhetherthefooter,dateandtime,andslidenumberappearonthetitleslide.Read/writeMsoTriState.Appliestoslidemasters.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThefooter,dateandtime,andslidenumberappearsonallslidesexceptthetitleslide.msoTriStateMixedmsoTriStateTogglemsoTrueThefooter,dateandtime,andslidenumberappearonthetitleslide.
Example
Thisexamplesetsthefooter,dateandtime,andslidenumbertonotappearonthetitleslide.
Application.ActivePresentation.SlideMaster.HeadersFooters_
.DisplayOnTitleSlide=msoFalse
ShowAll
DisplayPasteOptionsPropertyMsoTrueforMicrosoftPowerPointtodisplaythePasteOptionsbutton,whichdisplaysdirectlyundernewlypastedtext.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.DisplayPasteOptions
expressionRequired.AnexpressionthatreturnsanOptionsobject.
Example
ThisexampleenablesthePasteOptionsbuttoniftheoptionhasbeendisabled.
SubShowPasteOptionsButton()
WithApplication.Options
If.DisplayPasteOptions=FalseThen
.DisplayPasteOptions=True
EndIf
EndWith
EndSub
ShowAll
DisplaySlideMiniaturePropertyDeterminesifandwhentheslideminiaturewindowisdisplayedautomatically.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheslideminiaturewindowisnotdisplayedautomatically.msoTriStateMixedmsoTriStateTogglemsoTrueTheslideminiaturewindowisdisplayedautomaticallywhenthedocumentwindowisinblack-and-whiteview,theslidepaneiszoomedtogreaterthan150%ofthefitpercentage,oramasterviewisvisible.
Remarks
Thispropertyisnotavailableinslideshowviewandslidesorterview.Theslideminiaturewindowisn'tamemberofeithertheWindowscollectionortheSlideShowWindowscollection.
Thefitpercentageisdeterminedbyacombinationofthesizeoftheslidepaneandthesizeofthepresentationwindow.Todeterminethefitpercentage,settheZoomToFitpropertytoTrueandthenreturnthevalueoftheZoomproperty.
Example
Ifdocumentwindowoneisinslideview,thisexampledisplaystheslideminiaturewindow.
WithWindows(1).View
If.Type=ppViewSlideThen.DisplaySlideMiniature=msoTrue
EndWith
DocumentLibraryVersionsPropertyReturnsaDocumentLibraryVersionscollectionthatrepresentsthecollectionofversionsofasharedpresentationthathasversioningenabledandthatisstoredinadocumentlibraryonaserver.
expression.DocumentLibraryVersions
expressionRequired.AnexpressionthatreturnsaPresentationobject.
Example
Thefollowingexamplereturnsthecollectionofversionsfortheactivepresentation.Thisexampleassumesthattheactivepresentationhasversioningenabledandisstoredinashareddocumentlibraryonaserver.
DimobjVersionsAsDocumentLibraryVersions
SetobjVersions=ActivePresentation.DocumentLibraryVersions
DropPropertyForcalloutswithanexplicitlysetdropvalue,thispropertyreturnstheverticaldistance(inpoints)fromtheedgeofthetextboundingboxtotheplacewherethecalloutlineattachestothetextbox.ThisdistanceismeasuredfromthetopofthetextboxunlesstheAutoAttachpropertyissettoTrueandthetextboxistotheleftoftheoriginofthecalloutline(theplacethatthecalloutpointsto).Inthiscasethedropdistanceismeasuredfromthebottomofthetextbox.Read-onlySingle.
Remarks
UsetheCustomDropmethodtosetthevalueofthisproperty.
Thevalueofthispropertyaccuratelyreflectsthepositionofthecalloutlineattachmenttothetextboxonlyifthecallouthasanexplicitlysetdropvalue—thatis,ifthevalueoftheDropTypepropertyismsoCalloutDropCustom.
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
ShowAll
DropTypePropertyReturnsavaluethatindicateswherethecalloutlineattachestothecallouttextbox.Read-onlyMsoCalloutDropType.
MsoCalloutDropTypecanbeoneoftheseMsoCalloutDropTypeconstants.msoCalloutDropBottommsoCalloutDropCentermsoCalloutDropCustommsoCalloutDropMixedmsoCalloutDropTop
expression.DropType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
IfthecalloutdroptypeismsoCalloutDropCustom,thevaluesoftheDropandAutoAttachpropertiesandtherelativepositionsofthecallouttextboxandcalloutlineorigin(theplacethatthecalloutpointsto)areusedtodeterminewherethecalloutlineattachestothetextbox.
Thispropertyisread-only.UsethePresetDropmethodtosetthevalueofthisproperty.
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
DurationPropertyReturnsorsetsaSinglethatrepresentsthelengthofananimationinseconds.Read/write.
expression.Duration
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
EditingTypePropertyIfthespecifiednodeisavertex,thispropertyreturnsavaluethatindicateshowchangesmadetothenodeaffectthetwosegmentsconnectedtothenode.Ifthenodeisacontrolpointforacurvedsegment,thispropertyreturnstheeditingtypeoftheadjacentvertex.Read-onlyMsoEditingType.
MsoEditingTypecanbeoneoftheseMsoEditingTypeconstants.msoEditingAutomsoEditingCornermsoEditingSmoothmsoEditingSymmetric
expression.EditingType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thispropertyisread-only.UsetheSetEditingTypemethodtosetthevalueofthisproperty.
Example
ThisexamplechangesallcornernodestosmoothnodesinshapethreeonmyDocument.Shapethreemustbeafreeformdrawing.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).Nodes
Forn=1to.Count
If.Item(n).EditingType=msoEditingCornerThen
.SetEditingTypen,msoEditingSmooth
EndIf
Next
EndWith
EffectInformationPropertyReturnsanEffectInformationobjectrepresentinginformationforaspecifiedanimationeffect.
expression.EffectInformation
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampleaddsasoundeffecttothemainanimationsequenceforagivenshape.
SubAddSoundEffect()
DimeffMainAsEffect
SeteffMain=ActivePresentation.Slides(1).TimeLine.MainSequence(1)
MsgBoxeffMain.EffectInformation.AfterEffect
EndSub
EffectParametersPropertyReturnsanEffectParametersobjectrepresentinganimationeffectproperties.
expression.EffectParameters
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
EffectTypePropertySetsorreturnsanMsoAnimEffectconstantthatrepresentsananimationeffecttype.Read/write.
MsoAnimEffectcanbeoneoftheseMsoAnimEffectconstants.msoAnimEffectAppearmsoAnimEffectArcUpmsoAnimEffectAscendmsoAnimEffectBlastmsoAnimEffectBlindsmsoAnimEffectBoldFlashmsoAnimEffectBoldRevealmsoAnimEffectBoomerangmsoAnimEffectBouncemsoAnimEffectBoxmsoAnimEffectBrushOnColormsoAnimEffectBrushOnUnderlinemsoAnimEffectCenterRevolvemsoAnimEffectChangeFillColormsoAnimEffectChangeFontmsoAnimEffectChangeFontColormsoAnimEffectChangeFontSizemsoAnimEffectChangeFontStylemsoAnimEffectChangeLineColormsoAnimEffectCheckerboardmsoAnimEffectCirclemsoAnimEffectColorBlendmsoAnimEffectColorRevealmsoAnimEffectColorWavemsoAnimEffectComplementaryColormsoAnimEffectComplementaryColor2
msoAnimEffectContrastingColormsoAnimEffectCrawlmsoAnimEffectCreditsmsoAnimEffectCustommsoAnimEffectDarkenmsoAnimEffectDesaturatemsoAnimEffectDescendmsoAnimEffectDiamondmsoAnimEffectDissolvemsoAnimEffectEaseInmsoAnimEffectExpandmsoAnimEffectFademsoAnimEffectFadedAscendmsoAnimEffectFadedSwivelmsoAnimEffectFadedZoommsoAnimEffectFlashBulbmsoAnimEffectFlashOncemsoAnimEffectFlickermsoAnimEffectFlipmsoAnimEffectFloatmsoAnimEffectFlymsoAnimEffectFoldmsoAnimEffectGlidemsoAnimEffectGrowAndTurnmsoAnimEffectGrowShrinkmsoAnimEffectGrowWithColormsoAnimEffectLightenmsoAnimEffectMediaPausemsoAnimEffectMediaPlaymsoAnimEffectMediaStopmsoAnimEffectPath4PointStarmsoAnimEffectPath5PointStarmsoAnimEffectPath6PointStar
msoAnimEffectPath8PointStarmsoAnimEffectPathArcDownmsoAnimEffectPathArcLeftmsoAnimEffectPathArcRightmsoAnimEffectPathArcUpmsoAnimEffectPathBeanmsoAnimEffectPathBounceLeftmsoAnimEffectPathBounceRightmsoAnimEffectPathBuzzsawmsoAnimEffectPathCirclemsoAnimEffectPathCrescentMoonmsoAnimEffectPathCurvedSquaremsoAnimEffectPathCurvedXmsoAnimEffectPathCurvyLeftmsoAnimEffectPathCurvyRightmsoAnimEffectPathCurvyStarmsoAnimEffectPathDecayingWavemsoAnimEffectPathDiagonalDownRightmsoAnimEffectPathDiagonalUpRightmsoAnimEffectPathDiamondmsoAnimEffectPathDownmsoAnimEffectPathEqualTrianglemsoAnimEffectPathFigure8FourmsoAnimEffectPathFootballmsoAnimEffectPathFunnelmsoAnimEffectPathHeartmsoAnimEffectPathHeartbeatmsoAnimEffectPathHexagonmsoAnimEffectPathHorizontalFigure8msoAnimEffectPathInvertedSquaremsoAnimEffectPathInvertedTrianglemsoAnimEffectPathLeftmsoAnimEffectPathLoopdeLoop
msoAnimEffectPathNeutronmsoAnimEffectPathOctagonmsoAnimEffectPathParallelogrammsoAnimEffectPathPeanutmsoAnimEffectPathPentagonmsoAnimEffectPathPlusmsoAnimEffectPathPointyStarmsoAnimEffectPathRightTrianglemsoAnimEffectPathSCurve1msoAnimEffectPathSCurve2msoAnimEffectPathSineWavemsoAnimEffectPathSpiralLeftmsoAnimEffectPathSpiralRightmsoAnimEffectPathSpringmsoAnimEffectPathSquaremsoAnimEffectPathStairsDownmsoAnimEffectPathSwooshmsoAnimEffectPathTeardropmsoAnimEffectPathTrapezoidmsoAnimEffectPathTurnDownmsoAnimEffectPathTurnRightmsoAnimEffectPathTurnUpmsoAnimEffectPathTurnUpRightmsoAnimEffectPathVerticalFigure8msoAnimEffectPathWavemsoAnimEffectPathZigzagmsoAnimEffectPeekmsoAnimEffectPinwheelmsoAnimEffectPlusmsoAnimEffectRandomBarsmsoAnimEffectRandomEffectsmsoAnimEffectRiseUpmsoAnimEffectShimmer
msoAnimEffectSlingmsoAnimEffectSpinmsoAnimEffectSpinnermsoAnimEffectSpiralmsoAnimEffectSplitmsoAnimEffectStretchmsoAnimEffectStretchymsoAnimEffectStripsmsoAnimEffectStyleEmphasismsoAnimEffectSwishmsoAnimEffectSwivelmsoAnimEffectTeetermsoAnimEffectThinLinemsoAnimEffectTransparencymsoAnimEffectUnfoldmsoAnimEffectVerticalGrowmsoAnimEffectWavemsoAnimEffectWedgemsoAnimEffectWheelmsoAnimEffectWhipmsoAnimEffectWipemsoAnimEffectZipmsoAnimEffectZoommsoAnimEffectLightSpeed
expression.EffectType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplechangesananimationeffecttoarandombaranimation.
SubChangeEffectType()
DimeffRandomAsEffect
SeteffRandom=ActivePresentation.Slides(1).TimeLine.MainSequence(1)
effRandom.EffectType=msoAnimEffectRandomBars
EndSub
EmailSubjectPropertyReturnsorsetsthetextstringofthehyperlinksubjectline.ThesubjectlineisappendedtotheInternetaddress(URL)ofthehyperlink.Read/writeString.
Remarks
Thispropertyiscommonlyusedwithe-mailhyperlinks.Thevalueofthispropertytakesprecedenceoveranye-mailsubjectspecifiedintheAddresspropertyofthesameHyperlinkobject.
Example
Thisexamplesetsthee-mailsubjectlineofthefirsthyperlinkonslideoneintheactivepresentation.
ActivePresentation.Slides(1).Hyperlinks(1)_
.EmailSubject="QuoteRequest"
ShowAll
EmbeddablePropertyDetermineswhetherthespecifiedfontcanbeembeddedinthepresentation.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedfontcanbeembeddedinthepresentation.
expression.Embeddable
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplecheckseachfontusedintheactivepresentationtodeterminewhetherit'sembeddableinthepresentation.
ForEachusedFontInPresentations(1).Fonts
IfusedFont.EmbeddableThen
MsgBoxusedFont.Name&":Embeddable"
Else
MsgBoxusedFont.Name&":Notembeddable"
EndIf
NextusedFont
ShowAll
EmbeddedPropertyDetermineswhetherthespecifiedfontisembeddedinthepresentation.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedfontisembeddedinthepresentation.
expression.Embedded
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplecheckseachfontusedintheactivepresentationtodeterminewhetherit'sembeddedinthepresentation.
ForEachusedFontInPresentations(1).Fonts
IfusedFont.EmbeddedThen
MsgBoxusedFont.Name&":Embedded"
Else
MsgBoxusedFont.Name&":Notembedded"
EndIf
NextusedFont
ShowAll
EmbossPropertyDetermineswhetherthecharacterformatisembossed.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThecharacterformatisnotembossed.msoTriStateMixedThespecifiedtextrangecontainsbothembossedandunembossedcharacters.msoTriStateTogglemsoTrueThecharacterformatisembossed.
expression.Emboss
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsthetitletextonslideonetoembossed.
Application.ActivePresentation.Slides(1).Shapes.Title_
.TextFrame.TextRange.Font.Emboss=msoTrue
ShowAll
EncodingPropertyReturnsorsetsthedocumentencoding(codepageorcharacterset)tobeusedbytheWebbrowserwhenyouviewthesaveddocument.Thedefaultisthesystemcodepage.Read/writeMsoEncoding.
AlthoughMsoEncodingcanbeoneoftheseMsoEncodingconstants,youcannotnotuseanyoftheconstantsthathavethesuffixAutoDetect.ThoseconstantsareusedbytheReloadAsmethod.msoEncodingArabicmsoEncodingArabicASMOmsoEncodingArabicAutoDetectmsoEncodingArabicTransparentASMOmsoEncodingAutoDetectmsoEncodingBalticmsoEncodingCentralEuropeanmsoEncodingCyrillicmsoEncodingCyrillicAutoDetectmsoEncodingEBCDICArabicmsoEncodingEBCDICDenmarkNorwaymsoEncodingEBCDICFinlandSwedenmsoEncodingEBCDICFrancemsoEncodingEBCDICGermanymsoEncodingEBCDICGreekmsoEncodingEBCDICGreekModernmsoEncodingEBCDICHebrewmsoEncodingEBCDICIcelandicmsoEncodingEBCDICInternationalmsoEncodingEBCDICItalymsoEncodingEBCDICJapaneseKatakanaExtendedmsoEncodingEBCDICJapaneseKatakanaExtendedAndJapanesemsoEncodingEBCDICJapaneseLatinExtendedAndJapanese
msoEncodingEBCDICKoreanExtendedmsoEncodingEBCDICKoreanExtendedAndKoreanmsoEncodingEBCDICLatinAmericaSpainmsoEncodingEBCDICMultilingualROECELatin2msoEncodingEBCDICRussianmsoEncodingEBCDICSerbianBulgarianmsoEncodingEBCDICSimplifiedChineseExtendedAndSimplifiedChinesemsoEncodingEBCDICThaimsoEncodingEBCDICTurkishmsoEncodingEBCDICTurkishLatin5msoEncodingEBCDICUnitedKingdommsoEncodingEBCDICUSCanadamsoEncodingEBCDICUSCanadaAndJapanesemsoEncodingEBCDICUSCanadaAndTraditionalChinesemsoEncodingEUCChineseSimplifiedChinesemsoEncodingEUCJapanesemsoEncodingEUCKoreanmsoEncodingEUCTaiwaneseTraditionalChinesemsoEncodingEuropa3msoEncodingExtAlphaLowercasemsoEncodingGreekmsoEncodingGreekAutoDetectmsoEncodingHebrewmsoEncodingHZGBSimplifiedChinesemsoEncodingIA5GermanmsoEncodingIA5IRVmsoEncodingIA5NorwegianmsoEncodingIA5SwedishmsoEncodingISO2022CNSimplifiedChinesemsoEncodingISO2022CNTraditionalChinesemsoEncodingISO2022JPJISX02011989msoEncodingISO2022JPJISX02021984msoEncodingISO2022JPNoHalfwidthKatakana
msoEncodingISO2022KR
msoEncodingISO6937NonSpacingAccentmsoEncodingISO885915Latin9msoEncodingISO88591Latin1msoEncodingISO88592CentralEuropemsoEncodingISO88593Latin3msoEncodingISO88594BalticmsoEncodingISO88595CyrillicmsoEncodingISO88596ArabicmsoEncodingISO88597GreekmsoEncodingISO88598HebrewmsoEncodingISO88599TurkishmsoEncodingJapaneseAutoDetectmsoEncodingJapaneseShiftJISmsoEncodingKOI8RmsoEncodingKOI8UmsoEncodingKoreanmsoEncodingKoreanAutoDetectmsoEncodingKoreanJohabmsoEncodingMacCroatiamsoEncodingMacCyrillicmsoEncodingMacGreek1msoEncodingMacHebrewmsoEncodingMacIcelandicmsoEncodingMacJapanesemsoEncodingMacKoreanmsoEncodingMacLatin2msoEncodingMacRomanmsoEncodingMacRomaniamsoEncodingMacSimplifiedChineseGB2312msoEncodingMacTraditionalChineseBig5msoEncodingMacTurkishmsoEncodingMacUkraine
msoEncodingOEMArabicmsoEncodingOEMBalticmsoEncodingOEMCanadianFrenchmsoEncodingOEMCyrillicmsoEncodingOEMCyrillicIImsoEncodingOEMGreek437GmsoEncodingOEMHebrewmsoEncodingOEMIcelandicmsoEncodingOEMModernGreekmsoEncodingOEMMultilingualLatinImsoEncodingOEMMultilingualLatinIImsoEncodingOEMNordicmsoEncodingOEMPortuguesemsoEncodingOEMTurkishmsoEncodingOEMUnitedStatesmsoEncodingSimplifiedChineseAutoDetectmsoEncodingSimplifiedChineseGBKmsoEncodingT61msoEncodingTaiwanCNSmsoEncodingTaiwanEtenmsoEncodingTaiwanIBM5550msoEncodingTaiwanTCAmsoEncodingTaiwanTeleTextmsoEncodingTaiwanWangmsoEncodingThaimsoEncodingTraditionalChineseAutoDetectmsoEncodingTraditionalChineseBig5msoEncodingTurkishmsoEncodingUnicodeBigEndianmsoEncodingUnicodeLittleEndianmsoEncodingUSASCIImsoEncodingUTF7msoEncodingUTF8
msoEncodingVietnamesemsoEncodingWestern
msoEncodingMacArabic
expression.Encoding
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplecheckstoseewhetherthedefaultdocumentencodingisWestern,andthenitsetsthestringstrDocEncodingaccordingly.
IfApplication.DefaultWebOptions.Encoding=msoEncodingWesternThen
strDocEncoding="Western"
Else
strDocEncoding="Other"
EndIf
EndPropertyReturnsthenumberofthelastslideinthespecifiedprintrange.Read-onlyLong.
Example
Thisexampledisplaysamessagethatindicatesthestartingandendingslidenumbersforprintrangeoneintheactivepresentation.
WithActivePresentation.PrintOptions.Ranges
If.Count>0Then
With.Item(1)
MsgBox"Printrange1startsonslide"&.Start&_
"andendsonslide"&.End
EndWith
EndIf
EndWith
ShowAll
EndArrowheadLengthPropertyReturnsorsetsthelengthofthearrowheadattheendofthespecifiedline.Read/writeMsoArrowheadLength.
MsoArrowheadLengthcanbeoneoftheseMsoArrowheadLengthconstants.msoArrowheadLengthMediummsoArrowheadLengthMixedmsoArrowheadLongmsoArrowheadShort
expression.EndArrowheadLength
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
EndArrowheadStylePropertyReturnsorsetsthestyleofthearrowheadattheendofthespecifiedline.Read/writeMsoArrowheadStyle.
MsoArrowheadStylecanbeoneoftheseMsoArrowheadStyleconstants.msoArrowheadDiamondmsoArrowheadNonemsoArrowheadOpenmsoArrowheadOvalmsoArrowheadStealthmsoArrowheadStyleMixedmsoArrowheadTriangle
expression.EndArrowheadStyle
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
EndArrowheadWidthPropertyReturnsorsetsthewidthofthearrowheadattheendofthespecifiedline.Read/writeMsoArrowheadWidth.
MsoArrowheadWidthcanbeoneoftheseMsoArrowheadWidthconstants.msoArrowheadNarrowmsoArrowheadWidemsoArrowheadWidthMediummsoArrowheadWidthMixed
expression.EndArrowheadWidth
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
EndConnectedPropertyDetermineswhethertheendofthespecifiedconnectorisconnectedtoashape.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheendofthespecifiedconnectorisconnectedtoashape.
expression.EndConnected
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
EndConnectedShapePropertyReturnsaShapeobjectthatrepresentstheshapethattheendofthespecifiedconnectorisattachedto.Read-only.
NoteIftheendofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.
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
EndConnectionSitePropertyReturnsanintegerthatspecifiestheconnectionsitethattheendofaconnectorisconnectedto.Read-onlyLong.
NoteIftheendofthespecifiedconnectorisn'tattachedtoashape,thispropertygeneratesanerror.
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
EndingSlidePropertyReturnsorsetsthelastslidetobedisplayedinthespecifiedslideshow.Read/writeLong.
Example
Thisexamplerunsaslideshowoftheactivepresentation,startingwithslidetwoandendingwithslidefour.
WithActivePresentation.SlideShowSettings
.RangeType=ppShowSlideRange
.StartingSlide=2
.EndingSlide=4
.Run
EndWith
ShowAll
EntryEffectPropertyFortheAnimationSettingsobject,thispropertyreturnsorsetsthespecialeffectappliedtotheanimationforthespecifiedshape.FortheSlideShowTransitionobject,thispropertyreturnsorsetsthespecialeffectappliedtothespecifiedslidetransition.Read/writePpEntryEffect.
PpEntryEffectcanbeoneofthesePpEntryEffectconstants.ppEffectAppearppEffectBlindsHorizontalppEffectBlindsVerticalppEffectBoxInppEffectBoxOutppEffectCheckerboardAcrossppEffectCheckerboardDownppEffectCoverDownppEffectCoverLeftppEffectCoverLeftDownppEffectCoverLeftUpppEffectCoverRightppEffectCoverRightDownppEffectCoverRightUpppEffectCoverUpppEffectCrawlFromDownppEffectCrawlFromLeftppEffectCrawlFromRightppEffectCrawlFromUpppEffectCutppEffectCutThroughBlackppEffectDissolveppEffectFadeppEffectFlashOnceFast
ppEffectFlashOnceMediumppEffectFlashOnceSlowppEffectFlyFromBottomppEffectFlyFromBottomLeftppEffectFlyFromBottomRightppEffectFlyFromLeftppEffectFlyFromRightppEffectFlyFromTopppEffectFlyFromTopLeftppEffectFlyFromTopRightppEffectMixedppEffectNoneppEffectPeekFromDownppEffectPeekFromLeftppEffectPeekFromRightppEffectPeekFromUpppEffectRandomppEffectRandomBarsHorizontalppEffectRandomBarsVerticalppEffectSpiralppEffectSplitHorizontalInppEffectSplitHorizontalOutppEffectSplitVerticalInppEffectSplitVerticalOutppEffectStretchAcrossppEffectStretchDownppEffectStretchLeftppEffectStretchRightppEffectStretchUpppEffectStripsDownLeftppEffectStripsDownRightppEffectStripsLeftDownppEffectStripsLeftUp
ppEffectStripsRightDownppEffectStripsRightUpppEffectStripsUpLeftppEffectStripsUpRightppEffectSwivelppEffectUncoverDownppEffectUncoverLeftppEffectUncoverLeftDownppEffectUncoverLeftUpppEffectUncoverRightppEffectUncoverRightDownppEffectUncoverRightUpppEffectUncoverUpppEffectWipeDownppEffectWipeLeftppEffectWipeRightppEffectWipeUpppEffectZoomBottomppEffectZoomCenterppEffectZoomInppEffectZoomInSlightlyppEffectZoomOutppEffectZoomOutSlightly
expression.EntryEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
IftheTextLevelEffectpropertyforthespecifiedshapeissettoppAnimateLevelNone(thedefaultvalue)ortheAnimatepropertyissettoFalse,youwon'tseethespecialeffectyou'veappliedwiththeEntryEffectproperty.
Example
Thisexampleaddsatitleslidetotheactivepresentationandsetsthetitletoflyinfromtherightwheneverit'sanimatedduringaslideshow.
WithActivePresentation.Slides.Add(1,ppLayoutTitleOnly).Shapes(1)
.TextFrame.TextRange.Text="Sampletitle"
With.AnimationSettings
.TextLevelEffect=ppAnimateByAllLevels
.EntryEffect=ppEffectFlyFromRight
.Animate=True
EndWith
EndWith
ShowAll
EnvelopeVisiblePropertyDetermineswhetherthee-mailmessageheaderisvisibleinthedocumentwindow.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueThee-mailmessageheaderisvisibleinthedocumentwindow.
expression.EnvelopeVisible
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampledisplaysthee-mailmessageheader.
ActivePresentation.EnvelopeVisible=msoTrue
ShowAll
ExitPropertyReturnsorsetsanMsoTriStatethatrepresentswhethertheanimationeffectisanexiteffect.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheeffectisnotanexiteffect.msoTriStateMixedmsoTriStateTogglemsoTrueTheeffectisanexiteffect.
expression.Exit
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampledisplayswhetherthespecifiedanimationisanexitanimationeffect.
SubEffectExit()
DimeffMainAsEffect
SeteffMain=ActivePresentation.Slides(1).TimeLine.MainSequence(1)
IfeffMain.Exit=msoTrueThen
MsgBox"Thisisanexitanimationeffect."
Else
MsgBox"Thisisnotanexitanimationeffect."
EndIf
EndSub
ShowAll
ExtraColorsPropertyReturnsanExtraColorsobjectthatrepresentstheextracolorsavailableinthespecifiedpresentation.Read-only.
Example
Thefollowingexampleaddsarectangletoslideoneintheactivepresentationandsetsitsfillforegroundcolortothefirstextracolor.Iftherehasn'tbeenatleastoneextracolordefinedforthepresentation,thisexamplewillfail.
WithActivePresentation
Setrect=.Slides(1).Shapes_
.AddShape(msoShapeRectangle,50,50,100,200)
rect.Fill.ForeColor.RGB=.ExtraColors(1)
EndWith
ExtrusionColorPropertyReturnsaColorFormatobjectthatrepresentsthecoloroftheshape'sextrusion.Read-only.
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
ShowAll
ExtrusionColorTypePropertyReturnsorsetsavaluethatindicateswhethertheextrusioncolorisbasedontheextrudedshape'sfill(thefrontfaceoftheextrusion)andautomaticallychangeswhentheshape'sfillchanges,orwhethertheextrusioncolorisindependentoftheshape'sfill.Read/writeMsoExtrusionColorType.
MsoExtrusionColorTypecanbeoneoftheseMsoExtrusionColorTypeconstants.msoExtrusionColorAutomaticExtrusioncolorisbasedonshapefill.msoExtrusionColorCustomExtrusioncolorisindependentofshapefill.msoExtrusionColorTypeMixed
expression.ExtrusionColorType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
IfshapeoneonmyDocumenthasanautomaticextrusioncolor,thisexamplegivestheextrusionacustomyellowcolor.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).ThreeD
If.ExtrusionColorType=msoExtrusionColorAutomaticThen
.ExtrusionColor.RGB=RGB(240,235,16)
EndIf
EndWith
ShowAll
FarEastLineBreakControlPropertyReturnsorsetsthelinebreakcontroloptionifyouhaveanAsianlanguagesettingspecifiedTrueifthelinebreakcontroloptionisselected.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
Example
Thisexampleselectsthelinebreakoptionforthetextinshapeoneonthefirstslideoftheactivepresentation.
ActivePresentation.Slides(1).Shapes(1).TextFrame_
.TextRange.ParagraphFormat.FarEastLineBreakControl=msoTrue
ShowAll
FarEastLineBreakLanguagePropertyReturnsorsetsthelanguageusedtodeterminewhichlinebreaklevelisusedwhenthelinebreakcontroloptionisturnedon.Read/writeMsoFarEastLineBreakLanguageID.
MsoFarEastLineBreakLanguageIDcanbeoneoftheseMsoFarEastLineBreakLanguageIDconstants.MsoFarEastLineBreakLanguageJapaneseMsoFarEastLineBreakLanguageKoreanMsoFarEastLineBreakLanguageSimplifiedChineseMsoFarEastLineBreakLanguageTraditionalChinese
expression.FarEastLineBreakLanguage
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThefollowingexamplesetsthelinebreaklanguagetoJapanese.
ActivePresentation.FarEastLineBreakLanguage=_
MsoFarEastLineBreakLanguageJapanese
ShowAll
FarEastLineBreakLevelPropertyReturnsorsetsthelinebreakbaseduponAsiancharacterlevel.Read/writeLong.Read/writePpFarEastLineBreakLevel.
PpFarEastLineBreakLevelcanbeoneofthesePpFarEastLineBreakLevelconstants.ppFarEastLineBreakLevelCustomppFarEastLineBreakLevelNormalppFarEastLineBreakLevelStrict
expression.FarEastLineBreakLevel
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetslinebreakcontroltouselevelonekinsokucharacters.
ActivePresentation.FarEastLineBreakLevel=_
ppFarEastLineBreakLevelNormal
ShowAll
FeatureInstallPropertyReturnsorsetshowMicrosoftPowerPointhandlescallstomethodsandpropertiesthatrequirefeaturesnotyetinstalled.Read/writeMsoFeatureInstall.
MsoFeatureInstallcanbeoneoftheseMsoFeatureInstallconstants.msoFeatureInstallNoneDefault.Atrappablerun-timeautomationerrorisgeneratedwhenuninstalledfeaturesarecalled.msoFeatureInstallOnDemandAdialogboxisdisplayedpromptingtheusertoinstallnewfeatures.msoFeatureInstallOnDemandWithUIAprogressmeterisdisplayedduringinstallation.Theuserisn'tpromptedtoinstallnewfeatures.
expression.FeatureInstall
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
YoucanusethemsoFeatureInstallOnDemandWithUIconstanttopreventusersfrombelievingthattheapplicationisn'trespondingwhileafeatureisbeinginstalled.UsethemsoFeatureInstallNoneconstantwitherrortrappingroutinestoexcludeend-userfeatureinstallation.
NoteIfyourefertoanuninstalledpresentationdesigntemplateinastring,arun-timeerrorisgenerated.ThetemplateisnotinstalledautomaticallyregardlessofyourFeatureInstallpropertysetting.TousetheApplyTemplatemethodforatemplatethatisnotcurrentlyinstalled,youfirstmustinstalltheadditionaldesigntemplates.Todoso,installtheAdditionalDesignTemplatesforPowerPointbyrunningtheMicrosoftOfficeinstallationprogram(availablethroughtheAdd/RemoveProgramsiconinWindowsControlPanel).
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
ShowAll
FileDialogPropertyReturnsaFileDialogobjectthatrepresentsasingleinstanceofafiledialogbox.
expression.FileDialog(Type)
expressionRequired.AnexpressionthatreturnsanApplicationobject.
TypeRequiredMsoFileDialogType.Thetypeofdialogtoreturn.
MsoFileDialogTypecanbeoneoftheseMsoFileDialogTypeconstants.msoFileDialogFilePickermsoFileDialogFolderPickermsoFileDialogOpenmsoFileDialogSaveAs
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
FileFindPropertyReturnsanIFindobjectthatcanbeusedtolocatefiles.Read-only.
expression.FileFind
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexampledisplaysthenamesofallfilesintheMyDocumentsfolderthatbeginwith"New."
WithApplication.FileFind
.Name="New*.*"
.SearchPath="C:\MyDocuments"
.Execute
ForI=1To.Results.Count
MsgBox.Results(I)
Next
EndWith
FileNamePropertyReturnsorsetsthepathandfilenameoftheWebpresentationcreatedwhenallorpartoftheactivepresentationispublished.Read/writeString.
Remarks
TheFileNamepropertygeneratesanerrorifafolderinthespecifiedpathdoesnotexist.
Example
ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htmandsavesitintheTestfolder.
WithActivePresentation.PublishObjects(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.Publish
EndWith
FileSearchPropertyReturnsaFileSearchobjectthatcanbeusedtosearchforfilesusingeitheranabsoluteorrelativepath.Read-only.
Example
ThisexampledisplaysthenamesofallfilesintheMyDocumentsfolderthatbeginwith"New."
WithApplication.FileSearch
.FileName="New*.*"
.LookIn="C:\MyDocuments"
.Execute
ForI=1To.FoundFiles.Count
MsgBox.FoundFiles(I)
Next
EndWith
FillPropertyReturnsaFillFormatobjectthatcontainsfillformattingpropertiesforthespecifiedshape.Read-only.
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
FilterEffectPropertyReturnsaFilterEffectobjectthatrepresentsafiltereffectforananimationbehavior.Read-only.
expression.FilterEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
FirstChildPropertyReturnsaDiagramNodeobjectrepresentingthefirstdiagramnodeinacollectionofdiagramnodes.
expression.FirstChild
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
FirstMarginPropertyReturnsorsetsthefirst-lineindentforthespecifiedoutlinelevel,inpoints.Read/writeSingle.
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
Example
Thisexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation.
WithApplication.ActivePresentation_
.SlideMaster.TextStyles(ppBodyStyle)
With.Ruler.Levels(1)
.FirstMargin=9
.LeftMargin=54
EndWith
EndWith
FirstSlideNumberPropertyReturnsorsetstheslidenumberforthefirstslideinthepresentation.Read/writeLong.
Remarks
Theslidenumberistheactualnumberthatwillappearinthelower-rightcorneroftheslidewhenyoudisplayslidenumbers.Thisnumberisdeterminedbythenumber(order)oftheslidewithinthepresentation(theSlideIndexpropertyvalue)andthestartingslidenumberforthepresentation(theFirstSlideNumberpropertyvalue).Theslidenumberwillalwaysbeequaltothestartingslidenumber+theslideindexnumber–1.TheSlideNumberpropertyreturnstheslidenumber.
Example
Thisexampleshowshowchangingthefirstslidenumberintheactivepresentationaffectstheslidenumberofaspecificslide.
WithApplication.ActivePresentation
.PageSetup.FirstSlideNumber=1'startsslidenumberingat1
MsgBox.Slides(2).SlideNumber'returns2
.PageSetup.FirstSlideNumber=10'startsslidenumberingat10
MsgBox.Slides(2).SlideNumber'returns11
EndWith
ShowAll
FitToPagePropertyDetermineswhethertheslideswillbescaledtofillthepagethey'reprintedon.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.TheslideswillhavethedimensionsspecifiedinthePageSetupdialogbox,whetherornotthosedimensionsmatchthepagethey'reprintedon.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideswillbescaledtofillthepagethey'reprintedon,regardlessofthevaluesintheHeightandWidthboxesinthePageSetupdialogbox(Filemenu)
Example
Thisexampleprintstheactivepresentationandscaleseachslidetofittheprintedpage.
WithActivePresentation
.PrintOptions.FitToPage=msoTrue
.PrintOut
EndWith
FolderSuffixPropertyReturnsthefoldersuffixthatMicrosoftPowerPointuseswhenyousaveorpublishacompleteorpartialpresentationasaWebpage,uselongfilenames,andchoosetosavesupportingfilesinaseparatefolder(thatis,iftheUseLongFileNamesandOrganizeInFolderpropertiesaresettoTrue).Read-onlyString.
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
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
Example
Thisexamplereturnsthefoldersuffixusedbypresentationone.ThesuffixisreturnedinthestringvariablestrFolderSuffix.
strFolderSuffix=Presentations(1).WebOptions.FolderSuffix
ShowAll
FollowColorsPropertyReturnsorsetstheextenttowhichthecolorsinthespecifiedobjectfollowtheslide'scolorscheme.ThespecifiedobjectmustbeachartcreatedineitherMicrosoftGraphorMicrosoftOrganizationChart.Read/writePpFollowColors.
PpFollowColorscanbeoneofthesePpFollowColorsconstants.ppFollowColorsNoneThechartcolorsdon'tfollowtheslide'scolorscheme.ppFollowColorsMixedppFollowColorsSchemeAllthecolorsinthechartfollowtheslide'scolorscheme.ppFollowColorsTextAndBackgroundOnlythetextandbackgroundfollowtheslide'scolorscheme.
expression.FollowColors
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplespecifiesthatthetextandbackgroundofshapetwoonslideoneintheactivepresentationfollowtheslide'scolorscheme.ShapetwomustbeachartcreatedineitherMicrosoftGraphorMicrosoftOrganizationChart.
ActivePresentation.Slides(1).Shapes(2).OLEFormat.FollowColors=_
ppFollowColorsTextAndBackground
ShowAll
FollowMasterBackgroundPropertyDetermineswhethertheslideorrangeofslidesfollowstheslidemasterbackground.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedslideorrangeofslideshasacustombackground.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideorrangeofslidesfollowstheslidemasterbackground.
Remarks
Whenyoucreateanewslide,thedefaultvalueforthispropertyisTrue.Ifyoucopyaslidefromanotherpresentation,itretainsthesettingithadintheoriginalpresentation.Thatis,iftheslidefollowedtheslidemasterbackgroundintheoriginalpresentation,itwillautomaticallyfollowtheslidemasterbackgroundinthenewpresentation;or,iftheslidehadacustombackground,itwillretainthatcustombackground.
Notethatthelookoftheslide'sbackgroundisdeterminedbythecolorschemeandbackgroundobjectsaswellasbythebackgrounditself.IfsettingtheFollowMasterBackgroundpropertyalonedoesn'tgiveyoutheresultsyouwant,trysettingtheColorSchemeandDisplayMasterShapespropertiesaswell.
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
FontPropertyReturnsaFontobjectthatrepresentscharacterformatting.Read-only.
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
ShowAll
FontBoldPropertyDetermineswhetherthefontinthespecifiedWordArtisbold.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThefontinthespecifiedWordArtisbold.
Example
ThisexamplesetsthefonttoboldforshapethreeonmyDocumentiftheshapeisWordArt.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3)
If.Type=msoTextEffectThen
.TextEffect.FontBold=msoTrue
EndIf
EndWith
ShowAll
FontItalicPropertyDetermineswhetherthefontinthespecifiedWordArtisitalic.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThefontinthespecifiedWordArtisitalic.
Example
Thisexamplesetsthefonttoitalicfortheshapenamed"WordArt4"onmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes("WordArt4").TextEffect.FontItalic=msoTrue
FontNamePropertyReturnsorsetsthenameofthefontinthespecifiedWordArt.Read/writeString.
Example
Thisexamplesetsthefontnameto"CourierNew"forshapethreeonmyDocumentiftheshapeisWordArt.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3)
If.Type=msoTextEffectThen
.TextEffect.FontName="CourierNew"
EndIf
EndWith
ShowAll
FontsPropertyFontspropertyasitappliestothePresentationobject.
ReturnsaFontscollectionthatrepresentsallfontsusedinthespecifiedpresentation.Read-only.
expression.Fonts
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
FontspropertyasitappliestotheDefaultWebOptionsobject.
ReturnsaWebPageFontscollectionrepresentingthesetofavailablefontsforsavingapresentationasaWebpage.Read-only.
expression.Fonts
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Example
AsitappliestothePresentationobject.
ThisexamplereplacestheTimesNewRomanfontwiththeCourierfontintheactivepresentation.
Application.ActivePresentation.Fonts_
.Replace"TimesNewRoman","Courier"
AsitappliestotheDefaultWebOptionsobject.
Thisexamplesetsthefixed-widthfontdefaultWeboption,specifiedbythecharactersetconstantmsoCharacterSetEnglishWesternEuropeanOtherLatinScript,tobeCourierNew10points.
WithApplication.DefaultWebOptions_
.Fonts(msoCharacterSetEnglishWesternEuropeanOtherLatinScript)
.FixedWidthFont="CourierNew"
.FixedWidthFontSize=10
EndWith
FontSizePropertyReturnsorsetsthefontsizeforthespecifiedWordArt,inpoints.Read/writeSingle.
Example
Thisexamplesetsthefontsizeto16pointsfortheshapenamed"WordArt4"inmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes("WordArt4").TextEffect.FontSize=16
FooterPropertyReturnsaHeaderFooterobjectthatrepresentsthefooterthatappearsatthebottomofaslideorinthelower-leftcornerofanotespage,handout,oroutline.Read-only.
Example
Thisexamplesetsthetextforthefooterontheslidemasterintheactivepresentationandsetsthefooter,dateandtime,andslidenumbertoappearonthetitleslide.
WithApplication.ActivePresentation.SlideMaster.HeadersFooters
.Footer.Text="Introduction"
.DisplayOnTitleSlide=True
EndWith
ForeColorPropertyReturnsorsetsaColorFormatobjectthatrepresentstheforegroundcolorforthefill,line,orshadow.Read/write.
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
ShowAll
FormatPropertyReturnsorsetstheformatfortheautomaticallyupdateddateandtime.AppliesonlytoHeaderFooterobjectsthatrepresentadateandtime(returnedfromtheHeadersFooterscollectionbytheDateAndTimeproperty).Read/writePpDateTimeFormat.
PpDateTimeFormatcanbeoneofthesePpDateTimeFormatconstants.ppDateTimeddddMMMMddyyyyppDateTimedMMMMyyyyppDateTimedMMMyyppDateTimeFormatMixedppDateTimeHmmppDateTimehmmAMPMppDateTimeHmmssppDateTimehmmssAMPMppDateTimeMdyyppDateTimeMMddyyHmmppDateTimeMMddyyhmmAMPMppDateTimeMMMMdyyyyppDateTimeMMMMyyppDateTimeMMyy
expression.Format
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Makesurethatthedateandtimearesettobeupdatedautomatically(notdisplayedasfixedtext)bysettingtheUseFormatpropertytoTrue.
Example
Thisexamplesetsthedateandtimefortheslidemasteroftheactivepresentationtobeupdatedautomaticallyandthenitsetsthedateandtimeformattoshowhours,minutes,andseconds.
SetmyPres=Application.ActivePresentation
WithmyPres.SlideMaster.HeadersFooters.DateAndTime
.UseFormat=True
.Format=ppDateTimeHmmss
EndWith
FormulaPropertyReturnsorsetsaStringthatrepresentsaformulatouseforcalculatingananimation.Read/write.
expression.Formula
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
FrameColorsPropertyReturnsorsetsthetextcolorfortheoutlinepaneandthebackgroundcolorfortheoutlineandslidepanesforWebpresentations.Read/writePpFrameColors.
PpFrameColorscanbeoneofthesePpFrameColorsconstants.ppFrameColorsBlackTextOnWhiteppFrameColorsBrowserColorsppFrameColorsPresentationSchemeAccentColorppFrameColorsPresentationSchemeTextColorppFrameColorsWhiteTextOnBlack
expression.FrameColors
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplespecifiesthatwhensavingorpublishingtheactivepresentationasaWebpage,thetextcolorfortheoutlinepaneiswhiteandthebackgroundcolorfortheoutlineandslidepanesisblack,andPortableNetworkGraphics(PNG)areallowedasanimageformat.
WithActivePresentation.WebOptions
.FrameColors=ppFrameColorsWhiteTextOnBlack
.AllowPNG=True
EndWith
ShowAll
FrameSlidesPropertyDetermineswhetherathinframeisplacedaroundtheborderoftheprintedslides.Read/writeMsoTriState.Appliestoprintedslides,handouts,andnotespages.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueAthinframeisplacedaroundtheborderoftheprintedslides.
Example
Thisexampleprintstheactivepresentationwithaframearoundeachslide.
WithActivePresentation
.PrintOptions.FrameSlides=msoTrue
.PrintOut
EndWith
ShowAll
FromPropertyFrompropertyasitappliestotheColorEffectobject.
SetsorreturnsaColorFormatobjectthatrepresentsthestartingRGBcolorvalueofananimationbehavior.
expression.From
expressionRequired.AnexpressionthatreturnsaColorEffectobject.
Remarks
UsethispropertyinconjunctionwiththeTopropertytotransitionfromonecolortoanother.
FrompropertyasitappliestotheRotationEffectobject.
SetsorreturnsaSinglethatrepresentsthestartingangleindegrees,specifiedrelativetothescreen(forexample,90degreesiscompletelyhorizontal).Read/write.
expression.From
expressionRequired.AnexpressionthatreturnsaRotationEffectobject.
Remarks
UsethispropertyinconjunctionwiththeTopropertytotransitionfromonerotationangletoanother.
ThedefaultvalueisEmptyinwhichcasethecurrentpositionoftheobjectisused.
FrompropertyasitappliestothePropertyEffectobject.
SetsorreturnsaVariantthatrepresentsthestartingvalueofanobject’sproperty.Read/write.
expression.From
expressionRequired.AnexpressionthatreturnsaPropertyEffectobject.
Remarks
TheFrompropertyissimilartothePointsproperty,butusingtheFrompropertyiseasierforsimpletasks.
ThedefaultvalueisEmpty,inwhichcasethecurrentpositionoftheobjectisused.
Remarks
DonotconfusethispropertywiththeFromXorFromYpropertiesoftheScaleEffectandMotionEffectobjects,whichareonlyusedforscalingormotioneffects.
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,_
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
FromXPropertySetsorreturnsaSinglethatrepresentsthestartingwidthorhorizontalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentofthescreenwidth.Read/write.
expression.FromX
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.
UsethispropertyinconjunctionwiththeToXpropertytoresizeorjumpfromonepositiontoanother.
DonotconfusethispropertywiththeFrompropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.
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
FromYPropertyReturnsorsetsaSinglethatrepresentsthestartingheightorverticalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentageofthescreenwidth.Read/write.
expression.FromY
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.
UsethispropertyinconjunctionwiththeToYpropertytoresizeorjumpfromonepositiontoanother.
DonotconfusethispropertywiththeFrompropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.
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
FullNamePropertyReturnsthenameofthespecifiedadd-inorsavedpresentation,includingthepath,thecurrentfilesystemseparator,andthefilenameextension.Read-onlyString.
Remarks
ThispropertyisequivalenttothePathproperty,followedbythecurrentfilesystemseparator,followedbytheNameproperty.
Example
Thisexampledisplaysthepathandfilenameofeveryavailableadd-in.
ForEachaInApplication.AddIns
MsgBoxa.FullName
Nexta
Thisexampledisplaysthepathandfilenameoftheactivepresentation(assumingthatthepresentationhasbeensaved).
MsgBoxApplication.ActivePresentation.FullName
GapPropertyReturnsorsetsthehorizontaldistance(inpoints)betweentheendofthecalloutlineandthetextboundingbox.Read/writeSingle.
Example
Thisexamplesetsthedistancebetweenthecalloutlineandthetextboundingboxto3pointsforshapeoneonmyDocument.Fortheexampletowork,shapeonemustbeacallout.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(1).Callout.Gap=3
ShowAll
GradientColorTypePropertyReturnsthegradientcolortypeforthespecifiedfill.Thispropertyisread-only.UsetheOneColorGradient,PresetGradient,orTwoColorGradientmethodtosetthegradienttypeforthefill.Read-onlyMsoGradientColorType.
MsoGradientColorTypecanbeoneoftheseMsoGradientColorTypeconstants.msoGradientColorMixedmsoGradientOneColormsoGradientPresetColorsmsoGradientTwoColors
expression.GradientColorType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplechangesthefillforallshapesinmyDocumentthathaveatwo-colorgradientfilltoapresetgradientfill.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Withs.Fill
If.GradientColorType=msoGradientTwoColorsThen
.PresetGradientmsoGradientHorizontal,_
1,msoGradientBrass
EndIf
EndWith
Next
GradientDegreePropertyReturnsavaluethatindicateshowdarkorlightaone-colorgradientfillis.Avalueof0(zero)meansthatblackismixedinwiththeshape'sforegroundcolortoformthegradient;avalueof1meansthatwhiteismixedin;andvaluesbetween0and1meanthatadarkerorlightershadeoftheforegroundcolorismixedin.Read-onlySingle.
Thispropertyisread-only.UsetheOneColorGradientmethodtosetthegradientdegreeforthefill.
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
ShowAll
GradientStylePropertyReturnsthegradientstyleforthespecifiedfill.UsetheOneColorGradient,PresetGradient,orTwoColorGradientmethodtosetthegradientstyleforthefill.Attemptingtoreturnthispropertyforafillthatdoesn'thaveagradientgeneratesanerror.UsetheTypepropertytodeterminewhetherthefillhasagradient.Read-onlyMsoGradientStyle.
MsoGradientStylecanbeoneoftheseMsoGradientStyleconstants.msoGradientDiagonalDownmsoGradientDiagonalUpmsoGradientFromCentermsoGradientFromCornermsoGradientFromTitlemsoGradientHorizontalmsoGradientMixedmsoGradientVertical
expression.GradientStyle
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
GradientVariantPropertyReturnsthegradientvariantforthespecifiedfillasanintegervaluefrom1to4formostgradientfills.IfthegradientstyleismsoGradientFromTitleormsoGradientFromCenter,thispropertyreturnseither1or2.Thevaluesforthispropertycorrespondtothegradientvariants(numberedfromlefttorightandfromtoptobottom)ontheGradienttabintheFillEffectsdialogbox.Read-onlyLong.
Thispropertyisread-only.UsetheOneColorGradient,PresetGradient,orTwoColorGradientmethodtosetthegradientvariantforthefill.
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
GridDistancePropertySetsorreturnsaSinglethatrepresentsthedistancebetweengridlines.Read/write.
expression.GridDistance
expressionRequired.AnexpressionthatreturnsanPresentationobject.
Example
Thisexampledisplaysthegridlines,andthenspecifiesthedistancebetweengridlinesandenablesthesnaptogridsetting.
SubSetGridLines()
Application.DisplayGridLines=msoTrue
WithActivePresentation
.GridDistance=18
.SnapToGrid=msoTrue
EndWith
EndSub
GroupItemsPropertyReturnsaGroupShapesobjectthatrepresentstheindividualshapesinthespecifiedgroup.UsetheItemmethodoftheGroupShapesobjecttoreturnasingleshapefromthegroup.AppliestoShapeorShapeRangeobjectsthatrepresentgroupedshapes.Read-only.
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
HandoutMasterPropertyReturnsaMasterobjectthatrepresentsthehandoutmaster.Read-only.
Example
Thisexamplesetsthebackgroundpatternonthehandoutmasterintheactivepresentation.
Application.ActivePresentation.HandoutMaster.Background.Fill_
.PatternedmsoPatternDarkHorizontal
ShowAll
HandoutOrderPropertyReturnsorsetsthepagelayoutorderinwhichslidesappearonprintedhandoutsthatshowmultipleslidesononepage.Read/writePpPrintHandoutOrder.
PpPrintHandoutOrdercanbeoneofthesePpPrintHandoutOrderconstants.ppPrintHandoutHorizontalFirstSlidesareorderedhorizontally,withthefirstslideintheupper-leftcornerandthesecondslidetotherightofit.Ifyourlanguagesettingspecifiesaright-to-leftlanguage,thefirstslideisintheupper-rightcornerwiththesecondslidetotheleftofit.ppPrintHandoutVerticalFirstSlidesareorderedvertically,withthefirstslideintheupper-leftcornerandthesecondslidebelowit.Ifyourlanguagesettingspecifiesaright-to-leftlanguage,thefirstslideisintheupper-rightcornerwiththesecondslidebelowit.
expression.HandoutOrder
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetshandoutsoftheactivepresentationtocontainsixslidesperpage,orderstheslideshorizontallyonthehandouts,andprintsthem.
WithActivePresentation
.PrintOptions.OutputType=ppPrintOutputSixSlideHandouts
.PrintOptions.HandoutOrder=ppPrintHandoutHorizontalFirst
.PrintOut
EndWith
ShowAll
HangingPunctuationPropertyReturnsorsetsthehangingpunctuationoptionifyouhaveanAsianlanguagesettingspecified.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThehangingpunctuationoptionisselected.
Example
Thisexampleselectshangingpunctuationforthefirstparagraphoftheactivepresentation.
ActivePresentation.Paragraphs(1).HangingPunctuation=msoTrue
HasChildShapeRangePropertyTrueiftheselectioncontainschildshapes.Read-onlyBoolean.
expression.HasChildShapeRange
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
HasDiagramPropertyMsoTrueifashapeisadiagram.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseShapeisnotadiagram.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueShapeisadiagram.
expression.HasDiagram
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
HasDiagramNodePropertyMsoTrueifashapeisadiagramnode.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseShapeisnotadiagramnode.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueShapeisadiagramnode.
expression.HasDiagramNode
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
HasRevisionInfoPropertyReturnsaPpRevisionInfoconstantthatrepresentswhetherapresentationisamergedauthordocument,areviewerdocumentwithbaselines,oraregularMicrosoftPowerPointdocument.Read-only.
PpRevisionInfocanbeoneofthesePpRevisionInfoconstants.ppRevisionInfoBaselineThepresentationhasabaseline.ppRevisionInfoMergedThepresentationisamergedauthorpresentation.ppRevisionInfoNoneThepresentationhasnoreviewerinformation.
expression.HasRevisionInfo
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Commentsarenotconsideredreviewerinformation.
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
ShowAll
HasTablePropertyReturnswhetherthespecifiedshapeisatable.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisatable.
Example
Thisexamplechecksthecurrentlyselectedshapetoseeifitisatable.Ifitis,thecodesetsthewidthofcolumnonetooneinch(72points).
WithActiveWindow.Selection.ShapeRange
If.HasTable=msoTrueThen
.Table.Columns(1).Width=72
EndIf
EndWith
ShowAll
HasTextPropertyReturnswhetherthespecifiedshapehastextassociatedwithit.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapehastextassociatedwithit.
Example
IfshapetwoonmyDocumentcontainstext,thisexampleresizestheshapetofitthetext.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(2).TextFrame
If.HasTextThen.AutoSize=ppAutoSizeShapeToFitText
EndWith
ShowAll
HasTextFramePropertyReturnswhetherthespecifiedshapehasatextframe.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapehasatextframeandcanthereforecontaintext.
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
ShowAll
HasTitlePropertyReturnswhetherthecollectionofobjectsonthespecifiedslidecontainsatitleplaceholder.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThecollectionofobjectsonthespecifiedslidecontainsatitleplaceholder.
Example
Thisexamplerestoresthetitleplaceholdertoslideoneintheactivepresentationifthisplaceholderhasbeendeleted.Thetextoftherestoredtitleis"Restoredtitle."
WithActivePresentation.Slides(1)
If.Layout<>ppLayoutBlankThen
With.Shapes
IfNot.HasTitleThen
.AddTitle.TextFrame.TextRange_
.Text="Restoredtitle"
EndIf
EndWith
EndIf
EndWith
ShowAll
HasTitleMasterPropertyMsoTrueifthespecifiedpresentationhasatitlemaster.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedpresentationhasatitlemaster.
expression.HasTitleMaster
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampleaddsatitlemastertotheactivepresentationifitdoesn'talreadyhaveone.
WithApplication.ActivePresentation
IfNot.HasTitleMasterThen.AddTitleMaster
EndWith
HeaderPropertyReturnsaHeaderFooterobjectthatrepresentstheheaderthatappearsatthetopofaslideorintheupper-leftcornerofanotespage,handout,oroutline.Read-only.
Example
Thisexamplesetstheheadertextforthehandoutmasterfortheactivepresentation.Thistextwillappearintheupper-leftcornerofthepagewhenyouprintyourpresentationasanoutlineorahandout.
SetmyHandHF=Application.ActivePresentation.HandoutMaster_
.HeadersFooters
myHandHF.Header.Text="ThirdQuarterReport"
HeadersFootersPropertyReturnsaHeadersFooterscollectionthatrepresentstheheader,footer,dateandtime,andslidenumberassociatedwiththeslide,slidemaster,orrangeofslides.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
Thisexamplesetsthefootertextandthedateandtimeformatforthenotesmasterintheactivepresentationandsetsthedateandtimetobeupdatedautomatically.
WithActivePresentation.NotesMaster.HeadersFooters
.Footer.Text="RegionalSales"
With.DateAndTime
.UseFormat=True
.Format=ppDateTimeHmmss
EndWith
EndWith
HeightPropertyReturnsorsetstheheightofthespecifiedobject,inpoints.Read-onlySinglefortheMasterobject,read/writeSingleforallotherobjects.
Remarks
TheHeightpropertyofaShapeobjectreturnsorsetstheheightoftheforward-facingsurfaceofthespecifiedshape.Thismeasurementdoesn'tincludeshadowsor3-Deffects.
Example
Thisexamplesetstheheightofdocumentwindowtwotohalftheheightoftheapplicationwindow.
Windows(2).Height=Application.Height/2
Thisexamplesetstheheightforrowtwointhespecifiedtableto100points(72pointsperinch).
ActivePresentation.Slides(2).Shapes(5).Table.Rows(2).Height=100
ShowAll
HiddenPropertyDetermineswhetherthespecifiedslideishiddenduringaslideshow.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideishiddenduringaslideshow.
Example
Thisexamplemakesslidetwointheactivepresentationahiddenslide.
ActivePresentation.Slides(2).SlideShowTransition.Hidden=msoTrue
ShowAll
HideWhileNotPlayingPropertyDetermineswhetherthespecifiedmediaclipishiddenduringaslideshowexceptwhenit'splaying.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedmediaclipishiddenduringaslideshowexceptwhenit'splaying.
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
ShowAll
HorizontalAnchorPropertyReturnsorsetsthehorizontalalignmentoftextinatextframe.Read/writeMsoHorizontalAnchor.
MsoHorizontalAnchorcanbeoneoftheseMsoHorizontalAnchorconstants.msoAnchorNonemsoHorizontalAnchorMixedmsoAnchorCenter
expression.HorizontalAnchor
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsthealignmentofthetextinshapeoneonmyDocumenttotopcentered.
SetmyDocument=ActivePresentation.SlideMaster
WithmyDocument.Shapes(1)
.TextFrame.HorizontalAnchor=msoAnchorCenter
.TextFrame.VerticalAnchor=msoAnchorTop
EndWith
ShowAll
HorizontalFlipPropertyReturnswhetherthespecifiedshapeisflippedaroundthehorizontalaxis.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisflippedaroundthehorizontalaxis.
Example
ThisexamplerestoreseachshapeonmyDocumenttoitsoriginalstate,ifit'sbeenflippedhorizontallyorvertically.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Ifs.HorizontalFlipThens.FlipmsoFlipHorizontal
Ifs.VerticalFlipThens.FlipmsoFlipVertical
Next
HTMLProjectPropertyReturnstheHTMLProjectobject,whichisaWebpresentation(HTMLformat)accessedthroughtheMicrosoftScriptEditor.Read-only.
Remarks
TheHTMLProjectobjectcanbeinterpretedasthetop-levelprojectbranchintheProjectExplorerwindowoftheScriptEditor,foraloadedpresentation.ItcontainstheHTMLProjectItemscollection.MembersoftheHTMLProjectItemscollectionrepresentaslide,master,orthehandoutfortheWebpresentation.
Example
ThisexamplechecksthenameofeachmemberintheHTMLProjectItemscollectionfortheloadedHTMLProject.IfthenameisSlide2,itthenopensthegeneratedHTMLforthatslideintheMicrosoftScriptEditor.
DimiAsInteger
WithActivePresentation.HTMLProject
Fori=1To.HTMLProjectItems.Count
If.HTMLProjectItems(i).Name="Slide2"Then
.HTMLProjectItems(i).Open
EndIf
Next
EndWith
ShowAll
HTMLVersionPropertyReturnsorsetstheversionofHTMLforapublishedpresentation.Read/writePpHTMLVersion.
PpHTMLVersioncanbeoneofthesePpHTMLVersionconstants.ppHTMLAutodetectppHTMLDualppHTMLv3ppHTMLv4Default.
expression.HTMLVersion
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationinHTMLversion3.0.ItnamesthepublishedpresentationMallard.htm.
WithActivePresentation.PublishObjects(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.HTMLVersion=ppHTMLv3
.Publish
EndWith
HyperlinkPropertyReturnsaHyperlinkobjectthatrepresentsthehyperlinkforthespecifiedshape.Forthehyperlinktobeactiveduringaslideshow,theActionpropertymustbesettoppActionHyperlink.Read-only.
Example
ThisexamplesetsshapeoneonslideoneintheactivepresentationtojumptotheMicrosoftWebsitewhentheshapeisclickedduringaslideshow.
WithActivePresentation.Slides(1).Shapes(1)_
.ActionSettings(ppMouseClick)
.Action=ppActionHyperlink
.Hyperlink.Address="http://www.microsoft.com/"
EndWith
HyperlinksPropertyReturnsaHyperlinkscollectionthatrepresentsallthehyperlinksonthespecifiedslide.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
Thisexampleallowstheusertoupdateanoutdatedinternetaddressforallhyperlinksintheactivepresentation.
oldAddr=InputBox("Oldinternetaddress")
newAddr=InputBox("Newinternetaddress")
ForEachsInActivePresentation.Slides
ForEachhIns.Hyperlinks
IfLCase(h.Address)=oldAddrThenh.Address=newAddr
Next
Next
IdPropertyReturnsaLongthatidentifiestheshapeorrangeofshapes.Read-only.
expression.Id
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
IncludeNavigationPropertyDetermineswhetherthelinkbarforWebpresentationsisvisible.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThenavigationbarforWebpresentationsisnotvisible,whichenlargestheslide.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.ThenavigationbarforWebpresentationsisvisibleatthebottomofthepage.
Example
ThisexamplespecifiesthatthelinkbarisnottobeincludedinthespecifiedWebpresentation.ItthenpreviewsthepresentationintheactiveWebbrowser.
WithPresentations(2)
.WebOptions.IncludeNavigation=msoFalse
.WebPagePreview
EndWith
IndentLevelPropertyReturnsorsetsthetheindentlevelforthespecifiedtextasanintegerfrom1to5,where1indicatesafirst-levelparagraphwithnoindentation.Read/writeLong.
Example
Thisexampleindentsthesecondparagraphinshapetwoonslidetwointheactivepresentation.
Application.ActivePresentation.Slides(2).Shapes(2).TextFrame_
.TextRange.Paragraphs(2).IndentLevel=2
IndexPropertyReturnsaLongthatrepresentstheindexnumberforananimationeffectordesign.Read-only.
expression.Index
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thefollowingexampledisplaysthenameandindexnumberforalleffectsinthemainanimationsequenceofthefirstslide.
SubEffectInfo()
DimeffIndexAsEffect
DimseqMainAsSequence
SetseqMain=ActivePresentation.Slides(1).TimeLine.MainSequence
ForEacheffIndexInseqMain
WitheffIndex
MsgBox"EffectName:"&.DisplayName&vbLf&_
"EffectIndex:"&.Index
EndWith
Next
EndSub
ShowAll
InsetPenPropertyMsoTruetodrawlinesontheinsideofaspecifiedshape.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Aninsetpenisnotenabled.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueAninsetpenisenabled.
expression.InsetPen
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
AnerroroccursifthispropertyattemptstosetinsetpendrawingonanyMicrosoftOfficeAutoShapewhichdoesnotsupportinsetpendrawing.
Example
Thefollowinglineofcodeenablesaninsetpenforashape.Thisexampleassumesthatthefirstslideoftheactivepresentationcontainsashapeandtheshapesupportsinsetpendrawing.
SubDrawLinesInsideShape
ActivePresentation.Slides(1).Shapes(1).Line.InsetPen=msoTrue
EndSub
InteractiveSequencesPropertyReturnsaSequencesobjectthatrepresentsanimationsthataretriggeredbyclickingonaspecifiedshape.
expression.InteractiveSequences
expressionRequired.AnexpressionthatreturnsaTimeLineobject.
Remarks
ThedefaultvalueoftheInteractiveSequencespropertyisanemptySequencescollection.
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
ShowAll
IsFullScreenPropertyReturnswhetherthespecifiedslideshowwindowoccupiesthefullscreen.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowwindowoccupiesthefullscreen.
Example
Thisexamplereducestheheightofafull-screenslideshowwindowjustenoughsothatyoucanseethetaskbar.
WithApplication.SlideShowWindows(1)
If.IsFullScreenThen
.Height=.Height-20
EndIf
EndWith
ShowAll
IsNamedShowPropertyDetermineswhetheracustom(named)slideshowisdisplayedinthespecifiedslideshowview.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueAcustom(named)slideshowisdisplayedinthespecifiedslideshowview.
Example
Iftheslideshowrunninginslideshowwindowoneisacustomslideshow,thisexampledisplaysitsname.
WithSlideShowWindows(1).View
If.IsNamedShowThen
MsgBox"Nowshowinginslideshowwindow1:"_
&.SlideShowName
EndIf
EndWith
ShowAll
ItalicPropertyDetermineswhetherthecharacterformatisitalic.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThecharacterformatisnotitalic.msoTriStateMixedThespecifiedtextrangecontainsbothitalicandnonitaliccharacters.msoTriStateTogglemsoTrueThecharacterformatisitalic.
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
ItemPropertyReturnsorsetstheadjustmentvaluespecifiedbytheIndexargument.Forlinearadjustments,anadjustmentvalueof0.0generallycorrespondstotheleftortopedgeoftheshape,andavalueof1.0generallycorrespondstotherightorbottomedgeoftheshape.However,adjustmentscanpassbeyondshapeboundariesforsomeshapes.Forradialadjustments,anadjustmentvalueof1.0correspondstothewidthoftheshape.Forangularadjustments,theadjustmentvalueisspecifiedindegrees.TheItempropertyappliesonlytoshapesthathaveadjustments.Read/writeSingle.
expression.Item(Index)
expressionRequired.AnexpressionthatreturnsanAdjustmentsobject.
IndexRequiredLong.Theindexnumberoftheadjustment.
Remarks
AutoShapes,connectors,andWordArtobjectscanhaveuptoeightadjustments.
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
ShowAll
KernedPairsPropertyDetermineswhetherthecharacterpairsinthespecifiedWordArtarekerned.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueCharacterpairsinthespecifiedWordArtarekerned.
Example
ThisexampleturnsoncharacterpairkerningforshapethreeonmyDocumentiftheshapeisWordArt.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3)
If.Type=msoTextEffectThen
.TextEffect.KernedPairs=msoTrue
EndIf
EndWith
ShowAll
LanguageIDPropertyReturnsorsetsthelanguageforthespecifiedtextrange.UsedfortaggingportionsoftextwritteninadifferentlanguagethantheDefaultLanguageIDpropertyspecifies.ThisallowsMicrosoftPowerPointtocheckspellingandgrammaraccordingtothelanguageforeachtextrange.Thispropertyisnotrelatedtotheapplicationinterfacelanguage.Read/writeMsoLanguageID.
MsoLanguageIDcanbeoneoftheseMsoLanguageIDconstants.msoLanguageIDAfrikaansmsoLanguageIDAlbanianmsoLanguageIDAmharicmsoLanguageIDArabicmsoLanguageIDArabicAlgeriamsoLanguageIDArabicBahrainmsoLanguageIDArabicEgyptmsoLanguageIDArabicIraqmsoLanguageIDArabicJordanmsoLanguageIDArabicKuwaitmsoLanguageIDArabicLebanonmsoLanguageIDArabicLibyamsoLanguageIDArabicMoroccomsoLanguageIDArabicOmanmsoLanguageIDArabicQatarmsoLanguageIDArabicSyriamsoLanguageIDArabicTunisiamsoLanguageIDArabicUAEmsoLanguageIDArabicYemenmsoLanguageIDArmenianmsoLanguageIDAssamesemsoLanguageIDAzeriCyrillicmsoLanguageIDAzeriLatin
msoLanguageIDBasquemsoLanguageIDBelgianDutchmsoLanguageIDBelgianFrenchmsoLanguageIDBengalimsoLanguageIDBrazilianPortuguesemsoLanguageIDBulgarianmsoLanguageIDBurmesemsoLanguageIDByelorussianmsoLanguageIDCatalanmsoLanguageIDCherokeemsoLanguageIDChineseHongKongmsoLanguageIDChineseMacaomsoLanguageIDChineseSingaporemsoLanguageIDCroatianmsoLanguageIDCzechmsoLanguageIDDanishmsoLanguageIDDutchmsoLanguageIDEnglishAUSmsoLanguageIDEnglishBelizemsoLanguageIDEnglishCanadianmsoLanguageIDEnglishCaribbeanmsoLanguageIDEnglishIrelandmsoLanguageIDEnglishJamaicamsoLanguageIDEnglishNewZealandmsoLanguageIDEnglishPhilippinesmsoLanguageIDEnglishSouthAfricamsoLanguageIDEnglishTrinidadmsoLanguageIDEnglishUKmsoLanguageIDEnglishUSmsoLanguageIDEnglishZimbabwemsoLanguageIDEstonianmsoLanguageIDFaeroesemsoLanguageIDFarsi
msoLanguageIDFinnishmsoLanguageIDFrenchmsoLanguageIDFrenchCameroonmsoLanguageIDFrenchCanadianmsoLanguageIDFrenchCotedIvoiremsoLanguageIDFrenchLuxembourgmsoLanguageIDFrenchMalimsoLanguageIDFrenchMonacomsoLanguageIDFrenchReunionmsoLanguageIDFrenchSenegalmsoLanguageIDFrenchWestIndiesmsoLanguageIDFrenchZairemsoLanguageIDFrisianNetherlandsmsoLanguageIDGaelicIrelandmsoLanguageIDGaelicScotlandmsoLanguageIDGalicianmsoLanguageIDGeorgianmsoLanguageIDGermanmsoLanguageIDGermanAustriamsoLanguageIDGermanLiechtensteinmsoLanguageIDGermanLuxembourgmsoLanguageIDGreekmsoLanguageIDGujaratimsoLanguageIDHebrewmsoLanguageIDHindimsoLanguageIDHungarianmsoLanguageIDIcelandicmsoLanguageIDIndonesianmsoLanguageIDInuktitutmsoLanguageIDItalianmsoLanguageIDJapanesemsoLanguageIDKannadamsoLanguageIDKashmiri
msoLanguageIDKazakhmsoLanguageIDKhmermsoLanguageIDKirghizmsoLanguageIDKonkanimsoLanguageIDKoreanmsoLanguageIDLaomsoLanguageIDLatvianmsoLanguageIDLithuanianmsoLanguageIDMacedonianmsoLanguageIDMalayalammsoLanguageIDMalayBruneiDarussalammsoLanguageIDMalaysianmsoLanguageIDMaltesemsoLanguageIDManipurimsoLanguageIDMarathimsoLanguageIDMexicanSpanishmsoLanguageIDMixedmsoLanguageIDMongolianmsoLanguageIDNepalimsoLanguageIDNonemsoLanguageIDNoProofingmsoLanguageIDNorwegianBokmolmsoLanguageIDNorwegianNynorskmsoLanguageIDOriyamsoLanguageIDPolishmsoLanguageIDPunjabimsoLanguageIDRhaetoRomanicmsoLanguageIDRomanianmsoLanguageIDRomanianMoldovamsoLanguageIDRussianmsoLanguageIDRussianMoldovamsoLanguageIDSamiLappishmsoLanguageIDSanskrit
msoLanguageIDSerbianCyrillicmsoLanguageIDSerbianLatinmsoLanguageIDSesothomsoLanguageIDSimplifiedChinesemsoLanguageIDSindhimsoLanguageIDSlovakmsoLanguageIDSlovenianmsoLanguageIDSorbianmsoLanguageIDSpanishmsoLanguageIDSpanishArgentinamsoLanguageIDSpanishBoliviamsoLanguageIDSpanishChilemsoLanguageIDSpanishColombiamsoLanguageIDSpanishCostaRicamsoLanguageIDSpanishDominicanRepublicmsoLanguageIDSpanishEcuadormsoLanguageIDSpanishElSalvadormsoLanguageIDSpanishGuatemalamsoLanguageIDSpanishHondurasmsoLanguageIDSpanishModernSortmsoLanguageIDSpanishNicaraguamsoLanguageIDSpanishPanamamsoLanguageIDSpanishParaguaymsoLanguageIDSpanishPerumsoLanguageIDSpanishPuertoRicomsoLanguageIDSpanishUruguaymsoLanguageIDSpanishVenezuelamsoLanguageIDSutumsoLanguageIDSwahilimsoLanguageIDSwedishmsoLanguageIDSwedishFinlandmsoLanguageIDSwissFrenchmsoLanguageIDSwissGerman
msoLanguageIDSwissItalianmsoLanguageIDTajikmsoLanguageIDTamilmsoLanguageIDTatarmsoLanguageIDTelugumsoLanguageIDThaimsoLanguageIDTibetanmsoLanguageIDTraditionalChinesemsoLanguageIDTsongamsoLanguageIDTswanamsoLanguageIDTurkishmsoLanguageIDTurkmenmsoLanguageIDUkrainianmsoLanguageIDUrdumsoLanguageIDUzbekCyrillicmsoLanguageIDUzbekLatinmsoLanguageIDVendamsoLanguageIDVietnamesemsoLanguageIDWelshmsoLanguageIDXhosamsoLanguageIDZulumsoLanguageIDPortuguese
expression.LanguageID
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsthelanguageforthespecifiedtextinshapeonetoUSEnglish.
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange_
.LanguageID=msoLanguageIDEnglishUS
LanguageSettingsPropertyReturnsaLanguageSettingsobjectwhichcontainsinformationaboutthelanguagesettingsinMicrosoftPowerPoint.Read-only.
LastChildPropertyReturnsaDiagramNodeobjectrepresentingthelastdiagramnodeinacollectionofdiagramnodes.
expression.LastChild
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
LastSlideViewedPropertyReturnsaSlideobjectthatrepresentstheslideviewedimmediatelybeforethecurrentslideinthespecifiedslideshowview.
Example
Thisexampletakesyoutotheslideviewedimmediatelybeforethecurrentslideinslideshowwindowone.
WithSlideShowWindows(1).View
.GotoSlide(.LastSlideViewed.SlideIndex)
EndWith
ShowAll
LayoutPropertyLayoutpropertyasitappliestotheDiagramNodeobject.
ReturnsorsetsanMsoOrgChartLayoutTypeconstantthatrepresentsthelayouttypeforthediagramnodesinanorganizationchart.Read/write.
MsoOrgChartLayoutTypecanbeoneoftheseMsoOrgChartLayoutTypeconstants.msoOrgChartLayoutAssistantmsoOrgChartLayoutBothHangingmsoOrgChartLayoutLeftHangingmsoOrgChartLayoutMixedmsoOrgChartLayoutRightHangingmsoOrgChartLayoutStandard
expression.Layout
expressionRequired.AnexpressionthatreturnsaDiagramNodeobject.
Remarks
Thispropertygeneratesanerrorunlessthediagram'sTypepropertyismsoDiagramTypeOrgChart.
LayoutpropertyasitappliestotheSlideandSlideRangeobjects.
ReturnsorsetsaPpSlideLayoutconstantthatrepresentstheslidelayout.Read/write.
PpSlideLayoutcanbeoneofthesePpSlideLayoutconstants.ppLayoutBlankppLayoutChartppLayoutChartAndTextppLayoutClipartAndTextppLayoutClipArtAndVerticalTextppLayoutFourObjectsppLayoutLargeObjectppLayoutMediaClipAndTextppLayoutMixedppLayoutObjectppLayoutObjectAndTextppLayoutObjectOverTextppLayoutOrgchartppLayoutTableppLayoutTextppLayoutTextAndChartppLayoutTextAndClipartppLayoutTextAndMediaClipppLayoutTextAndObjectppLayoutTextAndTwoObjectsppLayoutTextOverObjectppLayoutTitle
ppLayoutTitleOnlyppLayoutTwoColumnTextppLayoutTwoObjectsAndTextppLayoutTwoObjectsOverTextppLayoutVerticalTextppLayoutVerticalTitleAndTextppLayoutVerticalTitleAndTextOverChart
expression.Layout
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
ShowAll
LayoutDirectionPropertyReturnsorsetsthelayoutdirectionfortheuserinterface.CanbeoneofthefollowingThedefaultvaluedependsonthelanguagesupportyouhaveselectedorinstalled.Read/writePpDirection.
PpDirectioncanbeoneofthesePpDirectionconstants.ppDirectionLeftToRightppDirectionMixedppDirectionRightToLeft
expression.LayoutDirection
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsthelayoutdirectiontoright-to-left.
Application.ActivePresentation.LayoutDirection=_
ppDirectionRightToLeft
ShowAll
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.
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
LeftMarginPropertyReturnsorsetstheleftindentforthespecifiedoutlinelevel,inpoints.Read/writeSingle.
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
Example
Thisexamplesetsthefirst-lineindentandhangingindentforoutlineleveloneinbodytextontheslidemasterfortheactivepresentation.
WithApplication.ActivePresentation_
.SlideMaster.TextStyles(ppBodyStyle)
With.Ruler.Levels(1)
.FirstMargin=9
.LeftMargin=54
EndWith
EndWith
ShowAll
LengthPropertyLengthpropertyasitappliestotheCalloutFormatobject.
WhentheAutoLengthpropertyofthespecifiedcalloutissettoFalse,theLengthpropertyreturnsthelength(inpoints)ofthefirstsegmentofthecalloutline(thesegmentattachedtothetextcalloutbox).Appliesonlytocalloutswhoselinesconsistofmorethanonesegment(typesmsoCalloutThreeandmsoCalloutFour).Read-onlyFloat.UsetheCustomLengthmethodtosetthevalueofthispropertyfortheCalloutFormatobject.
expression.Length
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
LengthpropertyasitappliestotheTextRangeobject.
Returnsthelengthofthespecifiedtextrange,incharacters.Read-onlyLong.
expression.Length
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
ShowAll
LevelsPropertyLevelspropertyasitappliestotheRulerobject.
ReturnsaRulerLevelsobjectthatrepresentsoutlineindentformatting.Read-only.
expression.Levels
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
LevelspropertyasitappliestotheTextStyleobject.
ReturnsaTextStyleLevelsobjectthatrepresentsoutlinetextformatting.Read-only.
expression.Levels
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
LinePropertyReturnsaLineFormatobjectthatcontainslineformattingpropertiesforthespecifiedshape.(Foraline,theLineFormatobjectrepresentsthelineitself;forashapewithaborder,theLineFormatobjectrepresentstheborder.)Read-only.
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
ShowAll
LineRuleAfterPropertyDetermineswhetherlinespacingafterthelastlineineachparagraphissettoaspecificnumberofpointsorlines.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLinespacingafterthelastlineineachparagraphissettoaspecificnumberofpoints.msoTriStateMixedmsoTriStateTogglemsoTrueLinespacingafterthelastlineineachparagraphissettoaspecificnumberoflines.
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
ShowAll
LineRuleBeforePropertyDetermineswhetherlinespacingbeforethefirstlineineachparagraphissettoaspecificnumberofpointsorlines.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLinespacingbeforethefirstlineineachparagraphissettoaspecificnumberofpoints.msoTriStateMixedmsoTriStateTogglemsoTrueLinespacingbeforethefirstlineineachparagraphissettoaspecificnumberoflines.
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
ShowAll
LineRuleWithinPropertyDetermineswhetherlinespacingbetweenbaselinesissettoaspecificnumberofpointsorlines.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLinespacingbetweenbaselinesissettoaspecificnumberofpoints.msoTriStateMixedmsoTriStateTogglemsoTrueLinespacingbetweenbaselinesissettoaspecificnumberoflines.
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
LinkFormatPropertyReturnsaLinkFormatobjectthatcontainsthepropertiesthatareuniquetolinkedOLEobjects.Read-only.
Example
ThisexampleupdatesthelinksbetweenanyOLEobjectsonslideoneintheactivepresentationandtheirsourcefiles.
ForEachshInActivePresentation.Slides(1).Shapes
Ifsh.Type=msoLinkedOLEObjectThen
Withsh.LinkFormat
.Update
EndWith
EndIf
Next
ShowAll
LoadedPropertyDetermineswhetherthespecifiedadd-inisloaded.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedadd-inisloaded.IntheAdd-Insdialogbox(Toolsmenu),thecheckboxesnexttoloadedadd-insareselected.
Example
ThisexampleaddsMyTools.ppatothelistintheAdd-Insdialogbox(Toolsmenu)andthenloadsit.
Addins.Add("c:\mydocuments\mytools.ppa").Loaded=msoTrue
Thisexampleunloadstheadd-innamed"MyTools."
Application.Addins("mytools").Loaded=msoFalse
ShowAll
LockAspectRatioPropertyDetermineswhetherthespecifiedshaperetainsitsoriginalproportionswhenyouresizeit.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseYoucanchangetheheightandwidthoftheshapeindependentlyofoneanotherwhenyouresizeit.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshaperetainsitsoriginalproportionswhenyouresizeit.
Example
ThisexampleaddsacubetomyDocument.Thecubecanbemovedandresized,butnotreproportioned.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.AddShape(msoShapeCube,50,50,100,200)_
.LockAspectRatio=msoTrue
ShowAll
LoopSoundUntilNextPropertyRead/writeMsoTriState.Specifieswhetherthesoundthat'sbeensetforthespecifiedslidetransitionloopsuntilthenextsoundstarts.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThesoundthat'sbeensetforthespecifiedslidetransitionloopsuntilthenextsoundstarts.
Example
ThisexamplespecifiesthatthefileDudududu.wavwillstarttoplayatthetransitiontoslidetwointheactivepresentationandwillcontinuetoplayuntilthenextsoundstarts.
WithActivePresentation.Slides(2).SlideShowTransition
.SoundEffect.ImportFromFile"c:\sndsys\dudududu.wav"
.LoopSoundUntilNext=msoTrue
EndWith
ShowAll
LoopUntilStoppedPropertyAsitappliestothePlaySettingsobject.
Determineswhetherthespecifiedmovieorsoundloopscontinuouslyuntileitherthenextmovieorsoundstarts,theuserclickstheslide,oraslidetransitionoccurs.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedmovieorsoundloopscontinuouslyuntileitherthenextmovieorsoundstarts,theuserclickstheslide,oraslidetransitionoccurs.
expression.LoopUntilStopped
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
AsitappliestotheSlideShowSettingsobject.
DetermineswhetherspecifiedslideshowloopscontinuouslyuntiltheuserpressesESC.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowloopscontinuouslyuntiltheuserpressesESC.
expression.LoopUntilStopped
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
MainSequencePropertyReturnsaSequenceobjectthatrepresentsthecollectionofEffectobjectsinthemainanimationsequenceofaslide.
expression.MainSequence
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThedefaultvalueoftheMainSequencepropertyisanemptySequencecollection.AnyattempttoreturnavaluefromthispropertywithoutaddingoneormoreEffectobjectstothemainanimationsequencewillresultinarun-timeerror.
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
MarginBottomPropertyReturnsorsetsthedistance(inpoints)betweenthebottomofthetextframeandthebottomoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.
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
MarginLeftPropertyReturnsorsetsthedistance(inpoints)betweentheleftedgeofthetextframeandtheleftedgeoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.
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
MarginRightPropertyReturnsorsetsthedistance(inpoints)betweentherightedgeofthetextframeandtherightedgeoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.
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
MarginTopPropertyReturnsorsetsthedistance(inpoints)betweenthetopofthetextframeandthetopoftheinscribedrectangleoftheshapethatcontainsthetext.Read/writeSingle.
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
MasterPropertyReturnsaMasterobjectthatrepresentstheslidemaster.Read-only.
Example
Thisexamplesetsthebackgroundfillfortheslidemasterforslideoneintheactivepresentation.
ActivePresentation.Slides(1).Master.Background.Fill_
.PresetGradientmsoGradientDiagonalUp,1,msoGradientDaybreak
ShowAll
MediaTypePropertyReturnstheOLEmediatype.Read-onlyPpMediaType.
PpMediaTypecanbeoneofthesePpMediaTypeconstants.ppMediaTypeMixedppMediaTypeMovieppMediaTypeOtherppMediaTypeSound
expression.MediaType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsallnativesoundobjectsonslideoneintheactivepresentationtoloopuntilmanuallystoppedduringaslideshow.
ForEachsoInActivePresentation.Slides(1).Shapes
Ifso.Type=msoMediaThen
Ifso.MediaType=ppMediaTypeSoundThen
so.AnimationSettings.PlaySettings_
.LoopUntilStopped=True
EndIf
EndIf
Next
MotionEffectPropertyReturnsaMotionEffectobjectthatrepresentsthepropertiesofamotionanimation.
expression.MotionEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
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.
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.
Remarks
Youcanusetheobject'snameinconjunctionwiththeItemmethodtoreturnareferencetotheobjectiftheItemmethodforthecollectionthatcontainstheobjecttakesaVariantargument.Forexample,ifthevalueoftheNamepropertyforashapeisRectangle2,then.Shapes("Rectangle2")willreturnareferencetothatshape.
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)
NameAsciiPropertyReturnsorsetsthefontusedforASCIIcharacters(characterswithcharactersetnumberswithintherangeof0to127).Read/writeString.
Remarks
ThedefaultvalueofthispropertyisTimesNewRoman.UsetheReplacemethodtochangethefontthat’sappliedtoalltextandthatappearsintheFontboxontheFormattingtoolbar.
Example
ThisexamplesetsthefontusedforASCIIcharactersinthetitleofthefirstslidetoCentury.
Application.ActivePresentation.Slides(1).Shapes.Title_
.TextFrame.TextRange.Font.NameAscii="Century"
NameComplexScriptPropertyReturnsorsetsthecomplexscriptfontname.Usedformixedlanguagetext.Read/writeString.
Remarks
Whenyouhavearight-to-leftlanguagesettingspecified,thispropertyisequivalenttotheComplexscriptsfontlistintheFontdialogbox(Formatmenu).WhenyouhaveanAsianlanguagesettingspecified,thispropertyisequivalenttotheAsiantextfontlistintheFontdialogbox(Formatmenu).
Example
ThisexamplesetsthecomplexscriptfonttoTimesNewRoman.
ActivePresentation.Slides(1).Shapes.Title.TextFrame_
.TextRange.Font.NameComplexScript="TimesNewRoman"
NamedSlideShowsPropertyReturnsaNamedSlideShowscollectionthatrepresentsallthenamedslideshows(customslideshows)inthespecifiedpresentation.Eachnamedslideshow,orcustomslideshow,isauser-selectedsubsetofthespecifiedpresentation.Read-only.
Remarks
UsetheAddmethodoftheNamedSlideShowsobjecttocreateanamedslideshow.
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
NameFarEastPropertyReturnsorsetstheAsianfontname.Read/writeString.
Remarks
UsetheReplacemethodtochangethefontthat’sappliedtoalltextandthatappearsintheFontboxontheFormattingtoolbar.
Example
ThisexampledisplaysthenameoftheAsianfontappliedtotheselection.
MsgBoxActiveWindow.Selection.ShapeRange_
.TextFrame.TextRange.Font.NameFarEast
NameOtherPropertyReturnsorsetsthefontusedforcharacterswhosecharactersetnumbersaregreaterthan127.Read/writeString.
Remarks
IntheU.S.EnglishversionofMicrosoftPowerPoint,thispropertyisread-onlyandthedefaultvalueisTimesNewRoman.UsetheReplacemethodtochangeafontinapresentation.TheNameOtherpropertysettingisthesameastheNameASCIIpropertysettingexceptwhentheNameASCIIpropertyissetto"UseFEFont."
Example
Thisexamplesetsthefontusedforcharacterswhosecharactersetnumbersaregreaterthan127,forthefirstmemberoftheFontscollection.
ActivePresentation.Fonts(1).NameOther="Tahoma"
NewPresentationPropertyReturnsaNewFileobjectthatrepresentsapresentationlistedontheNewPresentationtaskpane.Read-only.
expression.NewPresentation
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplelistsapresentationontheNewPresentationtaskpaneatthebottomofthelastsectioninthepane.
SubCreateNewPresentationListItem()
Application.NewPresentation.AddFileName:="C:\Presentation.ppt"
Application.CommandBars("TaskPane").Visible=True
EndSub
ShowAll
NodesPropertyNodespropertyasitappliestotheDiagramobject.
ReturnsaDiagramNodesobjectthatcontainsaflatlistofallofthenodesinthespecifieddiagram.
expression.Nodes
expressionRequired.AnexpressionthatreturnsaDiagramobject.
NodespropertyasitappliestotheShapeandShapeRangeobjects.
ReturnsaShapeNodescollectionthatrepresentsthegeometricdescriptionofthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentfreeformdrawings.
expression.Nodes
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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,_
EditingType:=msoEditingSmooth,X1:=210,Y1:=100
EndWith
NoLineBreakAfterPropertyReturnsorsetsthecharactersthatcannotendaline.Read/writeString.
Example
Thisexamplesets"$","(","[","\",and"{"ascharactersthatcannotendaline.
WithActivePresentation
.FarEastLineBreakLevel=ppFarEastLineBreakLevelCustom
.NoLineBreakAfter="$([\{"
EndWith
NoLineBreakBeforePropertyReturnsorsetsthecharactersthatcannotbeginaline.Read/writeString.
Example
Thisexamplesets"!",")",and"]"ascharactersthatcannotbeginaline.
WithActivePresentation
.FarEastLineBreakLevel=ppFarEastLineBreakLevelCustom
.NoLineBreakBefore="!)]"
EndWith
ShowAll
NormalizedHeightPropertyDetermineswhetherthecharacters(bothuppercaseandlowercase)inthespecifiedWordArtarethesameheight.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueAllcharacters(bothuppercaseandlowercase)inthespecifiedWordArtarethesameheight.
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
NotesMasterPropertyReturnsaMasterobjectthatrepresentsthenotesmaster.Read-only.
Example
Thisexamplesetstheheaderandfootertextforthenotesmasterfortheactivepresentation.
WithApplication.ActivePresentation.NotesMaster.HeadersFooters
.Header.Text="EmployeeGuidelines"
.Footer.Text="VolcanoCoffee"
EndWith
ShowAll
NotesOrientationPropertyReturnsorsetstheon-screenandprintedorientationofnotespages,handouts,andoutlinesforthespecifiedpresentation.Read/writeMsoOrientation.
MsoOrientationcanbeoneoftheseMsoOrientationconstants.msoOrientationHorizontalmsoOrientationMixedmsoOrientationVertical
expression.NotesOrientation
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetstheorientationofallnotespages,handouts,andoutlinesintheactivepresentationtohorizontal(landscape).
Application.ActivePresentation.PageSetup.NotesOrientation=_
msoOrientationHorizontal
NotesPagePropertyReturnsaSlideRangeobjectthatrepresentsthenotespagesforthespecifiedslideorrangeofslides.Read-only.
NoteThefollowingpropertiesandmethodswillfailifappliedtoaSlideRangeobjectthatrepresentsanotespage:Copymethod,Cutmethod,Deletemethod,Duplicatemethod,HeadersFootersproperty,Hyperlinksproperty,Layoutproperty,PrintStepsproperty,SlideShowTransitionproperty.
Remarks
TheNotesPagepropertyreturnsthenotespageforeitherasingleslideorarangeofslidesandallowsyoutomakechangesonlytothosenotespages.Ifyouwanttomakechangesthataffectallnotespages,usetheNotesMasterpropertytoreturntheSlideobjectthatrepresentsthenotesmaster.
Example
Thisexamplesetsthebackgroundfillforthenotespageforslideoneintheactivepresentation.
WithActivePresentation.Slides(1).NotesPage
.FollowMasterBackground=False
.Background.Fill.PresetGradient_
msoGradientHorizontal,1,msoGradientLateSunset
EndWith
NumberPropertyReturnsthebulletnumberofaparagraphwhentheTypepropertyoftheBulletFormatobjectissettoppBulletNumbered.Read-onlyLong.
Remarks
Ifthispropertyisqueriedformultipleparagraphswithdifferentnumbers,thenthevalueppBulletMixedisreturned.IfthispropertyisqueriedforaparagraphwithatypeotherthanppBulletNumbered,thenarun-timeerroroccurs.
Example
ThisexamplereturnsthebulletnumberofparagraphoneintheselectedtextrangetoavariablenamedmyParnum.
WithActiveWindow.Selection
If.Type=ppSelectionTextRangeThen
With.TextRange.Paragraphs(1).ParagraphFormat.Bullet
If.Type=ppBulletNumberedThen
myParnum=.Number
EndIf
EndWith
EndIf
EndWith
NumberOfCopiesPropertyReturnsorsetsthenumberofcopiesofapresentationtobeprinted.Thedefaultvalueis1.Read/writeLong.
Remarks
SpecifyingavaluefortheCopiesargumentofthePrintOutmethodsetsthevalueofthisproperty.
Example
Thisexampleprintsthreecollatedcopiesoftheactivepresentation.
WithActivePresentation.PrintOptions
.NumberOfCopies=3
.Collate=True
.Parent.PrintOut
EndWith
ObjectPropertyReturnstheobjectthatrepresentsthespecifiedOLEobject'stop-levelinterface.ThispropertyallowsyoutoaccessthepropertiesandmethodsoftheapplicationinwhichanOLEobjectwascreated.Read-only.
Remarks
UsetheTypeNamefunctiontodeterminethetypeofobjectthispropertyreturnsforaspecificOLEobject.
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
ShowAll
ObjectVerbsPropertyReturnsaObjectVerbscollectionthatcontainsalltheOLEverbsforthespecifiedOLEobject.Read-only.
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
ShowAll
ObscuredPropertyDetermineswhethertheshadowofthespecifiedshapeappearsfilledinandisobscuredbytheshape.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheshadowhasnofillandtheoutlineoftheshadowisvisiblethroughtheshapeiftheshapehasnofill.msoTriStateMixedmsoTriStateTogglemsoTrueTheshadowofthespecifiedshapeappearsfilledinandisobscuredbytheshape,eveniftheshapehasnofill.
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
OffsetXPropertyReturnsorsetsthehorizontaloffsetoftheshadowfromthespecifiedshape,inpoints.Apositivevalueoffsetstheshadowtotherightoftheshape;anegativevalueoffsetsittotheleft.Read/writeSingle.
Remarks
Ifyouwanttonudgeashadowhorizontallyorverticallyfromitscurrentpositionwithouthavingtospecifyanabsoluteposition,usetheIncrementOffsetXmethodortheIncrementOffsetYmethod.
Example
ThisexamplesetsthehorizontalandverticaloffsetsoftheshadowforshapethreeonmyDocument.Theshadowisoffset5pointstotherightoftheshapeand3pointsaboveit.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).Shadow
.Visible=True
.OffsetX=5
.OffsetY=-3
EndWith
OffsetYPropertyReturnsorsetstheverticaloffsetoftheshadowfromthespecifiedshape,inpoints.Apositivevalueoffsetstheshadowtotherightoftheshape;anegativevalueoffsetsittotheleft.Read/writeSingle.
Remarks
Ifyouwanttonudgeashadowhorizontallyorverticallyfromitscurrentpositionwithouthavingtospecifyanabsoluteposition,usetheIncrementOffsetXmethodortheIncrementOffsetYmethod.
Example
ThisexamplesetsthehorizontalandverticaloffsetsoftheshadowforshapethreeonmyDocument.Theshadowisoffset5pointstotherightoftheshapeand3pointsaboveit.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).Shadow
.Visible=True
.OffsetX=5
.OffsetY=-3
EndWith
OLEFormatPropertyReturnsanOLEFormatobjectthatcontainsOLEformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentOLEobjects.Read-only
Example
ThisexampleloopsthroughalltheobjectsonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftWorddocumentstobeupdatedmanually.
ForEachsldInActivePresentation.Slides
ForEachshInsld.Shapes
Ifsh.Type=msoLinkedOLEObjectThen
Ifsh.OLEFormat.ProgID="Word.Document"Then
sh.LinkFormat.AutoUpdate=ppUpdateOptionManual
EndIf
EndIf
Next
Next
OperatingSystemPropertyReturnsthenameoftheoperatingsystem.Read-onlyString.
Example
ThisexampleteststheOperatingSystempropertytoseewhetherPowerPointisrunningwitha32-bitversionofMicrosoftWindows.
os=Application.OperatingSystem
IfInStr(os,"Windows(32-bit)")<>0Then
MsgBox"Runninga32-bitversionofMicrosoftWindows"
EndIf
OptionsPropertyReturnsanOptionsobjectthatrepresentsapplicationoptionsinMicrosoftPowerPoint.
expression.Options
expressionRequired.AnexpressionthatreturnsanApplicationobject.
Example
UsetheOptionspropertytoreturntheOptionsobject.ThefollowingexamplesetsthreeapplicationoptionsforPowerPoint.
SubTogglePasteOptionsButton()
WithApplication.Options
If.DisplayPasteOptions=FalseThen
.DisplayPasteOptions=True
EndIf
EndWith
EndSub
ShowAll
OrganizeInFolderPropertyDetermineswhetherallsupportingfiles,suchasbackgroundtexturesandgraphics,areorganizedinaseparatefolderwhenyousaveorpublishthespecifiedpresentationasaWebpage.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseSupportingfilesaresavedinthesamefolderastheWebpage.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Allsupportingfiles,suchasbackgroundtexturesandgraphics,areorganizedinaseparatefolderwhenyousaveorpublishthespecifiedpresentationasaWebpage.
Remarks
ThenewfolderiscreatedwithinthefolderwhereyouhavesavedtheWebpage,andisnamedafterthepresentation.IftheUseLongFileNamespropertyissettoTrue,asuffixisaddedtothefoldername.
IfyousaveapresentationthatwaspreviouslysavedwiththeOrganizeInFolderpropertysettoadifferentvalue,MicrosoftPowerPointautomaticallymovesthesupportingfilesintooroutofthefolderasappropriate.
Ifyoudon'tuselongfilenames(thatis,iftheUseLongFileNamespropertyissettoFalse),PowerPointautomaticallysavesanysupportingfilesinaseparatefolder.ThefilescannotbesavedinthesamefolderastheWebpage.
Example
ThisexamplespecifiesthatallsupportingfilesaresavedinthesamefolderwhenpresentationtwoissavedorpublishedasaWebpage.
Presentations(2).WebOptions.OrganizeInFolder=msoFalse
ShowAll
OrientationPropertyReturnsorsetstextorientation.Read/writeMsoTextOrientation.Someoftheseconstantsmaynotbeavailabletoyou,dependingonthelanguagesupport(U.S.English,forexample)thatyou’veselectedorinstalled.
MsoTextOrientationcanbeoneoftheseMsoTextOrientationconstants.msoTextOrientationDownwardmsoTextOrientationHorizontalmsoTextOrientationHorizontalRotatedFarEastmsoTextOrientationMixedmsoTextOrientationUpwardmsoTextOrientationVerticalmsoTextOrientationVerticalFarEast
expression.Orientation
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexampleorientsthetexthorizontallywithinshapethreeonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(3).TextFrame_
.Orientation=msoTextOrientationHorizontal
ShowAll
OutputTypePropertyReturnsorsetsavaluethatindicateswhichcomponent(slides,handouts,notespages,oranoutline)ofthepresentationistobeprinted.Read/writePpPrintOutputType.
PpPrintOutputTypecanbeoneofthesePpPrintOutputTypeconstants.ppPrintOutputBuildSlidesppPrintOutputFourSlideHandoutsppPrintOutputNineSlideHandoutsppPrintOutputNotesPagesppPrintOutputOneSlideHandoutsppPrintOutputOutlineppPrintOutputSixSlideHandoutsppPrintOutputSlidesppPrintOutputThreeSlideHandoutsppPrintOutputTwoSlideHandouts
expression.OutputType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampleprintshandoutsoftheactivepresentationwithsixslidestoapage.
WithActivePresentation
.PrintOptions.OutputType=ppPrintOutputSixSlideHandouts
.PrintOut
EndWith
PageSetupPropertyReturnsaPageSetupobjectwhosepropertiescontrolslidesetupattributesforthespecifiedpresentation.Read-only.
Example
Thefollowingexamplesetstheslidesizeandslideorientationforthepresentationnamed"Pres1."
WithPresentations("pres1").PageSetup
.SlideSize=ppSlideSize35MM
.SlideOrientation=msoOrientationHorizontal
EndWith
ShowAll
PanesPropertyReturnsaPanescollectionthatrepresentsthepanesinthedocumentwindow.Read-only.
Example
Thisexampletestsforthenumberofpanesintheactivewindow.Ifthevalueisone,indicatinganyviewotherthatnormalview,normalviewisactivated.
IfActiveWindow.Panes.Count=1Then
ActiveWindow.ViewType=ppViewNormal
EndIf
ParagraphPropertyReturnsorsetsaLongthatrepresentstheparagraphinatextrangetowhichtoapplyanimationeffects.Read/write.
expression.Paragraph
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
ParagraphFormatPropertyReturnsaParagraphFormatobjectthatrepresentsparagraphformattingforthespecifiedtext.Read-only.
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
ParentPropertyReturnstheparentobjectforthespecifiedobject.
expression.Parent
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ParentGroupPropertyReturnsaShapeobjectthatrepresentsthecommonparentshapeofachildshapeorarangeofchildshapes.
expression.ParentGroup
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
PasswordPropertyReturnsorsetsaStringthatrepresentsapasswordthatmustbesuppliedtoopenthespecifiedpresentation.Read/write.
expression.Password
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexampleopensEarnings.ppt,setsapasswordforit,andthenclosesthepresentation.
SubSetPassword()
WithPresentations.Open(FileName:="C:\MyDocuments\Earnings.ppt")
.Password=complexstrPWD'globalvariable
.Save
.Close
EndWith
EndSub
PasswordEncryptionAlgorithmPropertyReturnsaStringindicatingthealgorithmMicrosoftPowerPointusesforencryptingdocumentswithpasswords.Read-only.
expression.PasswordEncryptionAlgorithm
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.
Example
ThisexamplesetsthepasswordencryptionoptionsifthepasswordencryptionalgorithminuseisnotRC4.
SubPasswordSettings()
WithActivePresentation
If.PasswordEncryptionAlgorithm<>"RC4"Then
.SetPasswordEncryptionOptions_
PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_
PasswordEncryptionAlgorithm:="RC4",_
PasswordEncryptionKeyLength:=56,_
PasswordEncryptionFileProperties:=True
EndIf
EndWith
EndSub
ShowAll
PasswordEncryptionFilePropertiesPropertyReturnsMsoTrueifMicrosoftPowerPointencryptsfilepropertiesforpassword-protecteddocuments.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.PasswordEncryptionFileProperties
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.
Example
Thisexamplesetsthepasswordencryptionoptionsifthefilepropertiesarenotencryptedforpassword-protecteddocuments.
SubPasswordSettings()
WithActivePresentation
If.PasswordEncryptionFileProperties=msoFalseThen
.SetPasswordEncryptionOptions_
PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_
PasswordEncryptionAlgorithm:="RC4",_
PasswordEncryptionKeyLength:=56,_
PasswordEncryptionFileProperties:=True
EndIf
EndWith
EndSub
PasswordEncryptionKeyLengthPropertyReturnsaLongindicatingthekeylengthofthealgorithmMicrosoftPowerPointuseswhenencryptingdocumentswithpasswords.Read-only.
expression.PasswordEncryptionKeyLength
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.
Example
Thisexamplesetsthepasswordencryptionoptionsifthepasswordencryptionkeylengthislessthan40.
SubPasswordSettings()
WithActivePresentation
If.PasswordEncryptionKeyLength<40Then
.SetPasswordEncryptionOptions
_
PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_
PasswordEncryptionAlgorithm:="RC4",_
PasswordEncryptionKeyLength:=56,_
PasswordEncryptionFileProperties:=True
EndIf
EndWith
EndSub
PasswordEncryptionProviderPropertyReturnsaStringspecifyingthenameofthealgorithmencryptionproviderthatMicrosoftPowerPointuseswhenencryptingdocumentswithpasswords.Read-only.
expression.PasswordEncryptionProvider
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsetheSetPasswordEncryptionOptionsmethodtospecifythealgorithmPowerPointusesforencryptingdocumentswithpasswords.
Example
ThisexamplesetsthepasswordencryptionoptionsifthepasswordencryptionalgorithminuseisnottheMicrosoftRSASChannelCryptographicProvider.
SubPasswordSettings()
WithActivePresentation
If.PasswordEncryptionProvider<>"MicrosoftRSASChannelCryptographicProvider"Then
.SetPasswordEncryptionOptions_
PasswordEncryptionProvider:="MicrosoftRSASChannelCryptographicProvider",_
PasswordEncryptionAlgorithm:="RC4",_
PasswordEncryptionKeyLength:=56,_
PasswordEncryptionFileProperties:=True
EndIf
EndWith
EndSub
PathPropertyReturnsaStringthatrepresentsthepathtothespecifiedAddIn,Application,orPresentationobjectorthepathfollowedbyaMotionEffectobject.Read-only.
expression.Path
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Ifyouusethispropertytoreturnapathforapresentationthathasnotbeensaved,itreturnsanemptystring.Usingthispropertytoreturnthepathforanadd-inthathasnotbeenloadedcausesanerror.
Thepathdoesn'tincludethefinalbackslash(\)orthenameofthespecifiedobject.UsetheNamepropertyofthePresentationobjecttoreturnthefilenamewithoutthepath,andusetheFullNamepropertytoreturnthefilenameandthepathtogether.
TheStringreturnedforaMotionEffectobjectisaspecificpaththatthemotioneffectfollowsbetweenFromandTousingthesamesyntaxastheVMLpathdescription.
Example
ThisexamplesavestheactivepresentationinthesamefolderasPowerPoint.
WithApplication
fName=.Path&"\testpresentation"
ActivePresentation.SaveAsfName
EndWith
ShowAll
PatternPropertyPatternpropertyasitappliestotheLineFormatobject.
Setsorreturnsavaluethatrepresentsthepatternappliedtothespecifiedline.Read/writeMsoPatternType.
MsoPatternTypecanbeoneoftheseMsoPatternTypeconstants.msoPattern10PercentmsoPattern20PercentmsoPattern25PercentmsoPattern30PercentmsoPattern40PercentmsoPattern50PercentmsoPattern5PercentmsoPattern60PercentmsoPattern70PercentmsoPattern75PercentmsoPattern80PercentmsoPattern90PercentmsoPatternDarkDownwardDiagonalmsoPatternDarkHorizontalmsoPatternDarkUpwardDiagonalmsoPatternDashedDownwardDiagonalmsoPatternDashedHorizontalmsoPatternDashedUpwardDiagonalmsoPatternDashedVerticalmsoPatternDiagonalBrickmsoPatternDivotmsoPatternDottedDiamondmsoPatternDottedGridmsoPatternHorizontalBrick
msoPatternLargeCheckerBoardmsoPatternLargeConfettimsoPatternLargeGridmsoPatternLightDownwardDiagonalmsoPatternLightHorizontalmsoPatternLightUpwardDiagonalmsoPatternLightVerticalmsoPatternMixedmsoPatternNarrowHorizontalmsoPatternNarrowVerticalmsoPatternOutlinedDiamondmsoPatternPlaidmsoPatternShinglemsoPatternSmallCheckerBoardmsoPatternSmallConfettimsoPatternSmallGridmsoPatternSolidDiamondmsoPatternSpheremsoPatternTrellismsoPatternWavemsoPatternWeavemsoPatternWideDownwardDiagonalmsoPatternWideUpwardDiagonalmsoPatternZigZagmsoPatternDarkVertical
expression.Pattern
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
PatternpropertyasitappliestotheFillFormatobject.
Setsorreturnsavaluethatrepresentsthepatternappliedtothespecifiedfill.UsetheBackColorandForeColorpropertiestosetthecolorsusedinthepattern.Read-onlyMsoPatternType.
MsoPatternTypecanbeoneoftheseMsoPatternTypeconstants.msoPattern10PercentmsoPattern20PercentmsoPattern25PercentmsoPattern30PercentmsoPattern40PercentmsoPattern50PercentmsoPattern5PercentmsoPattern60PercentmsoPattern70PercentmsoPattern75PercentmsoPattern80PercentmsoPattern90PercentmsoPatternDarkDownwardDiagonalmsoPatternDarkHorizontalmsoPatternDarkUpwardDiagonalmsoPatternDashedDownwardDiagonalmsoPatternDashedHorizontalmsoPatternDashedUpwardDiagonalmsoPatternDashedVerticalmsoPatternDiagonalBrickmsoPatternDivotmsoPatternDottedDiamondmsoPatternDottedGridmsoPatternHorizontalBrickmsoPatternLargeCheckerBoardmsoPatternLargeConfettimsoPatternLargeGridmsoPatternLightDownwardDiagonalmsoPatternLightHorizontalmsoPatternLightUpwardDiagonalmsoPatternLightVerticalmsoPatternMixed
msoPatternNarrowHorizontalmsoPatternNarrowVerticalmsoPatternOutlinedDiamondmsoPatternPlaidmsoPatternShinglemsoPatternSmallCheckerBoardmsoPatternSmallConfettimsoPatternSmallGridmsoPatternSolidDiamondmsoPatternSpheremsoPatternTrellismsoPatternWavemsoPatternWeavemsoPatternWideDownwardDiagonalmsoPatternWideUpwardDiagonalmsoPatternZigZagmsoPatternDarkVertical
expression.Pattern
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
ShowAll
PauseAnimationPropertyDetermineswhethertheslideshowpausesuntilthespecifiedmediaclipisfinishedplaying.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheslideshowcontinueswhilethemediaclipplaysinthebackground.msoTriStateMixedmsoTriStateTogglemsoTrueTheslideshowpausesuntilthespecifiedmediaclipisfinishedplaying.
Remarks
ForthePauseAnimationpropertysettingtotakeeffect,thePlayOnEntrypropertyofthespecifiedshapemustbesettomsoTrue.
Example
Thisexamplespecifiesthatshapethreeonslideoneintheactivepresentationwillbeplayedautomaticallywhenit'sanimatedandthattheslideshowwon'tcontinuewhilethemovieisplayinginthebackground.Shapethreemustbeasoundormovieobject.
SetOLEobj=ActivePresentation.Slides(1).Shapes(3)
WithOLEobj.AnimationSettings.PlaySettings
.PlayOnEntry=msoTrue
.PauseAnimation=msoTrue
EndWith
PermissionPropertyReturnsaPermissionobjectthatcanbeusedtorestrictpermissionstotheactivepresentationandtoreturnorsetspecificpermissionssettings.Read-only.
NoteUseofthePermissionobjectraisesanerroriftheWindowsRightsManagementclientisnotinstalled.
expression.Permission
expressionRequired.AnexpressionthatreturnsaPresentationobject.
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.
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
ShowAll
PerspectivePropertyDetermineswhethertheextrusionappearsinperspective.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheextrusionisaparallel,ororthographic,projection—thatis,ifthewallsdon'tnarrowtowardavanishingpoint.msoTriStateMixedmsoTriStateTogglemsoTrueTheextrusionappearsinperspective—thatis,ifthewallsoftheextrusionnarrowtowardavanishingpoint.
Example
ThisexamplesetstheextrusiondepthforshapeoneonmyDocumentto100pointsandspecifiesthattheextrusionbeparallel,ororthographic.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).ThreeD
.Visible=True
.Depth=100
.Perspective=msoFalse
EndWith
PictureFormatPropertyReturnsaPictureFormatobjectthatcontainspictureformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentpicturesorOLEobjects.Read-only.
Example
ThisexamplesetsthebrightnessandcontrastforshapeoneonmyDocument.ShapeonemustbeapictureoranOLEobject.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).PictureFormat
.Brightness=0.3
.Contrast=.75
EndWith
PlaceholderFormatPropertyReturnsaPlaceholderFormatobjectthatcontainsthepropertiesthatareuniquetoplaceholders.Read-only.
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
PlaceholdersPropertyReturnsaPlaceholderscollectionthatrepresentsthecollectionofalltheplaceholdersonaslide.Eachplaceholderinthecollectioncancontaintext,achart,atable,anorganizationalchart,oranotherobject.Read-only.
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
ShowAll
PlayOnEntryPropertyDetermineswhetherthespecifiedmovieorsoundisplayedautomaticallywhenit'sanimated.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedmovieorsoundisplayedautomaticallywhenit'sanimated.
Remarks
SettingthispropertytomsoTruesetstheAnimatepropertyoftheAnimationSettingsobjecttomsoTrue.SettingtheAnimatepropertytomsoFalseautomaticallysetsthePlayOnEntrypropertytomsoFalse.
UsetheActionVerbpropertytosettheverbthatwillbeinvokedwhenthemediaclipisanimated.
Example
Thisexamplespecifiesthatshapethreeonslideoneintheactivepresentationwillbeplayedautomaticallywhenit'sanimated.Shapethreemustbeasoundormovieobject.
SetOLEobj=ActivePresentation.Slides(1).Shapes(3)
OLEobj.AnimationSettings.PlaySettings.PlayOnEntry=msoTrue
PlaySettingsPropertyReturnsaPlaySettingsobjectthatcontainsinformationabouthowthespecifiedmediaclipplaysduringaslideshow.
expression.PlaySettings
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
PointerColorPropertyPointerColorPropertyasitappliestotheSlideShowSettingsobject.
ReturnsthepointercolorforthespecifiedpresentationasaColorFormatobject.Thiscolorissavedwiththepresentationandisthedefaultpencoloreachtimeyoushowthepresentation.Read-only.
PointerColorPropertyasitappliestotheSlideShowViewobject.
ReturnsaColorFormatobjectthatrepresentsthepointercolorforthespecifiedpresentationduringoneslideshow.Assoonastheslideshowisfinished,thecolorrevertstothedefaultcolorforthepresentation.Read-only.
Remarks
Tochangethepointertoapen,setthePointerTypepropertytoppSlideShowPointerPen.
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
ShowAll
PointerTypePropertyReturnsorsetsthetypeofpointerusedintheslideshow.Read/writePpSlideShowPointerType.
PpSlideShowPointerTypecanbeoneofthesePpSlideShowPointerTypeconstants.ppSlideShowPointerAlwaysHiddenppSlideShowPointerArrowppSlideShowPointerAutoArrowppSlideShowPointerNoneppSlideShowPointerPen
expression.PointerType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplerunsaslideshowoftheactivepresentation,changesthepointertoapen,andsetsthepencolorforthisslideshowtored.
SetcurrView=ActivePresentation.SlideShowSettings.Run.View
WithcurrView
.PointerColor.RGB=RGB(255,0,0)
.PointerType=ppSlideShowPointerPen
EndWith
ShowAll
PointsPropertyPointspropertyasitappliestothePropertyEffectobject.
ReturnsanAnimationPointsobjectthatrepresentsapointinananimation.UsetheFromandTopropertiestosetthevalueofthisproperty.
expression.Points
expressionRequired.AnexpressionthatreturnsaPropertyEffectobject.
PointspropertyasitappliestotheShapeNodeobject.
ReturnsaVariantthatrepresentsthepositionofthespecifiednodeasacoordinatepair.Eachcoordinateisexpressedinpoints.UsetheSetPositionmethodtosetthevalueofthisproperty.Read-only.
expression.Points
expressionRequired.AnexpressionthatreturnsaShapeNodeobject.
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
PositionPropertyReturnsorsetsthepositionofthespecifiedtabstop,inpoints.Read/writeSingle.
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
PresentationPropertyReturnsaPresentationobjectthatrepresentsthepresentationinwhichthespecifieddocumentwindoworslideshowwindowwascreated.Read-only.
Remarks
Iftheslidethat'scurrentlydisplayedindocumentwindowoneisfromanembeddedpresentation,Windows(1).View.Slide.Parentreturnstheembeddedpresentation,andWindows(1).Presentationreturnsthepresentationinwhichdocumentwindowonewascreated.
Iftheslidethat'scurrentlydisplayedinslideshowwindowoneisfromanembeddedpresentation,SlideShowWindows(1).View.Slide.Parentreturnstheembeddedpresentation,andSlideShowWindows(1).Presentationreturnsthepresentationinwhichtheslideshowwasstarted.
Example
Thisexamplecontinuestheslidenumberingforthepresentationinwindowoneintotheslidenumberingforthepresentationinwindowtwo.
firstPresSlides=Windows(1).Presentation.Slides.Count
Windows(2).Presentation.PageSetup_
.FirstSlideNumber=firstPresSlides+1
PresentationElapsedTimePropertyReturnsthenumberofsecondsthathaveelapsedsincethebeginningofthespecifiedslideshow.Read-onlyLong.
Example
Thisexamplegoestoslideseveninslideshowwindowoneifmorethanfiveminuteshaveelapsedsincethebeginningoftheslideshow.
WithSlideShowWindows(1).View
If.PresentationElapsedTime>300Then
.GotoSlide7
EndIf
EndWith
PresentationsPropertyReturnsaPresentationscollectionthatrepresentsallopenpresentations.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
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
ShowAll
PreservedPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetheradesignmasterispreservedfromchanges.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseThedesignmasterisnotpreservedandcanbeedited.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThedesignmasterispreservedandcannotbeedited.
expression.Preserved
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thefollowinglineofcodelocksandpreservesthefirstdesignmaster.
SubPreserveMaster
ActivePresentation.Designs(1).Preserved=msoTrue
EndSub
ShowAll
PresetExtrusionDirectionPropertyReturnsthedirectionthattheextrusion'ssweeppathtakesawayfromtheextrudedshape(thefrontfaceoftheextrusion).Read-onlyMsoPresetExtrusionDirection.
MsoPresetExtrusionDirectioncanbeoneoftheseMsoPresetExtrusionDirectionconstants.msoExtrusionBottommsoExtrusionBottomLeftmsoExtrusionBottomRightmsoExtrusionLeftmsoExtrusionNonemsoExtrusionRightmsoExtrusionTopmsoExtrusionTopLeftmsoExtrusionTopRightmsoPresetExtrusionDirectionMixed
expression.PresetExtrusionDirection
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thispropertyisread-only.Tosetthevalueofthisproperty,usetheSetExtrusionDirectionmethod.
Example
ThisexamplechangeseachextrusiononmyDocumentthatextendstowardtheupper-leftcorneroftheextrusion'sfrontfacetoanextrusionthatextendstowardthelower-rightcornerofthefrontface.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Withs.ThreeD
If.PresetExtrusionDirection=msoExtrusionTopLeftThen
.SetExtrusionDirectionmsoExtrusionBottomRight
EndIf
EndWith
Next
ShowAll
PresetGradientTypePropertyReturnsthepresetgradienttypeforthespecifiedfill.Read-onlyMsoPresetGradientType.UsethePresetGradientmethodtosetthepresetgradienttypeforthefill.
MsoPresetGradientTypecanbeoneoftheseMsoPresetGradientTypeconstants.msoGradientBrassmsoGradientCalmWatermsoGradientChromemsoGradientChromeIImsoGradientDaybreakmsoGradientDesertmsoGradientEarlySunsetmsoGradientFiremsoGradientFogmsoGradientGoldmsoGradientGoldIImsoGradientHorizonmsoGradientLateSunsetmsoGradientMahoganymsoGradientMossmsoGradientNightfallmsoGradientOceanmsoGradientParchmentmsoGradientPeacockmsoGradientRainbowmsoGradientRainbowIImsoGradientSapphiremsoGradientSilvermsoGradientWheatmsoPresetGradientMixed
expression.PresetGradientType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplechangesthefillforallshapesinmyDocumentwiththeMosspresetgradientfilltotheFogpresetgradientfill.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Withs.Fill
If.PresetGradientType=msoGradientMossThen
.PresetGradient=msoGradientFog
EndIf
EndWith
Next
ShowAll
PresetLightingDirectionPropertyReturnsorsetsthepositionofthelightsourcerelativetotheextrusion.Read/writeMsoPresetLightingDirection.
MsoPresetLightingDirectioncanbeoneoftheseMsoPresetLightingDirectionconstants.msoLightingBottommsoLightingBottomLeftmsoLightingBottomRightmsoLightingLeftmsoLightingNonemsoLightingRightmsoLightingTopmsoLightingTopLeftmsoLightingTopRightmsoPresetLightingDirectionMixed
expression.PresetLightingDirection
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
NoteYouwon'tseethelightingeffectsyousetiftheextrusionhasawireframesurface.
Example
ThisexamplespecifiesthattheextrusionforshapeoneonmyDocumentextendtowardthetopoftheshapeandthatthelightingfortheextrusioncomefromtheleft.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).ThreeD
.Visible=True
.SetExtrusionDirectionmsoExtrusionTop
.PresetLightingDirection=msoLightingLeft
EndWith
ShowAll
PresetLightingSoftnessPropertyReturnsorsetstheintensityoftheextrusionlighting.Read/writeMsoPresetLightingSoftness.
MsoPresetLightingSoftnesscanbeoneoftheseMsoPresetLightingSoftnessconstants.msoLightingBrightmsoLightingDimmsoLightingNormalmsoPresetLightingSoftnessMixed
expression.PresetLightingSoftness
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplespecifiesthattheextrusionforshapeoneonmyDocumentbelitbrightlyfromtheleft.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).ThreeD
.Visible=True
.PresetLightingSoftness=msoLightingBright
.PresetLightingDirection=msoLightingLeft
EndWith
ShowAll
PresetMaterialPropertyReturnsorsetstheextrusionsurfacematerial.Read/writeMsoPresetMaterial.
MsoPresetMaterialcanbeoneoftheseMsoPresetMaterialconstants.msoMaterialMattemsoMaterialMetalmsoMaterialPlasticmsoMaterialWireFramemsoPresetMaterialMixed
expression.PresetMaterial
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplespecifiesthattheextrusionsurfaceforshapeoneinmyDocumentbewireframe.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).ThreeD
.Visible=True
.PresetMaterial=msoMaterialWireFrame
EndWith
ShowAll
PresetShapePropertyReturnsorsetstheshapeofthespecifiedWordArt.Read/writeMsoPresetTextEffectShape.
MsoPresetTextEffectShapecanbeoneoftheseMsoPresetTextEffectShapeconstants.msoTextEffectShapeArchDownCurvemsoTextEffectShapeArchDownPourmsoTextEffectShapeArchUpCurvemsoTextEffectShapeArchUpPourmsoTextEffectShapeButtonCurvemsoTextEffectShapeButtonPourmsoTextEffectShapeCanDownmsoTextEffectShapeCanUpmsoTextEffectShapeCascadeDownmsoTextEffectShapeCascadeUpmsoTextEffectShapeChevronDownmsoTextEffectShapeChevronUpmsoTextEffectShapeCircleCurvemsoTextEffectShapeCirclePourmsoTextEffectShapeCurveDownmsoTextEffectShapeCurveUpmsoTextEffectShapeDeflatemsoTextEffectShapeDeflateBottommsoTextEffectShapeDeflateInflatemsoTextEffectShapeDeflateInflateDeflatemsoTextEffectShapeDeflateTopmsoTextEffectShapeDoubleWave2msoTextEffectShapeFadeDownmsoTextEffectShapeFadeLeftmsoTextEffectShapeFadeRight
msoTextEffectShapeFadeUpmsoTextEffectShapeInflatemsoTextEffectShapeInflateBottommsoTextEffectShapeInflateTopmsoTextEffectShapeMixedmsoTextEffectShapePlainTextmsoTextEffectShapeRingInsidemsoTextEffectShapeRingOutsidemsoTextEffectShapeSlantDownmsoTextEffectShapeSlantUpmsoTextEffectShapeStopmsoTextEffectShapeTriangleDownmsoTextEffectShapeTriangleUpmsoTextEffectShapeWave1msoTextEffectShapeWave2msoTextEffectShapeDoubleWave1
expression.PresetShape
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
SettingthePresetTextEffectpropertyautomaticallysetsthePresetShapeproperty.
Example
ThisexamplesetstheshapeofallWordArtonmyDocumenttoachevronwhosecenterpointsdown.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Ifs.Type=msoTextEffectThen
s.TextEffect.PresetShape=msoTextEffectShapeChevronDown
EndIf
Next
ShowAll
PresetTextEffectPropertyReturnsorsetsthestyleofthespecifiedWordArt.ThevaluesforthispropertycorrespondtotheformatsintheWordArtGallerydialogbox(numberedfromlefttoright,toptobottom).Read/writeMsoPresetTextEffect.
MsoPresetTextEffectcanbeoneoftheseMsoPresetTextEffectconstants.msoTextEffect1msoTextEffect2msoTextEffect3msoTextEffect4msoTextEffect5msoTextEffect6msoTextEffect7msoTextEffect8msoTextEffect9msoTextEffect10msoTextEffect11msoTextEffect12msoTextEffect13msoTextEffect14msoTextEffect15msoTextEffect16msoTextEffect17msoTextEffect18msoTextEffect19msoTextEffect20msoTextEffect21msoTextEffect22msoTextEffect23msoTextEffect24msoTextEffect25
msoTextEffect26msoTextEffect27msoTextEffect28msoTextEffect29msoTextEffect30msoTextEffectMixed
expression.PresetTextEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
SettingthePresetTextEffectpropertyautomaticallysetsmanyotherformattingpropertiesofthespecifiedshape.
Example
ThisexamplesetsthestyleforallWordArtonmyDocumenttothefirststylelistedintheWordArtGallerydialogbox.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Ifs.Type=msoTextEffectThen
s.TextEffect.PresetTextEffect=msoTextEffect1
EndIf
Next
ShowAll
PresetTexturePropertyReturnsthepresettextureforthespecifiedfill.Read-onlyMsoPresetTexture.
MsoPresetTexturecanbeoneoftheseMsoPresetTextureconstants.msoPresetTextureMixedmsoTextureBlueTissuePapermsoTextureBouquetmsoTextureBrownMarblemsoTextureCanvasmsoTextureCorkmsoTextureDenimmsoTextureFishFossilmsoTextureGranitemsoTextureGreenMarblemsoTextureMediumWoodmsoTextureNewsprintmsoTextureOakmsoTexturePaperBagmsoTexturePapyrusmsoTextureParchmentmsoTexturePinkTissuePapermsoTexturePurpleMeshmsoTextureRecycledPapermsoTextureSandmsoTextureStationerymsoTextureWalnutmsoTextureWaterDropletsmsoTextureWhiteMarblemsoTextureWovenMat
expression.PresetTexture
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
UsethePresetTexturedmethodtosetthepresettextureforthefill.
Example
ThisexampleaddsarectangletothemyDocumentandsetsitspresettexturetomatchthatofshapetwo.Fortheexampletowork,shapetwomusthaveapresettexturedfill.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes
presetTexture2=.Item(2).Fill.PresetTexture
.AddShape(msoShapeRectangle,100,0,40,80).Fill_
.PresetTexturedpresetTexture2
EndWith
ShowAll
PresetThreeDFormatPropertyReturnsthepresetextrusionformat.Eachpresetextrusionformatcontainsasetofpresetvaluesforthevariouspropertiesoftheextrusion.Thevaluesforthispropertycorrespondtotheoptions(numberedfromlefttoright,toptobottom)displayedwhenyouclickthe3-DbuttonontheDrawingtoolbar.Read-onlyMsoPresetThreeDFormat.
MsoPresetThreeDFormatcanbeoneoftheseMsoPresetThreeDFormatconstants.msoPresetThreeDFormatMixedTheextrusionhasacustomformatratherthanapresetformat.msoThreeD1msoThreeD2msoThreeD3msoThreeD4msoThreeD5msoThreeD6msoThreeD7msoThreeD8msoThreeD9msoThreeD10msoThreeD11msoThreeD12msoThreeD13msoThreeD14msoThreeD15msoThreeD16msoThreeD17msoThreeD18msoThreeD19msoThreeD20
expression.PresetThreeDFormat
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thispropertyisread-only.Tosetthepresetextrusionformat,usetheSetThreeDFormatmethod.
Example
ThisexamplesetstheextrusionformatforshapeoneonmyDocumentto3DStyle12iftheshapeinitiallyhasacustomextrusionformat.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(1).ThreeD
If.PresetThreeDFormat=msoPresetThreeDFormatMixedThen
.SetThreeDFormatmsoThreeD12
EndIf
EndWith
ShowAll
PrintColorTypePropertyReturnsorsetsthewaythespecifieddocumentwillbeprinted:inblackandwhite,inpureblackandwhite(alsoreferredtoashighcontrast),orincolor.Thedefaultvalueissetbytheprinter.Read/writePpPrintColorType.
PpPrintColorTypecanbeoneofthesePpPrintColorTypeconstants.ppPrintBlackAndWhiteppPrintColorppPrintPureBlackAndWhite
expression.PrintColorType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampleprintstheslidesintheactivepresentationincolor.
WithApplication.ActivePresentation
.PrintOptions.PrintColorType=ppPrintColor
.PrintOut
EndWith
ShowAll
PrintCommentsPropertySetsorreturnswhethercommentswillbeprinted.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Commentswillnotbeprinted.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueCommentswillbeprinted.
expression.PrintComments
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexampleinstructsMicrosoftPowerPointtoprintcomments.
SubPrintPresentationComments
ActivePresentation.PrintOptions.PrintComments=msoTrue
EndSub
ShowAll
PrintFontsAsGraphicsPropertyDetermineswhetherTrueTypefontsareprintedasgraphics.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTrueTypefontsareprintedasgraphics.
Example
ThisexamplespecifiesthatTrueTypefontsintheactivepresentationbeprintedasgraphics.
ActivePresentation.PrintOptions.PrintFontsAsGraphics=msoTrue
ShowAll
PrintHiddenSlidesPropertyDetermineswhetherhiddenslidesinthespecifiedpresentationwillbeprinted.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueThehiddenslidesinthespecifiedpresentationwillbeprinted.
Example
Thisexampleprintsallslides,whethervisibleorhidden,intheactivepresentation.
WithActivePresentation
.PrintOptions.PrintHiddenSlides=msoTrue
.PrintOut
EndWith
ShowAll
PrintInBackgroundPropertyDetermineswhetherthespecifiedpresentationisprintedinthebackground.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.Thespecifiedpresentationisprintedinthebackground,whichmeansthatyoucancontinuetoworkwhileit'sbeingprinted.
Example
Thisexampleprintstheactivepresentationinthebackground.
WithActivePresentation
.PrintOptions.PrintInBackground=msoTrue
.PrintOut
EndWith
PrintOptionsPropertyReturnsaPrintOptionsobjectthatrepresentsprintoptionsthataresavedwiththespecifiedpresentation.Read-only.
Example
Thisexamplecauseshiddenslidesintheactivepresentationtobeprinted,anditscalestheprintedslidestofitthepapersize.
WithApplication.ActivePresentation
With.PrintOptions
.PrintHiddenSlides=True
.FitToPage=True
EndWith
.PrintOut
EndWith
PrintStepsPropertyReturnsthenumberofslidesyou'dneedtoprinttosimulatethebuildsonthespecifiedslide,slidemaster,orrangeofslides.Read-onlyLong.
Example
Thisexamplesetsavariabletothenumberofslidesyou'dneedtoprinttosimulatethebuildsonslideoneintheactivepresentationandthendisplaysthevalueofthevariable.
steps1=ActivePresentation.Slides(1).PrintSteps
MsgBoxsteps1
ProductCodePropertyReturnstheMicrosoftPowerPointgloballyuniqueidentifier(GUID).YoumightusetheGUID,forexample,whenmakingprogramcallstoanApplicationProgrammingInterface(API).Read-onlyString.
Example
ThisexamplereturnsthePowerPointGUIDtothevariablepptGUID.
DimpptGUIDAsString
pptGUID=Application.ProductCode
ShowAll
ProgIDPropertyReturnstheprogrammaticidentifier(ProgID)forthespecifiedOLEobject.Read-onlyString.
Example
ThisexampleloopsthroughalltheobjectsonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.
ForEachsldInActivePresentation.Slides
ForEachshInsld.Shapes
Ifsh.Type=msoLinkedOLEObjectThen
Ifsh.OLEFormat.ProgID="Excel.Sheet"Then
sh.LinkFormat.AutoUpdate=ppUpdateOptionManual
EndIf
EndIf
Next
Next
ShowAll
PropertyPropertySetsorreturnsanMsoAnimPropertyconstantthatrepresentsananimationproperty.Read/write.
MsoAnimPropertycanbeoneoftheseMsoAnimPropertyconstants.msoAnimColormsoAnimHeigthmsoAnimNoneDefault.msoAnimOpacitymsoAnimRotationmsoAnimShape3DExtrudeForwardmsoAnimShape3DExtrusionColormsoAnimShape3DXRotationAnglemsoAnimShape3DYRotationAnglemsoAnimShapefBackColormsoAnimShapefColormsoAnimShapefGradientPresetmsoAnimShapefGradientTypemsoAnimShapeFlipHmsoAnimShapeFlipVmsoAnimShapefOnmsoAnimShapefOpacitymsoAnimShapefTypemsoAnimShapelColormsoAnimShapelDashesmsoAnimShapelEndArrowHeadmsoAnimShapelEndArrowLengthmsoAnimShapelEndArrowWidthmsoAnimShapelOnmsoAnimShapelStartArrowHeadmsoAnimShapelStartArrowLength
msoAnimShapelStartArrowWidthmsoAnimShapelStylemsoAnimShapelWidthmsoAnimShapepBrightnessmsoAnimShapepContrastmsoAnimShapepCropFromBottommsoAnimShapepCropFromLeftmsoAnimShapepCropFromRightmsoAnimShapepCropFromTopmsoAnimShapepFilenamemsoAnimShapepGammamsoAnimShapepGrayscalemsoAnimShapeRotationmsoAnimShapesColormsoAnimShapesEmbossedmsoAnimShapesOffsetXmsoAnimShapesOffsetYmsoAnimShapesOnmsoAnimShapesOpacitymsoAnimShapesTypemsoAnimShapeTypemsoAnimShapewfontBoldmsoAnimShapewfontItalicmsoAnimShapewfontNamemsoAnimShapewfontShadowmsoAnimShapewfontSizemsoAnimShapewfontSmallCapsmsoAnimShapewfontStrikeThroughmsoAnimShapewfontUnderlinemsoAnimShapewSpacingmsoAnimShapewVerticalmsoAnimTextBulletCharactermsoAnimTextBulletColor
msoAnimTextBulletFontNamemsoAnimTextBulletNumbermsoAnimTextBulletPicturemsoAnimTextBulletRelativeSizemsoAnimTextBulletStylemsoAnimTextBulletTypemsoAnimTextFontBoldmsoAnimTextFontColormsoAnimTextFontEmbossmsoAnimTextFontItalicmsoAnimTextFontNamemsoAnimTextFontShadowmsoAnimTextFontSizemsoAnimTextFontStrikeThroughmsoAnimTextFontSubscriptmsoAnimTextFontSuperscriptmsoAnimTextFontUnderlinemsoAnimWidthmsoAnimXmsoAnimY
expression.Property
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
PropertyEffectPropertyReturnsaPropertyEffectobjectforagivenanimationbehavior.
expression.PropertyEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
PublishObjectsPropertyReturnsaPublishObjectscollectionrepresentingthesetofcompleteorpartialloadedpresentationsthatareavailabletopublishtoHTML.Read-only.
Example
ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.
WithActivePresentation.PublishObjects.Item(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.Publish
EndWith
RangeEndPropertyReturnsorsetsthenumberofthelastslideinarangeofslidesyouarepublishingasaWebpresentation.Read/writeInteger.
Example
ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.
WithActivePresentation.PublishObjects(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.Publish
EndWith
RangesPropertyReturnsthePrintRangesobject,whichrepresentstherangesofslidesinthepresentationtobeprinted.Read-only.
Remarks
Ifyoudon'twanttoprintanentirepresentation,youmustusetheAddmethodtocreateaPrintRangeobjectforeachconsecutiverunofslidesyouwanttoprint.Forexample,ifyouwanttoprintslide1,slides3through5,andslides8and9inaspecifiedpresentation,youmustcreatethreePrintRangeobjects:onethatrepresentsslide1;onethatrepresentsslides3through5;andonethatrepresentsslides8and9.Formoreinformation,seetheexampleforthisproperty.
TheRangeTypepropertymustbesettoppPrintSlideRangefortherangesinthePrintRangescollectiontobeapplied.
ToclearalltheexistingprintrangesfromthePrintRangescollection,usetheClearAllmethod.
SpecifyingavaluefortheToandFromargumentsofthePrintOutmethodsetsthecontentsofthePrintRangesobject.
Example
Thisexampleprintsslide1,slides3through5,andslides8and9intheactivepresentation.
WithActivePresentation
With.PrintOptions
.RangeType=ppPrintSlideRange
With.Ranges
.Add1,1
.Add3,5
.Add8,9
EndWith
EndWith
.PrintOut
EndWith
RangeStartPropertyReturnsorsetsthenumberofthefirstslideinarangeofslidesyouarepublishingasaWebpresentation.Read/writeInteger.
Example
ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.
WithActivePresentation.PublishObjects(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.Publish
EndWith
ShowAll
RangeTypePropertyRangeTypepropertyasitappliestothePrintOptionsobject.
Returnsorsetsthetypeofprintrangeforthepresentation.Read/writePpPrintRangeType.
PpPrintRangeTypecanbeoneofthesePpPrintRangeTypeconstants.ppPrintAllppPrintCurrentppPrintNamedSlideShowppPrintSelectionppPrintSlideRange
expression.RangeType
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
RangeTypepropertyasitappliestotheSlideShowSettingsobject.
Returnsorsetsthetypeofslideshowtorun.Read/writePpSlideShowRangeType.
PpSlideShowRangeTypecanbeoneofthesePpSlideShowRangeTypeconstants.ppShowAllppShowNamedSlideShowppShowSlideRange
expression.RangeType
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Remarks
Toprinttheslidesrangesyou'vedefinedinthePrintRangescollection,youmustfirstsettheRangeTypepropertytoppPrintSlideRange.SettingRangeTypetoanythingotherthanppPrintSlideRangemeansthattherangesyou'vedefinedinthePrintRangescollectionwon'tbeapplied.However,thisdoesn'taffectthecontentsofthePrintRangescollectioninanyway.Thatis,ifyoudefinesomeprintranges,settheRangeTypepropertytoavalueotherthanppPrintSlideRange,andthenlatersetRangeTypebacktoppPrintSlideRange,theprintrangesyoudefinedbeforewillremainunchanged.
SpecifyingavaluefortheToandFromargumentsofthePrintOutmethodsetsthevalueofthisproperty.
Example
AsitappliestothePrintOptionsobject.
Thisexampleprintsthecurrentslidetheactivepresentation.
WithActivePresentation
.PrintOptions.RangeType=ppPrintCurrent
.PrintOut
EndWith
AsitappliestotheSlideShowSettingsobject.
Thisexamplerunsthenamedslideshow"QuickShow."
WithActivePresentation.SlideShowSettings
.RangeType=ppShowNamedSlideShow
.SlideShowName="QuickShow"
.Run
EndWith
ShowAll
ReadOnlyPropertyReturnswhetherthespecifiedpresentationisread-only.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedpresentationisread-only.
Example
Iftheactivepresentationisread-only,thisexamplesavesitasNewfile.ppt.
WithApplication.ActivePresentation
If.ReadOnlyThen.SaveAsFileName:="newfile"
EndWith
ShowAll
RegisteredPropertyReturnswhetherthespecifiedadd-inisregisteredintheWindowsregistry.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedadd-inisregisteredintheWindowsregistry.
Example
Thisexampleregisterstheadd-innamed"MyTools"intheWindowsregistry.
Application.Addins("MyTools").Registered=msoTrue
ShowAll
RelativePropertyMsoTruetosetthemotionpositionrelativetothepositionoftheshape.Thispropertyisonlyusedinconjunctionwithmotionpaths.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Themotionpathisabsolute.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThemotionpathisrelative.
expression.Relative
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
RelativeSizePropertyReturnsorsetsthebulletsizerelativetothesizeofthefirsttextcharacterintheparagraph.Canbeafloating-pointvaluefrom0.25through4,indicatingthatthebulletsizecanbefrom25percentthrough400percentofthetext-charactersize.Read/writeSingle.
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
ShowAll
RelyOnVMLPropertyDetermineswwhetherimagefilesaregeneratedfromdrawingobjectswhenyousaveorpublishacompleteorpartialpresentationasaWebpage.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.ImagesarenotgeneratedfromdrawingobjectswhenyousaveorpublishacompleteorpartialpresentationasaWebpage.msoTriStateMixedmsoTriStateTogglemsoTrueImagefilesaregeneratedfromdrawingobjectswhenyousaveorpublishacompleteorpartialpresentationasaWebpage.
Remarks
Youcanreducefilesizesbynotgeneratingimagesfordrawingobjects,ifyourWebbrowsersupportsVectorMarkupLanguage(VML).Forexample,MicrosoftInternetExplorer5andhighersupportthisfeature,andyoushouldsettheRelyOnVMLpropertytomsoTrueifyouaretargetingthisbrowser.ForbrowsersthatdonotsupportVML,theimagewillnotappearwhenyouviewaWebpagesavedwiththispropertysettomsoTrue.
Forexample,youshouldnotgenerateimagesifyourWebpageusesimagefilesthatyouhavegeneratedearlier,andifthelocationwhereyousavethepresentationisdifferentfromthefinallocationofthepageontheWebserver.
Example
ThisexamplespecifiesthatimagefilesaregeneratedwhensavingorpublishingtheactivepresentationtoaWebpage.
ActivePresentation.WebOptions.RelyOnVML=msoFalse
ShowAll
RemovePersonalInformationPropertyMsoTrueforMicrosoftPowerPointtoremovealluserinformationfromcomments,revisions,andthePropertiesdialogboxuponsavingapresentation.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseComments,revisions,andpersonalinformationremaininthepresentation.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueRemovescomments,revisions,andpersonalinformationwhensavingpresentation.
expression.RemovePersonalInformation
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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.
Example
Thisexamplesetstheactivepresentationtoremovepersonalinformationthenexttimetheusersavesit.
SubRemovePersonalInfo()
ActivePresentation.RemovePersonalInformation=msoTrue
EndSub
RepeatCountPropertySetsorreturnsanLongthatrepresentsthenumberoftimestorepeatananimation.Read/write.
expression.RepeatCount
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
RepeatDurationPropertySetsorreturnsaSinglethatrepresents,inseconds,howlongrepeatedanimationsshouldlast.Read/write.
expression.RepeatDuration
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
AnanimationwillstopattheendofitstimesequenceorthevalueoftheRepeatDurationproperty,whicheverisshorter.
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
ShowAll
ResizeGraphicsPropertyDetermineswhetherslidesandanygraphicsonthemaresizedtofittheWebpagedisplayareaofthetargetWebbrowser.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseSlidesandgraphicsremainthesizetheyareinthesourcepresentation,regardlessoftheWebbrowserdisplayarea.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.SlidesandanygraphicsonthemaresizedtofittheWebpagedisplayareaofthetargetWebbrowser.
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
ShowAll
RestartPropertySetsorreturnsanMsoAnimEffectRestartconstantthatrepresentswhethertheanimationeffectrestartsaftertheeffecthasstartedonce.Read/write.
MsoAnimEffectRestartcanbeoneoftheseMsoAnimEffectRestartconstants.msoAnimEffectRestartAlwaysmsoAnimEffectRestartNeverDefault.msoAnimEffectRestartWhenOff
expression.Restart
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
RevealPropertySetsorreturnsaMsoTriStateconstantthatdetermineshowtheembeddedobjectswillberevealed.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseComments,revisions,andpersonalinformationremaininthepresentation.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueRemovescomments,revisions,andpersonalinformationwhensavingthepresentation.
expression.Reveal
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
SettingavalueofmsoTruefortheRevealpropertywhenthefiltereffecttypeismsoAnimFilterEffectTypeWipewillmaketheshapeappear.SettingavalueofmsoFalsewillmaketheobjectdisappear.Inotherwords,ifyourfilterissettowipeandRevealistrue,youwillgetawipeineffectandwhenRevealisfalse,youwillgetawipeouteffect.
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
ShowAll
ReversePropertySetsorreturnsanMsoTriStateconstantthatrepresentsadiagram'sreversestate.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseThediagramisnotreversed.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueThediagramisreversed.
expression.Reverse
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thismethodgeneratesanerrorifthevalueofthetargetdiagram'sTypepropertyisanorganizationchart(msoDiagramTypeOrgChart).
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
ShowAll
RewindAtEndPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetheranobjectreturnstoitsbeginningpositionafterananimationhasended.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Theobjectdoesnotreturntoitsbeginningpositionafterananimationhasended.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueTheobjectreturnstoitsbeginningpositionafterananimationhasended.
expression.RewindAtEnd
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
RewindMoviePropertyDetermineswhetherthefirstframeofthespecifiedmovieisautomaticallyredisplayedassoonasthemoviehasfinishedplaying.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThefirstframeofthespecifiedmovieisautomaticallyredisplayedassoonasthemoviehasfinishedplaying.
Example
Thisexamplespecifiesthatthefirstframeofthemovierepresentedbyshapethreeonslideoneintheactivepresentationwillbeautomaticallyredisplayedwhenthemoviehasfinishedplaying.Shapethreemustbeamovieobject.
SetOLEobj=ActivePresentation.Slides(1).Shapes(3)
OLEobj.AnimationSettings.PlaySettings.RewindMovie=msoTrue
ShowAll
RGBPropertyRGBpropertyasitappliestotheColorFormatobject.
Returnsorsetsthered-green-blue(RGB)valueofthespecifiedcolor.Read/writeLong.
RGBpropertyasitappliestotheRGBColorobject.
Returnsorsetsthered-green-blue(RGB)valueofaspecifiedcolor-schemecolororextracolorwhenusedwitharead/writePpColorSchemeIndexconstant.TheColorsmethodisusedtoreturntheRGBColorobject.
PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppShadowppTitle
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
RootPropertyReturnsaDiagramNodeobjectthatrepresentstherootdiagramnodetowhichthesourcediagramnodebelongs.
expression.Root
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
RotatedCharsPropertyDetermineswhethercharactersinthespecifiedWordArtarerotated90degreesrelativetotheWordArt'sboundingshape.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseCharactersinthespecifiedWordArtretaintheiroriginalorientationrelativetotheboundingshape.msoTriStateMixedmsoTriStateTogglemsoTrueCharactersinthespecifiedWordArtarerotated90degreesrelativetotheWordArt'sboundingshape.
Remarks
IftheWordArthashorizontaltext,settingtheRotatedCharspropertytomsoTruerotatesthecharacters90degreescounterclockwise.IftheWordArthasverticaltext,settingtheRotatedCharspropertytomsoFalserotatesthecharacters90degreesclockwise.UsetheToggleVerticalTextmethodtoswitchbetweenhorizontalandverticaltextflow.
TheFlipmethodandRotationpropertyoftheShapeobjectandtheRotatedCharspropertyandToggleVerticalTextmethodoftheTextEffectFormatobjectallaffectthecharacterorientationanddirectionoftextflowinaShapeobjectthatrepresentsWordArt.Youmayhavetoexperimenttofindouthowtocombinetheeffectsofthesepropertiesandmethodstogettheresultyouwant.
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
ShowAll
RotationPropertyReturnsorsetsthenumberofdegreesthespecifiedshapeisrotatedaroundthez-axis.Apositivevalueindicatesclockwiserotation;anegativevalueindicatescounterclockwiserotation.Read/writeSingle
Remarks
Tosettherotationofathree-dimensionalshapearoundthex-axisorthey-axis,usetheRotationXpropertyortheRotationYpropertyoftheThreeDFormatobject.
Example
ThisexamplematchestherotationofallshapesonmyDocumenttotherotationofshapeone.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes
sh1Rotation=.Item(1).Rotation
Foro=1To.Count
.Item(o).Rotation=sh1Rotation
Next
EndWith
RotationEffectPropertyReturnsaRotationEffectobjectforananimationbehavior.
expression.RotationEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
RotationXPropertyReturnsorsetstherotationoftheextrudedshapearoundthex-axis,indegrees.Canbeavaluefrom–90through90.Apositivevalueindicatesupwardrotation;anegativevalueindicatesdownwardrotation.Read/writeSingle.
Remarks
Tosettherotationoftheextrudedshapearoundthey-axis,usetheRotationYpropertyoftheThreeDFormatobject.Tosettherotationoftheextrudedshapearoundthez-axis,usetheRotationpropertyoftheShapeobject.Tochangethedirectionoftheextrusion'ssweeppathwithoutrotatingthefrontfaceoftheextrusion,usetheSetExtrusionDirectionmethod.
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
ShowAll
RotationYPropertyReturnsorsetstherotationoftheextrudedshapearoundthey-axis,indegrees.Canbeavaluefrom–90through90.Apositivevalueindicatesrotationtotheleft;anegativevalueindicatesrotationtotheright.Read/writeSingle.
Remarks
Tosettherotationoftheextrudedshapearoundthex-axis,usetheRotationXpropertyoftheThreeDFormatobject.Tosettherotationoftheextrudedshapearoundthez-axis,usetheRotationpropertyoftheShapeobject.Tochangethedirectionoftheextrusion'ssweeppathwithoutrotatingthefrontfaceoftheextrusion,usetheSetExtrusionDirectionmethod.
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
RowsPropertyReturnsaRowscollectionthatrepresentsalltherowsinatable.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
Thisexampledeletesthethirdrowfromthetableinshapefiveofslidetwointheactivepresentation.
ActivePresentation.Slides(2).Shapes(5).Table.Rows(3).Delete
Thisexampleappliesadashedlinestyletothebottomborderofthesecondrowoftablecells.
ActiveWindow.Selection.ShapeRange.Table.Rows(2)_
.Cells.Borders(ppBorderBottom).DashStyle=msoLineDash
RulerPropertyReturnsaRulerobjectthatrepresentstherulerforthespecifiedtext.Read-only.
Example
Thisexamplesetsaleft-alignedtabstopat2inches(144points)forthetextinshapetwoonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes(2).TextFrame.Ruler.TabStops_
.AddppTabStopLeft,144
RunPropertyReturnsorsetsthenameofthepresentationormacrotoberunwhenthespecifiedshapeisclickedorthemousepointerpassesovertheshapeduringaslideshow.TheActionpropertymustbesettoppActionRunMacroorppActionRunProgramforthispropertytoaffecttheslideshowaction.Read/writeString.
Remarks
IfthevalueoftheActionpropertyisppActionRunMacro,thespecifiedstringvalueshouldbethenameofaglobalmacrothat'scurrentlyloaded.IfthevalueoftheActionpropertyisppActionRunProgram,thespecifiedstringvalueshouldbethefullpathandfilenameofaprogram.
YoucansettheRunpropertytoamacrothattakesnoargumentsoramacrothattakesasingleShapeorObjectargument.Theshapethatwasclickedduringtheslideshowwillbepassedasthisargument.
Example
ThisexamplespecifiesthattheCalculateTotalmacroberunwheneverthemousepointerpassesovertheshapeduringaslideshow.
WithActivePresentation.Slides(1)_
.Shapes(3).ActionSettings(ppMouseOver)
.Action=ppActionRunMacro
.Run="CalculateTotal"
.AnimateAction=True
EndWith
ShowAll
SavedPropertyDetermineswhetherchangeshavebeenmadetoapresentationsinceitwaslastsaved.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueNochangeshavebeenmadetoapresentationsinceitwaslastsaved.
Remarks
IftheSavedpropertyofamodifiedpresentationissettomsoTrue,theuserwon'tbepromptedtosavechangeswhenclosingthepresentation,andallchangesmadetoitsinceitwaslastsavedwillbelost.
Example
Thisexamplesavestheactivepresentationifit'sbeenchangedsincethelasttimeitwassaved.
WithApplication.ActivePresentation
IfNot.SavedAnd.Path<>""Then.Save
EndWith
ShowAll
SaveNewWebPagesAsWebArchivesPropertyMsoTrueforMicrosoftPowerPointtosavenewWebpagesasWebarchives.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseSavesnewWebpagesasindividualWebpages.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueSavesnewWebpagesasWebarchives.
expression.SaveNewWebPagesAsWebArchives
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
SettingtheSaveNewWebPagesAsWebArchivespropertywon'tchangetheformatofanycurrentlyopenWebpages.YoumustindividuallysaveopenWebpagesandexplicitlysettheWebpageformatusingtheSaveAsmethod.
Example
ThisexampleenablestheSaveNewWebPagesAsWebArchivesproperty,sothatwhennewWebpagesaresaved,theyaresavedasWebarchives.
SubSetWebOption()
Application.DefaultWebOptions_
.SaveNewWebPagesAsWebArchives=True
EndSub
ScaleEffectPropertyReturnsaScaleEffectobjectforagivenanimationbehavior.
expression.ScaleEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
SchemeColorPropertyReturnsorsetsthecolorintheappliedcolorschemethat'sassociatedwiththespecifiedobject.Read/writePpColorSchemeIndex.
PpColorSchemeIndexcanbeoneofthesePpColorSchemeIndexconstants.ppAccent1ppAccent2ppAccent3ppBackgroundppFillppForegroundppNotSchemeColorppSchemeColorMixedppShadowppTitle
expression.SchemeColor
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
ScreenSizePropertyReturnsorsetstheidealminimumscreensize(widthbyheight,inpixels)thatyoushouldusewhenviewingthesavedpresentationinaWebbrowser.Read/writeMsoScreenSize.
MsoScreenSizecanbeoneoftheseMsoScreenSizeconstants.msoScreenSize1024x768msoScreenSize1152x882msoScreenSize1152x900msoScreenSize1280x1024msoScreenSize1600x1200msoScreenSize1800x1440msoScreenSize1920x1200msoScreenSize544x376msoScreenSize640x480msoScreenSize720x512msoScreenSize800x600Default.
expression.ScreenSize
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsthetargetscreensizeto640x480pixels.
Presentations(2).WebOptions.ScreenSize=_
msoScreenSize640x480
ScreenTipPropertyReturnsorsetstheScreenTiptextofahyperlink.Read/writeString.
Remarks
ScreenTiptextappears,forexample,whenyousaveapresentationtoHTML,viewitinaWebbrowser,andrestthemousepointeroverahyperlink.SomebrowsersmaynotsupportScreenTips.
Example
ThisexamplesetstheScreenTiptextforthefirsthyperlink.
ActivePresentation.Slides(1).Hyperlinks(1)_
.ScreenTip="GototheMicrosofthomepage"
ScriptPropertyReturnsaScriptobjectthatrepresentsablockofscriptcodeonaMicrosoftPowerPointslide.InPowerPoint,scriptisassociatedwithananchorshape.Ifnoscriptisassociatedwiththespecifiedshape,thennothingisreturned.Read-only.
Remarks
ScriptcodeinsertedonaslidecanonlyberuninWebpresentations.
Bydefault,scriptanchorshapesarenotvisible.Tomakethemvisible,usethePowerPointuserinterface.YoucannotmakescriptanchorshapesvisiblewithVisualBasiccode.
ItispossibletousetheScriptpropertyonarangeofshapes(ShapeRange.Script)insteadofspecifyingasingleanchorshape.However,iftherangecontainsmorethanoneshape,yourcodewillnotworkandwillreturnamessagethatindicatestheScriptpropertycannotbeaccessed.
Example
Thisexamplesetsthescriptinglanguageforthescriptanchor(shapeeightonslideone)toMicrosoftVisualBasicScriptingEdition(VBScript).
WithActivePresentation.Slides(1).Shapes(8)
.Script.Language=msoScriptLanguageVisualBasic
EndWith
ScriptsPropertyReturnsaScriptscollectionthatrepresentsallScriptobjects(blocksofscriptcode)inapresentation.Read-only.
Remarks
Scriptcode,representedbyaScriptobject,canberunonlyinaWebpresentation.
ShowAll
SegmentTypePropertyReturnsavaluethatindicateswhetherthesegmentassociatedwiththespecifiednodeisstraightorcurved.Read-onlyMsoSegmentType.
MsoSegmentTypecanbeoneoftheseMsoSegmentTypeconstants.msoSegmentCurveTheSegmentTypepropertyreturnsthisvalueifthespecifiednodeisacontrolpointforacurvedsegment.msoSegmentLine
expression.SegmentType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Thispropertyisread-only.UsetheSetSegmentTypemethodtosetthevalueofthisproperty.
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
SelectedPropertyTrueifthespecifiedtablecellisselected.Read-onlyBoolean.
expression.Selected
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
SelectionPropertyReturnsaSelectionobjectthatrepresentstheselectioninthespecifieddocumentwindow.Read-only.
Example
Ifthere'stextselectedintheactivewindow,thisexamplemakesthetextitalic.
WithApplication.ActiveWindow.Selection
If.Type=ppSelectionTextThen
.TextRange.Font.Italic=True
EndIf
EndWith
SetEffectPropertyReturnsaSetEffectobjectfortheanimationbehavior.Read-only.YoucanusetheSetEffectobjecttosetthevalueofaproperty.
expression.SetEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
ShadowPropertyShadowpropertyasitappliestotheFontobject.
Determineswhetherthespecifiedtexthasashadow.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedtextdoesn'thaveashadow.msoTriStateMixedSomeofthetexthasashadowandsomedoesn't.msoTriStateTogglemsoTrueThespecifiedtexthasashadow.
expression.Shadow
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
ShadowpropertyasitappliestotheShapeandShapeRangeobjects.
Returnsaread/onlyShadowFormatobjectthatcontainsshadowformattingpropertiesforthespecifiedshapeorshapes.
expression.Shadow
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
ShapePropertyReturnsaShapeobjectthatrepresentsashapeinatablecell(fortheCellobject),adiagramnodeinadiagram(fortheDiagramNodeobject),orananimatedshape(fortheEffectobject).
expression.Shape
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
ShapeRangePropertyReturnsaShapeRangeobjectthatrepresentsalltheslideobjectsthathavebeenselectedonthespecifiedslide.Thisrangecancontainthedrawings,shapes,OLEobjects,pictures,textobjects,titles,headers,footers,slidenumberplaceholder,anddateandtimeobjectsonaslide.Read-only.
Remarks
Youcanreturnashaperangefromaselectionwhenthepresentationisinnormal,slide,oranymasterview.
Example
Thisexamplesetsthefillforegroundcolorforalltheselectedshapesinwindowone.
Windows(1).Selection.ShapeRange.Fill_
.ForeColor.RGB=RGB(255,0,255)
ShapesPropertyReturnsaShapescollectionthatrepresentsalltheelementsthathavebeenplacedorinsertedonthespecifiedslide,slidemaster,orrangeofslides.Thiscollectioncancontainthedrawings,shapes,OLEobjects,pictures,textobjects,titles,headers,footers,slidenumbers,anddateandtimeobjectsonaslide,orontheslideimageonanotespage.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
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"
SharedWorkspacePropertyReturnsaSharedWorkspaceobjectthatrepresentstheDocumentWorkspaceinwhichaspecifiedpresentationislocated.Read-only.
expression.SharedWorkspace
expressionRequired.AnexpressionthatreturnsaPresentationobject.
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
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.
Example
ThefollowingexamplereturnsareferencetotheDocumentWorkspaceinwhichtheactivepresentationisstored.ThisexampleassumesthattheactivedocumentbelongstoaDocumentWorkspace.
DimobjWorkspaceAsSharedWorkspace
SetobjWorkspace=ActivePresentation.SharedWorkspace
ShowAll
ShowScrollbarPropertyMsoTruetodisplaythescrollbarduringaslideshowinbrowsemode.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueNotusedwiththisproperty.msoFalsemsoTriStateMixedNotusedwiththisproperty.msoTriStateToggleNotusedwiththisproperty.msoTrue
expression.ShowScrollbar
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsetheShowTypepropertypriortosettingtheShowScrollbarproperty.
Example
Thisexamplespecifiestodisplaytheslideshowfortheactivepresentationinawindowanddisplaysascrollbarusedforbrowsingthroughtheslidesduringaslideshow.
SubShowSlideShowScrollBar()
WithActivePresentation.SlideShowSettings
.ShowType=ppShowTypeWindow
.ShowScrollBar=msoTrue
EndWith
EndSub
ShowAll
ShowSlideAnimationPropertyDetermineswhetherslideanimationsareenabledwhenpreviewing,saving,orpublishingaWebpresentation.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.msoTriStateMixedmsoTriStateTogglemsoTrueSlideanimationsareenabledwhenpreviewing,saving,orpublishingaWebpresentation.
Example
ThisexamplespecifiesthatslideanimationsinpresentationtwoareenabledfortheWebpresentation.ItthenpreviewstheWebpage.
WithPresentations(2)
.WebOptions.ShowSlideAnimation=msoTrue
.WebPagePreview
EndWith
ShowAll
ShowStartupDialogPropertyMsoTruetodisplaytheNewPresentationtaskpanewhenMicrosoftPowerPointisstarted.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseHidestheNewPresentationsidepane.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueDefault.DisplaystheNewPresentationsidepane.
expression.ShowStartupDialog
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThefollowinglineofcodedisablestheNewPresentationtaskpanewhenPowerPointstarts.
SubDontShowStartup
Application.ShowStartupDialog=msoFalse
EndSub
ShowAll
ShowTypePropertyReturnsorsetstheshowtypeforthespecifiedslideshow.Read/writePpSlideShowType.
PpSlideShowTypecanbeoneofthesePpSlideShowTypeconstants.ppShowTypeKioskppShowTypeSpeakerppShowTypeWindow
expression.ShowType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
ShowWindowsInTaskbarPropertyDetermineswhetherthereisaseparateWindowstaskbarbuttonforeachopenpresentation.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueDefault.ThereisaseparateWindowstaskbarbuttonforeachopenpresentation.
Remarks
WhensettoTrue,thispropertysimulatesthelookofasingle-documentinterface(SDI),whichmakesiteasiertonavigatebetweenopenpresentations.However,ifyouworkwithmultiplepresentationswhileotherapplicationsareopen,youmaywanttosetthispropertytoFalsetoavoidfillingyourtaskbarwithunnecessarybuttons.
ThispropertyisavailableonlywhenusingMicrosoftOfficewithWindowsUpdateorWindows2000.
Example
Thisexamplespecifiesthateachopenpresentationdoesn'thaveaseparateWindowstaskbarbutton.
Application.ShowWindowsInTaskbar=msoFalse
ShowAll
ShowWithAnimationPropertyDetermineswhetherthespecifiedslideshowdisplaysshapeswithassignedanimationsettings.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowdisplaysshapeswithassignedanimationsettings.
Example
Thisexamplerunsaslideshowoftheactivepresentationwithanimationandnarrationturnedoff.
WithActivePresentation.SlideShowSettings
.ShowWithAnimation=msoFalse
.ShowWithNarration=msoFalse
.Run
EndWith
ShowAll
ShowWithNarrationPropertyDetermineswhetherthespecifiedslideshowisshownwithnarration.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedslideshowisshownwithnarration.
Example
Thisexamplerunsaslideshowoftheactivepresentationwithanimationandnarrationturnedoff.
WithActivePresentation.SlideShowSettings
.ShowWithAnimation=msoFalse
.ShowWithNarration=msoFalse
.Run
EndWith
SignaturesPropertyReturnsaSignatureSetobjectthatrepresentsacollectionofdigitalsignatures.
expression.Signatures
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thefollowinglineofcodedisplaysthenumberofdigitalsignatures.
SubDisplayNumberOfSignatures
MsgBox"Numberofdigitalsignatures:"&_
ActivePresentation.Signatures.Count
EndSub
SizePropertyReturnsorsetsthecharactersize,inpoints.Read/writeSingle.
Example
Thisexamplesetsthesizeofthetextattachedtoshapeoneonslideoneto24points.
Application.ActivePresentation.Slides(1)_
.Shapes(1).TextFrame.TextRange.Font_
.Size=24
ShowAll
SlidePropertySlidepropertyasitappliestotheViewobject.
ReturnsorsetsaSlideobjectthatrepresentstheslidethat'scurrentlydisplayedinthespecifieddocumentwindowview.Read/write.
expression.Slide
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
SlidepropertyasitappliestotheSlideShowViewobject.
ReturnsaSlideobjectthatrepresentstheslidethat'scurrentlydisplayedinthespecifiedslideshowwindowview.Read-only.
expression.Slide
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Remarks
Ifthecurrentlydisplayedslideisfromanembeddedpresentation,youcanusetheParentpropertyoftheSlideobjectreturnedbytheSlidepropertytoreturntheembeddedpresentationthatcontainstheslide.(ThePresentationpropertyoftheSlideShowWindowobjectorDocumentWindowobjectreturnsthepresentationfromwhichthewindowwascreated,nottheembeddedpresentation.)
Example
AsitappliestotheViewobject.
ThisexampleplacesontheClipboardacopyoftheslidethat'scurrentlydisplayedinslideshowwindowone.
SlideShowWindows(1).View.Slide.Copy
Thisexampledisplaysthenameofthepresentationcurrentlyrunninginslideshowwindowone.
MsgBoxSlideShowWindows(1).View.Slide.Parent.Name
SlideElapsedTimePropertyReturnsthenumberofsecondsthatthecurrentslidehasbeendisplayed.Read/writeLong.
Remarks
UsetheResetSlideTimemethodtoresettheelapsedtimefortheslidethat'scurrentlydisplayed.
Example
Thisexamplesetsavariabletotheelapsedtimefortheslidethat'scurrentlydisplayedinslideshowwindowoneandthendisplaysthevalueofthevariable.
currTime=SlideShowWindows(1).View.SlideElapsedTime
MsgBoxcurrTime
SlideHeightPropertyReturnsorsetstheslideheight,inpoints.Read/writeSingle.
Example
Thisexamplesetstheslideheightto8.5inchesandtheslidewidthto11inchesfortheactivepresentation.
WithApplication.ActivePresentation.PageSetup
.SlideWidth=11*72
.SlideHeight=8.5*72
EndWith
SlideIDPropertyReturnsauniqueIDnumberforthespecifiedslide.Read-onlyLong.
Remarks
UnliketheSlideIndexproperty,theSlideIDpropertyofaSlideobjectwon'tchangewhenyouaddslidestothepresentationorrearrangetheslidesinthepresentation.Therefore,usingtheFindBySlideIDmethodwiththeslide'sIDnumbercanbeamorereliablewaytoreturnaspecificSlideobjectfromaSlidescollectionthanusingtheItemmethodwiththeslide'sindexnumber.
Example
ThisexampledemonstrateshowtoretrievetheuniqueIDnumberforaSlideobjectandthenusethisnumbertoreturnthatSlideobjectfromtheSlidescollection.
Setgslides=ActivePresentation.Slides
'GetslideID
graphSlideID=gslides.Add(2,ppLayoutChart).SlideID
gslides.FindBySlideID(graphSlideID)_
.SlideShowTransition.EntryEffect=_
ppEffectCoverLeft'UseIDtoreturnspecificslide
SlideIDsPropertyReturnsanarrayofslideIDsforthespecifiednamedslideshow.Read-onlyVariant.
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
SlideIndexPropertyReturnstheindexnumberofthespecifiedslidewithintheSlidescollection.Read-onlyLong.
Remarks
UnliketheSlideIDproperty,theSlideIndexpropertyofaSlideobjectcanchangewhenyouaddslidestothepresentationorrearrangetheslidesinthepresentation.Therefore,usingtheFindBySlideIDmethodwiththeslide'sIDnumbercanbeamorereliablewaytoreturnaspecificSlideobjectfromaSlidescollectionthanusingtheItemmethodwiththeslide'sindexnumber.
Example
Thisexampledisplaystheindexnumberofthecurrentlydisplayedslideinslideshowwindowone.
MsgBoxSlideShowWindows(1).View.Slide.SlideIndex
SlideMasterPropertyReturnsaMasterobjectthatrepresentstheslidemaster.
expression.SlideMaster
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsthebackgroundpatternfortheslidemasterfortheactivepresentation.
Application.ActivePresentation.SlideMaster.Background.Fill_
.PresetTexturedmsoTextureGreenMarble
ShowAll
SlideNumberPropertySlideNumberpropertyasitappliestotheHeadersFootersobject.
ReturnsaHeaderFooterobjectthatrepresentstheslidenumberinthelower-rightcornerofaslide,orthepagenumberinthelower-rightcornerofanotespageorapageofaprintedhandoutoroutline.Read-only.
expression.SlideNumber
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
SlideNumberpropertyasitappliestotheSlideandSlideRangeobjects.
Returnstheslidenumber.Read-onlyInteger.
expression.SlideNumber
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Remarks
TheSlideNumberpropertyofaSlideobjectistheactualnumberthatappearsinthelower-rightcorneroftheslidewhenyoudisplayslidenumbers.Thisnumberisdeterminedbythenumberoftheslidewithinthepresentation(theSlideIndexpropertyvalue)andthestartingslidenumberforthepresentation(theFirstSlideNumberpropertyvalue).Theslidenumberisalwaysequaltothestartingslidenumber+theslideindexnumber–1.
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
ShowAll
SlideOrientationPropertyReturnsorsetstheon-screenandprintedorientationofslidesinthespecifiedpresentation.Read/writeMsoOrientation.
MsoOrientationcanbeoneoftheseMsoOrientationconstants.msoOrientationHorizontalmsoOrientationMixedmsoOrientationVertical
expression.SlideOrientation
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsorientationofallslidesintheactivepresentationtovertical(portrait).
Application.ActivePresentation.PageSetup.SlideOrientation=_
msoOrientationVertical
SlideRangePropertyReturnsaSlideRangeobjectthatrepresentsarangeofselectedslides.Read-only.
Remarks
Asliderangecanbeconstructedinslideview,slidesorterview,normalview,notespageview,oroutlineview.Inslideview,SlideRangereturnsoneslide—thecurrent,displayedslide.
Example
Thisexamplesetsthebackgroundschemecolorforalltheselectedslidesinwindowone.
Windows(1).Selection.SlideRange.ColorScheme_
.Colors(ppBackground).RGB=RGB(0,0,255)
SlidesPropertyReturnsaSlidescollectionthatrepresentsallslidesinthespecifiedpresentation.Read-only.
Example
Thisexampleaddsaslidetotheactivepresentation.
Application.ActivePresentation.Slides.Add1,ppLayoutTitle
ShowAll
SlideShowNamePropertySlideShowNamepropertyasitappliestotheActionSetting,
PrintOptions,PublishObject,andSlideShowSettingsobjects.
Returnsorsetsthenameofthecustomslideshowtoruninresponsetoamouseactionontheshapeduringaslideshow(ActionSettingobject),returnsorsetsthenameofthecustomslideshowtoprint(PrintOptionsobject),orreturnsorsetsthenameofthecustomslideshowpublishedasawebpresentation(PublishObjectobject).Read/writeString.
expression.SlideShowName
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Remarks
TheRangeTypepropertymustbesettoppPrintNamedSlideShowtoprintacustomslideshow.
SlideShowNamepropertyasitappliestotheSlideShowViewobject.
Returnsthenameofthecustomslideshowthat'scurrentlyrunninginthespecifiedslideshowview.Read-onlyString.
expression.SlideShowName
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
SlideShowSettingsPropertyReturnsaSlideShowSettingsobjectthatrepresentstheslideshowsettingsforthespecifiedpresentation.Read-only.
Example
Thisexamplestartsaslideshowmeanttobepresentedbyaspeaker.Theslideshowwillrunwithanimationandnarrationturnedoff.
WithApplication.ActivePresentation.SlideShowSettings
.ShowType=ppShowTypeSpeaker
.ShowWithNarration=False
.ShowWithAnimation=False
.Run
EndWith
SlideShowTransitionPropertyReturnsaSlideShowTransitionobjectthatrepresentsthespecialeffectsforthespecifiedslidetransition.Read-only.
Example
Thisexamplesetsslidetwointheactivepresentationtoadvanceautomaticallyafter5secondsduringaslideshowandtoplayadogbarksoundattheslidetransition.
WithActivePresentation.Slides(2).SlideShowTransition
.AdvanceOnTime=True
.AdvanceTime=5
.SoundEffect.ImportFromFile"c:\windows\media\dogbark.wav"
EndWith
ActivePresentation.SlideShowSettings.AdvanceMode=_
ppSlideShowUseSlideTimings
SlideShowWindowPropertyReturnsaSlideShowWindowobjectthatrepresentstheslideshowwindowinwhichthespecifiedpresentationisrunning.Read-only.
Remarks
YoucanusethispropertyinconjunctionwiththeMekeywordandtheParentpropertytoreturntheslideshowwindowinwhichanActiveXcontroleventwasfired,asshownintheexample.
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
SlideShowWindowsPropertyReturnsaSlideShowWindowscollectionthatrepresentsallopenslideshowwindows.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
Thisexamplerunsaslideshowinawindowandsetstheheightandwidthoftheslideshowwindow.
WithApplication
.Presentations(1).SlideShowSettings.Run
With.SlideShowWindows(1)
.Height=250
.Width=250
EndWith
EndWith
ShowAll
SlideSizePropertyReturnsorsetstheslidesizeforthespecifiedpresentation.Read/writePpSlideSizeType.
PpSlideSizeTypecanbeoneofthesePpSlideSizeTypeconstants.ppSlideSize35MMppSlideSizeA3PaperppSlideSizeA4PaperppSlideSizeB4ISOPaperppSlideSizeB4JISPaperppSlideSizeB5ISOPaperppSlideSizeB5JISPaperppSlideSizeBannerppSlideSizeCustomppSlideSizeHagakiCardppSlideSizeLedgerPaperppSlideSizeLetterPaperppSlideSizeOnScreenppSlideSizeOverhead
expression.SlideSize
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetstheslidesizetooverheadfortheactivepresentation.
Application.ActivePresentation.PageSetup_
.SlideSize=ppSlideSizeOverhead
SlideWidthPropertyReturnsorsetstheslidewidth,inpoints.Read/writeSingle.
Example
Thisexamplesetstheslideheightto8.5inchesandtheslidewidthto11inchesfortheactivepresentation.
WithApplication.ActivePresentation.PageSetup
.SlideWidth=11*72
.SlideHeight=8.5*72
EndWith
ShowAll
SmoothPropertySetsorreturnsanMsoTriStatethatrepresentswhetherthetransitionfromoneanimationpointtoanotherissmoothed.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseTheanimationpointshouldnotbesmoothed.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.Theanimationshouldbesmoothed.
expression.Smooth
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplechangessmoothingforananimationpoint.
SubChangeSmooth(ByValaniAsAnimationBehavior,ByValblnAsMsoTriState)
ani.PropertyEffect.Points.Smooth=bln
EndSub
ShowAll
SmoothEndPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetherananimationshoulddecelerateasitends.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Ananimationdoesnotdeceleratewhenitends.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueAnanimationdecelerateswhenitends.
expression.SmoothEnd
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
SmoothStartPropertySetsorreturnsanMsoTriStateconstantthatrepresentswhetherananimationshouldacceleratewhenitstarts.Read/write.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTrueDoesn'tapplytothisproperty.msoFalseDefault.Theanimationdoesnotacceleratewhenitstarts.msoTriStateMixedDoesn'tapplytothisproperty.msoTriStateToggleDoesn'tapplytothisproperty.msoTrueTheanimationaccelerateswhenitstarts.
expression.SmoothStart
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
SnapToGridPropertyMsoTruetosnapshapestothegridlinesinthespecifiedpresentation.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrue
expression.SnapToGrid
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampletogglessnappingshapestothegridlinesintheactivepresentation.
SubToggleSnapToGrid()
WithActivePresentation
If.SnapToGrid=msoTrueThen
.SnapToGrid=msoFalse
Else
.SnapToGrid=msoTrue
EndIf
EndWith
EndSub
SoundEffectPropertyActionSettingobject:ReturnsaSoundEffectobjectthatrepresentsthesoundtobeplayedwhenthespecifiedshapeisclickedorthemousepointerpassesovertheshape.Ifyoudon'thearthesoundthatyouassignedtotheshapewhenyouruntheslideshow,makesurethattheTextLevelEffectpropertyissettoavalueotherthanppAnimateLevelNoneandthattheAnimatepropertyissettoTrue.
AnimationSettingsandEffectInformationobjects:ReturnsaSoundEffectobjectthatrepresentsthesoundtobeplayedduringtheanimationofthespecifiedshape.
SlideShowTransitionobject:ReturnsaSoundEffectobjectthatrepresentsthesoundtobeplayedduringthetransitiontothespecifiedslide.
expression.SoundEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsthefileBass.wavtobeplayedwhenevershapeoneonslideoneintheactivepresentationisanimated.
WithActivePresentation.Slides(1).Shapes(1).AnimationSettings
.Animate=True
.TextLevelEffect=ppAnimateByAllLevels
.SoundEffect.ImportFromFile"c:\bass.wav"
EndWith
SourceFullNamePropertyReturnsorsetsthenameandpathofthesourcefileforthelinkedOLEobject.Read/writeString.
Example
ThisexamplesetsthesourcefileforshapeoneonslideoneintheactivepresentationtoWordtest.docandspecifiesthattheobject'simagebeupdatedautomatically.
WithActivePresentation.Slides(1).Shapes(1)
If.Type=msoLinkedOLEObjectThen
With.LinkFormat
.SourceFullName="c:\mydocuments\wordtest.doc"
.AutoUpdate=ppUpdateOptionAutomatic
EndWith
EndIf
EndWith
ShowAll
SourceTypePropertyReturnsorsetsthesourcetypeofthepresentationtobepublishedtoHTML.Read/writePpPublishSourceType.
PpPublishSourceTypecanbeoneofthesePpPublishSourceTypeconstants.ppPublishAllppPublishNamedSlideShowUsethisvaluetopublishacustomslideshow,specifyingthenameofthecustomslideshowwiththeSlideShowNameproperty.ppPublishSlideRange
expression.SourceType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplepublishesthespecifiedsliderange(slidesthreethroughfive)oftheactivepresentationtoHTML.ItnamesthepublishedpresentationMallard.htm.
WithActivePresentation.PublishObjects(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.Publish
EndWith
SpaceAfterPropertyReturnsorsetstheamountofspaceafterthelastlineineachparagraphofthespecifiedtext,inpointsorlines.Read/writeSingle.
Example
Thisexamplesetsthespacingafterparagraphsto6pointsforthetextinshapetwoonslideoneintheactivepresentation.
WithApplication.ActivePresentation.Slides(1).Shapes(2)
With.TextFrame.TextRange.ParagraphFormat
.LineRuleAfter=False
.SpaceAfter=6
EndWith
EndWith
SpaceBeforePropertyReturnsorsetstheamountofspacebeforethefirstlineineachparagraphofthespecifiedtext,inpointsorlines.Read/writeSingle.
Example
Thisexamplesetsthespacingbeforeparagraphsto6pointsforthetextinshapetwoonslideintheactivepresentation.
WithApplication.ActivePresentation.Slides(1).Shapes(2)
With.TextFrame.TextRange.ParagraphFormat
.LineRuleBefore=False
.SpaceBefore=6
EndWith
EndWith
SpaceWithinPropertyReturnsorsetstheamountofspacebetweenbaselinesinthespecifiedtext,inpointsorlines.Read/writeSingle.
Example
Thisexamplesetslinespacingto21pointsforthetextinshapetwoonslidetwointheactivepresentation.
WithApplication.ActivePresentation.Slides(2).Shapes(2)
With.TextFrame.TextRange.ParagraphFormat
.LineRuleWithin=False
.SpaceWithin=21
EndWith
EndWith
ShowAll
SpeakerNotesPropertyDetermineswhetherspeakernotesaretobepublishedwiththepresentation.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueSpeakernotesaretobepublishedwiththepresentation.
Example
ThisexamplepublishesslidesthreethroughfiveoftheactivepresentationtoHTML.Itincludestheassociatedspeaker'snoteswiththepublishedpresentationandnamesitMallard.htm.
WithActivePresentation.PublishObjects(1)
.FileName="C:\Test\Mallard.htm"
.SourceType=ppPublishSlideRange
.RangeStart=3
.RangeEnd=5
.SpeakerNotes=msoTrue
.Publish
EndWith
ShowAll
SpeedPropertySpeedpropertyasitappliestotheSlideShowTransitionobject.
ReturnsorsetsaPpTransitionSpeedconstantthatrepresentsthespeedofthetransitiontothespecifiedslide.Read/write.
PpTransitionSpeedcanbeoneofthesePpTransitionSpeedconstants.ppTransitionSpeedFastppTransitionSpeedMediumppTransitionSpeedMixedppTransitionSpeedSlow
expression.Speed
expressionRequired.AnexpressionthatreturnsaSlideShowTransitionobject.
SpeedpropertyasitappliestotheTimingobject.
ReturnsorsetsaSinglethatrepresentsthespeed,inseconds,ofthespecifiedanimation.Read/write.
expression.Speed
expressionRequired.AnexpressionthatreturnsaTimingobject.
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
SplitHorizontalPropertyReturnsorsetsthepercentageofthedocumentwindowwidththattheoutlinepaneoccupiesinnormalview.Correspondstothepanedividerpositionbetweentheslideandoutlinepanes.Read/writeLong.
Remarks
ThemaximumvalueoftheSplitHorizontalpropertyisalwayslessthan100%becausetheslidepanehasaminimumwidththatdependsona10%zoomlevel.Theactualmaximumvaluemayvarydependingonthesizeoftheapplicationwindow.
Example
Thefollowingexamplesetstheverticalpanedividerfortheactivedocumentwindowtodivideat15%outlinepaneand85%slidepane.
ActiveWindow.SplitHorizontal=15
SplitVerticalPropertyReturnsorsetsthepercentageofthedocumentwindowheightthattheslidepaneoccupiesinnormalview.Correspondstothepanedividerpositionbetweentheslideandnotespanes.Read/writeLong.
Remarks
TheminimumvalueoftheSplitVerticalpropertyisalwaysgreaterthan0%becausetheslidepanehasaminimumheightthatdependsona10%zoomlevel.Theactualminimumvaluemayvarydependingonthesizeoftheapplicationwindow.
Example
Thefollowingexamplesetsthehorizontalpanedividerfortheactivedocumentwindowtodivideat60%slidepaneand40%notespane.
ActiveWindow.SplitVertical=60
ShowAll
StartPropertyStartpropertyasitappliestothePrintRangeobject.
Returnsthenumberofthefirstslideintherangeofslidestobeprinted.Read-onlyInteger.
expression.Start
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
StartpropertyasitappliestotheTextRangeobject.
Returnsthepositionofthefirstcharacterinthespecifiedtextrangerelativetothefirstcharacterintheshapethatcontainsthetext.Read-onlyLong.
expression.Start
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Example
AsitappliestothePrintRangeobject.
Thisexampledisplaysamessagethatindicatesthestartingandendingslidenumbersforprintrangeoneintheactivepresentation.
WithActivePresentation.PrintOptions.Ranges
If.Count>0Then
With.Item(1)
MsgBox"Printrange1startsonslide"&.Start&_
"andendsonslide"&.End
EndWith
EndIf
EndWith
StartingSlidePropertyReturnsorsetsthefirstslidetobedisplayedinthespecifiedslideshow.Read/writeLong.
Example
Thisexamplerunsaslideshowoftheactivepresentation,startingwithslidetwoandendingwithslidefour.
WithActivePresentation.SlideShowSettings
.RangeType=ppShowSlideRange
.StartingSlide=2
.EndingSlide=4
.Run
EndWith
StartValuePropertyReturnsorsetsthebeginningvalueofabulletedlistwhentheTypepropertyoftheBulletFormatobjectissettoppBulletNumbered.Thevaluemustbeintherangeof1to32767.Read/writeInteger.
Example
Thisexamplesetsthebulletsinthetextboxspecifiedbyshapetwoonslideonetostartwiththenumberfive.
WithActivePresentation.Slides(1).Shapes(2).TextFrame
With.TextRange.ParagraphFormat.Bullet
.Type=ppBulletNumbered
.StartValue=5
EndWith
EndWith
ShowAll
StatePropertyReturnsorsetsthestateoftheslideshow.Read/writePpSlideShowState.
PpSlideShowStatecanbeoneofthesePpSlideShowStateconstants.ppSlideShowBlackScreenppSlideShowDoneppSlideShowPausedppSlideShowRunningppSlideShowWhiteScreen
expression.State
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetstheviewstateinslideshowwindowonetoablackscreen.
SlideShowWindows(1).View.State=ppSlideShowBlackScreen
StopAfterSlidesPropertyReturnsorsetsthenumberofslidestobedisplayedbeforethemediaclipstopsplaying.Read/writeLong.
Remarks
FortheStopAfterSlidespropertysettingtotakeeffect,thePauseAnimationpropertyofthespecifiedslidemustbesettoFalse,andthePlayOnEntrypropertymustbesettoTrue.
Themediaclipwillstopplayingwhenthespecifiednumberofslideshavebeendisplayedorwhentheclipcomestoanend—whichevercomesfirst.Avalueof0(zero)specifiesthattheclipwillstopplayingafterthecurrentslide.
Example
Thisexamplespecifiesthatthemediacliprepresentedbyshapethreeonslideoneintheactivepresentationwillbeplayedautomaticallywhenit'sanimated,thattheslideshowwillcontinuewhilethemediaclipisplayinginthebackground,andthattheclipwillstopplayingafterthreeslidesaredisplayedorwhentheendoftheclipisreached—whichevercomesfirst.Shapethreemustbeasoundormovieobject.
SetOLEobj=ActivePresentation.Slides(1).Shapes(3)
WithOLEobj.AnimationSettings.PlaySettings
.PlayOnEntry=True
.PauseAnimation=False
.StopAfterSlides=3
EndWith
ShowAll
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.
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.
ppBulletStyleMixedAnyundefinedstyle.ppBulletThaiAlphaParenBothppBulletThaiAlphaParenRightppBulletThaiAlphaPeriodppBulletThaiNumParenBothppBulletThaiNumParenRightppBulletThaiNumPeriodppBulletTradChinPeriodTraditionalChinesewithaperiod.ppBulletTradChinPlainTraditionalChinesewithoutaperiod.
expression.Style
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
SubAddressPropertyReturnsorsetsthelocationwithinadocument—suchasabookmarkinaworddocument,arangeinaMicrosoftExcelworksheet,oraslideinaPowerPointpresentation—associatedwiththespecifiedhyperlink.Read/writeString.
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
ShowAll
SubscriptPropertyDetermineswhetherthespecifiedtextissubscript.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Thespecifiedtextisnotsubscript.msoTriStateMixedSomecharactersaresubscriptandsomearen't.msoTriStateTogglemsoTrueThespecifiedtextissubscript.
Remarks
SettingtheBaselineOffsetpropertytoanegativevalueautomaticallysetstheSubscriptpropertytomsoTrueandtheSuperscriptpropertytomsoFalse.
SettingtheBaselineOffsetpropertytoapositivevalueautomaticallysetstheSubscriptpropertytomsoFalseandtheSuperscriptpropertytomsoTrue.
SettingtheSubscriptpropertytomsoTrueautomaticallysetstheBaselineOffsetpropertyto–0.25(–25percent).
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
SubtypePropertySetsorreturnsaMsoAnimFilterEffectSubtypeconstantthatdeterminesthesubtypeofthefiltereffect.Read/write.
expression.Subtype
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
SuperscriptPropertyDetermineswhetherthespecifiedtextissuperscript.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseDefault.Thespecifiedtextisnotsuperscript.msoTriStateMixedSomecharactersaresuperscriptandsomearen't.msoTriStateTogglemsoTrueThespecifiedtextissuperscript.
Remarks
SettingtheBaselineOffsetpropertytoanegativevalueautomaticallysetstheSubscriptpropertytomsoTrueandtheSuperscriptpropertytomsoFalse.
SettingtheBaselineOffsetpropertytoapositivevalueautomaticallysetstheSubscriptpropertytomsoFalseandtheSuperscriptpropertytomsoTrue.
SettingtheSuperscriptpropertytomsoTrueautomaticallysetstheBaselineOffsetpropertyto0.3(30percent).
Example
Thisexamplesetsthetextforshapetwoonslideoneandthenmakesthefifthcharactersuperscriptwitha30-percentoffset.
WithApplication.ActivePresentation.Slides(1).Shapes(2).TextFrame
With.TextRange
.Text="E=mc2"
.Characters(5,1).Font.Superscript=msoTrue
EndWith
EndWith
ShowAll
SyncPropertyReturnsaSyncobjectthatenablesyoutomanagethesynchronizationofthelocalandservercopiesofasharedpresentationstoredinaMicrosoftWindowsSharePointServicessharedworkspace.Read-only.
expression.Sync
expressionRequired.AnexpressionthatreturnsaPresentationobject.
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
sharedorsynchronizationisnotenabled.UsetheStatuspropertytodeterminewhetherthedocumentissharedandwhethersynchronizationisenabled.
Notalldocumentsynchronizationproblemsraiserun-timeerrorsthatcanbetrapped.AfterusingthemethodsoftheSyncobject,itisagoodideatochecktheStatusproperty.IftheStatuspropertyismsoSyncStatusError,checktheErrorTypepropertyforadditionalinformationonthetypeoferrorthathasoccurred.
Inmanycircumstances,thebestwaytoresolveanerrorconditionistocalltheGetUpdatemethod.Forexample,ifacalltoPutUpdateresultsinanerrorcondition,thenacalltoGetUpdatewillresetthestatustomsoSyncStatusLocalChanges.
Example
ThefollowingexampledisplaysthenameofthelastpersontomodifytheactivepresentationiftheactivepresentationisashareddocumentinaDocumentWorkspace.
DimeStatusAsMsoSyncStatusType
DimstrLastUserAsString
eStatus=ActivePresentation.Sync.Status
IfeStatus=msoSyncStatusLatestThen
strLastUser=ActivePresentation.Sync.WorkspaceLastChangedBy
MsgBox"Youhavethemostup-to-datecopy."&_
"Thisfilewaslastmodifiedby"&strLastUser
EndIf
TablePropertyReturnsaTableobjectthatrepresentsatableinashapeorinashaperange.Read-only.
Example
Thisexamplesetsthewidthofthefirstcolumninthetableinshapefiveonthesecondslideto80points.
ActivePresentation.Slides(2).Shapes(5).Table_
.Columns(1).Width=80
ShowAll
TableDirectionPropertyReturnsorsetsthedirectioninwhichthetablecellsareordered.Read/writePpDirection.
PpDirectioncanbeoneofthesePpDirectionconstants.ppDirectionLeftToRightppDirectionMixedppDirectionRightToLeft
expression.TableDirection
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThedefaultvalueoftheTableDirectionpropertyisppDirectionLefttToRightunlesstheLanguageSettingspropertyortheDefaultLanguageIDpropertyissettoaright-to-leftlanguage,inwhichcasethedefaultvalueisppDirectionRightToLeft.TheppDirectionMixedconstantmaybereturnedwhenusingtheTextDirectionproperty.
Example
Thisexamplesetsthedirectioninwhichcellsintheselectedtableareorderedtolefttoright(firstcolumnistheleftmostcolumn).
ActiveWindow.Selection.ShapeRange.Table.TableDirection=_
ppDirectionLeftToRight
TabStopsPropertyReturnsaTabStopscollectionthatrepresentsthetabstopsforthespecifiedtext.Read-only.
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
TagsPropertyReturnsaTagsobjectthatrepresentsthetagsforthespecifiedobject.Read-only.
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
ShowAll
TargetBrowserPropertySetsorreturnsanMsoTargetBrowserconstantthatrepresentsthebrowserusedwithMicrosoftPowerPoint.Read/write.
MsoTargetBrowsercanbeoneoftheseMsoTargetBrowserconstants.msoTargetBrowserIE4msoTargetBrowserIE5msoTargetBrowserIE6msoTargetBrowserV3msoTargetBrowserV4
expression.TargetBrowser
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsthetargetbrowserfortheactivepresentationtoMicrosoftInternetExplorer6ifthecurrenttargetbrowserisanearlierversion.
SubSetWebBrowser()
WithActivePresentation.WebOptions
If.TargetBrowser<msoTargetBrowserIE6Then
.TargetBrowser=msoTargetBrowserIE6
EndIf
EndWith
EndSub
ThisexamplesetsthetargetbrowserforallpresentationstoInternetExplorer6.
SubGlobalTargetBrowser()
Application.DefaultWebOptions_
.TargetBrowser=msoTargetBrowserIE6
EndSub
TemplateNamePropertyReturnsthenameofthedesigntemplateassociatedwiththespecifiedpresentation.Read-onlyString.
Remarks
ThereturnedstringincludestheMS-DOSfilenameextension(forfiletypesthatareregistered)butdoesn'tincludethefullpath.
Example
ThefollowingexampleappliesthedesigntemplateProfessional.pottothepresentationPres1.pptifit'snotalreadyappliedtoit.
WithPresentations("Pres1.ppt")
If.TemplateName<>"Professional.pot"Then
.ApplyTemplate"c:\programfiles\microsoftoffice"&_
"\templates\presentationdesigns\Professional.pot"
EndIf
EndWith
ShowAll
TextPropertyTextpropertyasitappliestotheHeaderFooter,TextEffectFormat,and
TextRangeobjects.
ReturnsorsetsaStringthatrepresentsthetextcontainedinthespecifiedobject.Read/write.
expression.Text
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
TextpropertyasitappliestotheCommentobject.
ReturnsaStringthatrepresentsthetextinacomment.Read-only.
expression.Text
expressionRequired.AnexpressionthatreturnsaCommentobject.
Example
AsitappliestotheTextRangeobject.
Thisexamplesetsthetextandfontstyleforthetitleonslideoneintheactivepresentation.
SetmyPres=Application.ActivePresentation
WithmyPres.Slides(1).Shapes.Title.TextFrame.TextRange
.Text="Welcome!"
.Font.Italic=True
EndWith
ShowAll
TextDirectionPropertyReturnsorsetsthetextdirectionforthespecifiedparagraph.Read/writePpDirection.Thedefaultvaluedependsonthelanguagesupportyouhaveselectedorinstalled.
PpDirectioncanbeoneofthesePpDirectionconstants.ppDirectionLeftToRightppDirectionMixedppDirectionRightToLeft
expression.TextDirection
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexampledisplaysthetextdirectionfortheparagraphsinshapetwoonslideoneintheactivepresentation.
MsgBoxActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange_
.ParagraphFormat.TextDirection
TextEffectPropertyReturnsaTextEffectFormatobjectthatcontainstext-effectformattingpropertiesforthespecifiedshape.AppliestoShapeorShapeRangeobjectsthatrepresentWordArt.
expression.TextEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsthefontstyletoboldforshapethreeonmyDocumentiftheshapeisWordArt.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3)
If.Type=msoTextEffectThen
.TextEffect.FontBold=True
EndIf
EndWith
TextFramePropertyReturnsaTextFrameobjectthatcontainsthealignmentandanchoringpropertiesforthespecifiedshapeormastertextstyle.
Remarks
UsetheTextRangepropertyoftheTextFrameobjecttoreturnthetextinthetextframe.
UsetheHasTextFramepropertytodeterminewhetherashapecontainsatextframebeforeyouapplytheTextFrameproperty.
Example
ThisexampleaddsarectangletomyDocument,addstexttotherectangle,andsetsthetopmarginforthetextframe.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes_
.AddShape(msoShapeRectangle,180,175,350,140).TextFrame
.TextRange.Text="Hereissometesttext"
.MarginTop=10
EndWith
ShowAll
TextLevelEffectPropertyReturnsorsetsaPpTextLevelEffectconstantthatindicateswhetherthetextinthespecifiedshapeisanimatedbyfirst-levelparagraphs,second-levelparagraphs,orsomeotherlevel(uptofifth-levelparagraphs).Read/write.
PpTextLevelEffectcanbeoneofthesePpTextLevelEffectconstants.ppAnimateByAllLevelsppAnimateByFifthLevelppAnimateByFirstLevelppAnimateByFourthLevelppAnimateBySecondLevelppAnimateByThirdLevelppAnimateLevelMixedppAnimateLevelNone
expression.TextLevelEffect
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
FortheTextLevelEffectpropertysettingtotakeeffect,theAnimatepropertymustbesettoTrue.
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
TextRangePropertyReturnsaTextRangeobjectthatrepresentstheselectedtext(Selectionobject)orthetextinthespecifiedtextframe(TextFrameobject).
expression.TextRange
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Remarks
Youcanconstructatextrangefromaselectionwhenthepresentationisinslideview,normalview,outlineview,notespageview,oranymasterview.
Example
Thisexamplemakestheselectedtextboldinthefirstwindow.
Windows(1).Selection.TextRange.Font.Bold=True
TextRangeLengthPropertyReturnsorsetsanLongthatrepresentsthelengthofatextrange.Read-only.
expression.TextRangeLength
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
TextRangeStartPropertyReturnsorsetsanLongthatrepresentsthestartofatextrange.Read-only.
expression.TextRangeStart
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
TextShapePropertyReturnsaShapeobjectrepresentingtheshapeofthetextboxassociatedwithadiagramnode.
expression.TextShape
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
TextStylesPropertyReturnsaTextStylescollectionthatrepresentsthreetextstyles—titletext,bodytext,anddefaulttext—forthespecifiedslidemaster.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
Thisexamplesetsthefontnameandfontsizeforlevel-onebodytextonslidesintheactivepresentation.
WithActivePresentation.SlideMaster_
.TextStyles(ppBodyStyle).Levels(1)
With.Font
.Name="arial"
.Size=36
EndWith
EndWith
TextToDisplayPropertyReturnsorsetsthedisplaytextforahyperlinknotassociatedwithagraphic.Read/writeString.
Remarks
Thispropertywillcausearun-timeerrorifusedwithahyperlinkthatisnotassociatedwithatextrange.Youcanusecodesimilartothefollowingtotestwhetherornotagivenhyperlink,representedherebymyHyperlink,isassociatedwithatextrange.
IfTypeName(myHyperlink.Parent.Parent)="TextRange"Then
strTRtest="True"
EndIf
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
ShowAll
TextUnitEffectPropertyTextUnitEffectpropertyasitappliestotheAnimationSettingsobject.
ReturnsorsetsaPpTextUnitEffectconstantthatindicateswhetherthetextinthespecifiedshapeisanimatedparagraphbyparagraph,wordbyword,orletterbyletter.Read/write.
PpTextUnitEffectcanbeoneofthesePpTextUnitEffectconstants.ppAnimateByCharacterppAnimateByParagraphppAnimateByWordppAnimateUnitMixed
expression.TextUnitEffect
expressionRequired.AnexpressionthatreturnsanAnimationSettingsobject.
Remarks
FortheTextUnitEffectpropertysettingtotakeeffect,theTextLevelEffectpropertyforthespecifiedshapemusthaveavalueotherthanppAnimateLevelNoneorppAnimateByAllLevels,andtheAnimatepropertymustbesettoTrue.
TextUnitEffectpropertyasitappliestotheEffectInformationobject.
ReturnsanMsoAnimTextUnitEffectconstantthatindicateswhetherthetextinthespecifiedshapeisanimatedparagraphbyparagraph,wordbyword,orletterbyletter.Read-only.
MsoAnimTextUnitEffectcanbeoneoftheseMsoAnimTextUnitEffectconstants.msoAnimTextUnitEffectByCharactermsoAnimTextUnitEffectByParagraphmsoAnimTextUnitEffectByWordmsoAnimTextUnitEffectMixed
expression.TextUnitEffect
expressionRequired.AnexpressionthatreturnsanEffectInformationobject.
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
TextureNamePropertyReturnsthenameofthecustomtexturefileforthespecifiedfill.Read-onlyString.
Thispropertyisread-only.UsetheUserTexturedmethodtosetthetexturefileforthefill.
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
ShowAll
TextureTypePropertyReturnsthetexturetypeforthespecifiedfill.Read-onlyMsoTextureType.UsethePresetTexturedorUserTexturedmethodtosetthetexturetypeforthefill.
MsoTextureTypecanbeoneoftheseMsoTextureTypeconstants.msoTexturePresetmsoTextureTypeMixedmsoTextureUserDefined
expression.TextureType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplechangesthefilltocanvasforallshapesonmyDocumentthathaveacustomtexturedfill.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Withs.Fill
If.TextureType=msoTextureUserDefinedThen
.PresetTexturedmsoTextureCanvas
EndIf
EndWith
Next
ThreeDPropertyReturnsaThreeDFormatobjectthatcontains3-D–effectformattingpropertiesforthespecifiedshape.Read-only.
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
TimePropertySetsorreturnsaSinglethatrepresentsthetimeatagivenanimationpoint.Read/write.
expression.Time
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThevalueoftheTimepropertycanbeanyfloating-pointvaluebetween0and1,representingapercentageoftheentiretimelinefrom0%to100%.Forexample,avalueof0.2wouldcorrespondtoapointintimeat20%oftheentiretimelinedurationfromlefttoright.
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
TimeLinePropertyReturnsaTimeLineobjectrepresentingtheanimationtimelinefortheslide.
expression.TimeLine
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thefollowingexampleaddsabouncinganimationtothefirstshapeonthefirstslide.
SubNewTimeLineEffect()
DimsldFirstAsSlide
DimshpFirstAsShape
SetsldFirst=ActivePresentation.Slides(1)
SetshpFirst=sldFirst.Shapes(1)
sldFirst.TimeLine.MainSequence.AddEffect_
Shape:=shpFirst,EffectId:=msoAnimEffectBounce
EndSub
TimingPropertyReturnsaTimingobjectthatrepresentsthetimingpropertiesforananimationsequence.
expression.Timing
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thefollowingexamplesetsthedurationofthefirstanimationsequenceonthefirstslide.
SubSetTiming()
ActivePresentation.Slides(1).TimeLine_
.MainSequence(1).Timing.Duration=1
EndSub
TintAndShadePropertyReturnsaSinglethatrepresentsthelighteningordarkeningofthethecolorofaspecifiedshape.Read/write.
expression.TintAndShade
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
Youcanenteravaluefrom-1(darkest)to1(lightest)fortheTintAndShadeproperty,0(zero)beingneutral.
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
TitlePropertyReturnsaShapeobjectthatrepresentstheslidetitle.Read-only.
Remarks
YoucanalsousetheItemmethodoftheShapesorPlaceholderscollectiontoreturntheslidetitle.
Example
ThisexamplesetsthetitletextonmyDocument.
SetmyDocument=ActivePresentation.Slides(1)
myDocument.Shapes.Title.TextFrame.TextRange.Text="Welcome!"
TitleMasterPropertyReturnsaMasterobjectthatrepresentsthetitlemasterforthespecifiedpresentation.Ifthepresentationdoesn'thaveatitlemaster,anerroroccurs.
expression.TitleMaster
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
UsetheAddTitleMastermethodtoaddatitlemastertoapresentation.
Example
Iftheactivepresentationhasatitlemaster,thisexamplesetsthefootertextforthetitlemaster.
WithApplication.ActivePresentation
If.HasTitleMasterThen
.TitleMaster.HeadersFooters.Footer.Text="Introduction"
EndIf
EndWith
ShowAll
ToPropertyTopropertyasitappliestotheColorEffectobject.
SetsorreturnsaColorFormatobjectthatrepresentstheRGBcolorvalueofananimationbehavior.Read/write.
expression.To
expressionRequired.AnexpressionthatreturnsaColorEffectobject.
Remarks
UsethispropertyinconjunctionwiththeFrompropertytotransitionfromonecolortoanother.
TopropertyasitappliestotheRotationEffectobject.
SetsorreturnsaSinglethatrepresentstheendingrotationofanobjectindegrees,specifiedrelativetothescreen(forexample,90degreesiscompletelyhorizontal).Read/write.
expression.To
expressionRequired.AnexpressionthatreturnsaRotationEffectobject.
Remarks
UsethispropertyinconjunctionwiththeFrompropertytotransitionfromonerotationangletoanother.
ThedefaultvalueisEmptyinwhichcasethecurrentpositionoftheobjectisused.
TopropertyasitappliestothePropertyEffectobject.
SetsorreturnsaVariantthatrepresentstheendingvalueofanobject’sproperty.Read/write.
expression.To
expressionRequired.AnexpressionthatreturnsaPropertyEffectobject.
Remarks
ThedefaultvalueisEmpty,inwhichcasethecurrentpositionoftheobjectisused.
TopropertyasitappliestotheSetEffectobject.
SetsorreturnsaVariantthatrepresentsthevalueorendingvalueoftheSetEffectobject'sTypeproperty.Read/write.
expression.To
expressionRequired.AnexpressionthatreturnsaSetEffectobject.
Remarks
DonotconfusethispropertywiththeToXorToYpropertiesoftheScaleEffectandMotionEffectobjects,whichareonlyusedforscalingormotioneffects.
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,_
effectId:=msoAnimEffectBlinds)
SetanimColor=tmlTiming.MainSequence(1).Behaviors.Add(Type:=msoAnimTypeRotation)
SetrtnEffect=animColor.RotationEffect
rtnEffect.From=90
rtnEffect.To=270
EndSub
ShowAll
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.
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
ToXPropertySetsorreturnsaSinglethatrepresentstheendingwidthorhorizontalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentofthescreenwidth.Read/write.
expression.ToX
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.
UsethispropertyinconjunctionwiththeFromXpropertytoresizeorjumpfromonepositiontoanother.
DonotconfusethispropertywiththeTopropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.
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
ToYPropertyReturnsorsetsaSinglethatrepresentstheendingheightorverticalpositionofaScaleEffectorMotionEffectobject,respectively,specifiedasapercentageofthescreenwidth.Read/write.
expression.ToY
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
ThedefaultvalueofthispropertyisEmpty,inwhichcasethecurrentpositionoftheobjectisused.
UsethispropertyinconjunctionwiththeFromYpropertytoresizeorjumpfromonepositiontoanother.
DonotconfusethispropertywiththeTopropertyoftheColorEffect,RotationEffect,orPropertyEffectobjects,whichisusedtosetorchangecolors,rotations,orotherpropertiesofananimationbehavior,respectively.
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
TrackingPropertyReturnsorsetstheratioofthehorizontalspaceallottedtoeachcharacterinthespecifiedWordArttothewidthofthecharacter.Canbeavaluefrom0(zero)through5.(Largevaluesforthispropertyspecifyamplespacebetweencharacters;valueslessthan1canproducecharacteroverlap.)Read/writeSingle.
ThefollowingtablegivesthevaluesoftheTrackingpropertythatcorrespondtothesettingsavailableintheuserinterface.
Userinterfacesetting EquivalentTrackingpropertyvalueVeryTight 0.8Tight 0.9Normal 1.0Loose 1.2VeryLoose 1.5
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
TransparencyPropertyReturnsorsetsthedegreeoftransparencyofthespecifiedfill,shadow,orlineasavaluebetween0.0(opaque)and1.0(clear).Read/writeSingle.
Remarks
Thevalueofthispropertyaffectstheappearanceofsolid-coloredfillsandlinesonly;ithasnoeffectontheappearanceofpatternedlinesorpatterned,gradient,picture,ortexturedfills.
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
ShowAll
TransparencyColorPropertyReturnsorsetsthetransparentcolorforthespecifiedpictureasared-green-blue(RGB)value.Forthispropertytotakeeffect,theTransparentBackgroundpropertymustbesettoTrue.Appliestobitmapsonly.Read/writeLong.
Remarks
Ifyouwanttobeabletoseethroughthetransparentpartsofthepictureallthewaytotheobjectsbehindthepicture,youmustsettheVisiblepropertyofthepicture'sFillFormatobjecttoFalse.IfyourpicturehasatransparentcolorandtheVisiblepropertyofthepicture'sFillFormatobjectissettoTrue,thepicture'sfillwillbevisiblethroughthetransparentcolor,butobjectsbehindthepicturewillbeobscured.
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
ShowAll
TransparentBackgroundPropertyDetermineswhetherpartsofthepicturethatarethecolordefinedasthetransparentcolorappeartransparent.Read/writeMsoTriState.Appliestobitmapsonly.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTruePartsofthepicturethatarethecolordefinedasthetransparentcolorappeartransparent.
Remarks
UsetheTransparencyColorpropertytosetthetransparentcolor.
Ifyouwanttobeabletoseethroughthetransparentpartsofthepictureallthewaytotheobjectsbehindthepicture,youmustsettheVisiblepropertyofthepicture'sFillFormatobjecttomsoFalse.IfyourpicturehasatransparentcolorandtheVisiblepropertyofthepicture'sFillFormatobjectissettomsoTrue,thepicture'sfillwillbevisiblethroughthetransparentcolor,butobjectsbehindthepicturewillbeobscured.
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
TriggerDelayTimePropertySetsorreturnsaSinglethatrepresentsthedelay,inseconds,fromwhenananimationtriggerisenabled.Read/write.
expression.TriggerDelayTime
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
TriggerShapePropertySetsorreturnsaShapeobjectthatrepresentstheshapeassociatedwithananimationtrigger.Read/write.
expression.TriggerShape
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
TriggerTypePropertySetsorreturnsanMsoAnimTriggerTypeconstantthatrepresentsthetriggerthatstartsananimation.Read/write.
MsoAnimTriggerTypecanbeoneoftheseMsoAnimTriggerTypeconstants.msoAnimTriggerAfterPreviousmsoAnimTriggerMixedmsoAnimTriggerNonemsoAnimTriggerOnPageClickDefault.msoAnimTriggerOnShapeClickmsoAnimTriggerWithPrevious
expression.TriggerType
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
TypePropertyTypepropertyasitappliestotheAnimationBehaviorobject.
ReturnsorsetsanMsoAnimTypeconstantthatrepresentsthetypeofanimation.Read/write.
MsoAnimTypecanbeoneoftheseMsoAnimTypeconstants.MsoAnimTypeColorMsoAnimTypeMixedMsoAnimTypeMotionMsoAnimTypeNoneMsoAnimTypePropertyMsoAnimTypeRoatationMsoAnimTypeScaleMsoAnimTypeTransition
expression.Type
expressionRequired.AnexpressionthatreturnsanAnimationBehaviorobject.
TypepropertyasitappliestotheBulletFormatobject.
ReturnsorsetsaPpBulletTypeconstantthatrepresentsthetypeofbullet.Read/write.
PpBulletTypecanbeoneofthesePpBulletTypeconstants.ppBulletMixedppBulletNoneppBulletNumberedppBulletPictureppBulletUnnumbered
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.
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
msoFillGradientmsoFillMixedmsoFillPatternedmsoFillPicturemsoFillSolidmsoFillTextured
expression.Type
expressionRequired.AnexpressionthatreturnsaFillFormatobject.
TypepropertyasitappliestotheHyperlinkobject.
ReturnsanMsoHyperlinkTypeconstantthatrepresentsthetypeofhyperlink.Read-only.
MsoHyperlinkTypecanbeoneoftheseMsoHyperlinkTypeconstants.msoHyperlinkInlineShapeForuseinMicrosoftWordonly.msoHyperlinkRangemsoHyperlinkShape
expression.Type
expressionRequired.AnexpressionthatreturnsaHyperlinkobject.
TypepropertyasitappliestothePlaceholderFormatobject.
ReturnsaPpPlaceholderTypeconstantthatrepresentsthetypeofplaceholder.Read-only.
PpPlaceholderTypecanbeoneofthesePpPlaceholderTypeconstants.ppPlaceholderBitmapppPlaceholderBodyppPlaceholderCenterTitleppPlaceholderChartppPlaceholderDate
ppPlaceholderFooterppPlaceholderHeaderppPlaceholderMediaClipppPlaceholderMixedppPlaceholderObjectppPlaceholderOrgChartppPlaceholderSlideNumberppPlaceholderSubtitleppPlaceholderTableppPlaceholderTitleppPlaceholderVerticalBodyppPlaceholderVerticalTitle
expression.Type
expressionRequired.AnexpressionthatreturnsaPlaceholderFormatobject.
TypepropertyasitappliestotheSelectionobject.
ReturnsaPpSelectionTypeconstantthatrepresentsthetypeofobjectsinaselection.Read-only.
PpSelectionTypecanbeoneofthesePpSelectionTypeconstants.ppSelectionNoneppSelectionShapesppSelectionSlidesppSelectionText
expression.Type
expressionRequired.AnexpressionthatreturnsaSelectionobject.
TypepropertyasitappliestotheShadowFormatobject.
ReturnsorsetsanMsoShadowTypeconstantthatrepresentsthetypeofshadow.Read/write.
MsoShadowTypecanbeoneoftheseMsoShadowTypeconstants.msoShadow1msoShadow10msoShadow11msoShadow12msoShadow13msoShadow14msoShadow15msoShadow16msoShadow17msoShadow18msoShadow19msoShadow2msoShadow20msoShadow3msoShadow4msoShadow5msoShadow6msoShadow7msoShadow8msoShadow9msoShadowMixed
expression.Type
expressionRequired.AnexpressionthatreturnsaShadowFormatobject.
TypepropertyasitappliestotheShapeandShapeRangeobjects.
ReturnsanMsoShapeTypeconstantthatrepresentsthetypeofshapeorshapesinarangeofshapes.Read-only.
MsoShapeTypecanbeoneoftheseMsoShapeTypeconstants.msoAutoShapemsoCallout
msoCanvasmsoChartmsoCommentmsoDiagrammsoEmbeddedOLEObjectmsoFormControlmsoFreeformmsoGroupmsoLinemsoLinkedOLEObjectmsoLinkedPicturemsoMediamsoOLEControlObjectmsoPicturemsoPlaceholdermsoScriptAnchormsoShapeTypeMixedmsoTablemsoTextBoxmsoTextEffect
expression.Type
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
TypepropertyasitappliestotheSoundEffectobject.
ReturnsorsetsaPpSoundEffectTypeconstantthatrepresentsthetypeofsoundeffect.Read/write.
PpSoundEffectTypecanbeoneofthesePpSoundEffectTypeconstants.ppSoundEffectsMixedppSoundFileppSoundNoneppSoundStopPrevious
expression.Type
expressionRequired.AnexpressionthatreturnsaSoundEffectobject.
TypepropertyasitappliestotheTabStopobject.
ReturnsorsetsaPpTabStopTypeconstantthatrepresentstheformattingofatabstop.Read/write.
PpTabStopTypecanbeoneofthesePpTabStopTypeconstants.ppTabStopCenterppTabStopDecimalppTabStopLeftppTabStopMixedppTabStopRight
expression.Type
expressionRequired.AnexpressionthatreturnsaTabStopobject.
TypepropertyasitappliestotheViewobject.
ReturnsaPpViewTypeconstantthatrepresentsthetypeofview.Read-only.
PpViewTypecanbeoneofthesePpViewTypeconstants.ppViewHandoutMasterppViewMasterThumbnailsppViewNormalppViewNotesMasterppViewNotesPageppViewOutlineppViewPrintPreviewppViewSlideppViewSlideMasterppViewSlideSorter
ppViewThumbnailsppViewTitleMaster
expression.Type
expressionRequired.AnexpressionthatreturnsaViewobject.
Example
AsitappliestotheShapeobject.
ThisexampleloopsthroughalltheshapesonalltheslidesintheactivepresentationandsetsalllinkedMicrosoftExcelworksheetstobeupdatedmanually.
ForEachsldInActivePresentation.Slides
ForEachshInsld.Shapes
Ifsh.Type=msoLinkedOLEObjectThen
Ifsh.OLEFormat.ProgID="Excel.Sheet"Then
sh.LinkFormat.AutoUpdate=ppUpdateOptionManual
EndIf
EndIf
Next
Next
ShowAll
UnderlinePropertyDetermineswhetherthespecifiedtext(fortheFontobject)orthefontstyle(fortheFontInfoobject)isunderlined.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedtext(orfontstyle)isn'tunderlined.msoTriStateMixedSomecharactersareunderlined(forthespecifiedtext)andsomearen't.msoTriStateTogglemsoTrueThespecifiedtext(orfontstyle)isunderlined.
expression.Underline
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetstheformattingforthetextinshapetwoonslideoneintheactivepresentation.
WithApplication.ActivePresentation.Slides(1).Shapes(2)
With.TextFrame.TextRange.Font
.Size=32
.Name="Palatino"
.Underline=msoTrue
EndWith
EndWith
ShowAll
UpdateLinksOnSavePropertyDetermineswhetherhyperlinksandpathstoallsupportingfilesareautomaticallyupdatedbeforeyousaveorpublishthepresentationasaWebpage.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseHyperlinksandpathstoallsupportingfilesarenotautomaticallyupdatedbeforeyousaveorpublishthepresentationasaWebpage.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.HyperlinksandpathstoallsupportingfilesareautomaticallyupdatedbeforeyousaveorpublishthepresentationasaWebpage,ensuringthatthelinksareup-to-dateatthetimethepresentationissaved.
Remarks
YoushouldsetthispropertytoFalseifthelocationwherethepresentationissavedisdifferentfromthefinallocationontheWebserverandthesupportingfilesarenotavailableatthefirstlocation.
Example
Thisexamplespecifiesthatlinksarenotupdatedbeforethepresentationissaved.
Application.DefaultWebOptions.UpdateLinksOnSave=msoFalse
ShowAll
UseFormatPropertyDetermineswhetherthedateandtimeobjectcontainsautomaticallyupdatedinformation.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThedateandtimeobjectisafixedstring.msoTriStateMixedmsoTriStateTogglemsoTrueThedateandtimeobjectcontainsautomaticallyupdatedinformation.
Remarks
ThispropertyappliesonlytoaHeaderFooterobjectthatrepresentsadateandtime(returnedbytheDateAndTimeproperty).SettheUseFormatpropertyofadateandtimeHeaderFooterobjecttoTruewhenyouwanttosetorreturnthedateandtimeformatbyusingtheFormatproperty.SettheUseFormatpropertytomsoFalsewhenyouwanttosetorreturnthetextstringforthefixeddateandtime.
Example
Thisexamplesetsthedateandtimefortheslidemasteroftheactivepresentationtobeupdatedautomaticallyandthenitsetsthedateandtimeformattoshowhours,minutes,andseconds.
SetmyPres=Application.ActivePresentation
WithmyPres.SlideMaster.HeadersFooters.DateAndTime
.UseFormat=msoTrue
.Format=ppDateTimeHmmss
EndWith
ShowAll
UseLongFileNamesPropertyDetermineswhetherlongfilenamesareused.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseLongfilenamesarenotusedandtheDOSfilenameformat(8.3)isused.msoTriStateMixedmsoTriStateTogglemsoTrueDefault.LongfilenamesareusedwhenyousaveorpublishacompleteorpartialpresentationasaWebpage.
Remarks
Ifyoudon'tuselongfilenamesandyourpresentationhassupportingfiles,MicrosoftPowerPointautomaticallyorganizesthosefilesinaseparatefolder.Otherwise,usetheOrganizeInFolderpropertytodeterminewhethersupportingfilesareorganizedinaseparatefolder.
Example
Thisexampledisallowstheuseoflongfilenamesastheglobaldefaultfortheapplication.
Application.DefaultWebOptions.UseLongFileNames=msoFalse
ShowAll
UseTextColorPropertyDetermineswhetherthespecifiedbulletsaresettothecolorofthefirsttextcharacterintheparagraph.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedbulletsaresettoanyothercolor.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedbulletsaresettothecolorofthefirsttextcharacterintheparagraph.
Remarks
YoucannotexplicitlysetthispropertytomsoFalse.Settingthebulletformatcolor(usingtheColorpropertyoftheFontobject)setsthispropertytomsoFalse.WhenUseTextColorismsoFalse,youcansetittomsoTruetoresetthebulletformattothedefaultcolor.
Example
Thisexampleresetsbulletsinshapetwoonslideoneintheactivepresentationtotheirdefaultcharacter,font,andcolor.
WithActivePresentation.Slides(1).Shapes(2)
With.TextFrame.TextRange.ParagraphFormat.Bullet
.RelativeSize=1
.UseTextColor=msoTrue
.UseTextFont=msoTrue
.Character=8226
EndWith
EndWith
ShowAll
UseTextFontPropertyDetermineswhetherthespecifiedbulletsaresettothefontofthefirsttextcharacterintheparagraph.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalseThespecifiedbulletsaresettoacustomfont.msoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedbulletsaresettothefontofthefirsttextcharacterintheparagraph.
Remarks
YoucannotexplicitlysetthispropertytomsoFalse.Settingthebulletformatfont(usingtheNamepropertyoftheFontobject)setsthispropertytomsoFalse.WhenUseTextFontismsoFalse,youcansetittomsoTruetoresetthebulletformattothedefaultfont.
Example
Thisexampleresetsbulletsinshapetwoonslideoneintheactivepresentationtotheirdefaultcharacter,font,andcolor.
WithActivePresentation.Slides(1).Shapes(2)
With.TextFrame.TextRange.ParagraphFormat.Bullet
.RelativeSize=1
.UseTextColor=msoTrue
.UseTextFont=msoTrue
.Character=8226
EndWith
EndWith
ValuePropertySetsorreturnsaVariantthatrepresentsthevalueofapropertyforananimationpoint.
expression.Value
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
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
ShowAll
VBASignedPropertyDetermineswhethertheVisualBasicforApplications(VBA)projectforthespecifieddocumenthasbeendigitallysigned.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheVBAprojectforthespecifieddocumenthasbeendigitallysigned.
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
VBEPropertyReturnsaVBEobjectthatrepresentstheVisualBasicEditor.Read-only.
Example
ThisexamplesetsthenameoftheactiveprojectintheVisualBasicEditor.
Application.VBE.ActiveVBProject.Name="TestProject"
VBProjectPropertyReturnsaVBProjectobjectthatrepresentstheindividualVisualBasicprojectforthepresentation.Read-only.
Example
ThisexamplechangesthenameoftheVisualBasicprojectfortheactivepresentation.
ActivePresentation.VBProject.Name="TestProject"
VersionPropertyReturnsthePowerPointversionnumber.Read-onlyString.
Example
ThisexampledisplaysamessageboxthatcontainsthePowerPointversionnumberandbuildnumber,andthenameoftheoperatingsystem.
WithApplication
MsgBox"WelcometoPowerPointversion"&.Version&_
",build"&.Build&",runningon"&.OperatingSystem&"!"
EndWith
ShowAll
VerticalAnchorPropertyReturnsorsetstheverticalalignmentoftextinatextframe.Read/writeMsoVerticalAnchor.
MsoVerticalAnchorcanbeoneoftheseMsoVerticalAnchorconstants.msoAnchorBottommsoAnchorBottomBaseLineAnchorsthebottomofthetextstringtothecurrentpositionregardlessoftheresizingoftext.Whenyouresizetextwithoutbaselineanchoring,thetextcentersitselfonthepreviousposition.msoAnchorMiddlemsoAnchorTopmsoAnchorTopBaselineAnchorsthebottomofthetextstringtothecurrentpositionregardlessoftheresizingoftext.Whenyouresizetextwithoutbaselineanchoring,thetextcentersitselfonthepreviousposition.msoVerticalAnchorMixedRead-only.Returnedwhentwoormoretextboxeswithinashaperangehavethispropertysettodifferentvalues.
expression.VerticalAnchor
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
ThisexamplesetsthealignmentofthetextinshapeoneonmyDocumenttotopcentered.
SetmyDocument=ActivePresentation.SlideMaster
WithmyDocument.Shapes(1)
.TextFrame.HorizontalAnchor=msoAnchorCenter
.TextFrame.VerticalAnchor=msoAnchorTop
EndWith
ShowAll
VerticalFlipPropertyDetermineswhetherthespecifiedshapeisflippedaroundtheverticalaxis.Read-onlyMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedshapeisflippedaroundtheverticalaxis.
Example
ThisexamplerestoreseachshapeonmyDocumenttoitsoriginalstateifit'sbeenflippedhorizontallyorvertically.
SetmyDocument=ActivePresentation.Slides(1)
ForEachsInmyDocument.Shapes
Ifs.HorizontalFlipThens.FlipmsoFlipHorizontal
Ifs.VerticalFlipThens.FlipmsoFlipVertical
Next
ShowAll
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
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
ShowAll
ViewPropertyViewpropertyasitappliestotheSlideShowWindowobject.
ReturnsaSlideShowViewobject.Read-only.
expression.View
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
ViewpropertyasitappliestotheDocumentWindowobject.
ReturnsaViewobjectthatrepresentstheviewinthespecifieddocumentwindow.Read-only.
expression.View
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Example
AsitappliestotheSlideShowWindowobject.
ThisexampleusestheViewpropertytoexitthecurrentslideshow,setstheviewintheactivewindowtoslideview,andthendisplaysslidethree.
Application.SlideShowWindows(1).View.Exit
WithApplication.ActiveWindow
.ViewType=ppViewSlide
.View.GotoSlide3
EndWith
ShowAll
ViewTypePropertyViewTypepropertyasitappliestotheDocumentWindowobject.
Returnsorsetsthetypeoftheviewcontainedinthespecifieddocumentwindow.Read/writePpViewType.
PpViewTypecanbeoneofthesePpViewTypeconstants.ppViewHandoutMasterppViewMasterThumbnailsppViewNormalppViewNotesMasterppViewNotesPageppViewOutlineppViewPrintPreviewppViewSlideppViewSlideMasterppViewSlideSorterppViewThumbnailsppViewTitleMaster
expression.ViewType
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
ViewTypepropertyasitappliestothePaneobject.
nanyviewwithpanes,returnsthetypeofviewforthespecifiedpane.Whenreferencingaviewwithoutpanes,returnsthetypeofviewfortheparentDocumentWindowobject.Read-onlyPpViewType.
PpViewTypecanbeoneofthesePpViewTypeconstants.ppViewHandoutMasterppViewMasterThumbnails
ppViewNormalppViewNotesMasterppViewNotesPageppViewOutlineppViewPrintPreviewppViewSlideppViewSlideMasterppViewSlideSorterppViewThumbnailsppViewTitleMaster
expression.ViewType
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
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
ShowAll
VisiblePropertyReturnsorsetsthevisibilityofthespecifiedobjectortheformattingappliedtothespecifiedobject.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueThespecifiedobjectorobjectformattingisvisible.
Example
Thisexamplesetsthehorizontalandverticaloffsetsfortheshadowofshapethreeonthefirstslideintheactivepresentation.Theshadowisoffset5pointstotherightoftheshapeand3pointsaboveit.Iftheshapedoesn'talreadyhaveashadow,thisexampleaddsonetoit.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes(3).Shadow
.Visible=msoTrue
.OffsetX=5
.OffsetY=-3
EndWith
WebOptionsPropertyReturnstheWebOptionsobject,whichcontainspresentation-levelattributesusedbyMicrosoftPowerPointwhenyousaveorpublishacompleteorpartialpresentationasaWebpageoropenaWebpage.Read-only.
Example
ThisexamplespecifiesthatwhensavingorpublishingtheactivepresentationasaWebpage,PortableNetworkGraphics(PNG)areallowed,andthetextcolorfortheoutlinepaneiswhiteandthebackgroundcolorfortheoutlineandslidepanesisblack.
WithActivePresentation.WebOptions
.FrameColors=ppFrameColorsWhiteTextOnBlack
.AllowPNG=True
EndWith
WeightPropertyReturnsorsetsthethicknessofthespecifiedline,inpoints.Read/writeSingle.
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
WidthPropertyReturnsorsetsthewidthofthespecifiedobject,inpoints.Read-onlySinglefortheMasterobject,read/writeSingleforallotherobjects.
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
ShowAll
WindowsPropertyWindowspropertyasitappliestotheApplicationobject.
ReturnsaDocumentWindowscollectionthatrepresentsallopendocumentwindows.Read-only.
WindowspropertyasitappliestothePresentationobject.
ReturnsaDocumentWindowscollectionthatrepresentsalldocumentwindowsassociatedwiththespecifiedpresentation.Thispropertydoesn'treturnanyslideshowwindowsassociatedwiththepresentation.Read-only.
Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.
Example
AsitappliestotheApplicationobject.
Thisexampleclosesallwindowsexcepttheactivewindow.
WithApplication.Windows
Fori=.CountTo2Step-1
.Item(i).Close
Next
EndWith
ShowAll
WindowStatePropertyReturnsorsetsthestateofthespecifiedwindow.Read/writePpWindowState.
PpWindowStatecanbeoneofthesePpWindowStateconstants.ppWindowMaximizedppWindowMinimizedppWindowNormal
expression.WindowState
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Remarks
WhenthestateofthewindowisppWindowNormal,thewindowisneithermaximizednorminimized.
Example
Thisexamplemaximizestheactivewindow.
Application.ActiveWindow.WindowState=ppWindowMaximized
ShowAll
WordWrapPropertyWordWrappropertyasitappliestotheTextFrameobject.
Determineswhetherlinesbreakautomaticallytofitinsidetheshape.Read/writeMsoTriState.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueLinesbreakautomaticallytofitinsidetheshape.
expression.WordWrap
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
WordWrappropertyasitappliestotheParagraphFormatobject.
UsedonlywithKanjicharacters.Read/writeLong.
Example
AsitappliestotheTextFrameobject.
ThisexampleaddsarectanglethatcontainstexttomyDocument,andthenturnsoffwordwrappinginthenewrectangle.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes.AddShape(msoShapeRectangle,_
0,0,100,300).TextFrame
.TextRange.Text=_
"Hereissometesttextthatistoolongforthisbox"
.WordWrap=False
EndWith
WritePasswordPropertySetsorreturnsaStringthatrepresentsapasswordforsavingchangestothespecifieddocument.Read/write.
expression.WritePassword
expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.
Example
Thisexamplesetsthepasswordforsavingchangestotheactivepresentation.
SubSetSavePassword()
ActivePresentation.WritePassword=complexstrPWD'globalvariable
EndSub
ShowAll
ZoomPropertyZoompropertyasitappliestotheViewobject.
Returnsorsetsthezoomsettingofthespecifiedviewasapercentageofnormalsize.Canbeavaluefrom10to400percent.Read/writeInteger.
expression.Zoom
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
ZoompropertyasitappliestotheSlideShowViewobject.
Returnsthezoomsettingofthespecifiedslideshowwindowviewasapercentageofnormalsize.Canbeavaluefrom10to400percent.Read-onlyInteger.
expression.Zoom
expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.
Example
AsitappliestotheViewobject.
Thefollowingexamplesetsthezoomto30percentfortheviewindocumentwindowone.
Windows(1).View.Zoom=30
ShowAll
ZoomToFitPropertyDetermineswhethertheviewiszoomedtofitthedimensionsofthedocumentwindoweverytimethedocumentwindowisresized.Read/writeMsoTriState.Thispropertyappliesonlytoslideview,notespageview,ormasterview.
MsoTriStatecanbeoneoftheseMsoTriStateconstants.msoCTruemsoFalsemsoTriStateMixedmsoTriStateTogglemsoTrueTheviewiszoomedtofitthedimensionsofthedocumentwindoweverytimethedocumentwindowisresized.
Remarks
WhenthevalueoftheZoompropertyisexplicitlyset,thevalueoftheZoomToFitpropertyisautomaticallysettomsoFalse.
Example
Thefollowingexamplesetstheviewindocumentwindowonetoslideview,withthezoomautomaticallysettofitthedimensionsofthewindow.
WithWindows(1)
.ViewType=ppViewSlide
.View.ZoomToFit=msoTrue
EndWith
ZOrderPositionPropertyReturnsthepositionofthespecifiedshapeinthez-order.Shapes(1)returnstheshapeatthebackofthez-order,andShapes(Shapes.Count)returnstheshapeatthefrontofthez-order.Read-onlyLong.
Thispropertyisread-only.Tosettheshape'spositioninthez-order,usetheZOrdermethod.
Remarks
Ashape'spositioninthez-ordercorrespondstotheshape'sindexnumberintheShapescollection.Forexample,iftherearefourshapesontheslide,theexpressionmyDocument.Shapes(1)returnstheshapeatthebackofthez-order,andtheexpressionmyDocument.Shapes(4)returnstheshapeatthefrontofthez-order.
Wheneveryouaddanewshapetoacollection,it'saddedtothefrontofthez-orderbydefault.
Example
ThisexampleaddsanovaltomyDocumentandthenplacestheovalsecondfromthebackinthez-orderifthereisatleastoneothershapeontheslide.
SetmyDocument=ActivePresentation.Slides(1)
WithmyDocument.Shapes.AddShape(msoShapeOval,100,100,100,300)
While.ZOrderPosition>2
.ZOrdermsoSendBackward
Wend
EndWith
ShowAll
AfterNewPresentationEventOccursafterapresentationiscreated.
expression.AfterNewPresentation(Pres)
expressionRequired.AnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresRequiredPresentation.Thepresentationthatiscreated.
Example
ThisexampleusestheRGBfunctiontosettheslidemasterbackgroundcolorforthenewpresentationtosalmonpink,andthenappliesthethirdcolorschemetothenewpresentation.
PrivateSubApp_AfterNewPresentation(ByValPresAsPresentation)
WithPres
SetCS3=.ColorSchemes(3)
CS3.Colors(ppBackground).RGB=RGB(240,115,100)
.SlideMaster.ColorScheme=CS3
EndWith
EndSub
ShowAll
AfterPresentationOpenEventOccursafteranexistingpresentationisopened.
expression.AfterPresentationOpen(Pres)
expressionRequired.AnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresRequiredPresentation.Thepresentationthatisopened.
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
ColorSchemeChangedEventOccursafteracolorschemeischanged.
PrivateSubobject_ColorSchemeChanged(ByValSldRangeAsSlideRange)
objectAvariablethatreferencesanobjectoftypeApplicationdeclaredwitheventsinaclassmodule.
SldRangeTherangeofslidesaffectedbythechange.
Remarks
Actionswhichtriggerthiseventwouldincludeactionssuchasmodifyingaslide'sorslidemaster'scolorscheme,orapplyingatemplate.
ToaccesstheApplicationevents,declareanApplicationvariableintheGeneralDeclarationssectionofyourcode.ThensetthevariableequaltotheApplicationobjectforwhichyouwanttoaccessevents.ForinformationaboutusingeventswiththeMicrosoftPowerPointApplicationobject,seeUsingEventswiththeApplicationObject.
Example
Thisexampledisplaysamessagewhenthecolorschemefortheselectedslideorslidesischanged.ThisexampleassumesanApplicationobjectcalledPPTApphasbeendeclaredusingtheWithEventskeyword.
PrivateSubPPTApp_ColorSchemeChanged(ByValSldRangeAsSlideRange)
IfSldRange.Count=1Then
MsgBox"You'vechangedthecolorschemefor"_
&SldRange.Name&"."
Else
MsgBox"You'vechangedthecolorschemefor"_
&SldRange.Count&"slides."
EndIf
EndSub
ShowAll
NewPresentationEventOccursafterapresentationiscreated,asitisaddedtothePresentationscollection.
PrivateSubapplication_NewPresentation(ByValPresAsPresentation)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThenewpresentation.
Example
ThisexampleusestheRGBfunctiontosettheslidemasterbackgroundcolorforthenewpresentationtosalmonpink,andthenappliesthethirdcolorschemetothenewpresentation.
PrivateSubApp_NewPresentation(ByValPresAsPresentation)
WithPres
SetCS3=.ColorSchemes(3)
CS3.Colors(ppBackground).RGB=RGB(240,115,100)
.SlideMaster.ColorScheme=CS3
EndWith
EndSub
PresentationBeforeSaveEventOccursbeforeapresentationissaved.
PrivateSubobject_PresentationBeforeSave(ByValPresAsPresentation,CancelAsBoolean)
objectAvariablethatreferencesanobjectoftypeApplicationdeclaredwitheventsinaclassmodule.
PresThepresentationbeingsaved.
CancelTruetocancelthesaveprocess.
Remarks
ThiseventistriggeredastheSaveAsdialogboxappears.
ToaccesstheApplicationevents,declareanApplicationvariableintheGeneralDeclarationssectionofyourcode.ThensetthevariableequaltotheApplicationobjectforwhichyouwanttoaccessevents.ForinformationaboutusingeventswiththeMicrosoftPowerPointApplicationobject,seeUsingEventswiththeApplicationObject.
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
ShowAll
PresentationCloseEventOccursimmediatelybeforeanyopenpresentationcloses,asitisremovedfromthePresentationscollection.
PrivateSubapplication_PresentationClose(ByValPresAsPresentation)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThepresentationthatisbeingclosed.
Example
ThisexamplesavesacopyoftheactivepresentationasanHTMLfile,withthesamenameandwithinthesamefolder.
PrivateSubApp_PresentationClose(ByValPresAsPresentation)
FindNum=InStr(1,Pres.FullName,".")
HTMLName=Mid(Pres.FullName,1,FindNum-1)_
&".htm"
Pres.SaveCopyAsHTMLName,ppSaveAsHTML
EndSub
ShowAll
PresentationNewSlideEventOccurswhenanewslideiscreatedinanyopenpresentation,astheslideisaddedtotheSlidescollection.
PrivateSubapplication_PresentationNewSlide(ByValSldAsSlide)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
SldThenewslide.
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
ShowAll
PresentationOpenEventOccursafteranexistingpresentationisopened,asitisaddedtothePresentationscollection.
PrivateSubapplication_PresentationOpen(ByValPresAsPresentation)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThepresentationthatisopened.
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
ShowAll
PresentationPrintEventOccursbeforeapresentationisprinted.
PrivateSubapplication_PresentationPrint(ByValPresAsPresentation)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThepresentationtobeprinted.
Example
ThisexamplesetsthePrintHiddenSlidespropertytoTruesothateverytimetheactivepresentationisprinted,thehiddenslidesareprintedaswell.
PrivateSubApp_PresentationPrint(ByValPresAsPresentation)
Pres.PrintOptions.PrintHiddenSlides=True
EndSub
ShowAll
PresentationSaveEventOccursbeforeanyopenpresentationissaved.
PrivateSubapplication_PresentationSave(ByValPresAsPresentation)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThepresentationtobesaved.
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
ShowAll
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)
Example
ThefollowingexampledisplaysamessageifthesynchronizationofapresentationinaDocumentWorkspacefails.
PrivateSubapp_PresentationSync(ByValPresAsPresentation,_
ByValSyncEventTypeAsOffice.MsoSyncEventType)
IfSyncEventType=msoSyncEventDownloadFailedOr_
SyncEventType=msoSyncEventUploadFailedThen
MsgBox"Synchronizationfailed."&_
"Pleasecontactyouradministrator,"&vbCrLf&_
"ortryagainlater."
EndIf
EndSub
SlideSelectionChangedEventThiseventoccursatdifferenttimesdependingonthecurrentview.
View DescriptionNormal,Master Occurswhentheslideintheslidepanechanges.SlideSorter Occurswhentheselectionchanges.Slide,Notes Occurswhentheslidechanges.Outline Doesnotoccur.
PrivateSubobject_SlideSelectionChanged(ByValSldRangeAsSlideRange)
objectAvariablethatreferencesanobjectoftypeApplicationdeclaredwitheventsinaclassmodule.
SldRangeTheselectionofslides.Inmostcasesthiswouldbeasingleslide(forexample,inSlideViewyounavigatetothenextslide),butinsomecasesthiscouldbemultipleslides(forexample,amarqueeselectioninSlideSorterView).
Remarks
ToaccesstheApplicationevents,declareanApplicationvariableintheGeneralDeclarationssectionofyourcode.ThensetthevariableequaltotheApplicationobjectforwhichyouwanttoaccessevents.ForinformationaboutusingeventswiththeMicrosoftPowerPointApplicationobject,seeUsingEventswiththeApplicationObject.
Example
Thisexampledisplaysamessageeverytimeauserselectsadifferentslide.ThisexampleassumesanApplicationobjectcalledPPTApphasbeendeclaredusingtheWithEventskeyword.
PrivateSubPPTApp_SlideSelectionChanged(ByValSldRangeAsSlideRange)
MsgBox"Slideselectionchanged."
EndSub
ShowAll
SlideShowBeginEventOccurswhenyoustartaslideshow.MicrosoftPowerPointcreatestheslideshowwindowandpassesittothisevent.Ifoneslideshowbranchestoanother,theSlideShowBegineventdoesnotoccuragainwhenthesecondslideshowbegins.
PrivateSubapplication_SlideShowBegin(ByValWnAsSlideShowWindow)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
WnTheslideshowwindowinitializedpriortothisevent.
Example
Thisexampleadjuststhesizeandpositionoftheslideshowwindowandthenreactivatesit.
PrivateSubApp_SlideShowBegin(ByValWnAsSlideShowWindow)
WithWn
.Height=325
.Width=400
.Left=100
.Activate
EndWith
EndSub
ShowAll
SlideShowEndEventOccursafteraslideshowends—immediatelyafterthelastSlideShowNextSlideeventoccurs.
PrivateSubapplication_SlideShowEnd(ByValPresAsPresentation)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThepresentationclosedwhenthiseventoccurs.
Remarks
TheSlideShowEndeventalwaysoccursbeforeaslideshowendsiftheSlideShowBegineventhasoccurred.YoucanusetheSlideShowEndeventtoreturnanypropertysettingsandvariableinitializationsthatoccurintheSlideShowBegineventtotheiroriginalsettings.
Example
Thisexampleturnsofftheentryeffectandautomaticadvancetimingslideshowtransitioneffectsforslidesonethroughfourattheendoftheslideshow.Italsosetstheslidestoadvancemanually.
PrivateSubApp_SlideShowEnd(ByValPresAsPresentation)
WithPres.Slides.Range(Array(1,4))_
.SlideShowTransition
.EntryEffect=ppEffectNone
.AdvanceOnTime=msoFalse
EndWith
WithPres.SlideShowSettings
.AdvanceMode=ppSlideShowManualAdvance
EndWith
EndSub
ShowAll
SlideShowNextBuildEventOccursuponmouse-clickortiminganimation,butbeforetheanimatedobjectbecomesvisible.
PrivateSubapplication_SlideShowNextBuild(ByValWnAsSlideShowWindow)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
WnTheactiveslideshowwindow.
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
ShowAll
SlideShowNextClickEventOccursonthenextclickontheslide.
PrivateSubapplication_SlideShowNextClick(ByValWnAsSlideShowWindow,ByValnEffectAsEffect)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
WnTheslideshowwindowinitializedpriortothisevent.
nEffectTheeffecttoanimateonnextclick.
ShowAll
SlideShowNextSlideEventOccursimmediatelybeforethetransitiontothenextslide.Forthefirstslide,occursimmediatelyaftertheSlideShowBeginevent.
PrivateSubapplication_SlideShowNextSlide(ByValWnAsSlideShowWindow)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
WnTheactiveslideshowwindow.
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
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
ShowAll
WindowActivateEventOccurswhentheapplicationwindoworanydocumentwindowisactivated.
PrivateSubapplication_WindowActivate(ByValPresAsPresentation,ByValWnAsDocumentWindow)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThepresentationdisplayedintheactivatedwindow.
WnTheactivateddocumentwindow.
Example
Thisexampleopenseveryactivatedpresentationinslidesorterview.
PrivateSubApp_WindowActivate_(ByValPresAsPresentation,ByValWnAsDocumentWindow)
Wn.ViewType=ppViewSlideSorter
EndSub
ShowAll
WindowBeforeDoubleClickEventOccurswhenyoudouble-clicktheitemsintheviewslistedinthefollowingtable.
View ItemNormalorslideview ShapeSlidesorterview SlideNotespageview Slideimage
Thedefaultdouble-clickactionoccursafterthiseventunlesstheCancelargumentissettoTrue.
PrivateSubapplication_WindowBeforeDoubleClick(ByValSelAsSelection,ByValCancelAsBoolean)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
SelTheselectionbelowthemousepointerwhenthedouble-clickoccurs.
CancelFalsewhentheeventoccurs.IftheeventproceduresetsthisargumenttoTrue,thedefaultdouble-clickactionisn'tperformedwhentheprocedureisfinished.
Example
Inslidesorterview,thedefaultdouble-clickeventforanyslideistochangetoslideview.Inthisexample,iftheactivepresentationisdisplayedinslidesorterview,thedefaultactionispreemptedbytheWindowBeforeDoubleClickevent.TheeventprocedurechangestheviewtonormalviewandthencancelsthechangetoslideviewbysettingtheCancelargumenttoTrue.
PrivateSubApp_WindowBeforeDoubleClick_(ByValSelAsSelection,ByValCancelAsBoolean)
WithApplication.ActiveWindow
If.ViewType=ppViewSlideSorterThen
.ViewType=ppViewNormal
Cancel=True
EndIf
EndWith
EndSub
ShowAll
WindowBeforeRightClickEventOccurswhenyouright-clickashape,aslide,anotespage,orsometext.ThiseventistriggeredbytheMouseUpevent.
PrivateSubapplication_WindowBeforeRightClick(ByValSelAsSelection,ByValCancelAsBoolean)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
SelTheselectionbelowthemousepointerwhentheright-clickoccurred.
CancelFalsewhentheeventoccurs.IftheeventproceduresetsthisargumenttoTrue,thedefaultcontextmenudoesnotappearwhentheprocedureisfinished.
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
ShowAll
WindowDeactivateEventOccurswhentheapplicationwindoworanydocumentwindowisdeactivated.
PrivateSubapplication_WindowDeactivate(ByValPresAsPresentation,ByValWnAsDocumentWindow)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
PresThepresentationdisplayedinthedeactivatedwindow.
WnThedeactivateddocumentwindow.
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
ShowAll
WindowSelectionChangeEventOccurswhentheselectionoftext,ashape,oraslideintheactivedocumentwindowchanges,whetherthroughtheuserinterfaceorthroughcode.
PrivateSubapplication_WindowSelectionChange(ByValSelAsSelection)
applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.ForinformationaboutusingeventswiththeApplicationobject,seeUsingEventswiththeApplicationObject.
SelRepresentstheobjectselected.
Example
Thisexampledetermineswhenadifferentslideisbeingselectedandchangesthebackgroundcolorofthenewlyselectedslide.
PrivateSubApp_WindowSelectionChange(ByValSelAsSelection)
WithSel
If.Type=ppSelectionNoneThen
With.SlideRange(1)
.ColorScheme.Colors(ppBackground).RGB=_
RGB(240,115,100)
EndWith
EndIf
EndWith
EndSub
ShowAll
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
ppWindowNormal 1
ShowAll
AddingcontrolstoadocumentToaddcontrolstoadocument,displaytheControlToolbox,clickthecontrolyouwanttoadd,andthenclickonthedocument.Draganadjustmenthandleofthecontroluntilthecontrol'soutlineisthesizeandshapeyouwant.
NoteDraggingacontrol(oranumberof"grouped"controls)fromtheformbacktotheControlToolboxcreatesatemplateofthatcontrol,whichcanbereused.Thisisausefulfeatureforimplementingastandard"lookandfeel"foryourapplications.
ShowAll
SettingcontrolpropertiesYoucansetsomecontrolpropertiesatdesigntime(beforeanymacroisrunning).Indesignmode,right-clickacontrolandclickPropertiestodisplaythePropertieswindow.Propertynamesareshownintheleftcolumninthewindow,propertyvaluesintherightcolumn.Yousetapropertyvaluebyenteringthenewvaluetotherightofthepropertyname.
ShowAll
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
ShowAll
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.
ShowAll
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()
frmSalesPeople.Show
IfblnCancelled=TrueThen
MsgBox"OperationCancelled!",vbExclamation
Else
MsgBox"TheSalesperson'sIDis:"&
intSalesPersonID&_
"TheRegionis:"&strRegion
EndIf
EndSub
CreatingaUserFormTocreateacustomdialogbox,youmustcreateaUserForm.TocreateaUserForm,clickUserFormontheInsertmenuintheVisualBasicEditor.
UsethePropertieswindowtochangethename,behavior,andappearanceoftheform.Forexample,tochangethecaptiononaform,settheCaptionproperty.
ShowAll
AddingcontrolstoaUserFormToaddcontrolstoauserform,findthecontrolyouwanttoaddintheToolbox,dragthecontrolontotheform,andthendraganadjustmenthandleonthecontroluntilthecontrol'soutlineisthesizeandshapeyouwant.
NoteDraggingacontrol(oranumberof"grouped"controls)fromtheformbacktotheToolboxcreatesatemplateofthatcontrol,whichcanbereused.Thisisausefulfeatureforimplementingastandard"lookandfeel"foryourapplications.
Whenyou'veaddedcontrolstotheform,usethecommandsontheFormatmenuintheVisualBasicEditortoadjustthecontrolalignmentandspacing.
DisplayingacustomdialogboxTotestyourdialogboxintheVisualBasicEditor,clickRunSub/UserFormontheRunmenuintheVisualBasicEditor.
TodisplayadialogboxfromVisualBasic,usetheShowmethod.ThefollowingexampledisplaysthedialogboxnamedUserForm1.
PrivateSubGetUserName()
UserForm1.Show
EndSub
ShowAll
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.
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.
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"
HyperlinkObjectMultipleobjects Hyperlinks
Hyperlink
Representsahyperlinkassociatedwithanon-placeholdershapeortext.YoucanuseahyperlinktojumptoanInternetorintranetsite,toanotherfile,ortoaslidewithintheactivepresentation.TheHyperlinkobjectisamemberoftheHyperlinkscollection.TheHyperlinkscollectioncontainsallthehyperlinksonaslideoramaster.
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.
ShowAll
ReturninganObjectfromaCollectionTheItemmethodreturnsasingleobjectfromacollection.ThefollowingexamplesetsthefirstPresvariabletoaPresentationobjectthatrepresentspresentationone.
SetfirstPres=Presentations.Item(1)
TheItemmethodisthedefaultmethodformostcollections,soyoucanwritethesamestatementmoreconciselybyomittingtheItemkeyword.
SetfirstPres=Presentations(1)
Formoreinformationaboutaspecificcollection,seetheHelptopicforthatcollectionortheItemmethodforthecollection.
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
ScaleEffectObjectAnimationBehavior ScaleEffect
RepresentsascalingeffectforanAnimationBehaviorobject.
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
HyperlinksCollectionObjectMultipleobjects Hyperlinks
Hyperlink
AcollectionofalltheHyperlinkobjectsonaslideormaster.
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