microsoft office 2003 web components visual basic reference · (msdn) web site for the latest...

2370
New Objects Visit the Office Developer Center on the Microsoft Developer Network (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product news, technical articles, downloads, and samples. The following table lists objects added to the Microsoft Office 2003 Web Components object model. Object Description ChScrollView Use the properties and methods of the ChScrollView object return information about, or to scroll and zoom the view of a chart. ChSelectionCollection Use the ChSelectionCollection collection to work with all currently selected objects in a chart. ListObject A ListObject object represents an XML list on a worksheet. ListObjects Use the properties and methods of the ListObjects collection to work with all the XML lists on a worksheet. ListRow A ListRow object represents a row in an XML list. ListRows Use the the ListRows collection to work with the all the rows in an XML list. XmlDataBinding An XmlDataBinding object represents an XML data binding for XML lists and mapped data in a Spreadsheet component. XmlDataBindings Use the XmlDataBindings collection to work with all the XML data bindings in a Spreadsheet component. XmlMap An XmlMap object represents an XML schema map that maps XML data to the worksheets in a Spreadsheet component. XmlMaps Use the XmlMaps collection to work with all of

Upload: others

Post on 22-Jul-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewObjects

VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetwork(MSDN)WebsiteforthelatestinformationaboutprogrammingwithMicrosoftOffice2003WebComponents,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistsobjectsaddedtotheMicrosoftOffice2003WebComponentsobjectmodel.

Object DescriptionChScrollView Usethepropertiesandmethodsofthe

ChScrollViewobjectreturninformationabout,ortoscrollandzoomtheviewofachart.

ChSelectionCollection UsetheChSelectionCollectioncollectiontoworkwithallcurrentlyselectedobjectsinachart.

ListObject AListObjectobjectrepresentsanXMLlistonaworksheet.

ListObjects UsethepropertiesandmethodsoftheListObjectscollectiontoworkwithalltheXMLlistsonaworksheet.

ListRow AListRowobjectrepresentsarowinanXMLlist.

ListRows UsethetheListRowscollectiontoworkwiththealltherowsinanXMLlist.

XmlDataBinding AnXmlDataBindingobjectrepresentsanXMLdatabindingforXMLlistsandmappeddatainaSpreadsheetcomponent.

XmlDataBindings UsetheXmlDataBindingscollectiontoworkwithalltheXMLdatabindingsinaSpreadsheetcomponent.

XmlMap AnXmlMapobjectrepresentsanXMLschemamapthatmapsXMLdatatotheworksheetsinaSpreadsheetcomponent.

XmlMaps UsetheXmlMapscollectiontoworkwithallof

Page 2: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

theXMLschemamapsinaSpreadsheetcomponent.

Page 3: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewProperties(AlphabeticalList)

VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetwork(MSDN)WebsiteforthelatestinformationaboutprogrammingwithMicrosoftOffice2003WebComponents,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistspropertiesaddedtotheMicrosoftOffice2003WebComponentsobjectmodel(sortedalphabetically).

NewProperty Object(s)Active ListRowAllowUISelection ChartSpaceAsync XmlDataBindingBarWidth ChChartBindingData XmlDataBindingBindingInProgress XmlDataBinding,XmlDataBindingsCanQuery XmlDataBindingCanUpdate XmlDataBindingDataBodyRange ListObjectDefaultQueryOnLoad SpreadsheetHeaderRowRange ListObjectHorizontalExtent ChScrollViewHorizontalExtentMax ChScrollViewHorizontalPosition ChScrollViewInsertRowRange ListObjectListObject Range,WorkbookListObjects WorksheetListRows ListObjectLoadMode XmlDataBindingMapData XmlMapPropNames ListObjectScrollView ChChart

Page 4: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectionCollection ChartSpaceVerticalExtent ChScrollViewVerticalExtentMax ChScrollViewVerticalPosition ChScrollViewXmlDataBindings WorkbookXmlMap XmlDataBindingXmlMaps Workbook

Page 5: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewProperties(byObject)

VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetwork(MSDN)WebsiteforthelatestinformationaboutprogrammingwithMicrosoftOffice2003WebComponents,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistspropertiesaddedtotheMicrosoftOffice2003WebComponentsobjectmodel(sortedbyobjectname).

Object NewPropertiesChartSpace AllowUISelection,SelectionCollectionChChart BarWidth,ScrollViewChScrollView HorizontalExtent,HorizontalExtentMax,

HorizontalPosition,VerticalExtent,VerticalExtentMax,VerticalPosition

ListObject DataBodyRange,HeaderRowRange,InsertRowRange,ListRows,PropNames

ListRow ActivePivotField SubtotalLabelBackColor,SubtotalLabelFont,

SubtotalLabelForeColor,SubtotalLabelHAlignment

Range ListObjectSpreadsheet DefaultQueryOnLoadWorkbook ListObject,XmlDataBindings,XmlMapsWorksheet ListObjectsXmlDataBinding Async,BindingData,BindingInProgress,

CanQuery,CanUpdate,LoadMode,XmlMapXmlDataBindings BindingInProgressXmlMap MapData

Page 6: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewMethods(AlphabeticalList)

VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetwork(MSDN)WebsiteforthelatestinformationaboutprogrammingwithMicrosoftOffice2003WebComponents,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistsmethodsaddedtotheMicrosoftOffice2003WebComponentsobjectmodel(sortedalphabetically).

NewMethod ObjectAdd XmlDataBindings,XmlMapsDelete XmlDataBinding,XmlMapExportMetaData XmlMapFireParametersOut SpreadsheetGetDataPointVisible ChSeriesExportXML XmlMapImportXml XmlMapOverrideDefaultElementFormatting ChChartDrawRefresh XmlDataBindingSelect2 ChPointSetExtent ChScrollViewSetPosition ChScrollViewUpdate XmlDataBindingValidate Range

Page 7: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewMethods(byObject)

VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetwork(MSDN)WebsiteforthelatestinformationaboutprogrammingwithMicrosoftOffice2003WebComponents,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistsmethodsaddedtotheMicrosoftOffice2003WebComponentsobjectmodel(sortedbyobjectname).

Object NewMethodChChartDraw OverrideDefaultElementFormattingChPoint Select2ChScrollView SetExtent,SetPositionChSeries GetDataPointVisibleRange ValidateSpreadsheet FireParametersOutXmlDataBinding Delete,Refresh,UpdateXmlDataBindings AddXmlMap Delete,ExportMetaData,ExportXML,ImportXmlXmlMaps Add

Page 8: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewEvents

VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetwork(MSDN)WebsiteforthelatestinformationaboutprogrammingwithMicrosoftOffice2003WebComponents,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistseventsaddedtotheMicrosoftOffice2003WebComponentsobjectmodel.

NewEvent ObjectBindingAdded SpreadsheetBindingCompleted SpreadsheetBindingDeleted SpreadsheetBindingError SpreadsheetBindingUpdated SpreadsheetParametersOutReady SpreadsheetRowReady Spreadsheet

Page 9: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MakingConnectionstoExternalDataSourcesMoreSecureWhenyoudefineaconnectiontoanexternaldatasourceforanOfficeWebcomponentonaWebpage,thisinformationisstoredasanunencrypted(plaintext)connectionstringintheHTMLsource.Asaresult,auseropeningthepageinabrowsercaneasilyviewtheHTMLsourceforthepageandreadtheconnectionstring,whichmayincludeausernameandpassword,dependingonhowyoudefinedtheconnection.

Topreventunauthorizedaccessusinginformationfromtheconnectionstring,ifthedatasourcesupportsthismodeofauthentication,useWindowsAuthentication(alsoreferredtoasaTrustedConnectionandIntegratedSecurity),whichusesthecurrentuser'sMicrosoftWindowsaccounttoconnecttoanexternaldatasource.UsingWindowsAuthenticationtoconnecttoanexternaldatasourcehasthefollowingadvantages:

Theprogrammerorpagedesignerdoesn'thavetoenterausernameorpasswordtoconnecttothedatasource,sothatinformationcannotbeexposedinthepage'sHTMLsource.

Theuserofthepagedoesn'thavetoenterausernameorpasswordtoconnecttothedatasourcewhenopeningthepage,sothatinformationcannotbecompromisedwhileit'sbeingsenttotheserver.

OnlyaWindowsuseraccountthatisconfiguredinthesecuritysystemforthedatasourcewillbeallowedtoconnecttothatdatasource.

ImportantTouseWindowsAuthentication,theusersyouwanttoconnecttoanexternaldatasourcemusthaveuseraccountsonaWindowsdomain.UsersthataremembersofaWindowsWorkgroupcannotuseWindowsAuthentication.

Page 10: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefiningaConnectioninanOfficeWebComponent'sUserInterfaceForexample,toconnecttoMicrosoftSQLServerusingWindowsAuthenticationfromtheuserinterfaceoftheSpreadsheetcomponent,usethefollowingprocedurewhendefiningaconnection.

ImportantBeforeyoucanuseWindowsAuthenticationtoconnecttoaMicrosoftSQLServerdatabase,theserveradministratormustconfiguretheservertousethismodeofauthentication,andmustgrantloginaccesstoyourWindowsuseraccount(oragroupofwhichyouruseraccountisamember)aswellastheaccountsofanyusersyouwanttoaccessyoursolution.Additionally,theserveradministratorshouldgiveusers'accountstheminimumlevelofpermissionstothetablesorstoredproceduresrequiredforyoursolution.

1. Inthedesignwindow,makesurethespreadsheetisactivated.Forinstructions,seeHelpforyourdesignprogram.

2. ClickCommandsandOptionsonthetoolbar,andthenclicktheDataSourcetab.

3. ClickEdit,andthendouble-clickNewSQLServerConnection.

4. InServername,specifythenameoftheserver.

5. UnderLogoncredentials,clickUseWindowsAuthentication.

6. ClickNext,andthenfollowthedirectionsinremainingscreensoftheDataConnectionWizardtospecifythedatatoretrieve.

Notes

SomedesignprogramsdonotsupporttheSpreadsheet'sdesign-timeuserinterfacebydefault.Ifyouareusingsuchaprogram,theDataSourcetabwillnotbedisplayedinstep2.Toactivatethedesign-timeuserinterface,youmustsettheDisplayDesignTimeUIpropertytoTrue.

OtherdatasourcesthatsupportWindowsAuthenticationmaypresentdifferentoptionsintheDataConnectionWizard.Forexample,to

Page 11: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

connecttoanOracledatabaseusingWindowsAuthentication,youmustenteronlyaforwardslash(/)intheUserNamebox.FormoreinformationusingWindowsAuthenticationtoconnecttoadatasource,seethedocumentationforthedatasourceprovideryouareusing.

IfyouusetheDataRetrievalServiceforMicrosoftSQLServer(oruseaDataRetrievalServiceConnections(.uxdc)filethatisdefinedtousethatdataretrievalservice)toconnecttoanexternaldatasource,andyoudonotuseWindowsAuthentication,theusernameandpasswordusedtoconnecttothedatasourcearenotsavedintheWebpage.Whenyouusethismethodtoconnecttoanexternaldatasource,usersoftheWebPagethathostsyourspreadsheetwillbepromptedtoentertheirlogininformation.Touseadataretrievalservice,youmusthaveaccesstoaWindowsSharePointServicesserveronwhichthatdataretrievalserviceisinstalled.Bydefault,WindowsSharePointServicesinstallsadataretrievalserviceforconnectingtodatainSharePointlists.ASharePointsiteadministratorcaninstalltheOffice2003WebPartsandComponentstoadddataretrievalservicesforMicrosoftSQLServerandMicrosoftBusinessSolutions.TheOffice2003WebPartsandComponentsisavailablefromDownloadsonMicrosoftOfficeOnline.Tostartdefiningaconnectionusingadataretrievalservice,instep2intheprocedureabove,clickEdit,clickNewSource,andthenclickeitherMicrosoftBusinessSolutions(toconnecttoMicrosoftBusinessSolutionsdata)orclickDataretrievalservices(toconnecttoWindowsSharePointServiceslistsorMicrosoftSQLServerdata).

Page 12: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefiningaConnectiontoExternalDataProgrammaticallyWhenworkingwiththeConnectionStringpropertytodefinetheconnectiontoanexternaldatasource(ordefiningtheconnectionstringforanADOConnectionobjecttopasstotheConnectionpropertyofthePivotTableobject),youshoulduseWindowsAuthenticationifpossible.TouseWindowsAuthenticationwithSQLServer,yourconnectionstringshouldusethisformat,whichincludesIntegratedSecurity=SSPI:

Provider=SQLOLEDB;DataSource=NameOfServer;InitialCatalog=NameOfDatabaseIntegratedSecurity=SSPI

Otherdatasourcesmayrequireadifferentformatfortheirconnectionstrings,forexampletoconnecttoanOracledatabaseusingWindowsAuthenticationrequiresyoutopassaforwardslash(/)fortheUserIDvalue:

Provider=MSDAORA.1;UserID=/;DataSource=NameOfServer;InitialCatalog=NameOfDatabase

Page 13: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorkingwithDataSourcesthatDoNotSupportWindowsAuthenticationIfWindowsAuthenticationisnotavailableforthedatasourceyouwanttoworkwith,youmustpassausernameandpasswordtoconnecttothedatasourcewhenyoudefineaconnectioneitherprogrammaticallyorintheuserinterfaceofanOfficeWebcomponent.BecausethisusernameandpasswordmightbeviewedwhentheSpreadsheet,Chart,orPivotTablecomponentisonaWebpage,avoidusingthismodeofauthenticationtoconnecttosensitivedatafromacomponentonaWebpage.Evenifyouarenotconcernedaboutunauthorizedusersviewingyourdata,youshouldconnectonlywithauseraccountthathaslimitedpermissionsonthedatasource.Forexample,whenconnectingtoaSQLServerdatabaseusingausernameandpassword,donotusetheSAaccountoranyotheraccountthathaselevatedpermissions,becauseanunauthorizedusermightbeabletousethisaccountandpasswordtoaccessotherdataontheserver.

Page 14: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CreatinganAccessibleChartWhenyoucreateanewchart,bydefaulttheHasSelectionMarksandAllowPropertyToolBoxpropertiesaresettoFalse.Asaresult,auserworkingwithachartusingonlyakeyboardcannotseewhenaniteminthechartisselected(HasSelectionMarks)andcannotdisplaytheCommandsandOptionsdialogboxforsettingpropertiesoftheselecteditem(AllowPropertyToolBox).Toenablethesefeaturestomakeachartmoreaccessibleforkeyboardusers,youcansetthesepropertiesmanuallyatdesigntimebyusingthefollowingprocedure.

EnableselectionmarksandtheCommandsandOptionsdialogbox

1. Right-clicktheclickthechartcontrol,andthenclickCommandsandOptions.

2. OntheShow/HidetabunderLetusersview,clickSelectionmarksandCommandsandOptionsdialogbox.

Alternatively,youcansetthesepropertiesprogrammaticallyasinthefollowingexample.

SubMake_Accessible()

'Showselectionmarksforindividualchartelements.Chartspace1.HasSelectionMarks=True

'AllowtheusertodisplaytheCommandsandOptionsdialogbox.Chartspace1.AllowPropertyToolbox=True

EndSub

Page 15: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllGroupingDefsCollectionObject

Multipleobjects AllGroupingDefsGroupingDefPageFields

ContainsalloftheGroupingDefobjectsinthedatasourcecontrol.

Page 16: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheAllGroupingDefsCollectionTheDataSourceControlobject'sAllGroupingDefspropertyreturnsanAllGroupingDefscollection.

Page 17: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllPageFieldsCollectionObject

Multipleobjects AllPageFieldsPageFieldMultipleobjects

ContainsallthePageFieldobjectsinthedatasourcecontrol.

Page 18: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheAllPageFieldsCollectionTheDataSourceControlobject'sAllPageFieldspropertyreturnsanAllPageFieldscollection.

Page 19: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BordersCollectionObject

Range BordersMultipleobjects

AcollectionoffourBorderobjectsthatrepresentthefourbordersofaworksheetrange.

Page 20: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheBordersCollectionTheRangeobject’sBorderspropertyreturnsaBorderscollection.

Page 21: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChAxesCollection

ChChart ChAxesMultipleobjects

ThecollectionofChAxisobjectsthatrepresenttheaxesforasinglechart.Eachchartcanhaveuptosixteenaxes.

Page 22: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChAxescollectionTheChChartobject’sAxespropertyreturnsaChAxescollection.

Page 23: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChCategoryLabelsCollectionObject

ChAxis ChCategoryLabelsMultipleobjects

RepresentsacollectionofalltheChCategoryLabelobjectsforthespecifiedcategoryaxis.

Page 24: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChCategoryLabelsCollectionObjectUsetheCategoryLabelspropertyoftheChAxisobjecttoreturnaChCategoryLabelscollection.ThefollowingexampledisplaysthenumberoflabelsforthecategoryaxisonthefirstchartinChartspace1.

SubDisplayItemCount

DimchtChart1DimchConstantsSetchConstants=Chartspace1.ConstantsSetchtChart1=Chartspace1.Charts(0)MsgBoxchChart1.Axes(chConstants.chAxisPositionCategory)_.CategoryLabels.ItemCount

EndSub

Page 25: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChChartFieldsObject

ChDropZone ChChartFieldsMultipleobjects

Representsthefieldsthathavebeenaddedtoadropzone.ContainsacollectionofChChartFieldobjects.

Page 26: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChChartFieldsobjectTheChDropZoneobject'sChartFieldspropertyreturnsaChChartFieldsobject.

Page 27: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChChartsCollection

Multipleobjects ChChartsChChartMultipleobjects

ThecollectionofChChartobjectsinthechartworkspace.EachChChartobjectrepresentsasinglechart.Thechartworkspacecancontainupto64charts.

Page 28: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChChartscollectionTheChartSpaceobject’sChartspropertyreturnsaChChartscollection.

Page 29: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChDataLabelsCollectionCollection

ChSeries ChDataLabelsCollectionMultipleobjects

RepresentsthecollectionofChDataLabelsobjectsforadataseries.EachChDataLabelsobjectrepresentsasetofdatalabelsforadataseries.

Page 30: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChDataLabelsCollectioncollectionUsetheDataLabelsCollectionpropertyoftheChSeriesobjecttoreturnaDataLabelsCollectioncollection.

UsetheAddmethodoftheChDataLabelsCollectioncollectiontoaddasetofdatalabelstoadataseries.

ThefollowingexampleaddsdatalabelstothefirstseriesinthefirstchartinChartspace1,andthenformatsthedatalabels.

SubAddDataLabels()

DimserSeries1DimdlSeries1Labels

'Setavariabletothefirstseriesofthefirstchart'inChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addasetofdatalabelstothefirstseriesandreturn'aDataLabelsobject.SetdlSeries1Labels=serSeries1.DataLabelsCollection.Add

'Setthenumberformatofthedatalabels.dlSeries1Labels.NumberFormat="0.00"

'Setthedatalabelstodisplaythecategory'nameforthedatapoint.dlSeries1Labels.HasCategoryName=True

'Setthedatalabelstodisplaythevalue'forthedatapoint.dlSeries1Labels.HasValue=True

Page 31: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 32: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChErrorBarsCollectionObject

ChSeries ChErrorBarsCollectionMultipleobjects

ThecollectionofChErrorBarsobjectsforasingleseries.

Page 33: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChErrorBarsCollectionobjectTheChSeriesobject’sErrorBarsCollectionpropertyreturnsaChErrorBarsCollectionobject.

ThefollowingexampleaddserrorbarstothefirstseriesinthefirstchartinChartSpace1,thensetsthepropertiesfortheerrorbars.

SubAddErrorBars()

DimchConstantsDimebCollectionDimebSeries1

SetchConstants=ChartSpace1.Constants

'Setavariabletothecollectionoferrorbarsfor'thefirstseriesinthefirstchartofChartspace1.SetebCollection=ChartSpace1.Charts(0).SeriesCollection(0).ErrorBarsCollection

'Adderrorbarstothechart.ebCollection.Add

'Setavariabletotheerrorbarsforthedataseries.SetebSeries1=ebCollection.Item(0)

'Settheerrorbarssothattheyrepresentacertain'percentageofthevalueofadatapoint.ebSeries1.Type=chConstants.chErrorBarTypePercent

'Theerrorbarsrepresent5%ofadatapoint.ebSeries1.Amount=0.05

Page 34: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 35: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChLegendEntriesCollection

ChLegend ChLegendEntriesMultipleobjects

ThecollectionofChLegendEntryobjectsforthespecifiedlegend.

Page 36: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChLegendEntriescollectionTheChLegendobject’sLegendEntriespropertyreturnsaChLegendEntriescollection.

UseLegendEntries(index),whereindexisthelegendentryindexnumber,toreturnasingleLegendEntryobject.Youcannotreturnlegendentriesbyname.

Theindexnumberrepresentsthepositionofthelegendentryinthelegend.LegendEntries(0)isatthetopofthelegend,andLegendEntries(LegendEntries.Count-1)isatthebottom.Thefollowingexamplechangesthefontforthetextofthelegendentryatthetopofthechartspacelegend(thisisusuallythelegendforseriesone)inChartspace1.

Chartspace1.ChartSpaceLegend.LegendEntries(0)_.Font.Bold=True

Page 37: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChPointsCollection

ChSeries ChPointsMultipleobjects

AcollectionofalltheChPointobjectsinadataseries.Thenumberofdatapointsinaseriesislimitedonlybytheamountofsystemmemoryinthecomputerbeingused.

Page 38: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChPointscollectionTheChSeriesobject’sPointspropertyreturnsaChPointscollection.

UsePoints(index),whereindexisthepointindexnumber,toreturnasingleChPointobject.Pointsarenumberedfromlefttorightontheseries.Points(0)istheleftmostpoint,andPoints(Points.Count-1)istherightmostpoint.ThefollowingexamplestoresthevalueofthethirdpointinthefirstdataseriesofthefirstchartinChartspace1inavariable.

SubGetPointValue()

DimptSeries1PointsDimdblPointValue

'Setavariabletothecollectionofpointsforthefirst'datasertiesinthefirstchartinChartspace1.SetptSeries1Points=ChartSpace1.Charts(0).SeriesCollection(0).Points

'Storetheunderlyingvalueofthethirddatapointinavariable.dblPointValue=ptSeries1Points(2).GetValue(chDimValues)

EndSub

Page 39: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChSelectionCollectionCollection

Multipleobjects ChSelectionCollection

Page 40: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChSelectionCollectionCollectionYouusetheSelectionCollectionpropertytoretrievetheselectionlist.TheSelectionCollectionpropertyoftheChartSpaceobject(forexample,ChartSpace.SelectionCollection)returnsaChSelectionCollectioncollectionthatcontainsallselectedobjectsinachart,includingbothprimaryandsecondaryselections.Theprimaryselectionisthefirstiteminthiscollection.Anyadditionalitemsaresecondaryselections,whichcanonlybeChPointobjects.Thiscollectionalwayscontainsatleastoneitem,whichistheprimaryselection.TheobjectreturnedbyChartSpace.SelectionCollection(0)isthesameobjectthatisreturnedbytheSelectionpropertyoftheChartSpaceobject(forexample,ChartSpace.Selection).TheChSelectionCollectioncollectioncanonlybepopulatedbyusingtheSelect2method,forexample,Chartspace.Charts(0).Seriescollection(x),Points(y).Select2().MultipleitemscannotbeselectedintheuserinterfaceoftheChartcomponent.Itemsmustbeaddedtoorremovedfromaselectionprogrammatically.Tocapturemultipleselectionswhenauserclicksonachart,youmustmonitorthemousemoveandmousebuttoneventsandidentifytheitemsbeingselectedusingtheRangeFromPointmethodoftheChartSpaceobject.Topreventthebuilt-inselectionhandlingbehavioroftheChartcomponentfrominterferingwithprogrammatictrackingofmultipleselections,youmustmakesurethattheAllowUISelectionpropertyoftheChartSpaceobjectissettoFalse.

YouusetheItempropertytoreturnasingleselectedobjectfromtheChSelectionCollectioncollection.IndividualobjectsintheChSelectionCollectioncollectionareindexedbeginningwith0forthefirstobject,1forthesecondobject,andsoforth.YouusetheCountpropertytoreturnthenumberofitemsintheChSelectionCollectioncollection.TheParentpropertyreturnstheparentobject,whichistheChartSpaceobjectinthiscase.

TheChSelectionCollectioncollectionhasnomethods.

Page 41: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChSeriesCollectionCollectionObject

ChChart ChSeriesCollectionMultipleobjects

AcollectionofalltheChSeriesobjectsonachart.Achartcancontainupto256series.

Page 42: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChSeriesCollectionCollectionObjectTheChChartobject’sSeriesCollectionpropertyreturnsaChSeriesCollectioncollection.

UsetheAddmethodtocreateanewseriesandaddittothechart.

UseSeriesCollection(index),whereindexistheseriesindexnumberorname,toreturnasingleChSeriesobject.ThefollowingexamplesetsthecoloroftheinteriorforthefirstseriesinthefirstchartofChartSpace1.

ChartSpace1.Charts(0).SeriesCollection(1).Interior.Color="Red"

Page 43: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChTrendlinesCollection

ChSeries ChTrendlinesMultipleobjects

ThecollectionofChTrendlineobjectsforaseries.

Page 44: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChTrendlinescollectionTheTrendlinespropertyoftheChSeriesobjectreturnsaChTrendlinescollection.

UsetheAddmethodoftheChTrendlineobjecttoaddatrendlinetoyourchart.

ThefollowingexampleaddsatrendlinetothefirstseriesinthefirstchartinChartspace1andthenformatsthetrendline.

SubAddPolyTrendline()

DimserSeries1DimchConstantsDimtlSeries1Trend

SetchConstants=ChartSpace1.Constants

'Setavariabletothefirstseriesofthefirstchart'inChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addatrendlinetothefirstseriesandreturn'aTrendlineobject.SettlSeries1Trend=serSeries1.Trendlines.Add

'Displaytheequationusedtocalculatethetrendline.tlSeries1Trend.IsDisplayingEquation=True

'Setthetrendlinetobeapolynomialtrendline.tlSeries1Trend.Type=chConstants.chTrendlineTypePolynomial

EndSub

Page 45: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 46: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataPagesCollectionObject

Multipleobjects DataPagesDataPageMultipleobjects

ContainsallDataPageobjectsinthedatasourcecontrol.

Page 47: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheDataPagesCollectionTheDataSourceControlobject'sDataPagespropertyreturnsaDataPagescollection.

Page 48: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ElementExtensionsCollectionObject

Multipleobjects ElementExtensionsElementExtension

ContainstheElementExtensionobjectsforthespecifieddatasourcecontrol.

Page 49: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheElementExtensionsCollectionTheDataSourceControlobject'sElementExtensionspropertyreturnsanElementExtensionscollection.

Page 50: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FiltersCollectionObject

AutoFilter FiltersMultipleobjects

RepresentsthecollectionoffiltersusedwiththeAutoFilter.EachfilterisrepresentedbyaFilterobject.TheAutoFilterobjectcontainsaFilterscollection,theFilterscollectioncontainsaFilterobjectforeachcolumninthefilteredrange,andeachFilterobjectcontainsaCriteriaobject.

Page 51: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheFiltersObjectTheAutoFilterobject’sFilterspropertyreturnsaFilterscollection.

Page 52: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupingDefsCollectionObject

RecordsetDef GroupingDefsGroupingDefPageFields

RepresentsthecollectionofGroupingDefobjectsthatcreategroupingparentsofthedetailrecordsinarecordsetdefinition.Sequenceisimportant:thelowertheindex,thehigherthelevelofgrouping.Index0(zero)isthelowestgroupinglevel.

Page 53: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheGroupingDefsCollectionTheRecordsetDefobject'sGroupingDefspropertyreturnsaGroupingDefscollection.

Page 54: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupLevelsCollectionObject

Multipleobjects GroupLevelsGroupLevel

RepresentsthecollectionofGroupLevelobjectsforthespecifieddatasourcecontrol.EachGroupLevelobjectrepresentsthesetofallrecordsatagivenlevelofthedataaccesspagehierarchy.

Page 55: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheGroupLevelsCollectionTheDataSourceControlobject'sGroupLevelspropertyreturnsaGroupLevelscollection.

Page 56: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeadingsObject

Window HeadingsMultipleobjects

AcollectionoftherowandcolumnheadingsforaWindowobject.

Page 57: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheHeadingsobjectThefollowingpropertiesreturnaHeadingscollection.

TheWindowobject'sRowHeadingsproperty.

TheWindowobject'sColumnHeadingsproperty.

ThefollowingexamplecustomizestheheadingofcolumnDintheactivesheetinSpreadsheet1:

Spreadsheet1.ActiveWindow.ColumnHeadings(4).Caption="1999Sales"

Page 58: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListObjectsCollection

Worksheet ListObjectsMultipleobjects

Page 59: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheListObjectsCollectionTheListObjectscollectionisacollectionofalltheListObjectobjectsonaworksheet.AListObjectobjectrepresentsanXMLlistinaSpreadsheetcomponent.TheListObjectobjectisamemberoftheListObjectscollection.

IndividualListObjectobjectsintheListObjectscollectionareindexedbeginningwith1forthefirstobject,2forthesecondobject,andsoforth.YouusetheItempropertytoreturnasingleListObjectobjectfromtheListObjectscollection.TheargumentfortheItempropertyisthenameortheindexnumberintheListObjectscollectionoftheListObjectobject.ThenameisthevalueoftheIDattributeofanMapInfo/Map/EntryinanXMLSpreadsheetfile.TheXMLfragmentwherethesedetailsappearintheXMLSpreadsheetfilelookssomethinglikethefollowing:

<x2:MapInfoxmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml"><x2:Mapx2:ID="Cust_MapId"><x2:Entryx2:ID="example_id"x2:Type="table">...</x2:Entry></x2:Map></x2:MapInfo>

Intheexampleabove,theIDvalueisexample_id.YoucanalsogetthenamebyusingtheNamepropertyoftheListObjectobject.UsingMicrosoftExcel,youcancreateanXMLSpreadsheetfilebycreatingadataboundspreadsheetandthensavingtheworkbookasanXMLSpreadsheet.

Youusetheread-onlyCountpropertytoreturnthenumberofobjectsintheListObjectscollection.UsingtheApplicationandParentpropertieswillreturntheSpreadsheetcomponentandtheparentobject(whichistheWorksheetobject)forthespecifiedListObjectscollection.

Page 60: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListRowsCollection

ListObject ListRowsMultipleobjects

Page 61: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheListRowsCollectionTheListRowscollectionisacollectionofalltheListRowobjectsinaListObjectobject.AListObjectobjectrepresentsanXMLlistinaSpreadsheetcomponent.TheListRowobjectisamemberoftheListRowscollection.

IndividualListRowobjectsintheListRowscollectionareindexedbeginningwith1forthefirstobject,2forthesecondobject,andsoforth.YouusetheItempropertytoreturnasingleListRowobjectfromtheListRowscollection.TheargumentfortheItempropertyistheindexnumberintheListRowscollectionoftheListRowobject.

YoucreateanewrowintheListRowscollectionbypromotingthecellsintheinsertrowtoan"official"row.Todothis,youusetheAddmethod,whichreturnsaListRowobjectrepresentingthenewlycreatedrow.ThenewrowwillbeaddedtothebottomoftheXMLlist.

Youusetheread-onlyCountpropertytoreturnthenumberofobjectsintheListRowscollection.TheApplicationandParentpropertiesreturntheSpreadsheetcomponentandtheparentobject(whichistheListObjectobject)forthespecifiedListRowsobject.

Page 62: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LookupRelationshipsCollectionObject

PageRowsource LookupRelationshipsPageRelationshipMultipleobjects

RepresentsthecollectionofPageRelationshipobjectsthatdefinealookupjoinrelationshipwithapagerowsource.Intheobjectdiagramshowninthistopic,thefirstPageRowsourceobject(abovetheLookupRelationshipscollection)istheobjectonthe“many”sideoftheone-to-manyrelationshipandthePageRelationshipobject(belowthecollection)istheobjectonthe“one”side.

Page 63: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheLookupRelationshipsCollectionThePageRowsourceobject'sLookupRelationshipspropertyreturnsaLookupRelationshipscollection.

Page 64: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LookupSchemaRelationshipsCollectionObject

SchemaRowsource LookupSchemaRelationshipsSchemaRelationshipSchemaRelatedFields

RepresentsthecollectionofSchemaRelationshipobjectsforwhichasingleschemarowsourceactsasthe“many”sideoftheone-to-manyrelationship.

Page 65: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheLookupSchemaRelationshipsCollectionTheSchemaRowsourceobject'sLookupSchemaRelationshipspropertyreturnsaLookupSchemaRelationshipscollection.

Page 66: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NamesCollection

Multipleobjects NamesNameRange

AcollectionofalltheNameobjectsintheworkbook.EachNameobjectcanrepresentadefinednameforarangeofcells,aformula,oraconstantsvalue.

Page 67: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheNamescollectionUsetheNamespropertytoreturntheNamescollection.Thefollowingexamplecreatesalistofallthenamesintheactiveworkbook,alongwiththeaddressestowhichtheyrefer.

SubList_All_Names()DimnmCurrentNameDimrngCurrent

SetrngCurrent=Spreadsheet1.ActiveSheet.Range("A1")

'Loopthroughallofthenamesintheactiveworkbook.ForEachnmCurrentNameInSpreadsheet1.ActiveWorkbook.Names

'Writethecurrentnametotheworksheet.rngCurrent.Value=nmCurrentName.Name

'Writethedefinitionofthecurrentnametotheworksheet.rngCurrent.Offset(0,1).Value="'"&nmCurrentName.RefersTo

SetrngCurrent=rngCurrent.Offset(1,0)NextEndSub

UsetheAddmethodtocreateanameandaddittothecollection.ThefollowingexamplecreatesanewnamethatreferstocellsA1:C20ontheworksheetnamed"Sheet1."

Spreadsheet1.Names.Add"CurrentMonth","=Sheet1!$A$1:$C$20"

TheRefersToargumentmustbespecifiedinA1-stylenotation,including

Page 68: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

dollarsigns($)whereappropriate.Forexample,ifcellA10isselectedonSheet1andyoudefineanamebyusingtheRefersToargument"=Sheet1!A1:B1",thenewnameactuallyreferstocellsA10:B10(becauseyouspecifiedarelativereference).Tospecifyanabsolutereference,use"=Sheet1!$A$1:$B$1".

Page 69: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OCCommandsObject

Multipleobjects OCCommandsOCCommand

ContainsacollectionofOCCommandobjectsthatrepresentthecollectionofalloftheuserinterfaceandkeyboardcommandsthatareavailableinthespecifiedMicrosoftOfficeWebComponent.

Page 70: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheOCCommandsobjectThefollowingpropertiesreturnaOCCommandscollection:

TheChartSpaceobject'sCommandsproperty.

ThePivotTableobject'sCommandsproperty.

TheSpreadsheetobject'sCommandsproperty.

TheOCCommandId,ChartCommandIdEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachWebcomponent.

UsetheItempropertytoreturnasingleOCCommandobject.

Page 71: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageFieldsCollectionObject

Multipleobjects PageFieldsPageFieldMultipleobjects

ThecollectionofPageFieldobjectsdescribingthefieldsthatwillbepresentintherecordsetproducedbythespecifiedrecordsetdefinition.Thesefieldsareacombinationofoutputfieldsfromthepagerowsourcesthatmakeupthisrecordsetdefinitionandotherpagefieldsthatareaddedtothiscollection.Sequencewithinthiscollectionisunimportantbecauseallcontrolsbindbynameratherthanbytheirordinalrelationshiptofieldsintheoutputrecordset.

Page 72: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePageFieldsCollectionObjectTheRecordsetDef,PageRowSource,andGroupingDefobjects'PageFieldspropertyreturnsaPageFieldscollection.

Page 73: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRelatedFieldsCollectionObject

PageRelationship PageRelatedFieldsPageRelatedFieldPageField

ThecollectionofPageRelatedFieldobjectsthatbelongtoagivenrecordsetdefinition.ThiscollectionisautomaticallyfilledwhenarecordsetdefinitionbasedontheSchemaRelatedFieldscollectioniscreated.

Page 74: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePageRelatedFieldsCollectionThePageRelationshipobject'sPageRelatedFieldspropertyreturnsaPageRelatedFieldscollection.

Page 75: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRowsourcesCollectionObject

RecordsetDef PageRowsourcesPageRowsourceMultipleobjects

ThecollectionofPageRowsourceobjectsinthedatamodel.

Page 76: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePageRowsourcesCollectionObjectTheRecordsetDefobject'sPageRowsourcespropertyreturnsaPageRowsourcescollection.

Page 77: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PanesCollectionObject

Window PanesMultipleobjects

ThecollectionofPaneobjectsforaworksheet.

Page 78: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePanesCollectionTheWindowobject’sPanespropertyreturnsaPanescollection.

Page 79: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParameterValuesCollectionObject

RecordsetDef ParameterValuesParameterValue

ThecollectionofParameterValueobjectsforarecordsetdefinition.

Page 80: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheParameterValuesCollectionTheRecordsetDefobject'sParameterValuespropertyreturnsaParameterValuescollection.

Page 81: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotAggregatesCollectionObject

PivotCell PivotAggregatesPivotAggregateMultipleobjects

ThecollectionofPivotAggregateobjectsforthespecifiedcell.

Page 82: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotAggregatesCollectionThePivotCellobject’sAggregatespropertyreturnsanobjectfromthePivotAggregatescollection.

Page 83: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotAxisMembersCollection

Multipleobjects PivotAxisMembersPivotAxisMemberMultipleobjects

AcollectionofPivotAxisMemberobjects.

Page 84: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotAxisMemberscollectionUsetheItempropertyofthePivotAxisMemberscollectiontoreturnaPivotAxisMemberobject.

Page 85: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotColumnMembersCollection

Multipleobjects PivotColumnMembersPivotColumnMemberMultipleobjects

AcollectionofPivotColumnMemberobjects.

Page 86: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotColumnMembersCollectionUsetheItempropertyofthePivotColumnMemberscollectiontoreturnaPivotColumnMemberobject.

Page 87: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotFieldsCollectionObject

Multipleobjects PivotFieldsPivotFieldMultipleobjects

ThecollectionofPivotFieldobjectsinthespecifiedfieldset.

Page 88: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotFieldsCollectionUsetheFieldspropertyofthefollowingobjectstoreturnaPivotFieldscollection:PivotDetailRange,PivotFieldSet,PivotResultColumnAxis,PivotResultDataAxis,PivotResultGroupAxis,PivotResultPageAxis,orPivotResultRowAxis.

Page 89: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotFieldSetsCollectionObject

Multipleobjects PivotFieldSetsPivotFieldSetMultipleobjects

ThecollectionofPivotFieldSetobjectsonthespecifiedaxisorinthespecifiedview.

Page 90: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotFieldSetsCollectionThefollowingpropertiesreturnanobjectfromthePivotFieldSetscollection:

ThePivotAxisobject’sFieldSetsproperty

ThePivotDataAxisobject’sFieldSetsproperty

ThePivotFilterAxisobject’sFieldSetsproperty

ThePivotGroupAxisobject’sFieldSetsproperty

ThePivotResultFilterAxisobject'sFieldSetsproperty

ThePivotViewobject’sFieldSetsproperty

Page 91: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotMemberPropertiesCollection

PivotField PivotMemberPropertiesPivotMemberProperty

AcollectionofPivotMemberPropertyobjects.

Page 92: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotMemberPropertiescollectionUsetheItempropertyofthePivotMemberPropertiescollectiontoreturnaPivotMemberPropertyobject.

Page 93: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotMembersCollectionObject

Multipleobjects PivotMembersPivotMemberMultipleobjects

AcollectionofPivotMemberobjects.

Page 94: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotMembersCollectionThefollowingpropertiesreturnanobjectfromthePivotMemberscollection:

TheChildMemberspropertyofthefollowingobjects:PivotAxisMember,PivotColumnMember,PivotMember,PivotPageMember,orPivotRowMember

ThePivotFieldobject’sCustomGroupMembersproperty

Page 95: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotPageMembersCollection

PivotPageMember PivotPageMembersPivotPageMemberMultipleobjects

AcollectionofPivotPageMemberobjects.

Page 96: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotPageMembersCollectionUsetheItempropertyofthePivotPageMemberscollectiontoreturnaPivotPageMemberobject.

Page 97: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultGroupFieldsCollection

Multipleobjects PivotResultGroupFieldsPivotResultGroupFieldMultipleobjects

AcollectionofPivotResultGroupFieldobjects.

Page 98: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultGroupFieldscollectionThefollowingpropertiesreturnaPivotResultGroupFieldscollection:

ThePivotResultColumnAxisobject'sGroupFieldsproperty.

ThePivotResultGroupAxisobject'sGroupFieldsproperty.

ThePivotResultPageAxisobject'sGroupFieldsproperty.

ThePivotResultRowAxisobject'sGroupFieldsproperty.

Page 99: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultMemberPropertiesCollection

Multipleobjects PivotResultMemberPropertiesPivotResultMemberPropertyPivotMemberProperty

Thecollectionofmemberpropertiesforaresultmember.

Page 100: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultMemberPropertiescollectionThefollowingpropertiesreturnaPivotResultMemberPropertiescollection:

ThePivotAxisMemberobject'sMemberPropertiesproperty.

ThePivotColumnMemberobject'sMemberPropertiesproperty.

ThePivotPageMemberobject'sMemberPropertiesproperty.

ThePivotRowMemberobject'sMemberPropertiesproperty.

Page 101: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotRowMembersCollection

Multipleobjects PivotRowMembersPivotRowMemberMultipleobjects

AcollectionofPivotRowMemberobjects.

Page 102: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotRowMembersCollectionUsetheItempropertyofthePivotRowMemberscollectiontoreturnaPivotRowMemberobject.

Page 103: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotTotalsCollectionObject

Multipleobjects PivotTotalsPivotTotalMultipleobjects

ThecollectionofPivotTotalobjectsonthespecifieddataaxisorinthespecifiedview.

Page 104: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotTotalsCollectionThePivotDataAxis,PivotResultDataAxis,andPivotViewobjects'TotalspropertyreturnsaPivotTotalscollection.

Page 105: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetDefsCollectionObject

Multipleobjects RecordsetDefsRecordsetDefMultipleobjects

ThecollectionofRecordsetDefobjectsforthespecifieddatasourcecontrol.

Page 106: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheRecordsetDefsCollectionTheDataSourceControlobject'sRecordsetDefspropertyreturnaRecordsetDefscollection.

Page 107: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaFieldsCollectionObject

SchemaRowsource SchemaFieldsSchemaFieldSchemaProperties

ThecollectionofallavailableSchemaFieldobjectsinaschemarowsource.

Page 108: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaFieldsCollectionTheSchemaRowsourceobject'sSchemaFieldspropertyreturnsaSchemaFieldscollection.

Page 109: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaParametersCollectionObject

SchemaRowsource SchemaParametersSchemaParameterSchemaProperties

ThecollectionofSchemaParameterobjectsforthespecifiedschemarowsource.

Page 110: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaParametersCollectionTheSchemaRowsourceobject'sSchemaParameterspropertyreturnsaSchemaParameterscollection.

Page 111: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRelationshipsCollectionObject

Multipleobjects SchemaRelationshipsSchemaRelationshipSchemaRelatedFields

ThecollectionofSchemaRelationshipobjectsforadatasourcecontrol.

Page 112: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaRelationshipsCollectionTheDataSourceControlobject'sSchemaRelationshipspropertyreturnsaSchemaRelationshipscollection.

Page 113: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRowsourcesCollectionObject

Multipleobjects SchemaRowsourcesSchemaRowsourceMultipleobjects

ThecollectionofSchemaRowsourceobjectsforthespecifieddatasourcecontrol.Thiscollectionisautomaticallyrepopulatedwithobjectsinthedatabasewheneverthedatabaseisopened.

Page 114: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaRowsourcesCollectionTheDataSourceControlobject'sSchemaRowsourcespropertyreturnsaSchemaRowsourcescollection.

Page 115: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SheetsCollection

Multipleobjects SheetsWorkbook

AcollectionofalltheWorksheetobjectsintheworkbook.EachWorksheetobjectrepresentsaworksheet.

Page 116: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSheetscollectionThefollowingpropertiesreturnaSheetscollection.

TheSpreadsheetobject'sSheetsproperty.

TheWindowobject'sSelectedSheetsproperty.

TheWorkbookobject'sSheetsproperty.

Page 117: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SublistRelationshipsCollectionObject

RecordsetDef SublistRelationshipsPageRelationshipMultipleobjects

ThecollectionofPageRelationshipobjectsoftypedscSublistthatallhavethesamerecordsetdefinitionastheir“one”side(parent)ofaone-to-manyrelationship.Recordsinthechildofasublistrelationshipareretrievedonlywhentheyareneeded.

Page 118: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSublistRelationshipsCollectionTheRecordsetDefobject'sSublistRelationshipspropertyreturnsaSublistRelationshipscollection.

Page 119: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SublistSchemaRelationshipsCollectionObject

SchemaRowsource SublistSchemaRelationshipsSchemaRelationshipSchemaRelatedFields

ThecollectionofSchemaRelationshipobjectsthatallhavethesameschemarowsourceastheir“one”side(fromaone-to-manyrelationship).

Page 120: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSublistSchemaRelationshipsCollectionTheSchemaRowsourceobject'sSublistSchemaRelationshipspropertyreturnsaSublistSchemaRelationshipscollection.

Page 121: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WindowsCollectionObject

Multipleobjects WindowsWindowMultipleobjects

AcollectionofalltheWindowobjectsintheSpreadsheetcontrol.TheWindowscollectionfortheSpreadsheetobjectcontainsallthewindowsintheapplication,whereastheWindowscollectionfortheWorkbookobjectcontainsonlythewindowsinthespecifiedworkbook.Inbothcases,theSpreadsheetobjectcontainsonlyoneWindowobject.Thisobjectrepresentsthewindowforactivesheetwithintheworkbook.

EachsheethasadistinctWindowobjectassociatedwithit.Application.ActiveWindoworApplication.Workbooks(1).Windows(1)alwaysreturnsapointertotheactivesheet'swindow.ThereisnoActiveSheet.WindoworSheets(i).Window.

Page 122: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheWindowsCollectionObjectThefollowingpropertiesreturnaWindowscollection.

TheSpreadsheetobject'sWindowsproperty

TheWorkbookobject'sWindowsproperty.

Page 123: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorkbooksCollection

Multipleobjects WorkbooksMultipleobjects

AcollectioncontainingtheWorkbookobjectthatisopeninthespreadsheetcontrol.Thespreadsheetcontrolsupportsonlyoneopenworkbook.

Page 124: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheWorkbookscollectionUsetheActiveWorkbookpropertytorefertotheworkbookthatiscurrentlyopeninthespreadsheetcontrol.

Page 125: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorksheetsCollectionObject

Multipleobjects WorksheetsWorkbook

AcollectionofalltheWorksheetobjectsintheworkbook.EachWorksheetobjectrepresentsaworksheet.

Page 126: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheWorksheetsCollectionObjectUsetheWorksheetspropertyofSpreadsheetorWorkbookobjecttoreturntheWorksheetscollection.

UsetheAddmethodtocreateanewworksheetandaddittothecollection.ThefollowingexampleaddstwonewworksheetsbeforesheetoneofSpreadsheet1.

Spreadsheet1.Worksheets.Add_Spreadsheet1.Worksheets(1),,2

UseWorksheets(index),whereindexistheworksheetindexnumberorname,toreturnasingleWorksheetobject.ThefollowingexamplehidesworksheetoneintheSpreadsheet1.

Spreadsheet1.Worksheets(1).Visible=False

TheWorksheetobjectisalsoamemberoftheSheetscollection.

Page 127: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XmlDataBindingsCollection

Workbook XmlDataBindingsWorkbook

TheXmlDataBindingscollectioncontainsalloftheXmlDataBindingobjectsassociatedwithaSpreadsheetcomponent.EachXmlDataBindingobjectcontainsconfigurationdatathatbindstheSpreadsheetcomponenttoadataretrievalservice,SOAPWebService,XMLfile,oraWebPart.

Page 128: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheXmlDataBindingsCollectionTheXMLDataBindingobjectisamemberoftheXmlDataBindingscollection,whichisacollectionofalloftheXmlDataBindingobjectsinaSpreadsheetcomponent.Withinthecollection,individualXmlDataBindingobjectsareindexedbeginningwith1forthefirstobject,2forthesecond,andsoon.YoucanreturnaXmlDataBindingobjectfromtheXmlDataBindingscollectionbyusingtheItempropertyofthecollection.TheargumentfortheItempropertyistheindexinthecollectionoftheobjectyouwanttoreturnorthebindingIDoftheobject.ThebindingIDisthevalueoftheIDattributeintheXMLthatrepresentsthebinding.YoucanfindthisintheXMLSpreadsheetfilefortheSpreadsheetcomponent(orSpreadsheetWebPart)orbyexaminingtheBindingDatapropertyoftheXmlDataBindingobject.YoucancreateanXMLSpreadsheetfilebycreatingadataboundspreadsheetusingMicrosoftExcelandthensavingtheworkbookasanXMLSpreadsheet.

YoucreateanewXmlDataBindingobjectusingtheAddmethodoftheXmlDataBindingscollection.OnceyouhavecreatedtheXmlDataBindingobject,youcanuseitsBindingDatapropertytospecifybindingconfigurationinformationandyoucanusetheXmlMappropertytospecifytheschemamapassociatedwiththebinding.

ThefollowingexamplecreatestheXmlDataBindingsobjectusingtheXmlDataBindingspropertyoftheWorkbookobjectandshowshowtoworkwiththebindinginformation:

DimobjBindingsDimobjBindingDimstrBindingInfo

SetobjBindings=Spreadsheet1.ActiveWorkbook.XmlDataBindings

ForEachobjBindinginobjBindings

Page 129: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'SavetheXMLbindinginformationtoavariable.strBindingInfo=objBinding.BindingData'Workwiththebindinginformationhere.Next

Page 130: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XmlMapsCollection

Workbook XmlMapsWorkbook

TheXmlMapscollectionisacollectionofalloftheXmlMapobjectsassociatedwithaSpreadsheetcomponent.AnXmlMapobjectisanXMLschemamapthatspecifieshowtomapdatafromadatasourcetotheSpreadsheetcomponent.

Page 131: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheXmlMapsCollectionIntheXmlMapscollection,individualXmlMapobjectsareindexedbeginningwith1forthefirstobject,2forthesecondobject,andsoon.YoureturnaXmlMapobjectfromtheXmlMapscollectionusingtheItemproperty.TheargumentfortheItempropertyistheindexinthecollectionoftheobjectyouwanttoreturnorthemapIDoftheobject.ThemapIDisthevalueoftheIDattributeintheXMLthatrepresentsthemap.YoucanfindthisintheXMLSpreadsheetfileforthepartorbyexaminingtheMapDatapropertyoftheXmlMapobject.YoucancreateanXMLSpreadsheetfilebycreatingadata-boundspreadsheetinMicrosoftExcelandthensavingtheworkbookasanXMLSpreadsheet.YoucancreateanewXmlMapobjectbyusingtheAddmethodoftheXmlMapscollection.

ThefollowingexampleusestheXmlMapspropertytoreturntheXmlMapscollectionobject:

DimobjMapsDimobjMapDimstrMapInfo

SetobjMaps=Spreadsheet1.ActiveWorkbook.XmlMaps

ForEachobjMapinobjMaps'SavetheXMLmapinformationtoavariable.strMapInfo=objMap.MapData'Workwiththemapinformationhere.Next

Page 132: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AutoFilterObject

Multipleobjects AutoFilterMultipleobjects

RepresentstheAutoFiltercontainer.TheAutoFilterobjectcontainsaRangecollectionandaFilterscollection.

Page 133: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheAutoFilterObjectTheWorksheetobject’sAutoFilterpropertyreturnstheAutoFilterobjectforthespecifiedworksheet.

Page 134: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BorderObject

Range BordersBorderRange

Representstheborderofanobject.

TheBorderobjectisamemberoftheBorderscollection.

Page 135: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheBorderObjectTheBorderscollection’sItempropertyreturnsaBorderobject.

Page 136: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ByRefObject

ByRef

Containsthevalueofaneventparameter.

Page 137: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheByRefobjectSomeeventsreturnorsetvaluesthroughparametersthataretypedasByRefobjects.WhenaneventparameteristypedasaByRefobject,usetheValuepropertyoftheparametertoreturnorsettheparameter.

ThefollowingeventparametersreturnorsetvaluesthroughaByRefobject:

TheBeforeContextMenuevent'sMenuandCancelparameters

TheBeforeKeyDownevent'sCancelparameter

TheBeforeKeyPressevent'sCancelparameter

TheBeforeKeyUpevent'sCancelparameter

TheBeforeRenderevent'sCancelparameter

TheCommandBeforeExecuteevent'sCancelparameter

TheCommandCheckedevent'sCheckedparameter

TheCommandEnabledevent'sEnabledparameter

TheCommandTipTextevent'sCaptionparameter

TheEndEditevent'sFinalValue,Cancel,andErrorDescriptionparameters

TheStartEditevent'sInitialValue,Cancel,andErrorDescriptionparameters(Spreadsheet)

TheStartEditevent'sInitialValue,ArrowMode,CaretPosition,Cancel,andErrorDescriptionparameters(PivotTable)

Page 138: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartSpaceObject

ChartSpace Multipleobjects

Representsthechartworkspace.Thechartworkspaceisthetop-levelchartcontainer;itcancontainmorethanonechart,witheachchartrepresentedbyaChChartobject.Whenachartworkspaceisfirstcreated,itisempty(itdoesnotcontainanycharts).UsetheAddmethodoftheChChartsobjecttocreateanewchart.

Page 139: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChartSpaceObjectYoucanuseeithertheCreateObjectmethodortheNewkeywordtocreateanewChartSpaceobject.

TheobjectIDforachartcontrolonanHTMLpageoraVisualBasicformreturnsaChartSpaceobject.

TheprogrammaticidentifierfortheChartSpaceobjectisCLSID:0002E55D-0000-0000-C000-000000000046.Thefollowingexamplecreatesachartworkspacenamed"ChartSpace1"onanHTMLpage.

<objectid=ChartSpace1classid=CLSID:0002E55D-0000-0000-C000-000000000046style="width:100%;height:350"></object>

Page 140: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChAxisObject

Multipleobjects ChAxisMultipleobjects

Representsasingleaxisonachart.Achartcanhaveuptosixteenaxes.TheChAxisobjectisamemberoftheChAxescollection.

Page 141: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChAxisobjectUsetheChAxesobject’sAddmethodtoaddanaxistoachart.

ThefollowingpropertiesandmethodsreturnaChAxisobject.

TheChAxesobject’sAddmethod

TheChAxesobject’sItemproperty

TheChAxisobject’sCrossingAxisproperty

TheChGridlinesobject’sParentproperty

Page 142: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChBorderObject

Multipleobjects ChBorder

Representstheborderofanobjectonachart.

Page 143: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChBorderobjectThefollowingpropertiesreturnaChBorderobject:

TheChChartobject'sBorderproperty

TheChChartDrawobject'sBorderproperty

TheChDataLabelobject'sBorderproperty

TheChDataLabelsobject'sBorderproperty

TheChDropZoneobject'sButtonBorderproperty

TheChDropZoneobject'sWatermarkBorderproperty

TheChLegendobject'sBorderproperty

TheChPlotAreaobject'sBorderproperty

TheChPointobject'sBorderproperty

TheChSegmentBoundaryobject'sBorderproperty

TheChSeriesobject'sBorderproperty

TheChSurfaceobject'sBorderproperty

TheChTitleobject'sBorderproperty

UsetheColor,DashStyle,andWeightpropertiestosettheattributesofaborder.ThefollowingexamplesetsborderpropertiesforthelegendofChartSpace1.

SubFormat_Chartspace_Legend()

DimChartLegendDimchConstants

SetchConstants=ChartSpace1.Constants

'Setavariabletothelegendforthechartspace.

Page 144: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetChartLegend=ChartSpace1.ChartSpaceLegend

'Setthelegendcolor.ChartLegend.Border.Color="Blue"

'Setthelineweightforthelegend.ChartLegend.Border.Weight=chConstants.owcLineWeightThick

'Setthelinestyleforthelegend.ChartLegend.Border.DashStyle=chLineRoundDot

EndSub

Page 145: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChCategoryLabelObject

Multipleobjects ChCategoryLabelMultipleobjects

RepresentsasinglelabelinaChCategoryLabelscollection.

Page 146: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChCategoryLabelobjectYoucanusethefollowingpropertiestoreturnaChCategoryLabelobject:

TheItempropertyoftheChCategoryLabelscollection

TheParentLabelpropertyoftheChCategoryLabelobject

Page 147: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChChartObject

Multipleobjects ChChartMultipleobjects

Representsasinglechartinthechartworkspace.Thechartworkspacecancontainupto16charts.TheChChartobjectisamemberoftheChChartscollection.

UsingtheChChartObject

UsetheChChartscollectionobject’sAddmethodtoaddacharttothechartworkspace:

ThefollowingpropertiesandmethodsreturnaChChartobject.

TheChAxesobject’sParentproperty

TheChAxisobject’sParentproperty

TheChChartsobject’sAddmethod

TheChChartsobject’sItemproperty

TheChPlotAreaobject’sParentproperty

TheChSeriesobject’sParentproperty

TheChSeriesCollectionobject’sParentproperty

Page 148: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChChartDrawObject

ChChartDraw Multipleobjects

Canbeusedtodrawitemsonachart,suchasaline,rectangle,orellipse.

Page 149: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChChartDrawobjectTheDrawEllipse,DrawLine,DrawPolyLine,DrawPolygon,DrawLinemethodscanbeusedtoadddrawingobjectstoachart.TheDrawTextmethodcanbeusedtoaddtexttoachart.TheBorder,Font,Interior,andLinepropertiescanbeusedtoformateachdrawingobjectbeforeitisaddedtothechart.

Youmustutilizeoneormoreofthefollowingeventstoaddadrawingobjecttoachart:BeforeRender,AfterRender,orAfterFinalRender.

Page 150: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChChartFieldObject

ChDropZone ChChartFieldsChChartFieldChDropZone

Representsafieldinadropzone.

Page 151: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChChartFieldobjectTheChChartFieldsobject'sItempropertyreturnsaChChartFieldobject.

Accessingthisobjectwhenyourchartisboundtoliteraldatawillresultinarun-timeerror.

Page 152: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UnsupportedLanguageElementYouhaverequestedHelpforalanguageelementthatisnotsupported.

Page 153: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChDataLabelObject

Multipleobjects ChDataLabelMultipleobjects

Representsasingledatalabelforaseries,orthesingledatalabelforatrendline.

Page 154: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChDataLabelobjectThefollowingpropertiescanbeusedtoreturnaChDataLabelobject:

TheChDataLabelsobject'sItemproperty

TheChTrendlineobject'sDataLabelproperty

ThefollowingexampleaddsdatalabelstothefirstseriesinthefirstchartinChartspace1,andthenformatsthethirddatalabel.

SubFormatSeriesLabel()

DimserSeries1DimdlSeries1Labels

'Setavariabletothefirstseriesofthefirstchart'inChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addasetofdatalabelstothefirstseriesandreturn'aDataLabelsobject.SetdlSeries1Labels=serSeries1.DataLabelsCollection.Add

dlSeries1Labels.Item(2).Font.Bold=TruedlSeries1Labels.Item(2).Font.Color="Red"

EndSub

Page 155: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChDataLabelsObject

Multipleobjects ChDataLabelsMultipleobjects

ContainsacollectionofChDataLabelobjectsthatrepresentallthedatalabelsinthespecifiedsetofdatalabelsforaseries.Notethataseriescancontainmorethanonesetofdatalabels.

Page 156: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChDataLabelsobjectThefollowingmethodsandpropertiescanbeusedtoreturnaChDataLabelsobject:

TheChDataLabelsCollectioncollectionobject'sAddmethod.

TheChDataLabelsCollectioncollectionobject'sItemproperty.

ThefollowingexampleaddsdatalabelstothefirstseriesinthefirstchartinChartspace1andthenformatsthedatalabels.

SubAddDataLabels()

DimserSeries1DimdlSeries1Labels

'Setavariabletothefirstseriesofthefirstchart'inChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addasetofdatalabelstothefirstseriesandreturn'aDataLabelsobject.SetdlSeries1Labels=serSeries1.DataLabelsCollection.Add

'Setthenumberformatofthedatalabels.dlSeries1Labels.NumberFormat="0.00"

'Setthedatalabelstodisplaythecategory'nameforthedatapoint.dlSeries1Labels.HasCategoryName=True

'Setthedatalabelstodisplaythevalue'forthedatapoint.dlSeries1Labels.HasValue=True

Page 157: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 158: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChDropZoneObject

Multipleobjects ChDropZoneMultipleobjects

Representsadropzoneonchartsthatareboundtoarelationaldatasource.

Page 159: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChDropZoneobjectTheChartSpaceobject'sDropZonesmethodreturnsaChDropZoneobject.

ThefollowingexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetup_DropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 160: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChErrorBarsObject

ChSeries ChErrorBarsCollectionChErrorBarsMultipleobjects

Representstheerrorbarsforaseries.Errorbarsindicatethedegreeofuncertaintyforchartdata.OnlyseriesinRadar,Polar,Area,Bar,Column,Line,andXY(Scatter)chartscanhaveerrorbars.Onlyseriesinscatterchartscanhavexandyerrorbars.TheChErrorBarsobjectisnotacollection.Thereisnoobjectthatrepresentsasingleerrorbar;youeitherhavexerrorbarsoryerrorbarsturnedonforallpointsinaseriesoryouhavethemturnedoff.

Page 161: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChErrorBarsobjectUsetheAddmethodoftheChErrorBarsCollectionobjecttoadderrorbarstoaseries.

ThefollowingmethodsreturnaChErrorBarsobject.Formoreinformation,seetheHelptopicsforthesemethods:

TheChErrorBarsCollectionobject’sAddmethod

TheChErrorBarsCollectionobject’sItemproperty

ThefollowingexampleaddserrorbarstothefirstseriesinthefirstchartinChartSpace1,andthensetsthepropertiesfortheerrorbars.

SubAddErrorBars()

DimchConstantsDimebCollectionDimebSeries1

SetchConstants=ChartSpace1.Constants

'Setavariabletothecollectionoferrorbarsfor'thefirstseriesinthefirstchartofChartspace1.SetebCollection=ChartSpace1.Charts(0).SeriesCollection(0).ErrorBarsCollection

'Adderrorbarstothechart.ebCollection.Add

'Setavariabletotheerrorbarsforthedataseries.SetebSeries1=ebCollection.Item(0)

'Settheerrorbarssothattheyrepresentacertain'percentageofthevalueofadatapoint.

Page 162: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ebSeries1.Type=chConstants.chErrorBarTypePercent

'Theerrorbarsrepresent5%ofadatapoint.ebSeries1.Amount=0.05

EndSub

Page 163: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChFontObject

Multipleobjects ChFont

Containsthefontattributes(fontname,fontsize,color,andsoon)foranobjectonachart.

Page 164: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChFontobjectThefollowingpropertiescanbeusedtoreturnaChFontobject:

TheChAxisobject'sFontproperty

TheChChartDrawobject'sFontproperty

TheChDataLabelobject'sFontproperty

TheChDataLabelsobject'sFontproperty

TheChDropZoneobject'sButtonFontproperty

TheChDropZoneobject'sWatermarkFontproperty

TheChLegendobject'sFontproperty

TheChLegendEntryobject'sFontproperty

TheChTitleobject'sFontproperty

UsetheNamepropertytosetthefontforaparticularobject.TheBold,Italic,Color,Underline,andSizepropertiescanbeusedtofurtherformatthefontofaparticularobject.

Page 165: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChFormatMapObject

Multipleobjects ChFormatMapChSegments

TheChFormatMapobjectallowsformattingtorepresentarangeofdatavalues.TheChFormatMapobjectcanbeusedprovidevisualcuesthathighlightcertainportionsofyourdata.

Page 166: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChFormatMapobjectTheFormatMappropertyoftheChSeriesobjectreturnsaChFormatMapobject.

FormatmapscontainoneormoreChSegmentobjects,eachofwhichcanbeformattedindependently.

ThefollowingexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreated.Thesmallervaluesaredisplayedinwhite,thenlargervaluesaredisplayedinalightshadeofblue,andfinallythelargestvaluesinthechartaredisplayedindarkblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1DimchConstants

SetchConstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;PersistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=ServerName;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderdetailstable.ChartSpace1.SetDatachConstants.chDimCategories,chConstants.chDataBound,"ProductID"ChartSpace1.SetDatachConstants.chDimValues,chConstants.chDataBound,"Quantity"

Page 167: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Createaformatmap.ChartSpace1.SetDatachConstants.chDimFormatValues,chConstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Specifythatthedivisionsinformattingbecreatedautomatically.segSegment1.HasAutoDivisions=True

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chConstants.chBoundaryValuePercentsegSegment1.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%.segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"

EndSub

ThefollowingexamplebindsChartspace1totheOrderDetailstableintheNorthwinddatabase.Then,twosegmentsarecreated.Thefirstsegmenthighlightsthelowest10%ofvaluesinthefirstseriesinthechart.Thesecondsegmenthighlightsthetop20%ofvaluesinthefirstseriesinthechart.

SubWindow_Onload()

Page 168: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Dimserseries1DimsegBottom10PctDimsegTop20PctDimchConstants

SetchConstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;PersistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=ServerName;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderdetailstable.ChartSpace1.SetDatachConstants.chDimCategories,chConstants.chDataBound,"ProductID"ChartSpace1.SetDatachConstants.chDimValues,chConstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachConstants.chDimFormatValues,chConstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.Setserseries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addasegmenttotheformatmap.Thissegmentwill'representthebottom10%ofvaluesinthechart.SetsegBottom10Pct=serseries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segBottom10Pct.Begin.ValueType=chConstants.chBoundaryValuePercentsegBottom10Pct.End.ValueType=chConstants.chBoundaryValuePercent

Page 169: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthebeginningvalueto0%,andtheendingvalueto10%.

segBottom10Pct.Begin.Value=0

segBottom10Pct.End.Value=0.1

'Formattheinteriorofthematchingvalues.segBottom10Pct.Begin.Interior.Color="red"segBottom10Pct.End.Interior.Color="red"

'Addasegmenttotheformatmap.Thissegmentwill'representthetop20%ofvaluesinthechart.SetsegTop20Pct=serseries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segTop20Pct.Begin.ValueType=chConstants.chBoundaryValuePercentsegTop20Pct.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto80%,andtheendingvalueto100%.segTop20Pct.Begin.Value=0.8segTop20Pct.End.Value=1

'Formattheinteriorofthematchingvalues.segTop20Pct.Begin.Interior.Color="green"segTop20Pct.End.Interior.Color="green"

EndSub

Page 170: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChGridlinesObject

ChAxis ChGridlinesMultipleobjects

Representsmajororminorgridlinesonachartaxis.Youcannothavegridlineswithoutanaxis.Gridlinesextendthetickmarksonachartaxistomakeiteasiertoseethevaluesassociatedwiththedatamarkers.Thisobjectisnotacollection.Thereisnoobjectthatrepresentsasinglegridline;youeitherhaveallgridlinesforanaxisturnedonorallofthemturnedoff.

Page 171: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChGridlinesobjectThefollowingpropertiesreturnaChGridlinesobject.

TheChAxisobject’sMajorGridlinesproperty

TheChAxisobject’sMinorGridlinesproperty

ThefollowingexampleenablesthemajorandminorgridlinesforthevalueaxisinthefirstchartinChartspace1.Then,theweightofthegridlinesisformatted.

SubEnableGridlines()

DimchConstantsDimaxValueAxis

SetchConstants=ChartSpace1.Constants

'SetavariabletothevalueaxisinthefirstchartinChartspace1.SetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)

'Thefollowingtwolinesofcodeturnonthemajorand'minorgridlinesforthevalueaxis.axValueAxis.HasMajorGridlines=TrueaxValueAxis.HasMinorGridlines=True

'Thefollowingtwolinesofcodesetthelineweightofthe'majorandminorgridlinesforthevalueaxis.axValueAxis.MajorGridlines.Line.Weight=chConstants.owcLineWeightMediumaxValueAxis.MinorGridlines.Line.Weight=chConstants.owcLineWeightHairline

EndSub

Page 172: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChInteriorObject

Multipleobjects ChInterior

Representstheinteriorformattingofanobject.

Page 173: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChInteriorobjectThefollowingpropertiesreturnaChInteriorobject:

TheChChartobject'sInteriorproperty

TheChChartDrawobject'sInteriorproperty

TheChartSpaceobject'sInteriorproperty

TheChDataLabelobject'sInteriorproperty

TheChDataLabelsobject'sInteriorproperty

TheChDropZoneobject'sButtonInteriorproperty

TheChDropZoneobject'sWatermarkInteriorproperty

TheChLegendobject'sInteriorproperty

TheChPlotAreaobject'sInteriorproperty

TheChPointobject'sInteriorproperty

TheChSegmentBoundaryobject'sInteriorproperty

TheChSeriesobject'sInteriorproperty

TheChSurfaceobject'sInteriorproperty

TheChTitleobject'sInteriorproperty

ThefollowingexamplesetstheinteriorfillofthefirsttwoseriesandtheplotareaofthefirstchartinChartSpace1.

SubFormatInteriorFills()

DimchConstantsDimserSeries1DimserSeries2

SetchConstants=ChartSpace1.Constants

Page 174: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)SetserSeries2=ChartSpace1.Charts(0).SeriesCollection(1)

'Settheinteriorfillofthefirstseriestoatwo-colorgradient.serSeries1.Interior.SetTwoColorGradientchConstants.chGradientDiagonalDown,_chConstants.chGradientVariantCenter,"Blue","Silver"

'Settheinteriorfillofthesecondseriestoasolidcolor.serSeries2.Interior.SetSolid"Purple"

'Settheinteriorfilloftheplotareatoapresettexture.ChartSpace1.Charts(0).PlotArea.Interior.SetTextured_chConstants.chTextureParchment,chConstants.chTile

EndSub

Page 175: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChLegendObject

Multipleobjects ChLegendMultipleobjects

Representsachartworkspaceorchartlegend.Achartorchartworkspacecanhaveonlyonelegend.TheChLegendobjectcontainsaChLegendEntriescollectionthatcontainsoneormoreChLegendEntryobjects.

Page 176: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChLegendobjectUsetheHasLegendpropertyortheHasChartSpaceLegendpropertytoenablethelegend.

ThefollowingpropertiesreturnaChLegendobject.

TheChartSpaceobject’sChartSpaceLegendproperty

TheChChartobject’sLegendproperty

TheChLegendEntriesobject’sParentproperty

TheChLegendEntryobject’sParentproperty

Page 177: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChLegendEntryObject

ChLegend ChLegendEntriesChLegendEntryMultipleobjects

Representsasinglelegendentry.TheChLegendEntryobjectisamemberoftheChLegendEntriescollection.

Page 178: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChLegendEntryobjectTheChLegendEntriescollection’sItempropertyreturnsaChLegendEntryobject.

UseLegendEntries(index),whereindexisthelegendentryindexnumber,toreturnasingleLegendEntryobject.Youcannotreturnlegendentriesbyname.

Theindexnumberrepresentsthepositionofthelegendentryinthelegend.LegendEntries(0)isatthetopofthelegend,andLegendEntries(LegendEntries.Count)isatthebottom.Thefollowingexamplechangesthefontforthetextofthelegendentryatthetopofthechartspacelegend(thisisusuallythelegendforseriesone)inChartspace1.

Chartspace1.ChartSpaceLegend.LegendEntries(0)_.Font.Bold=True

Page 179: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChLineObject

Multipleobjects ChLine

Representstheformattingofalineonachart.

Page 180: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChLineobjectYoucanusethefollowingpropertiestoreturnaChLineobject:

TheChAxisobject'sLineproperty

TheChChartDrawobject'sLineproperty

TheChErrorBarsobject'sLineproperty

TheChGridlinesobject'sLineproperty

TheChPointobject'sLineproperty

TheChSegmentBoundaryobject'sLineproperty

TheChSeriesobject'sLineproperty

TheChTrendlineobject'sLineproperty

Page 181: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChMarkerObject

ChSeries ChMarker

RepresentsadatamarkeronaLine,XY(Scatter),Radar,orPolarchart.

Page 182: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChMarkerobjectTheChSeriesobject’sMarkerpropertyreturnsaChMarkerobject.

UsetheSizeandStylepropertiestoformatChMarkerobjects.

ThefollowingexampleconvertsthefirstseriesinthefirstchartofChartspace1toalinechart,andthenformatsthemarkersontheline.

SubFormatMarkers()

DimserSeries1DimchConstants

SetchConstants=ChartSpace1.Constants

'Setavariabletothefirstseriesofthefirstchart'inChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Changethetypeofthefirstdataseriestoalinechart.serSeries1.Type=chConstants.chChartTypeLineMarkers

'Setthemarkerstyle.serSeries1.Marker.Style=chConstants.chMarkerStyleDiamond

'Setthesizeofthemarkers.serSeries1.Marker.Size=7

EndSub

Page 183: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChPlotAreaObject

Multipleobjects ChPlotAreaMultipleobjects

Representstheplotareaonachart(theareawherethechartdataisplotted).Pie,Doughnut,Radar,andPolarchartsdonothaveaplotarea;instead,thesechartsdrawdirectlyonthechartarea.

Page 184: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChPlotAreaobjectTheChChartobject’sPlotAreapropertyreturnsaChPlotAreaobject.

ThefollowingexamplefillstheplotareaofthefirstchartinChartspace1withapredefinedtexture.

SubFormatPlotArea()DimchConstants

SetchConstants=ChartSpace1.Constants

'Settheinteriorfilloftheplotareatoapresettexture.ChartSpace1.Charts(0).PlotArea.Interior.SetTextured_

chConstants.chTextureParchment,chConstants.chTile

EndSub

Page 185: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChPointObject

ChSeries ChPointsChPointMultipleobjects

Representsasingledatapointinaseriesonachart.TheChPointobjectisamemberoftheChPointscollection,whichcontainsallthepointsinagivenseries.

Page 186: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChPointobjectUsethisobjecttoformatsingledatapointsinaseries,orusetheGetValuemethodtoreturnapointvalue.

TheChPointsobject’sItempropertyreturnsaChPointobject.

Page 187: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChScalingObject

Multipleobjects ChScaling

Representsthescalingforadataseries,axis,orchart.

Page 188: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChScalingobjectThefollowingpropertiesreturnaChScalingobject:

TheChAxisobject'sScalingproperty

TheChChartobject'sScalingsproperty

TheChSeriesobject'sScalingsproperty

Page 189: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChScrollViewObject

ChChart ChScrollView

Page 190: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChScrollViewObjectYouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationandtocontrolthescrollviewofachart.

YouusethetheScrollViewpropertyoftheChChartobjecttoretrievetheChScrollViewobjectofthechart(oneperchart.)Thisobjectistheprimaryinterfacethatallowsapplicationstoretrieveinformationandcontrolthescrollview.TheChScrollViewobjecthasseveralpropertiesthatyoucanusetospecifyanddeterminethescrollviewofthechart.

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.

TheVerticalPositionandHorizontalPositionpropertiesshiftthescrollviewverticallyandhorizontally.Theinitialvaluesofthesepropertiesaretreatedasthelocation(0,0),andarerelativetothevaluesoftheLeftandToppropertiesoftheactualplotarea(theChPlotAreaobject).TheincrementalshiftinthepositionofthescrollviewisrelativetotheratiooftheVerticalExtentandVerticalExtentMaxproperties,andtotheratiooftheHorizontalExtentandHorizontalExtentMaxproperties.

TheratiooftheVerticalExtentandVerticalExtentMaxpropertiesdescribesthepositionofthescrollviewarea’sverticaldimensionrelativetotheactualplotarea’sverticaldimension.TheratiooftheHorizontalExtentandHorizontalExtentMaxpropertiesvaluedescribesthepositionofthescrollviewarea’shorizontaldimensionrelativetotheactualplotarea’shorizontaldimension.

YoucanzoomthedisplayofthechartinoroutbysettingtheVerticalExtentMaxandHorizontalExtentMaxpropertiestovaluesgreaterorlessthantheVerticalExtentandHorizontalExtentproperties,respectively.Forexample,tozoomthechartby200%,setthe

Page 191: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VerticalExtentMaxandHorizontalExtentMaxpropertiestotwicethevalueoftheVerticalExtentandHorizontalExtentproperties.

Whetherthechartiszoomedornot,youcanaccessthescrollview’sdimensionsbyusingtheTop,Left,Right,andBottompropertiesoftheChScrollViewobject.And,youcanaccesstheactualplotarea’sdimensionsbyusingtheTop,Left,Right,andBottompropertiesoftheChPlotAreaobject.

IfthevalueofeithertheHorizontalExtentortheHorizontalExtentMaxpropertyislessthanorequaltozero(0),thescrollviewisdisabledandachartcannotbescrolledhorizontally.Similarly,achartcannotbescrolledverticallyifthevalueofeithertheVerticalExtentMaxortheVerticalExtentpropertyislessthanorequaltozero.

YoucanalsochangethescrollpositionandscrollextentusingtheSetPositionandSetExtentmethodsoftheChartcomponent.UsingtheSetPositionandSetExtentmethodsisthesameassettingtheindividualHorizontalExtent,VerticalExtent,HorizontalPosition,andVerticalPositionproperties,butthesemethodsallowyoutosetmultiplepropertiesatthesametimetoreducethenumberoftimesthechartisrepainted.

Page 192: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChSegmentObject

ChFormatMap ChSegmentsChSegmentChSegmentBoundary

Representsasinglesegmentinaformatmap.Eachsegmentofaformatmapcanbeformattedindependentlyoftheothersegments.

Page 193: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChSegmentobjectThefollowingmethodsandpropertiesreturnaChSegmentobject.

TheChSegmentsobject'sAddmethod

TheChSegmentsobject'sItemproperty

UsetheAddmethodoftheChSegmentsobjecttocreateanewsegment.UsethepropertiesoftheChSegmentBoundaryobjectreturnedbytheBeginpropertytoformatthebeginningofasegment.UsethepropertiesoftheChSegmentBoundaryobjectreturnedbytheEndpropertytoformattheendofasegment.

Page 194: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplebindsChartspace1totheOrderDetailstableintheNorthwinddatabase.Then,twosegmentsarecreated.Thefirstsegmenthighlightsthelowest10%ofvaluesinthefirstseriesinthechart.Thesecondsegmenthighlightsthetop20%ofvaluesinthefirstseriesinthechart.

SubWindow_Onload()

Dimserseries1DimsegBottom10PctDimsegTop20PctDimchConstants

SetchConstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.

ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;persistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;DataSource="&_"ServerName;"

ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderdetailstable.ChartSpace1.SetDatachConstants.chDimCategories,chConstants.chDataBound,"ProductID"ChartSpace1.SetDatachConstants.chDimValues,chConstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachConstants.chDimFormatValues,chConstants.chDataBound,"Quantity"

Page 195: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'SetavariabletothefirstseriesinthefirstchartinChartspace1.Setserseries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addasegmenttotheformatmap.Thissegmentwill'representthebottom10%ofvaluesinthechart.SetsegBottom10Pct=serseries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.

segBottom10Pct.Begin.ValueType=chConstants.chBoundaryValuePercentsegBottom10Pct.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto10%segBottom10Pct.Begin.Value=0segBottom10Pct.End.Value=0.1

'Formattheinteriorofthematchingvalues.segBottom10Pct.Begin.Interior.Color="red"segBottom10Pct.End.Interior.Color="red"

'Addasegmenttotheformatmap.Thissegmentwill'representthetop20%ofvaluesinthechart.

SetsegTop20Pct=serseries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segTop20Pct.Begin.ValueType=chConstants.chBoundaryValuePercentsegTop20Pct.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto80%,andtheendingvalueto100%.segTop20Pct.Begin.Value=0.8segTop20Pct.End.Value=1

Page 196: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Formattheinteriorofthematchingvalues.segTop20Pct.Begin.Interior.Color="green"segTop20Pct.End.Interior.Color="green"

EndSub

Page 197: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChSegmentBoundaryObject

ChSegment ChSegmentBoundaryMultipleobjects

RepresentstheboundariesofofaChSegmentobject.

Page 198: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChSegmentBoundaryobjectThefollowingpropertiesreturnaChSegmentBoundaryobject.

TheChSegmentobject'sBeginproperty

TheChSegmentobject'sEndproperty

UsetheValuepropertytosetthebeginningandendingvaluesofaChSegmentBoundaryobject.UsetheValueTypepropertytospecifywhetheravaluerepresentsapercentageoranabsolutevalue.

UsetheobjectsreturnedbythefollowingpropertiestoformataChSegmentBoundaryobject:Border,Interior,andLine.

Page 199: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChSegmentsObject

ChFormatMap ChSegmentsMultipleobjects

RepresentsthecollectionofsegmentsforaChFormatMapobject.

Page 200: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChSegmentsobjectTheSegmentspropertyoftheChFormatMapobjectcanbeusedtoreturnaChSegmentsobject.

UsetheAddmethodoftheChSegmentsobjecttoaddasegmenttoaformatmap.

UsetheItempropertyoftheChSegmentsobjecttoreturnasingleChSegmentobject.

Page 201: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChSeriesObject

Multipleobjects ChSeriesMultipleobjects

Representsaseriesonachart.TheChSeriesobjectisamemberoftheChSeriesCollectioncollection.

Page 202: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChSeriesobjectUsetheAddmethodoftheChSeriesCollectioncollectiontoaddaseriestoachart.

ThefollowingpropertiesandmethodsreturnaChSeriesobject:

TheChDataLabelsobject’sParentproperty

TheChDataLabelsCollectionobject’sParentproperty

TheChErrorBarsobject’sParentproperty

TheChErrorBarsCollectionobject’sParentproperty

TheChPointobject’sParentproperty

TheChPointsobject’sParentproperty

TheChSeriesCollectionobject’sAddmethod

TheChSeriesCollectionobject’sItemproperty

TheChTrendlineobject’sParentproperty

TheChTrendlinesobject’sParentproperty

Page 203: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChSurfaceObject

ChPlotArea ChSurfaceMultipleobjects

Representsthesurfaceofthewallsandfloorofachart.

Page 204: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChSurfaceobjectThefollowingpropertiescanbeusedtoreturnaChSurfaceobject:

TheChChartobject'sBackWallproperty

TheChChartobject'sSideWallproperty

TheChChartobject'sFloorproperty

YoucanusetheBorder,Interior,andThicknesspropertiestoformataChSurfaceobject.

Page 205: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChTitleObject

Multipleobjects ChTitleMultipleobjects

Representsthetitleofachartworkspace,axis,orchart.

Page 206: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChTitleobjectUsetheHasTitleorHasChartspaceTitlepropertytoenabletitles.

ThefollowingpropertiesreturnaChTitleobject:

TheChartSpaceobject’sChartSpaceTitleproperty

TheChAxisobject’sTitleproperty

TheChChartobject’sTitleproperty

ThefollowingexampleaddsatitletothefirstchartinChartpsace1andthenformatsthenewly-createdtitle.

SubAddChartTitle()

DimChart1TitleDimchConstants

SetchConstants=ChartSpace1.Constants

'Enablethetitleforthefirstchartinthe'chartspace.ChartSpace1.Charts(0).HasTitle=True

'Setavariabletothecharttitle.SetChart1Title=ChartSpace1.Charts(0).Title

'Setthecaoptionforthetitle.Chart1Title.Caption="2000SalesbyDepartment"

'Setthetitletodisplayatthebottomofthechart.Chart1Title.Position=chConstants.chTitlePositionBottom

'Formatthefontusedforthetitle.

Page 207: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Chart1Title.Font.Bold=TrueChart1Title.Font.Name="Tahoma"Chart1Title.Font.Size=16

EndSub

Page 208: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChTrendlineObject

ChSeries ChTrendlinesChTrendlineMultipleobjects

Representsatrendlineonachart.Atrendlineshowsthetrend,ordirection,ofdatainaseries.TheChTrendlineobjectisamemberoftheChTrendlinescollection.

Page 209: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChTrendlineobjectUsetheAddmethodoftheChTrendlinesobjecttoaddatrendlinetoaseries.

ThefollowingmethodandpropertyreturnaChTrendlineobject.

TheChTrendlinescollection’sAddmethod

TheChTrendlinescollection’sItemproperty

ThefollowingexampleaddsatrendlinetothefirstseriesinthefirstchartinChartspace1andthenformatsthetrendline.

SubAddPolyTrendline()

DimserSeries1DimchConstantsDimtlSeries1Trend

SetchConstants=ChartSpace1.Constants

'Setavariabletothefirstseriesofthefirstchart'inChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addatrendlinetothefirstseriesandreturn'aTrendlineobject.SettlSeries1Trend=serSeries1.Trendlines.Add

'Displaytheequationusedtocalculatethetrendline.tlSeries1Trend.IsDisplayingEquation=True

'Setthetrendlinetobeapolynomialtrendline.tlSeries1Trend.Type=chConstants.chTrendlineTypePolynomial

Page 210: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 211: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChUserDefinedSelectionObject

ChUserDefinedSelection

RepresentsanobjectdrawnonthechartbetweencallstotheBeginObjectandEndObjectmethods.

Page 212: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheChUserDefinedSelectionobjectWhenacustomdrawingobjectisselected,theChartSpaceobject'sSelectionpropertyreturnsaChUserDefinedSelectionobject.

Page 213: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CoordinateObject

Coordinate

StorestheXandY-coordinatesofadatapointforlaterretrieval.

Page 214: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheCoordinateobjectUsetheValueToPointmethodoftheChAxisorChSeriesobjecttoreturnaCoordinateobject.

UsethexandypropertiesoftheCoordinateobjecttoreturntheXandY-coordinatesofthedatapointcurrentlystoredintheCoordinateobject.

ThefollowingexamplechangesthetitleofthefirstchartinChartspace1tothepixelcoordinatesofadatapointinthefirstseriesofthechart.

SubGetPixelCoordinates()

DimchChart1DimlXPosDimlYPosDimcoPointCoordinates

'SetavariabletothefirstchartinChartspace1.SetchChart1=ChartSpace1.Charts(0)

'Enablethetitleforthechart.chChart1.HasTitle=True

'SetaCoordinateobjecttothecoordinatesofadatapoint.SetcoPointCoordinates=chChart1.SeriesCollection(0).ValueToPoint("Pears",10)

'SetavariabletotheX-coordinate.lXPos=coPointCoordinates.x

'SetavariabletotheY-coordinate.lYPos=coPointCoordinates.y

'Setthechart'stitlestothepixelcoordinatesofthespecified

Page 215: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'datapoint.chChart1.Title.Caption="X("&lXPos&")Y("&lYPos&")"

EndSub

Page 216: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CriteriaObject

Filter CriteriaFilter

ContainstheentirearrayofAutoFiltercriteria.EachcriterionisaStringvalue.TheAutoFilterobjectcontainsaFilterscollection,theFilterscollectioncontainsaFilterobjectforeachcolumninthefilteredrange,andeachFilterobjectcontainsaCriteriaobject.

Page 217: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheCriteriaObjectTheFilterobject’sCriteriapropertyreturnstheCriteriaobjectforthespecifiedfilter.

Page 218: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataPageObject

Multipleobjects DataPageMultipleobjects

Representsthecombinationofsectionsthatareshownonadataaccesspagewhentheexpandbuttonisclicked.Thesesectionsincludeacaptionsection,agroupheaderandgroupfootersectionforeachrecord,andanavigationsectioncorrespondingtothesetofvisiblerecordsfromarecordsetwithinasingleparentrecord.

TheDataPageobjectisamemberoftheDataPagescollection.

Page 219: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheDataPageObjectThefollowingpropertiesreturnaDataPageobject:

TheDataPagesobject'sItemproperty

TheSectionobject'sDataPageproperty

TheDSCEventInfoobject'sDataPageproperty

Page 220: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataSourceControlObject

DataSourceControl Multipleobjects

Representsadatasourcecontrol.Thedatasourcecontrolisthetop-levelcontainerinthedatamodel.

Page 221: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheDataSourceControlObjectYoucanuseeithertheCreateObjectmethodortheNewkeywordtocreateaDataSourceControlobject.

TheobjectIDforadatasourcecontrolonanHTMLpagereturnsaDataSourceControlobject.TheprogrammaticidentifierfortheDataSourceControlobjectisCLSID:CLSID:0002E55B-0000-0000-C000-000000000046.Thefollowingexamplecreatesadatasourcecontrolnamed"MSODSC"onanHTMLpage.

<objectid=MSODSCclassid=CLSID:0002E55B-0000-0000-C000-000000000046></object>

Page 222: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DSCEventInfoObject

DSCEventInfo Multipleobjects

Containsinformationaboutthespecifieddatasourcecontrolevent.

Page 223: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheDSCEventInfoObjectThefollowingdatasourcecontroleventsuseaDSCEventInfoobjectastheironlyparameter:

TheAfterDeleteevent

TheAfterInsertevent

TheAfterUpdateevent

TheBeforeCollapseevent

TheBeforeDeleteevent

TheBeforeExpandevent

TheBeforeFirstPageevent

TheBeforeInitialBindevent

TheBeforeInsertevent

TheBeforeLastPageevent

TheBeforeNextPageevent

TheBeforeOverwriteevent

TheBeforePreviousPageevent

TheBeforeUpdateevent

TheCurrentevent

TheDataErrorevent

TheDataPageCompleteevent

TheDirtyevent

TheFocusevent

TheRecordExitevent

Page 224: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TheRecordsetSaveProgressevent

TheUndoevent

YoucanusethepropertiesoftheDSCEventInfoobjecttoreturninformationaboutthedataaccesspagewhenaneventistrapped.TheSectionpropertycanbeusedtodeterminethesectionofthedataaccesspagewheretheeventoccurred.YoucanusetheReturnValuepropertytocancelthecompletionofsomeevents.

TheeventslistedabovevaryintheirsupportoftheDSCEventInfoproperties.SomeoftheeventssupportasubsetoftheDSCEventInfoproperties,andsomeeventsdon'tsupportanyoftheDSCEventInfoproperties.Usinganunsupportedpropertywillresultinarun-timeerror.

ThefollowingexamplecancelsthedeletionofarecordiftheDiscontinuedfieldissettheNo.TheSectionpropertyoftheDSCEventInfoobjectisusedtodrilldowntothevalueoftheDiscontinuedfield.IfthefieldcontainsthevalueNo,thentheReturnValueoftheDSCEventInfoobjectissettoFalse,cancelingthedeletionoftherecord.

SubMSODSC_BeforeDelete(DSCEventInfo)

DimtxtDiscontinued

'Setavariabletothetextboxthatcontainsthevalue'oftheDiscontinuedfieldfortherecordthatistobedeleted.SettxtDiscontinued=DSCEventInfo.Section.HTMLContainer_.Children("Discontinued")

'Checkthevalueofthecontrol.IftxtDiscontinued.Value="No"Then

'Displayamessagetotheuser.Msgbox"Donotdeleteproductsthathavenot"&_"beendiscontinued."

Page 225: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Cancelthedeletionoftherecord.DSCEventInfo.ReturnValue=FalseEndIf

EndSub

Page 226: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ElementExtensionObject

Multipleobjects ElementExtensionsElementExtension

Addsdata-relatedpropertiestoHTMLelementssuchastextboxesanddrop-downlistboxes.ElementextensionstierecordsetandgroupingdefinitionobjectssuchaspagefieldstoanelementontheHTMLpagethatcanbeboundtotheirresultingdata.

TheElementExtensionobjectisamemberoftheElementExtensionscollection.

Page 227: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheElementExtensionObjectThefollowingmethodandpropertyreturnanElementExtensionobject:

TheElementExtensionscollection'sAddmethod

TheElementExtensionscollection'sItemproperty

Page 228: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterObject

Multipleobjects FilterMultipleobjects

RepresentsasinglefilterusedwiththeAutoFilter.TheFilterobjectisamemberoftheFilterscollection.TheAutoFilterobjectcontainsaFilterscollection,theFilterscollectioncontainsaFilterobjectforeachcolumninthefilteredrange,andeachFilterobjectcontainsaCriteriaobject.

Page 229: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheFilterObjectTheFiltersobject'sItempropertyreturnsaFilterobject.

Page 230: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FontObject

Multipleobjects Font

Containsthefontattributes(fontname,fontsize,color,andsoon)foranobject.

Page 231: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheFontobjectUsetheFontpropertytoreturnaFontobject.

ThefollowingexampleformatscellsA1:C5asbold.

Spreadsheet1.ActiveSheet.Range("A1:A5").Font.Bold=True

Page 232: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupingDefObject

Multipleobjects GroupingDefPageFields

Representsagroupingdefinition.Agroupingdefinitionisaspecialtypeofrecordsetdefinition.AswithRecordsetDefobjects,youcanuseagroupingdefinition'snameintheExecutemethodandintheRecordSourcepropertyofagrouplevelorelementextension.

AgroupingdefinitiondefinesanADOgroupingrecordsetthatappearsasaparentofthecontainingrecordsetinthehierarchyorrecordsetsproducedbyapage.Atruntime,allthedataforthecontainingrecordsetdefinitionisfetchedbeforethegroupingrecordsetiscreated.

Page 233: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheGroupingDefObjectThefollowingmethodsandpropertyreturnaGroupingDefobject:

TheGroupingDefscollection'sAddmethod

TheGroupingDefscollection'sAddTotalmethod

TheGroupingDefsorAllGroupingDefscollections'Itemproperty

Page 234: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupLevelObject

Multipleobjects GroupLevel

Representsthesetofallrecordsatagivenlevelofthedataaccesspagehierarchy.TheGroupLevelobjectisamemberoftheGroupLevelscollection.

Page 235: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheGroupLevelObjectThefollowingmethodandpropertyreturnaGroupLevelobject:

TheGroupLevelscollection’sAddmethod

TheGroupLevelscollection’sItemproperty

TheDataPageobject'sGroupLevelproperty

Page 236: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeadingObject

Window HeadingsHeadingWindow

Representsasingleroworcolumnheaderinthespecifiedwindow'sHeadingscollection.

Page 237: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheHeadingobjectUsetheHeadingscollection'sItempropertytoreturnanindividualHeadingobject.ThiscanbeexpressedasHeadings(Index)orHeadings.Item(Index),whereIndexistheindexnumberoftheindividualHeadingobject.

UsetheCaptionpropertytocustomizetherowandcolumnheadingsinawindow.ThefollowingexampleillustrateshowtousetheCaptionpropertytochangetherowandcolumnheadinginawindow:

SubChange_Headings()

DimhdrColHeadingsDimhdrRowHeadings

'Setavariabletothecolumnheadingsintheactivewindow.SethdrColHeadings=Spreadsheet1.ActiveWindow.ColumnHeadings

'Setavariabletotherowheadingsintheactivewindow.SethdrRowHeadings=Spreadsheet1.ActiveWindow.RowHeadings

'SettheheadingsofcolumnsAthroughD.hdrColHeadings(1).Caption="Qtr1"hdrColHeadings(2).Caption="Qtr2"hdrColHeadings(3).Caption="Qtr3"hdrColHeadings(4).Caption="Qtr4"

'Settheheadingsofrows1though5.hdrRowHeadings(1).Caption="Sedan"hdrRowHeadings(2).Caption="Convertible"hdrRowHeadings(3).Caption="Truck"hdrRowHeadings(4).Caption="Sport-Utility"

Page 238: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

hdrRowHeadings(5).Caption="Minivan"

EndSub

TheCaptionpropertyoftheHeadingobjectislimitedto256characters,andthetextcannotbewrappedtoasecondline.

UsetheResetHeadingsmethodtosettherowandcolumnheadingsbacktotheirdefaultvalues.

Page 239: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HyperlinkObject

Range HyperlinkRange

Representsahyperlink.

Page 240: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheHyperlinkObjectTheRangeobject’sHyperlinkpropertyreturnsaHyperlinkobject.

Page 241: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InteriorObject

Multipleobjects Interior

Representstheinteriorofanobject.

Page 242: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheInteriorObjectThefollowingpropertiesreturnanInteriorobject:

TheRangeobject’sInteriorproperty

TheTitleBarobject’sInteriorproperty

Page 243: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListObjectObject

Multipleobjects ListObjectMultipleobjects

Page 244: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheListObjectObjectAListObjectobjectrepresentsanXMLlistonaworksheet.TheListObjectobjectisamemberoftheListObjectscollection.IndividualListObjectobjectsintheListObjectscollectionareindexedbeginningwith1forthefirstobject,2forthesecondobject,andsoon.YouusetheItempropertytoreturnasingleListObjectobjectfromtheListObjectscollection.TheargumentfortheItempropertyisthenameortheindexnumberintheListObjectscollectionoftheListObjectobject.ThenameisthevalueoftheIDattributeofanEntryelement(MapInfo/Map/Entry)inanXMLspreadsheetfile.TheXMLfragmentwherethesedetailsappearintheXMLSpreadsheetfilelookssomethinglikethefollowing:

<x2:MapInfoxmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml"><x2:Mapx2:ID="Cust_MapId"><x2:Entryx2:ID="example_id"x2:Type="table">...</x2:Entry></x2:Map></x2:MapInfo>

YoucanalsogetthenamebyusingtheNamepropertyoftheListObjectobject.UsingMicrosoftExcel,youcancreateanXMLSpreadsheetfilebycreatingadataboundspreadsheetandthensavingtheworkbookasanXMLSpreadsheet.

ThisexamplesetsthelineweightoftheborderfortherangeofthespecifiedlistintheSpreadsheetcomponent.

SubSetListBorder()DimssConstantsDimrngList

SetssConstants=Spreadsheet1.Constants

Page 245: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setavariabletotherangethatcontainsthelist.SetrngList=Spreadsheet1.ActiveSheet.ListObjects(1).Range'Settherangeborderweight.rngList.Borders.Weight=ssConstants.owcLineWeightMediumEndSub

Page 246: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListRowObject

ListObject ListRowsListRowMultipleobjects

Page 247: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheListRowObjectAListRowobjectrepresentsarowinaListObjectobjectinaSpreadsheetcomponent.TheListRowobjectisamemberoftheListRowscollection.TheListRowscollectioncontainsalltherowsinaListObjectobject.TheListRowobjecthasnodefaultproperty.

IndividualListRowobjectsintheListRowscollectionareindexedbeginningwith1forthefirstobject,2forthesecondobject,andsoforth.YouusetheItempropertytoreturnasingleListRowobjectfromtheListRowscollection.TheargumentfortheItempropertyistheindexnumberintheListRowscollectionoftheListRowobject.

YouusetheDeletemethodtodeletethecellsofarowinalist.Deletingtherowwillcauseashiftupfortheremainingcellsbelowthedeletedrow.Theread/writeActivepropertyoftheListRowobjectallowsyoutofindoutifarowisselectedortoselectit.YouusetheRangepropertytoreturnaRangeobjectthatrepresentstherangetowhichthespecifiedlistrowapplies.

YoufindoutthecurrentordinalpositionoftheListRowobjectintheListRowscollectionusingtheIndexproperty.TheApplicationandParentpropertiesreturntheSpreadsheetcomponentandtheparentobject(whichistheListObjectobject)forthespecifiedListRowsobject.

Page 248: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NameObject

Multipleobjects NamesNameRange

Representsadefinednameforarangeofcells,aformula,oraconstantvalue.TheNameobjectisamemberoftheNamescollection.

Page 249: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheNameobjectUseNames(index),whereindexisthename,indexnumberordefinedname,toreturnasingleNameobject.

Theindexnumberindicatesthepositionofthenamewithinthecollection.Thefollowingexampledisplaysthecellreferenceforthefirstnameintheapplicationcollection.

MsgBoxNames(1).RefersTo

Thefollowingexampledeletesthename"mySortRange"fromtheactiveworkbook.

ActiveWorkbook.Names("mySortRange").Delete

UsetheNamepropertytoreturnorsetthetextofthenameitself.ThefollowingexamplechangesthenameofthefirstNameobjectintheactiveworkbook.

Names(1).Name="stock_values"

UsetheAddmethodtocreateanameandaddittothecollection.ThefollowingexamplecreatesanewnamethatreferstocellsA1:C20ontheworksheetnamed"Sheet1."

Spreadsheet1.Names.Add"CurrentMonth","=Sheet1!$A$1:$C$20"

TheRefersToargumentmustbespecifiedinA1-stylenotation,includingdollarsigns($)whereappropriate.Forexample,ifcellA10isselectedonSheet1andyoudefineanamebyusingtheRefersToargument"=Sheet1!A1:B1",thenewnameactuallyreferstocellsA10:B10(becauseyouspecifiedarelativereference).Tospecifyanabsolutereference,use"=Sheet1!$A$1:$B$1".

Page 250: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OCCommandObject

Multipleobjects OCCommandsOCCommand

RepresentsasinglecommandinthespecifiedMicrosoftOfficeWebComponent.

Page 251: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheOCCommandobjectUsetheItempropertyoftheOCCommandscollectiontoreturnasingleOCCommandobject.

TheOCCommandId,ChartCommandIdEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachMicrosoftOfficeWebComponent.

UsetheExecutemethodoftheOCCommandobjecttoexecuteaparticularcommand.ThefollowingexampleusestheExecutemethodtoselecttheupper-leftcellintheactivesheetofSpreadsheet1.

SubSelectUpperLeft()

DimssConstants

SetssConstants=Spreadsheet1.Constants

'Selecttheupper-leftcellintheactiveworksheet.Spreadsheet1.Commands(ssConstants.ssCommandMoveToOrigin).Execute

EndSub

UsetheCommandBeforeExecuteeventtoimposecertainrestrictionsbeforeacommandisexecuted,ortocancelacommand.ThefollowingexamplerefreshesPivotTable1whentheExportcommandisinvokedsothatthelatestdataisexportedtoMicrosoftExcel.

SubPivotTable1_CommandBeforeExecute(Command,Cancel)

DimptConstants

SetptConstants=PivotTable1.Constants

Page 252: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'ChecktoseeiftheExportcommand'hasbeeninvoked.IfCommand=ptConstants.plCommandExportThen

'RefreshthePivotTablelist.PivotTable1.Refresh

EndIf

EndSub

Thefollowingexamplepreventstheuserfromcutting,copying,orexportingthecontentsofSpreadsheet1toMicrosoftExcel.

SubSpreadsheet1_CommandBeforeExecute(Command,Cancel)

DimssConstants

SetssConstants=Spreadsheet1.Constants

SelectCaseCommand

'ChecktoseeiftheExportcommandhas'beeninvoked.CasessConstants.ssCommandExport

'Cancelthecommand.Cancel.Value=True

'Displayamessagetotheuser.MsgBox"Exportofthedataisprohibited."

'ChecktoseeiftheCutorCopycommands

Page 253: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'havebeeninvoked.CasessConstants.ssCommandCopy,ssConstants.ssCommandCut

'Cancelthecommand.Cancel.Value=True

'Displayamessagetotheuser.MsgBox"CuttingorCopyingthedataisprohibited."EndSelect

EndSub

UsetheCommandExecuteeventwhenyouwanttoexecuteasetofcommandswhenaparticularcommandisexecuted.ThefollowingexamplewritesthecurrentdateandtimetoanHTMLtextboxcontroleverytimethatPivotTable1isrefreshed.

SubPivotTable1_CommandExecute(Command)

DimptConstants

SetptConstants=PivotTable1.Constants

'ChecktoseeifthePivotTablelisthasbeenrefreshed.IfCommand=ptConstants.plCommandRefreshThen

'Writethecurrentdataandtimetothetextbox.TextBox.Value="PivotTablelastrefeshedon"&_Date&"at"&Time

EndIf

Page 254: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 255: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HiddenLanguageElementYouhaverequestedHelpforalanguageelementthatishidden,andthereforeunavailableforprogrammaticaccess.

Page 256: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OWCLanguageSettingsObject

Multipleobjects OWCLanguageSettings

ReturnsinformationaboutthelanguagesettingsfortheMicrosoftOfficeWebComponents.

Page 257: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheOWCLanguageSettingsobjectUseApplication.LanguageSettings.LanguageID(MsoAppLanguageID),whereMsoAppLanguageIDisoneofthefollowingconstantsusedtoreturnlocaleidentifier(LCID)informationtothespecifiedapplication:msoLanguageIDHelp,msoLanguageIDInstall,msoLanguageIDUI,ormsoLanguageIDUIPrevious.Thefollowingexamplereturnstheinstalllanguage,userinterfacelanguage,andHelplanguageLCIDsforaspreadsheetcontrolnamedSpreadsheet1inamessagebox.

MsgBox"ThefollowinglocaleIDsareregistered"&_"forthisapplication:InstallLanguage-"&_Spreadsheet1.LanguageSettings.LanguageID(msoLanguageIDInstall)&_"UserInterfaceLanguage-"&_Spreadsheet1.LanguageSettings.LanguageID(msoLanguageIDUI)&_"HelpLanguage-"&_Spreadsheet1.LanguageSettings.LanguageID(msoLanguageIDHelp)

ThefollowingexampletestswhethertheU.S.Englishlanguageisregisteredasapreferrededitinglanguage.

IfSpreadsheet1.LanguageSettings._LanguagePreferredForEditing(msoLanguageIDEnglishUS)ThenMsgBox"U.S.Englishisoneofthechoseneditinglanguages."EndIf

Page 258: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageFieldObject

Multipleobjects PageFieldMultipleobjects

Representsafieldinarecordsetorgroupingdefinition.Thepagefieldnameisusedbyacontrolonadataaccesspagetobindtodatafromarecordset.

PageFieldobjectscomeinthreetypes:

Output.Thistypecomesdirectlyfromaschemafieldinaschemarowsource.Forschemarowsourcesofthetabletypeorviewtype,thismeansthefieldislistedintheSELECTlistoftheSQLstatementgeneratedbythedatamodel.Forschemarowsourcesofthetexttypeorstoredproceduretype,allschemafieldsappearasoutputandthepagefieldnamemustbethesameastheschemafieldname.

Calculated.Thisisalocallycalculatedcolumnaddedtoarecordset.VisualBasicforApplicationsexpressionsyntaxissupported.ExpressionscanreferencepagefieldsoftypedscOutputordscGroupingwithinthesamerecordsetdefinitionorgroupingdefinition.ExpressionscanalsoreferenceHTMLelementsbyusingthedocumentobjectmodel(forexample,=Quantity*UnitPrice*Document.All("Text0").Value).Calculatedfieldsarerecalculatedwheneveranupdatedrecordissaved,wheneverthepageisrefreshed,orwhenevertherecordset'sResyncmethodiscalled.

Grouping.ThisisagroupingfieldoraggregatefieldattachedtoaGroupingDeforRecordsetDefobject.

ThePageFieldobjectcanbeamemberoftheAllPageFields,GroupingFields,OutputFields,orPageFieldscollection.

Page 259: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePageFieldObjectThefollowingpropertiesandmethodreturnaPageFieldobject:

TheAllPageFieldscollection'sItemproperty

ThePageFieldscollection'sAddmethod

ThePageFieldscollection'sItemproperty

ThePageRelatedFieldobject'sManySideproperty

ThePageRelatedFieldobject'sOneSideproperty

Page 260: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRelatedFieldObject

PageRelationship PageRelatedFieldsPageRelatedFieldPageField

Representsapageinstanceofthecolumnpairingsthatmakeupapagerelationship.ThenamesofthesefieldsareusedingeneratingjoinclausesinSQLandinrelatingaparentrecordsetdefinitiontoachildrecordsetdefinition.

ThePageRelatedFieldobjectisamemberofthePageRelatedFieldscollection.

Page 261: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePageRelatedFieldObjectThePageRelatedFieldscollection'sItempropertyreturnsaPageRelatedFieldobject.

Page 262: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRelationshipObject

Multipleobjects PageRelationshipMultipleobjects

APageRelationshipobjecttiestwopagerowsourcestogether,eitherwithinarecordsetdefinition(aLookupRelationshipscollection)orbetweenrecordsetdefinitions(aSublistRelationshipscollection).ApagerelationshipiscreatedfrominformationinaSchemaRelationshipobject.

ThePageRelationshipobjectisamemberoftheLookupRelationshipsorSublistRelationshipscollection.

Page 263: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePageRelationshipObjectThefollowingmethodsandpropertiesreturnaPageRelationshipobject:

TheLookupRelationshipscollection'sAddmethod

TheLookupRelationshipscollection'sItemproperty

TheSublistRelationshipscollection'sAddmethod

TheSublistRelationshipscollection'sItemproperty

Page 264: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRowsourceObject

Multipleobjects PageRowsourceMultipleobjects

APageRowsourceobjectreferstoaninstanceofaSchemaRowsourceobjectthatiscurrentlyinuseonadataaccesspage.Atable,view,orstoredproceduremustbeinthedatamodelasaschemarowsourcebeforeitcanbeaddedasapagerowsource;thepagerowsourceisthenusedasadatasourceforthepage.

ThePageRowsourceobjectisamemberofthePageRowsourcescollection.

Page 265: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePageRowsourceObjectThefollowingpropertiesreturnaPageRowsourceobject:

ThePageFieldobject'sPageRowsourceproperty

ThePageRelationshipobject'sManySideproperty

ThePageRelationshipobject'sOneSideproperty

ThePageRowsourcescollection'sItemproperty

TheRecordsetDefobject'sPrimaryPageRowsourceproperty

Page 266: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PaneObject

Multipleobjects PaneMultipleobjects

Representsapaneinawindow.ThePaneobjectisamemberofboththePanescollectionandtheWindowobject.

Page 267: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePaneObjectThefollowingpropertiesreturnaPaneobject:

ThePanescollection’sItemproperty

TheWindowobject’sActivePaneproperty

Page 268: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParameterValueObject

RecordsetDef ParameterValuesParameterValue

Representsaninputparametervalueexpression.Thisexpressionisevaluatedatexecutetimetoprovidearun-timeparametervaluetoarowsourceoftypedscProcedureordscCommandText.

Page 269: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheParameterValueObjectThefollowingmethodandpropertyreturnaParameterValueobject:

TheParameterValuescollection'sAddmethod

TheParameterValuescollection'sItemproperty

Page 270: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotAggregateObject

PivotCell PivotAggregatesPivotAggregateMultipleobjects

RepresentsthedataassociatedwithatotalinaPivotTablelist.Atotaldefineswhattheuserwantstosee,butthedatathatresultsfromthetotaliscalledtheaggregateoraggregatevalue.ThePivotAggregateobjectisamemberofthePivotAggregatescollection.

Page 271: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotAggregateObjectThePivotAggregatescollection’sItempropertyreturnsaPivotAggregateobject.

Page 272: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotAxisObject

Multipleobjects PivotAxisMultipleobjects

UsedasthebaseclassforthePivotResultAxis,PivotResultColumnAxis,PivotResultDataAxis,PivotResultFilterAxis,PivotResultGroupAxis,PivotResultPageAxis,andPivotResultRowAxisobjects.UsetheSourceAxispropertyofoneoftheseobjectstoreturnaPivotAxisobject.

Page 273: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotAxisMemberObject

Multipleobjects PivotAxisMemberMultipleobjects

Representsthevaluesdisplayedforagroupedfield.ThePivotAxisMemberobjectisamemberofthePivotAxisMemberscollection.

Page 274: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotAxisMemberobjectThefollowingpropertiesreturnaPivotAxisMemberobject:

TheFindAxisMemberpropertyofthePivotAxisMember,PivotColumnMember,PivotPageMember,andPivotRowMemberobjects

TheParentAxisMemberpropertyofthePivotAxisMember,PivotColumnMember,PivotPageMember,andPivotRowMemberobjects

TheTotalMemberpropertyofthePivotAxisMember,PivotColumnMember,PivotPageMember,andPivotRowMemberobjects

TheMemberpropertyofthePivotResultColumnAxis,PivotResultGroupAxis,PivotResultPageAxis,andPivotResultRowAxisobjects

TheItempropertyofthePivotAxisMemberscollection.

ThePivotAxisMemberhasmanypropertiesincommonwiththePivotMemberobject.HoweverthePivotAxisMemberobjectcontainssomepropertiesthatthePivotMemberobjectdoesnothave.YoucanusetheGroupFieldandCustomGroupTypepropertiestoaccessthegroupingsettingsofthemember.YoucanusetheHyperlinkpropertytoaccessthehyperlinksettingsofthemember.TheMemberPropertiespropertycanbeusedtoaccessanymemberpropertiesofthemember.TheHeight,Left,andWidthpropertiescanbeusedtosetthesizeandpositionofthemember.

Page 275: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotCellObject

Multipleobjects PivotCellMultipleobjects

Representsacell(agroupingofdata)inaPivotTablelist.Acelldisplaysaggregates,andiftheunderlyingdetailrecordsareavailable,youcanhavethecelldisplayadetailgrid.Groupedfieldsontherowandcolumnaxisdeterminetheamountofdatathatagivencellrepresents.Evenasimplelistwithnogroupedfieldsisreallyasinglecelldisplayingadetailgrid.

Page 276: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotCellObjectThefollowingpropertiesreturnaPivotCellobject:

ThePivotAggregate,PivotDetailCell,andPivotDetailRangeobjects'Cellproperty

ThePivotDataobject’sCells,CellsEx,andCurrentCellproperties

ThePivotRangeobject’sBottomRight,Cells,andTopLeftproperties

Page 277: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotColumnMemberObject

Multipleobjects PivotColumnMemberMultipleobjects

RepresentsthevaluesdisplayedforagroupedfieldinthecolumnareaofaPivotTablelist.ThePivotColumnMemberobjectisamemberofthePivotColumnMemberscollection.

Page 278: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotColumnMemberobjectThefollowingpropertiesreturnaPivotColumnMemberobject:

ThePivotCellobject'sColumnMemberproperty

ThePivotResultColumnAxisobject'sColumnMemberproperty

ThePivotColumnMemberobject'sFindColumnMemberproperty

ThePivotColumnMemberobject'sParentColumnMemberproperty

ThePivotColumnMemberobject'sTotalColumnMemberproperty

ThePivotColumnMemberscollection'sItemproperty

ThePivotDataobject'sLeftproperty

ThePivotColumnMemberobjecthasmanypropertiesincommonwiththePivotAxisMemberobject.UsetheDetailLeft,DetailLeftOffset,DetailsExpandedpropertiesorMoveDetailLeftmethodtocustomizethewaydetailrecordsaredisplayed.

Page 279: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotDataObject

Multipleobjects PivotDataMultipleobjects

RepresentsthedatainaPivotTablelist.

Page 280: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotDataObjectThefollowingpropertiesreturnaPivotDataobject:

TheDatapropertyofthefollowingobjects:PivotCell,PivotResultAxis,PivotResultColumnAxis,PivotResultDataAxis,PivotResultFilterAxis,PivotResultGroupAxis,PivotResultPageAxis,andPivotResultRowAxis.

ThePivotTableobject’sActiveDataproperty.

Page 281: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotDataAxisObject

Multipleobjects PivotDataAxisMultipleobjects

RepresentsthedataaxisforaPivotTablelist.Thedataaxiscontainsfieldsetsandtotals.

Page 282: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotDataAxisObjectThefollowingpropertiesreturnaPivotDataAxisobject:

ThePivotViewobject’sDataAxisproperty

ThePivotResultDataAxisobject'sSourceDataAxisproperty

Page 283: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotDetailCellObject

Multipleobjects PivotDetailCellMultipleobjects

RepresentsacellinthedetailgridforaPivotTablelist.

Page 284: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotDetailCellObjectThefollowingpropertiesreturnaPivotDetailCellobject:

ThePivotCellobject’sDetailCellsproperty

ThePivotDetailRangeobject’sBottomRightproperty

ThePivotDetailRangeobject’sTopLeftproperty

Page 285: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotDetailRangeObject

PivotCell PivotDetailRangeMultipleobjects

RepresentstherangeofcellsinthedetailgridforaPivotTablelist.

Page 286: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotDetailRangeObjectThePivotCellobject’sDetailRangepropertyreturnsaPivotDetailRangeobject.

Page 287: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotFieldObject

Multipleobjects PivotFieldMultipleobjects

RepresentsasinglefieldinaPivotTablelist.

Page 288: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotFieldObjectThefollowingpropertiesandmethodsreturnaPivotFieldobject:

TheFieldpropertyofthefollowingobjects:PivotAxisMember,PivotColumnMember,PivotDetailCell,PivotMember,PivotPageMember,PivotRowMember,andPivotTotal.

ThePivotFieldobject'sFilterContextproperty.

ThePivotFieldsobject’sItemproperty.

ThePivotFieldSetobject’sAddCalculatedFieldandAddCustomGroupFieldmethods,andBoundFieldproperty.

ThePivotResultFieldandPivotResultGroupFieldobjects'SourceFieldproperty.

Page 289: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotFieldSetObject

Multipleobjects PivotFieldSetMultipleobjects

Representsasetoffieldsthathavebeenlockedtogethertoformahierarchy.Forexample,inafieldsetforgeography,thefieldsmightbeContinent,Country/Region,State,andCity—inthatorder.Typically,afieldsetwillonlycontainasinglefieldifthedatasourceisarecordset.

Page 290: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotFieldSetObjectThefollowingpropertiesandmethodreturnaPivotFieldSetobject:

ThePivotFieldobject’sFieldSetproperty.

ThePivotFieldSetsobject’sItemproperty.

ThePivotViewobject'sAddFieldSetmethod.

Page 291: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotFilterAxisObject

Multipleobjects PivotFilterAxisMultipleobjects

RepresentsthefilteraxisinaPivotTablelist.

Page 292: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotFilterAxisObjectThefollowingpropertiesreturnaPivotFilterAxisobject:

ThePivotViewobject’sFilterAxisproperty

ThePivotResultFilterAxisobject'sSourceFilterAxisproperty

Page 293: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotFontObject

Multipleobjects PivotFont

Containsthefontattributes(fontname,fontsize,color,andsoon)forthespecifiedobject.

Page 294: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotFontObjectThefollowingpropertiesreturnaPivotFontobject:

ThePivotFieldobject’sDetailFont,GroupedFont,andSubtotalFontproperties

ThePivotLabelobject’sFontproperty

ThePivotViewobject’sFieldLabelFont,HeaderFont,PropertyCaptionFont,PropertyValueFont,andTotalFontproperties

Page 295: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotGroupAxisObject

Multipleobjects PivotGroupAxisMultipleobjects

RepresentsthegroupaxisinaPivotTablelist.

Page 296: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotGroupAxisObjectThefollowingpropertiesreturnaPivotGroupAxisobject:

ThePivotResultColumnAxisobject'sSourceColumnAxisproperty

ThePivotResultPageAxisobject'sSourcePageAxisproperty

ThePivotResultRowAxisobject'sSourceRowAxisproperty

ThePivotViewobject’sColumnAxis,PageAxis,andRowAxisproperties

Page 297: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotHyperlinkObject

Multipleobjects PivotHyperlink

RepresentsahyperlinkinaPivotTablelist.

Page 298: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotHyperlinkobjectUsetheHyperlinkpropertyofthePivotDetailCell,PivotAxisMember,PivotColumnMember,PivotRowMemberorPivotPageMemberobjectstoreturnaPivotHyperlinkobject.

ThePivotTablecontrolwilltreatfieldmembersashyperlinkswhentheIsHyperlinkpropertyofthefieldissettoTrue.

UsetheAddresspropertytoreturntheaddressforaPivotHyperlinkobject.TheAddresspropertyofaPivotHyperlinkobjectisread-only.YoumustupdatethedatabaseitselftochangetheaddressofahyperlinkinaPivotTablelist.UsetheFollowmethodtoresolve,download,anddisplaythetargetdocument.

Page 299: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotLabelObject

Multipleobjects PivotLabelPivotFont

Representsthelabelforthespecifiedobject.Containsformatattributes(foregroundcolor,backgroundcolor,font,andsoon).

Page 300: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotLabelObjectThefollowingpropertiesreturnaPivotLabelobject:

ThePivotAxisobject’sLabelproperty

ThePivotDataAxisobject’sLabelproperty

ThePivotFilterAxisobject’sLabelproperty

ThePivotGroupAxisobject’sLabelproperty

ThePivotResultLabelobject'sSourceLabelproperty

ThePivotViewobject’sLabelproperty

ThePivotViewobject’sTitleBarproperty

Page 301: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotMemberObject

Multipleobjects PivotMemberMultipleobjects

Representsthevaluesdisplayedforagroupedfield.

Page 302: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotMemberObjectThefollowingpropertiesandmethodreturnaPivotMemberobject:

TheFindMemberpropertyofthefollowingobjects:PivotAxisMember,PivotColumnMember,PivotFieldSet,PivotPageMember,orPivotRowMember

TheParentMemberpropertyofthefollowingobjects:PivotAxisMember,PivotColumnMember,PivotMember,PivotPageMember,orPivotRowMember

TheSourceMemberpropertyofthefollowingobjects:PivotAxisMember,PivotColumnMember,PivotPageMember,orPivotRowMember

ThePivotFieldobject'sAddCustomGroupMembermethod

ThePivotFieldSetobject'sAllMemberorMemberproperties

ThePivotMembersobject’sItemproperty

Page 303: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotMemberPropertyObject

Multipleobjects PivotMemberProperty

RepresentsamemberpropertyforaPivotTablemember.AmemberpropertyisacustompropertythathasbeendefinedforthememberinanOLAPcube.

Page 304: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotMemberPropertyobjectThefollowingpropertiesreturnaPivotMemberPropertyobject:

ThePivotMemberPropertiescollection'sItemproperty

ThePivotResultMemberPropertyobject'sMemberPropertyproperty

UsetheDisplayInpropertytocontrolwhetherthespecifiedmemberpropertyisdisplayedinthePivotTablelist,ScreenTip,boththePivotTablelistandScreenTip,ornotatall.UsetheCaptionpropertytosetthecaptionforamemberproperty.

Thefollowingexamplesetsthecaptionsof,andthendisplaysthemembercaptionsoftheStoreNamefield.

SubDisplayMemberProperties()

DimptViewDimptConstantsDimfldStoreName

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetptView=PivotTable1.ActiveView

'SetavariabletotheStoreNamefield.SetfldStoreName=ptView.FieldSets("Store").Fields("StoreName")

'Thefollowingthreelinesofcodespecifythatthememberpropertiesare'displayedinthePivotTablelist.fldStoreName.MemberProperties("StoreManager").DisplayIn=ptConstants.plDisplayPropertyInReportfldStoreName.MemberProperties("StoreType").DisplayIn=ptConstants.plDisplayPropertyInReportfldStoreName.MemberProperties("StoreSqft").DisplayIn=ptConstants.plDisplayPropertyInReport

Page 305: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Thefollowingthreelinesofcodesetthecaptionforthememberproperties.fldStoreName.MemberProperties("StoreManager").Caption="ManagerName"fldStoreName.MemberProperties("StoreType").Caption="StoreType"fldStoreName.MemberProperties("StoreSqft").Caption="SizeinSQFT"

EndSub

Page 306: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotPageMemberObject

Multipleobjects PivotPageMemberMultipleobjects

RepresentsthevaluesdisplayedforagroupedfieldinthepageareaofaPivotTablelist.ThePivotPageMemberobjectisamemberofthePivotPageMemberscollection.

Page 307: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotPageMemberobjectThefollowingpropertiesreturnaPivotRowMemberobject:

ThePivotCellobject'sPageMemberproperty

ThePivotResultPageAxisobject'sPageMemberproperty

ThePivotPageMemberobject'sFindPageMemberproperty

ThePivotPageMemberobject'sParentPageMemberproperty

ThePivotPageMemberobject'sTotalPageMemberproperty

ThePivotPageMembercollection'sItemproperty

ThePivotPageMemberobjecthasmanypropertiesincommonwiththePivotAxisMemberobject.

Page 308: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotRangeObject

PivotData PivotRangeMultipleobjects

RepresentsarangeofcellsinaPivotTablelist.

Page 309: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotRangeObjectThePivotDataobject’sRangepropertyreturnsaPivotRangeobject.

Page 310: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultAxisObject

Multipleobjects PivotResultAxisMultipleobjects

ContainspointerstothedataforaresultaxisinaPivotTablelist.

Page 311: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultAxisobjectThefollowingpropertiesreturnaPivotResultAxisobject:

ThePivotResultFieldobject'sAxisproperty.

ThePivotResultGroupFieldobject'sAxisproperty.

UsetheDatapropertytorefertothedata.UsetheSourceAxispropertytorefertothesourceaxis.

Page 312: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultColumnAxisObject

PivotData PivotResultColumnAxisMultipleobjects

RepresentsthedataincolumnaxisofaPivotTablelist.

Page 313: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultColumnAxisobjectTheColumnAxispropertyofthePivotDataobjectreturnsaPivotResultColumnAxisobject.

UsetheDatapropertytoreturnapointertothedata.

UsetheSourceColumnAxispropertytoreturnapointertotheaxis.

Page 314: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultDataAxisObject

PivotData PivotResultDataAxisMultipleobjects

RepresentsthedataaxisofaPivotTablelist.

Page 315: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultDataAxisobjectTheDataAxispropertyofthePivotDataobjectreturnsaPivotResultDataAxisobject.

UsetheDatapropertytoreturnapointertothedata.

UsetheSourceDataAxispropertytoreturnapointertotheaxis.

Page 316: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultFieldObject

PivotResultField Multipleobjects

Pointstothesourcefieldandaxisofaresultfield.

Page 317: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultFieldobjectUsetheSourceAxispropertyoftheobjectreturnedbytheAxispropertytorefertothesourceaxisfortheresultfield.

UsetheSourceFieldpropertytorefertothesourcefieldfortheresultfield.

Page 318: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultFilterAxisObject

PivotData PivotResultFilterAxisMultipleobjects

RepresentsthedataofthefilteraxisofaPivotTablelist.

Page 319: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultFilterAxisobjectTheFilterAxispropertyofthePivotDataobjectreturnsaPivotResultFilterAxisobject.

UsetheDatapropertytoreturnapointertothedata.

UsetheSourceFilterAxispropertytoreturnapointertotheaxis.

Page 320: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultGroupAxisObject

Multipleobjects PivotResultGroupAxisMultipleobjects

RepresentsthedatainthegroupingaxisofaPivotTablelist.

Page 321: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultGroupAxisobjectThefollowingpropertiesreturnaPivotResultGroupAxisobject:

TheChCategoryLabelsobject'sPivotAxisproperty

TheChSeriesCollectionobject'sPivotAxisproperty

ThePivotAxisMemberobject'sAxisproperty

ThePivotColumnMemberobject'sAxisproperty

ThePivotRowMemberobject'sAxisproperty

ThePivotPageMemberobject'sAxisproperty

UsetheDatapropertytoreturnapointertothedata.

UsetheSourceAxispropertytoreturnapointertotheaxis.

Page 322: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultGroupFieldObject

Multipleobjects PivotResultGroupFieldMultipleobjects

Representsthegroupingfieldforaresultmember.

Page 323: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultGroupFieldobjectThefollowingpropertiesreturnaPivotResultGroupFieldobject:

ThePivotResultGroupFieldscollection'sItemproperty.

ThePivotAxisMemberobject'sGroupFieldproperty.

ThePivotColumnMemberobject'sGroupFieldproperty.

ThePivotPageMemberobject'sGroupFieldproperty.

ThePivotRowMemberobject'sGroupFieldproperty.

UsethePivotResultAxisobjectreturnedbythetheAxispropertytoconfigurethesourceaxis.

UsethePivotFieldobjectreturnedbytheSourceFieldpropertytoconfigurethesourcefield.

Page 324: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultLabelObject

Multipleobjects PivotResultLabelPivotLabel

Representsthelabelforaresultaxis.

Page 325: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultLabelobjectThefollowingpropertiesreturnaPivotResultLabelobject:

ThePivotDataobject'sLabelproperty

ThePivotResultAxisobject'sLabelproperty

ThePivotResultColumnAxisobject'sLabelproperty

ThePivotResultDataAxisobject'sLabelproperty

ThePivotResultFilterAxisobject'sLabelproperty

ThePivotResultGroupAxisobject'sLabelproperty

ThePivotResultPageAxisobject'sLabelproperty

ThePivotResultRowAxisobject'sLabelproperty

UsethePivotLabelobjectreturnedbytheSourceLabelpropertytoformattheresultlabel.

Page 326: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultMemberPropertyObject

Multipleobjects PivotResultMemberPropertiesPivotResultMemberPropertyPivotMemberProperty

Representsamemberpropertyforaresultmember.

Page 327: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultMemberPropertyobjectTheItempropertyofthePivotResultMemberPropertiescollectionreturnsaPivotResultMemberPropertyobject.

UsethePivotMemberPropertyobjectreturnedbytheMemberPropertypropertytoaccessthesettingsforthememberproperty.

Page 328: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultPageAxisObject

PivotData PivotResultPageAxisMultipleobjects

RepresentsthedatatheofrowaxisofaPivotTablelist.

Page 329: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultPageAxisobjectThePageAxispropertyofthePivotDataobjectreturnsaPivotResultPageAxisobject.

UsetheDatapropertytoreturnapointertothedata.

UsetheSourcePageAxispropertytoreturnapointertotheaxis.

Page 330: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotResultRowAxisObject

PivotData PivotResultRowAxisMultipleobjects

RepresentsthedatatheofrowaxisofaPivotTablelist.

Page 331: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotResultRowAxisobjectTheRowAxispropertyofthePivotDataobjectreturnsaPivotResultRowAxisobject.

UsetheDatapropertytoreturnapointertothedata.

UsetheSourceRowAxispropertytoreturnapointertotheaxis.

Page 332: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotRowMemberObject

Multipleobjects PivotRowMemberMultipleobjects

RepresentsthevaluesdisplayedforagroupedfieldintherowareaofaPivotTablelist.ThePivotRowMemberobjectisamemberofthePivotRowMemberscollection.

Page 333: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotRowMemberobjectThefollowingpropertiesreturnaPivotRowMemberobject:

ThePivotCellobject'sRowMemberproperty.

ThePivotResultRowAxisobject'sRowMemberproperty.

ThePivotRowMemberobject'sFindRowMemberproperty.

ThePivotRowMemberobject'sParentRowMemberproperty.

ThePivotRowMemberobject'sTotalRowMemberproperty.

ThePivotRowMembercollection'sItemproperty.

ThePivotDataobject'sTopproperty.

ThePivotRowMemberobjecthasmanypropertiesincommonwiththePivotAxisMemberobject.UsetheTotalRowHeightandTotalRowMemberpropertiestocustomizethewaytotalsaredisplayed.

Page 334: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotTableObject

PivotTable Multipleobjects

RepresentsthecontainerforaPivotTablelist.

Page 335: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotTableObjectYoucanuseeithertheCreateObjectmethodortheNewkeywordtocreateaPivotTableobject.

TheobjectIDforaPivotTablelistonanHTMLpagereturnsaPivotTableobject.TheprogrammaticidentifierforthePivotTableobjectisCLSID:0002E55A-0000-0000-C000-000000000046.ThefollowingexamplecreatesaPivotTablelistnamed"PivotTable1"onanHTMLpage.

<objectid=PivotTable1classid=CLSID:0002E55A-0000-0000-C000-000000000046></object>

Page 336: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotTotalObject

Multipleobjects PivotTotalMultipleobjects

RepresentsatotalinaPivotTablelist.Atotalistheaggregatevaluethatisdisplayedforthecontentsofagivencell.

Page 337: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotTotalObjectThefollowingpropertiesandmethodsreturnaPivotTotalobject:

ThePivotAggregateobject'sTotalproperty

ThePivotFieldobject'sFilterOnandSortOnproperties

ThePivotTotalsobject'sItemproperty

ThePivotViewobject'sAddCalculatedTotalandAddTotalmethods

Page 338: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotViewObject

Multipleobjects PivotViewMultipleobjects

RepresentsaspecificviewofaPivotTablelist.

Page 339: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingthePivotViewObjectTheViewpropertyofthefollowingobjectsreturnsaPivotViewobject:PivotAxis,PivotAxisMember,PivotColumnMember,PivotData,PivotDataAxis,PivotFieldSet,PivotFilterAxis,PivotGroupAxis,PivotMember,PivotPageMember,PivotRowMember,andPivotTotal.

ThePivotTableobject’sActiveViewpropertyalsoreturnsaPivotViewobject.

Page 340: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProtectionObject

Worksheet ProtectionWorksheet

Containstheprotectionpropertiesforaworksheet.

Page 341: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheProtectionObjectTheWorksheetobject’sProtectionpropertyreturnsaProtectionobject.

Page 342: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RangeObject

Multipleobjects RangeMultipleobjects

Representsacell,arangeofcells,arow,oracolumn.

Page 343: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheRangeObjectThefollowingpropertiesandmethodsreturnaRangeobject.

Object Properties/MethodsAutoFilter RangeListObject DataBodyRange

HeaderRowRangeInsertRowRangeRange

ListRow RangeName RefersToRangePane VisibleRangeRange Cells

ColumnsCurrentArrayCurrentRegionEndEntireColumnEntireRowFindFindNextFindPreviousItemMergeAreaNextOffsetPreviousRangeRows

Spreadsheet ActiveCell

Page 344: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CellsColumnsRangeRectIntersectRectUnionRowsSelection

Window ActiveCellRangeFromPointRangeSelectionSelectionVisibleRange

Worksheet CellsColumnsRangeRowsUsedRange

Page 345: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordNavigationControlObject

RecordNavigationControl

Representsarecordnavigationcontrol.

Page 346: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheRecordNavigationControlObjectYoucanuseeithertheCreateObjectmethodortheNewkeywordtocreateaRecordNavigationControlobject.

TheobjectIDforarecordnavigationcontrolonanHTMLpagereturnsaRecordNavigationControlobject.TheprogrammaticidentifierfortheRecordNavigationControlobjectisCLSID:0002E55C-0000-0000-C000-000000000046.Thefollowingexamplecreatesarecordnavigationcontrolnamed"RNC1"onanHTMLpage.

<objectid=RNC1classid=CLSID:0002E55C-0000-0000-C000-000000000046></object>

Page 347: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetDefObject

Multipleobjects RecordsetDefMultipleobjects

Representsarecordsetdefinition.

Page 348: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheRecordsetDefObjectThefollowingpropertiesreturnaRecordsetDefobject:

ThePageFieldobject'sRecordsetDefproperty

ThePageRowsourceobject'sRecordsetDefproperty

TheRecordsetDefobject'sParentRecordsetDefproperty

TheRecordsetDefsobject'sItemproperty,anditsAddandAddNewmethods

Page 349: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaFieldObject

SchemaRowsource SchemaFieldsSchemaFieldSchemaProperties

Representsafieldinaschemarowsource.ThenamesofthesefieldsareusedingeneratingSELECTstatementsforrowsourcesoftypedscTableordscView.TheSchemaFieldobjectisamemberoftheSchemaFieldscollection.

Page 350: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaFieldObjectThefollowingmethodandpropertyreturnaSchemaFieldobject:

TheSchemaFieldscollection'sAddmethod

TheSchemaFieldscollection'sItemproperty

Page 351: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaParameterObject

SchemaRowsource SchemaParametersSchemaParameterSchemaProperties

Representsasingleparameterforaschemarowsource.TheSchemaParameterobjectisamemberoftheSchemaParameterscollection.

Page 352: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaParameterObjectThefollowingmethodandpropertyreturnaSchemaParameterobject:

TheSchemaParameterscollection'sAddmethod

TheSchemaParameterscollection'sItemproperty

Page 353: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaPropertiesObject

Multipleobjects SchemaPropertiesSchemaProperty

Thisobjectisnotdocumented.

Page 354: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaPropertyObject

Multipleobjects SchemaPropertiesSchemaProperty

Thisobjectisnotdocumented.

Page 355: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRelatedFieldObject

SchemaRelationship SchemaRelatedFieldsSchemaRelatedField

Describesthecolumnpairingsthatmakeupaschemarelationship.ThenamesofthesefieldsareusedingeneratingjoinclausesinSQLandfortyingaparentrecordsetdefinitiontoasublistchildrecordsetdefinition.TheSchemaRelatedFieldobjectisamemberoftheSchemaRelatedFieldscollection.

Page 356: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaRelatedFieldThefollowingmethodandpropertyreturnaSchemaRelatedFieldobject:

TheSchemaRelatedFieldscollection'sAddmethod

TheSchemaRelatedFieldscollection'sItemproperty

Page 357: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRelatedFieldsCollectionObject

SchemaRelationship SchemaRelatedFieldsSchemaRelatedField

ThecollectionofSchemaRelatedFieldobjectsforaschemarelationship.

Page 358: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaRelatedFieldsCollectionTheSchemaRelationshipobject'sSchemaRelatedFieldspropertyreturnsaSchemaRelatedFieldscollection.

Page 359: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRelationshipObject

Multipleobjects SchemaRelationshipSchemaRelatedFields

Representsaschemarelationship.Aschemarelationshipdescribeshowschemarowsourcesareconnected,anditalwayshasa“one”sideanda“many”side(fromaone-to-manyrelationship).TheSchemaRelationshipobjectisamemberoftheSchemaRelationshipscollection.

Page 360: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaRelationshipObjectThefollowingpropertiesandmethodreturnaSchemaRelationshipobject:

TheLookupSchemaRelationshipscollection'sItemproperty

TheSchemaRelationshipscollection'sAddandAddNewmethods,andItemproperty

TheSublistSchemaRelationshipscollection'sItemproperty

Page 361: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRowsourceObject

Multipleobjects SchemaRowsourcesSchemaRowsourceMultipleobjects

Representsaschemarowsource.Everytable,view,orstoredprocedureinthedatabaseisapotentialschemarowsource,asarecommandsdefinedexplicitlytothedatasourcecontrol.

TheSchemaRowsourceobjectisamemberoftheSchemaRowsourcescollection.

Page 362: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSchemaRowsourceObjectThefollowingmethodandpropertyreturnaSchemaRowsourceobject:

TheSchemaRowsourcescollection'sAddandAddNewmethods

TheSchemaRowsourcescollection'sItemproperty.

Page 363: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SectionObject

Multipleobjects SectionMultipleobjects

Aninstanceofasinglegroupheader,footer,caption,ornavigationsection.

Page 364: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSectionObjectThefollowingpropertiesandmethodreturnaSectionobject:

Object Properties/MethodDataPage FirstSectionDataSourceControl CurrentSection

GetContainingSectionDSCEventInfo SectionSection ChildSection

NextSectionNextSiblingParentSectionPreviousSectionPreviousSibling

Page 365: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SpreadsheetObject

Spreadsheet Multipleobjects

Representsthecontainerforthespreadsheet.

Page 366: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheSpreadsheetObjectYoucanusetheCreateObjectmethodortheNewkeywordtocreateaSpreadsheetobject.

TheobjectIDforaspreadsheetcontrolonanHTMLpageoraVisualBasicformreturnsaSpreadsheetobject.

TheprogrammaticidentifierfortheSpreadsheetobjectisCLSID:0002E559-0000-0000-C000-000000000046.Thefollowingexamplecreatesaspreadsheetnamed"Spreadsheet1"onanHTMLpage.

<objectid=Spreadsheet1classid=CLSID:0002E559-0000-0000-C000-000000000046style="width:49%;height:350"></object>

Page 367: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TitleBarObject

Multipleobjects TitleBarMultipleobjects

Representsthetitlebaronthespreadsheet.

Page 368: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheTitleBarObjectTheSpreadsheetobject’sTitleBarpropertyreturnsaTitleBarobject.

Page 369: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WindowObject

Multipleobjects WindowMultipleobjects

Representsawindow.Manyworksheetcharacteristics,suchasscrollbarsandgridlines,areactuallypropertiesofthewindow.TheWindowobjectisamemberoftheWindowscollection.EachworksheethasauniqueWindowobject.Codecanonlyaccessthewindowfortheactivesheetoftheworkbook.Inotherwords,althoughtheWindowscollectionstatesthatthereisonlyoneWindowobject,thereare,infact,multipleWindowobjects,butyoumayonlyaccesstheWindowobjectfortheactivesheet.

Page 370: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheWindowobjectThefollowingpropertiesreturnaWindowobject.

TheSpreadsheetobject'sActiveWindowproperty.

TheWindowscollection'sItemproperty.

ThefollowingexamplehidestherowandcolumnheadingsintheactivewindowofSpreadsheet1.

SubHideHeadings()

Spreadsheet1.ActiveWindow.DisplayColumnHeadings=FalseSpreadsheet1.ActiveWindow.DisplayRowHeadings=False

EndSub

ThefollowingexamplemovescolumnCsothatit'stheleftmostcolumninthewindow.

Spreadsheet1.ActiveWindow.ScrollColumn=3

Page 371: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorkbookObject

Multipleobjects WorkbookMultipleobjects

Representsaworkbook.TheWorkbookobjectisamemberoftheWorkbookscollection.

Page 372: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheWorkbookobjectUsetheActiveWorkbookpropertyoftheSpreadsheetobjecttoreturnareferencetotheopenworkbook.

AworkbookcontainsaWorksheetscollection.

Page 373: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorksheetObject

Multipleobjects WorksheetMultipleobjects

Representsasingleworksheetinaworkbook.

Page 374: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheWorksheetObjectThefollowingpropertiesreturnaWorksheetobject:

TheRangeobject’sWorksheetproperty

TheSpreadsheet,Window,andWorkbookobjects'ActiveSheetproperty

TheWorksheetobject'sNextandPreviousproperties

TheWorksheetscollection'sAddmethodandItemproperty

Page 375: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XmlDataBindingObject

XmlDataBindings XmlDataBindingMultipleobjects

AnXmlDataBindingobjectrepresentsanXMLdatabindinginaSpreadsheetcomponent.Youcanbind,orconnect,aSpreadsheetcomponenttoadataretrievalservice,SOAPWebService,XMLfile,orWebPart,andthatbindingisrepresentedbytheXmlDataBindingobject.

Page 376: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheXmlDataBindingObjectTheXMLDataBindingobjectisamemberoftheXmlDataBindingscollection,whichisacollectionofalloftheXmlDataBindingobjectsinaSpreadsheetcomponent.Withinthecollection,individualXmlDataBindingobjectsareindexedbeginningwith1forthefirstobject,2forthesecond,andsoon.YoucanreturnaXmlDataBindingobjectfromtheXmlDataBindingscollectionbyusingtheItempropertyofthecollection.TheargumentfortheItempropertyistheindexinthecollectionoftheobjectyouwanttoreturnorthebindingIDoftheobject.ThebindingIDisthevalueoftheIDattributeintheXMLthatrepresentsthebinding.YoucanfindthisintheXMLSpreadsheetfilefortheSpreadsheetcomponent(orSpreadsheetWebPart)orbyexaminingtheBindingDatapropertyoftheXmlDataBindingobject.YoucancreateanXMLSpreadsheetfilebycreatingadataboundspreadsheetusingMicrosoftExcelandthensavingtheworkbookasanXMLSpreadsheet.

YoucreateanewXmlDataBindingobjectusingtheAddmethodoftheXmlDataBindingscollection.OnceyouhavecreatedtheXmlDataBindingobject,youcanuseitsBindingDatapropertytospecifybindingconfigurationinformation.

ThefollowingexampleshowshowtoworkwitheachXmlDataBindingobjectrelatedtoaSpreadsheetcomponent:

DimobjBindingsDimobjBindingDimstrBindingInfo

SetobjBindings=Spreadsheet1.ActiveWorkbook.XmlDataBindings

ForEachobjBindinginobjBindings'SavetheXMLbindinginformationtoavariable.strBindingInfo=objBinding.BindingData'Workwiththebindinginformationhere.Next

Page 377: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XmlMapObject

Workbook XmlMapsXmlMapWorkbook

AnXmlMapobjectrepresentstheXMLschemamapforaSpreadsheetcomponent.TheXmlMapobjectisamemberoftheXmlMapscollection.

Page 378: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingtheXmlMapObjectIntheXmlMapscollection,individualXmlMapobjectsareindexedbeginningwith1forthefirstobject,2forthesecondobject,andsoon.YoureturnaXmlMapobjectfromtheXmlMapscollectionusingtheItemproperty.TheargumentfortheItempropertyistheindexinthecollectionoftheobjectyouwanttoreturnorthemapIDoftheobject.ThemapIDisthevalueoftheIDattributeintheXMLthatrepresentsthemap.YoucanfindthisintheXMLSpreadsheetfileforthepartorbyexaminingtheMapDatapropertyoftheXmlMapobject.YoucancreateanXMLSpreadsheetfilebycreatingadata-boundspreadsheetinMicrosoftExcelandthensavingtheworkbookasanXMLSpreadsheet.YoucancreateanewXmlMapobjectbyusingtheAddmethodoftheXmlMapscollection.

ThefollowingexampleshowshowtoworkwitheachXmlMapobjectrelatedtoaSpreadsheetcomponent.ItusestheXmlMapspropertyoftheActiveWorkbookobjecttoreturntheXmlMapscollectionobject:

DimobjMapsDimobjMapDimstrMapInfo

SetobjMaps=Spreadsheet1.ActiveWorkbook.XmlMaps

ForEachobjMapinobjMaps'SavetheXMLmapinformationtoavariable.strMapInfo=objMap.MapData'WorkwiththemapinformationXMLhere.Next

Page 379: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 380: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActivateMethod

ActivatemethodasitappliestotheRangeobject.

ActivatemethodasitappliestotheWorksheetobject.

Page 381: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRangeobject.

AsitappliestotheWorksheetobject.

Page 382: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 383: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddMethod

AddmethodasitappliestotheChAxesobject.

AddmethodasitappliestotheChChartsobject.

AddmethodasitappliestotheChDataLabelsCollectionobject.

AddmethodasitappliestotheChErrorBarsCollectionobject.

AddmethodasitappliestotheChSegmentsobject.

AddmethodasitappliestotheChSeriesCollectionobject.

AddmethodasitappliestotheChTrendlinesobject.

AddmethodasitappliestotheElementExtensionsobject.

AddmethodasitappliestotheGroupingDefsobject.

Page 384: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheGroupLevelsobject.

AddmethodasitappliestotheSheetsandWorksheetsobjects.

Page 385: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestothePageFieldsobject.

Page 386: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheLookupRelationshipsandSublistRelationshipsobjects.

Page 387: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheParameterValuesobject.

AddmethodasitappliestotheRecordsetDefsobject.

Page 388: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheSchemaFieldsobject.

Page 389: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheSchemaParametersobject.

Page 390: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheSchemaRelatedFieldsobject.

Page 391: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheSchemaRelationshipsobject.

Page 392: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheSchemaRowsourcesobject.

Page 393: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddmethodasitappliestotheCriteriaobject.

AddmethodasitappliestotheNamesobject.

AddmethodasitappliestotheListRowscollection.

AddmethodasitappliestotheXmlDataBindingscollection.

Page 395: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChChartsobject.

AsitappliestotheChDataLabelsCollectionobject.

AsitappliestotheChErrorBarsCollectionobject.

AsitappliestotheChSeriesCollectionobject.

AsitappliestotheChTrendlinesobject.

AsitappliestotheCriteriaobject.

Page 396: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddCalculatedFieldMethod

AddsacalculatedfieldtoaPivotTable.Acalculatedfieldcanbeusedlikeanyotherfieldforsorting,filtering,orgrouping.YoumustusetheAddFieldSetmethodtocreateacustomfieldsetbeforeyouaddacalculatedfield.ReturnsaPivotFieldobject.

expression.AddCalculatedField(Name,Caption,DataField,Expression)

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobjectthatwascreatedbytheAddFieldSetmethod.

NameRequiredString.Thenameofthecalculatedfield.Thenamemustbeuniquewithinthefieldset.

CaptionRequiredString.ThecaptiondisplayedforthecalculatedfieldinthePivotTableuserinterface.Althoughthisargumentisrequired,youcanassignablankstringtothecaption.

DataFieldRequiredString.ThenameofthenewfieldthatiscreatedintheunderlyingrecordsetforthePivotTable.

ExpressionRequiredString.Theexpressionusedtocalculatetheitemsinthenewfield.TheexpressionmustbecompatiblewiththeJetexpressionservice.

Page 397: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksCustomfieldsetscancontainonlyonecalculatedfield.Addingasecondcalculatedfieldtoacustomfieldsetresultsinarun-timeerror.

Page 398: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsanewfieldsetnamed"Variance"toPivotTable1.Withinthenewfieldset,acalculatedfieldwiththecaption"BudgetVariance"iscreated.ThecalculatedfieldistheninsertedintothePivotTableview.

SubTestAddFieldSet()

DimvwViewDimfsNewFieldSet

SetvwView=PivotTable1.ActiveView

'AddacustomfieldsettothePivotTable.SetfsNewFieldSet=vwView.AddFieldSet("Variance")

'Addacalculatedtotaltothenewlycreatedfieldset.fsNewFieldSet.AddCalculatedField"Variance",_

"BudgetVariance","fldVariance",_

"Budget/Actual"

'Insertthecalculatedfieldintothedataaxis.vwView.DataAxis.InsertFieldSetfsNewFieldSet

EndSub

Page 399: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddCalculatedTotalMethod

AddsacalculatedtotaltoaPivotTable.UsetheAddCalculatedTotalmethodtocreateacustomtotalbasedontotalsalreadydefinedinthePivotTable.ThecalculatedtotalisreturnedasaPivotTotalobject.

expression.AddCalculatedTotal(Name,Caption,Expression,SolveOrder)

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

NameRequiredString.UsedtoidentifythenewcalculatedtotalinthePivotTotalscollection.ThisparametermustbeuniquewithinthePivotTotalscollection.Mustbebetween1and50charactersinlength.

CaptionRequiredString.UsedtoidentifythenewcalculatedtotalinthePivotTableuserinterface.

ExpressionRequiredString.Theexpressionusedtocalculatethenewcalculatedtotal.Mustbeavalidmultidimensionalexpression(MDX)statementfortheOLEDBproviderthatisbeingusedtoaccessthedata.

SolveOrderOptionalLong.IndicatesthesolveorderofthenewcalculatedtotalwhenthePivotTableisrefreshed.TheSolveOrderparameterisusefulifyoucreateacalculatedtotalthatisdependentoncalculatedtotalsthatwerecreatedearlier.

Page 400: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleaddsacalculatedtotalnamed"SalesinLastPeriod"toaPivotTablenamed"PivotTable1."Thenewcalculatedtotaldisplaysthesalesintheprevioustimeperiod.TheexampleutilizestheFoodMartOLAPcubethatisinstalledwithMicrosoftSQLServer7.0OLAPServices.

SubTestAddCalculatedTotal()

DimstrExpDimtotCalcTotalDimvwView

SetvwView=PivotTable1.ActiveView

'TheMDXexpressionusedforthenewcalculatedtotal.strExp="([Measures].[StoreSales],Time.PrevMember)"

'Createthenewcalculatedtotal.SettotCalcTotal=vwView.AddCalculatedTotal_("SalesinLastPeriod","SalesinLastPeriod",strExp)

'InsertthecalculatedtotalinthedataareaofthePivotTable.vwView.DataAxis.InsertTotaltotCalcTotal

EndSub

Page 401: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddCustomGroupFieldMethod

Addsacustomgroupfieldtoafieldset.ReturnsaPivotFieldobject.

expression.AddCustomGroupField(Name,Caption,Before)

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

NameOptionalString.Thenameforthenewfield.

CaptionOptionalString.Thecaptiontodisplayforthenewfield.

BeforeOptionalVariant.Index,name,orreferencetothefield.

Page 402: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksOnceyouhaveusedthismethodtocreateacustomgroupfield,usetheAddCustomGroupMembermethodtoaddmemberstothegroup.

Notethatthecustomgroupfieldanditsmembersarecreatedattheclient,notthedatasource.

Page 403: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsacustomgroupfieldtotheTimefieldset,andthenaddstwomemberstothefield.

SubCreateCustomGroup()

DimfsTimeDimfsHalfYear

'SetavariabletotheTimefieldset.SetfsTime=PivotTable1.ActiveView.FieldSets("Time")

'Addacustomgroupfieldnamed"Group1"totheTimefieldset.SetfsHalfYear=fsTime.AddCustomGroupField("Group1","Group1",_"Quarter")'Addamembertothecustomfieldset.Thismemberincludesall"Q1"'and"Q2"membersunder1997.fsHalfYear.AddCustomGroupMemberfsTime.Member.Childmembers("1997").Name,_Array("Q1","Q2"),"1stHalf"

'Addamembertothecustomfieldset.Thismemberincludesall"Q3"'and"Q4"membersunder1997.fsHalfYear.AddCustomGroupMemberfsTime.Member.ChildMembers("1997").Name,_Array("Q3","Q4"),"2ndHalf"

EndSub

Page 404: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddCustomGroupMemberMethod

Addsamembertoacustomgroupfield.ReturnsaPivotMemberobject.

expression.AddCustomGroupMember(Parent,varChildMembers,bstrCaption)

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

ParentRequiredVariant.Name,uniquename,referencetotheparentmemberforthenewmember(s).

varChildMembersRequiredVariant.Arrayofmembernames,uniquenames,ormemberreferencestoaddtothenewcustomgroupmember.

bstrCaptionOptionalString.Thecaptiontodisplayforthenewmember.

Page 405: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethismethodtopopulateafieldcreatedusingtheAddCustomGroupFieldmethod.

Page 406: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsacustomgroupfieldtotheTimefieldset,andthenaddstwomemberstothefield.

SubCreateCustomGroup()

DimfsTimeDimfsHalfYear

'SetavariabletotheTimefieldset.SetfsTime=PivotTable1.ActiveView.FieldSets("Time")

'Addacustomgroupfieldnamed"Group1"totheTimefieldset.SetfsHalfYear=fsTime.AddCustomGroupField("Group1","Group1",_"Quarter")'Addamembertothecustomfieldset.Thismemberincludesall"Q1"'and"Q2"membersunder1997.fsHalfYear.AddCustomGroupMemberfsTime.Member.Childmembers("1997").Name,_Array("Q1","Q2"),"1stHalf"

'Addamembertothecustomfieldset.Thismemberincludesall"Q3"'and"Q4"under1997.fsHalfYear.AddCustomGroupMemberfsTime.Member.ChildMembers("1997").Name,_Array("Q3","Q4"),"2ndHalf"

EndSub

Page 407: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddFieldSetMethod

AddsacustomfieldsettoaPivotTable.Onceyouhavecreatedacustomfieldset,youcanusetheAddCalculatedFieldmethodtodefineacustomfield.ReturnsaPivotFieldSetobject.

expression.AddFieldSet(Name)

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

NameRequiredString.Specifiesthenameofthenewfieldset.ThenamemustbeuniquewithinthethePivotFieldSetscollection.Mustbebetween1and24charactersinlength.

Page 408: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumustaddacalculatedfieldtothenewfieldsetbeforeyouaddittothecurrentPivotTableview.Customfieldsetscancontainonlyonecalculatedfield.Addingasecondcalculatedfieldtoacustomfieldsetresultsinarun-timeerror.

NoteYoucanaddacustomfieldsettoyourPivotTableifthePivotTableisconnectedtoanonlineanalyticalprocessing(OLAP)datasource,butthefieldsetwillnotworkwiththedatasource.

Page 409: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsacalculatedfieldnamed"Variance"toanewfieldsetinPivotTable1.ThecalculatedfieldistheninsertedintothePivotTableview.

SubTestAddFieldSet()DimvwViewDimfsNewFieldSet

SetvwView=PivotTable1.ActiveView

'AddacustomfieldsettothePivotTable.SetfsNewFieldSet=vwView.AddFieldSet("Variance")

'Addacalculatedtotaltothenewlycreatedfieldset.fsNewFieldSet.AddCalculatedField"Variance",_"BudgetVariance","fldVariance",_"Budget/Actual"

'Insertthecalculatedfieldintothedataaxis.vwView.DataAxis.InsertFieldSetfsNewFieldSet

EndSub

Page 410: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddInMethod

Addsanadd-intothespecifiedspreadsheet.

expression.AddIn(AddIn)

expressionAnexpressionthatreturnsaSpreadsheetobject.

AddInRequiredObject.Specifiestheadd-in.

Page 411: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddNewMethod

Createsanewschemarowsourceandarecordsetdefinition.ReturnsaRecordsetDefobject.

expression.AddNew(Source,RowsourceType,Name)

expressionAnexpressionthatreturnsaRecordsetDefsobject.

SourceRequiredString.SpecifiescommandtextforanewschemarowsourceoftypedscCommandTextordscCommandFile,orforthenameofatable,view,orstoredproceduretobeaddedasaschemarowsource.Formoreinformation,seetheHelptopicfortheCommandTextproperty.

RowsourceTypeOptionalVariant.Specifiesthetypeofthenewschemarowsource.CanbeoneofthedscRowsourceTypeEnumconstants.ThedefaultconstantisdscCommandText.

NameOptionalVariant.Specifiesthenameoftherecordsetdefinition,pagerowsource,andschemarowsourcecreatedbyusingtheAddNewmethod.IfyoudonotspecifythisargumentandthevalueoftheRowsourceTypeargumentisdscTable,dscView,ordscProcedure,thenewnameisthesameasthenamespecifiedintheSourceargument(withnumeralsautomaticallyappendedtoittomakeitunique,ifnecessary).IfyoudonotspecifythisargumentandthevalueoftheRowsourceTypeargumentisdscCommandTextordscCommandFile,thenewnameis"CommandN",whereNisoneormoreappendednumerals.

Page 412: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksPagefieldsarenormallycreatedwithnamesthatareuniquethroughoutthepagedatadefinition.However,whenapagefieldisaddedtoarecordsetdefinitionwhoseprimarypagerowsourceisoftypedscProcedure,dscCommandText,ordscCommandFile,thepagefieldnamemustbethesameastheschemafieldname.ThiscanresultinmultiplepagefieldobjectswiththesamenameintheAllPageFieldscollection.Todifferentiatebetweenobjectswiththesamename,youcanusetheexpressionAllPageFields("RecordsetdefName.PagefieldName")whereRecordsetdefNameisthenameoftherecordsetdefinition,andPagefieldNameisthenameofthepagefield.Notethatpagefieldnamesthemselvescannotcontainperiods.

Page 413: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 414: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddTotalMethod

AddTotalmethodasitappliestotheGroupingDefsobject.

AddTotalmethodasitappliestothePivotViewobject.

Page 415: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestothePivotViewobject.

Page 416: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ApplyMethod

AppliesthespecifiedAutoFilter.YoutypicallyusetheAutoFiltermethodtoturnontheAutoFilterandaddoneormorecriteriatoit;youcanthenusetheApplymethodtoapplythenewfilter.

expression.Apply

expressionAnexpressionthatreturnsanAutoFilterobject.

Page 417: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsontheAutoFilterfortherangeA1:C20,setsfiltersforcolumnsAandC,andthenappliesthefilters.

PrivateSubEnableAutoFilter()DimafFiltersDimafCol1DimafCol3

'TurnonAutoFilter.Spreadsheet1.Worksheets("Sheet1").Range("A1:C20").AutoFilter

'SetavariabletotheAutoFilterobject.SetafFilters=Spreadsheet1.Worksheets("sheet1").AutoFilter

SetafCol1=afFilters.Filters(1)SetafCol3=afFilters.Filters(3)

'AddacriteriathatexcludesbluefromcolumnA.afCol1.Criteria.Add"blue"

'AddacriteriathatexcludesgreenfromcolumnA.afCol1.Criteria.Add"green"

'Addacriteriathatexcludesyellowfromcolumnc.afCol3.Criteria.Add"yellow"

'Applythecriteria.afFilters.ApplyEndSub

Page 418: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ApplyFilterMethod

Filterstherecordonadataaccesspagebaseduponthecurrentlyselectedfield.EquivalentinfunctionalitytotheFilterbySelectionbuttonontherecordnavigationcontrol.

expression.ApplyFilter

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 419: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodreliesuponthecurrentselectiononthedataaccesspagetodeterminethefieldtofilterby.Therefore,youmustsetthefocustothefieldtosortby,whentheprocedurecontainingthismethodisinvokedbyacontrolonthedataaccesspage,suchasacommandbutton.

Page 420: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplefiltersthedataaccesspagebaseduponthecurrentlydisplayeditemintheCategoryIDfield.

SubCommand0_onclick()

MSODSC.Datapages(0).FirstSection.HTMLContainer.Children("CategoryID").Focus

MSODSC.Datapages(0).ApplyFilter

EndSub

Page 421: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AutoFilterMethod

DisplaysorhidestheAutoFilterdrop-downarrows.YoutypicallyusethismethodtoturnontheAutoFilterandaddoneormorecriteriatoit;youcanthenusetheApplymethodtoapplythenewfilter.

expression.AutoFilter(Field,Criteria1,Operator,Criteria2,VisibleDropDown)

expressionAnexpressionthatreturnsaRangeobject.

FieldOptionalVariant.Thisargumentisnotsupported.

Criteria1OptionalVariant.Thisargumentisnotsupported.

OperatorOptionalVariant.Thisargumentisnotsupported.

Criteria2OptionalVariant.Thisargumentisnotsupported.

VisibleDropDownOptionalVariant.Thisargumentisnotsupported.

Page 422: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDonotconfusethismethodwiththeAutoFilterproperty.ThismethodappliestoaRangeobjectandturnsontheAutoFilter,whereastheAutoFilterpropertyreturnstheAutoFilterobjectforagivenworksheet.

Page 423: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsontheAutoFilterfortherangeA1:C20,setsfiltersforcolumnsAandC,andthenappliesthefilters.

SubApply_AutoFilter()DimafFiltersDimafCol1DimafCol3'TurnonAutoFilter.Spreadsheet1.Worksheets("Sheet1").Range("A1:C20").AutoFilter'SetavariabletotheAutoFilterobject.SetafFilters=Spreadsheet1.Worksheets("sheet1").AutoFilterSetafCol1=afFilters.Filters(1)SetafCol3=afFilters.Filters(3)'AddacriteriathatexcludesbluefromcolumnA.afCol1.Criteria.Add"blue"'AddacriteriathatexcludesgreenfromcolumnA.afCol1.Criteria.Add"green"'Addacriteriathatexcludesyellowfromcolumnc.afCol3.Criteria.Add"yellow"'Applythecriteria.afFilters.ApplyEndSub

Page 424: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AutoFitMethod

Changesthewidthofthecolumnsintherangeortheheightoftherowsintherangetoachievethebestfit.

expression.AutoFit

expressionRequired.AnexpressionthatreturnsaRangeobject.Mustbearoworarangeofrows,oracolumnorarangeofcolumns.Otherwise,thismethodgeneratesanerror.

Page 425: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleadjuststheselectedrowsandcolumnstothebestfit.

SubAutoFitSelection()

DimrngSelected

SetrngSelected=Spreadsheet1.Selection

rngSelected.Rows.AutoFitrngSelected.Columns.AutoFit

EndSub

Page 426: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AutoLayoutMethod

ResetsthespecifiedPivotTablelisttoadefaultviewconfiguration.IfthePivotTableisboundtoarecordset,afieldsetisaddedtothedataaxisforeachfieldintherecordset.IfthePivotTableisboundtoanmultidimensionaldatasource,suchasanOLAPcube,allfieldsetsareremovedfromtheaxes,clearingthecurrentview.

expression.AutoLayout(MaxDataFields)

expressionAnexpressionthatreturnsaPivotViewobject.

MaxDataFieldsOptionalLong.Specifiesthemaximumnumberoffieldsthatcanbeaddedtothedataaxisifthedatamemberisarecordset.Ifthisargumentisnotspecifiedoriszero(0),thereisnolimittothenumberoffieldsthatwillbeadded.

Page 427: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresetstheactiveviewforPivotTable1.

PivotTable1.ActiveView.AutoLayout

Page 428: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeginObjectMethod

BeginsthedrawingsequenceforthespecifiedChChartDrawobject.

expression.BeginObject(id)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

idRequiredLong.Setthisargumenttoauniqueidentifierthatwillsubsequentlybeusedtoidentifytheobjectbeingdrawn.Setto-1toidentifytheChChartDrawobjectthathasbeenpassedintoaneventprocedure.

Page 429: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucancombinemultipledrawingelementsintoasingleuser-selectableitembyplacingthembetweencallstotheBeginObjectandEndObjectmethods.

Page 430: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheBeforeRendereventtocancelthedrawingofthegridlinesandtheplotareaofthefirstchartinChartspace1.TheAfterRenderEventthenreplacestheplotareawithanellipsethatisdrawnafterthechartisrendered.

PrivateSubChartSpace1_BeforeRender(chartObject,Cancel)

SelectCaseTypeName(chartObject)

Case"ChGridlines"

'Cancelthedrawingofthegridlines.Cancel.Value=True

Case"ChPlotArea"

'Cancelthedrawingoftheplotarea.Cancel.Value=True

EndSelect

EndSub

PrivateSubChartSpace1_AfterRender(drawObject,chartObject)

DimchConstants

SetchConstants=ChartSpace1.Constants

'Checktoseeifthecharthasbeenrendered.IfTypeName(chartObject)="ChChart"Then

Page 431: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Thenextthreelinesofcodesettheinterior'andborderpropertiesoftheellipse.drawObject.Interior.SetPresetGradient_chConstants.chGradientHorizontal,_chConstants.chGradientVariantStart,_Int((24-1+1)*Rnd+1)drawObject.Border.Weight=1drawObject.Border.Color="black"

'Beginthedrawingobject.drawObject.BeginObject1

'Drawtheellipse.drawObject.DrawEllipsechartObject.PlotArea.Left,chartObject.PlotArea.Bottom,_chartObject.PlotArea.Right,chartObject.PlotArea.Top

drawObject.EndObject

EndIf

EndSub

Page 432: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeginUndoMethod

Specifiesthebeginningofanundoblock.ThismeansthatallstatementsbetweenthiscallanditscorrespondingEndUndomethodcallwillbeundonebyasinglecalltotheUndomethod.Thismakesitpossibleforyoutocombineentiremacrosintoonestatementthatcanbeeasilyundone.Undoblockscanbenested.

expression.BeginUndo

expressionAnexpressionthatreturnsaChartSpaceorSpreadsheetobject.

Page 433: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesanundoblockcontainingcodethatsetsthenumberformatandfontforcellD10.YoucanundoalloftheformattingbyclickingUndoonSpreadsheet1'stoolbar.

SubUndoBlock()DimrngCurrent'Enableundo.Spreadsheet1.EnableUndo=True'Startanundoblock.Spreadsheet1.BeginUndoSetrngCurrent=Spreadsheet1.Worksheets("sheet1").Range("D10")'Thefollowingthreelinesofcodeapply'variousformattingtocellD10.rngCurrent.NumberFormat="0.###"rngCurrent.Font.Color="Blue"rngCurrent.Font.Name="TimesNewRoman"'Endtheundoblock.Spreadsheet1.EndUndoEndSub

Page 434: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 435: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BorderAroundMethod

AddsabordertoarangeandsetstheColor,LineStyle,andWeightpropertiesforthenewborder.

expression.BorderAround(LineStyle,Weight,ColorIndex,Color)

expressionRequired.AnexpressionthatreturnsaRangeobject.

LineStyleOptionalVariant.Thelinestylefortheborder.CanbeaXlLineStyleconstant.

WeightOptionalXlBorderWeight.Theborderweight.

ColorIndexOptionalXlColorIndex.Thebordercolor,asanindexintothecurrentcolorpalette,orasanXlColorIndexconstant.

ColorOptionalVariant.Thebordercolor,asanRGBvalue.

Page 436: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumustspecifyeitherColorIndexorColor,butnotboth.

YoucanspecifyeitherLineStyleorWeight,butnotboth.Ifyoudon'tspecifyeitherargument,thedefaultlinestyleandweightareused.

Page 437: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsathickredborderaroundtherangeA1:D4onSheet1.

SubAdd_Border()

DimssConstants

SetssConstants=Spreadsheet1.Constants

Spreadsheet1.Worksheets("Sheet1").Range("A1:D4")_.BorderAround,ssConstants.xlThick,3

EnbSub

Page 438: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CalculateMethod

Calculatestheopenworkbook,aspecificworksheetinaworkbook,oraspecifiedrangeofcellsonaworksheet.

expression.Calculate

expressionAnexpressionthatreturnsaRange,Spreadsheet,orWorksheetobject.

Page 439: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausestheactiveworksheetonthespreadsheettoberecalculated.

Spreadsheet1.ActiveSheet.Calculate

ThisexamplecausestherangeA1:G5inSheet1toberecalculated.

Spreadsheet1.Worksheets("Sheet1").Range("A1:G5").Calculate

Page 440: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CalculateFullMethod

Forceseveryformulaintheopenworkbooktoberecalculated.

expression.CalculateFull

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 441: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleforcesafullcalculationofalldatainSpreadsheet1.

Spreadsheet1.CalculateFull

Page 442: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 443: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ClearMethod

ClearmethodasitappliestotheChartSpaceobject.

ClearMethodasitappliestotheRangeobject.

Page 444: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChartSpaceobject.

AtisappliestotheRangeobject.

Page 445: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ClearContentsMethod

Deletesalldatafromthespecifiedrange.

expression.ClearContents

expressionAnexpressionthatreturnsaRangeobject.

Page 446: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledeletesalldatafromcellsA4:B10ontheactiveworksheetinSpreadhseet1.

Spreadsheet1.ActiveSheet.Range("A4:B10").ClearContents

Page 447: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ClearFormatsMethod

Deletesallformattingfromthespecifiedrange.

expression.ClearFormats

expressionAnexpressionthatreturnsaRangeobject.

Page 448: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleclearstheformattingfromallcellsontheactiveworksheet.

Spreadsheet1.ActiveSheet.Cells.ClearFormats

Page 449: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CollapseMethod

Causesthespecifiedsectiontocollapse.

expression.Collapse

expressionAnexpressionthatreturnsaSectionobject.

Page 450: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 451: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CopyMethod

CopymethodasitappliestotheSheets,Worksheet,andWorksheetsobjects.

CopymethodasitappliestotheRangeobject.

CopymethodasitappliestothePivotTableobject.

Page 452: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheSheets,Worksheet,andSheetsobjects.

AsitappliestotheRangeobject.

AsitappliestothePivotTableobject.

Page 453: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CopyFromRecordsetMethod

CopiesthecontentsofanADOorDAORecordsetobjectontoaworksheet,beginningattheupper-leftcornerofthespecifiedrange.IftheRecordsetobjectcontainsfieldswithOLEobjectsinthem,thismethodfails.

expression.CopyFromRecordset(Data,MaxRows,MaxColumns)

expressionRequired.AnexpressionthatreturnsaRangeobject.

DataRequiredVariant.ThenameoftheRecordsetobjecttocopyintotherange.

MaxRowsOptionalVariant.Themaximumnumberofrecordstocopyontotheworksheet.Ifthisargumentisomitted,alltherecordsintheRecordsetobjectarecopied.

MaxColumnsOptionalVariant.Themaximumnumberoffieldstocopyontotheworksheet.Ifthisargumentisomitted,allthefieldsintheRecordsetobjectarecopied.

Page 454: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksCopyingbeginsatthecurrentrowoftheRecordsetobject.Aftercopyingiscompleted,theEOFpropertyoftheRecordsetobjectisTrue.

Whenthismethodcopiestherecordsettotheworksheet,theresultswillbetruncatedifyoudonotspecifyarangethatislargeenoughtoholdthecontentsoftherecordset.

Page 455: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecopiesarecordsetnamedrstAuthorsintotheactivesheetofSpreadsheet1startingatcellA1.

Spreadsheet1.ActiveSheet.Cells.CopyFromRecordsetrstAuthors

Page 456: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CutMethod

CutsthespecifiedrangeandeithermovesittotheClipboardorpastesitintoaspecifieddestinationrange.

expression.Cut(Destination)

expressionAnexpressionthatreturnsaRangeobject.

DestinationOptionalVariant.Ifyoudonotspecifythisargument,thespecifiedrangeissenttotheClipboard.IfthisargumentisaRangeobject,thesourcerangeismovedtothespecifiedrange.

Page 457: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemovestheformula,data,andformattingfromcellA3tocellG7ontheactiveworksheet.

SubMoveCell()DimshtSourceSetshtSource=Spreadsheet1.ActiveSheet'MovethecontentsofcellA3tocellG7.shtSource.Range("A3").CutshtSource.Range("G7")EndSub

Page 458: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 459: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeleteMethod

DeletemethodasitappliestotheHyperlink,ListRow,Name,PivotHyperlink,Sheets,Worksheet,Worksheets,XmlDataBinding,andXmlMapobjects.

Page 460: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeletemethodasitappliestotheChAxes,ChCharts,ChSeriesCollection,ElementExtensions,GroupingDefs,GroupLevels,LookupRelationships,PageFields,ParameterValues,RecordsetDefs,SchemaFields,SchemaRelationships,SchemaRowsources,andSublistRelationshipsobjects.

DeletemethodasitappliestotheChDataLabelsCollection,ChErrorBarsCollection,ChSegmentsandChTrendlinesobjects.

DeletemethodasitappliestotheRangeobject.

Page 461: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChDataLabelsCollectioncollection.

Page 462: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeleteCustomGroupMemberMethod

Deletesamemberfromacustomgroupfield.

expression.DeleteCustomGroupMember(CustomGroupMember)

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

CustomGroupMemberRequiredVariant.Name,uniquename,orreferencetothemembertodelete.

Page 463: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodwillreturnarun-timeerrorifthememberreferredtobytheCustomGroupMemberargumentisnotamemberofacustomgroupfield.

Page 464: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeleteFieldMethod

DeletesacalculatedfieldthatwascreatedbytheAddCalculatedFieldorAddCustomGroupFieldmethodsfromthespecifiedfieldset.

expression.DeleteField(Field)

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

FieldRequiredVariant.Thename,uniquenameorreferencetoacalculatedfieldinthefieldset.

Page 465: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeleteFieldSetMethod

DeletesafieldsetthatwascreatedusingtheAddFieldSetmethod.ThefieldsetisremovedfromthePivotTableviewandfromthePivotFieldSetscollection.

expression.DeleteFieldSet(FieldSet)

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

FieldSetRequiredVariant.Thenameof,orareferenceto,acustomfieldset.

Page 466: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowinglineofcodedeletesacustomfieldsetnamed"Variance"fromPivotTable1.

PivotTable1.ActiveView.DeleteFieldSet"Variance"

Page 467: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeleteRecordMethod

Deletesarecordfromthespecifieddataaccesspage.

expression.DeleteRecord

expressionAnexpressionthatreturnsaDataPageobject.

Page 468: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeleteTotalMethod

DeletesaPivotTotalobjectfromthePivotTotalscollection.Youcandeleteonlyuser-definedtotals.

expression.DeleteTotal(Total)

expressionAnexpressionthatreturnsaPivotViewobject.

TotalRequiredVariant.Specifiesthenameornumberofthetotal.

Page 469: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledeletesatotalnamed"TotalBudget"fromPivotTable1.

SubDelete_Total()DimvwView

SetvwView=PivotTable1.ActiveView

'Deletethetotalnamed"TotalBudget."vwView.DeleteTotalvwView.Totals("TotalBudget")EndSub

Page 470: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DrawEllipseMethod

Drawsanellipseonthespecifiedchart.UsethecurrentsettingsoftheBorderandInteriorpropertiestodeterminethepropertiesofthenewellipse.

expression.DrawEllipse(Left,Top,Right,Bottom)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

LeftRequiredLong.Pixelcoordinateoftheleftedgeoftheellipse.

TopRequiredLong.Pixelcoordinateofthetopedgeoftheellipse.

RightRequiredLong.Pixelcoordinateoftherightedgeoftheellipse.

BottomRequiredLong.Pixelcoordinateofthebottomedgeoftheellipse.

Page 471: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheBeforeRendereventtocanceldrawingthegridlinesandplotareaofthefirstchartinChartspace1.TheAfterRendereventthenreplacestheplotareawithanellipsethatisdrawnafterthechartisrendered.

PrivateSubChartSpace1_BeforeRender(chartObject,Cancel)

SelectCaseTypeName(chartObject)

Case"ChGridlines"

'Cancelthedrawingofthegridlines.Cancel.Value=True

Case"ChPlotArea"

'Cancelthedrawingoftheplotarea.Cancel.Value=True

EndSelect

EndSub

PrivateSubChartSpace1_AfterRender(drawObject,chartObject)

DimchConstants

SetchConstants=ChartSpace1.Constants

'Checktoseeifthecharthasbeenrendered.IfTypeName(chartObject)="ChChart"Then

Page 472: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Thenextthreelinesofcodesettheinterior'andborderpropertiesoftheellipse.drawObject.Interior.SetPresetGradient_chConstants.chGradientHorizontal,_chConstants.chGradientVariantStart,_Int((24-1+1)*Rnd+1)drawObject.Border.Weight=1drawObject.Border.Color="black"

'Beginthedrawingobject.drawObject.BeginObject1

'Drawtheellipse.drawObject.DrawEllipsechartObject.Left,chartObject.Bottom,_chartObject.Right,chartObject.Top

drawObject.EndObject

EndIf

EndSub

Page 473: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DrawLineMethod

Drawsalineonthespecifiedchart.UsesthecurrentsettingsoftheLinepropertytodeterminethepropertiesofthenewline.

expression.DrawLine(x0,y0,x1,y1)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

x0RequiredLong.StartingpixelcoordinateintheXplane.

y0RequiredLong.StartingpixelcoordinateintheYplane.

x1RequiredLong.EndingpixelcoordinateintheXplane.

y1RequiredLong.EndingpixelcoordinateintheYplane.

Page 474: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleillustrateshowyoucanusetheBeforeRenderandAfterRendereventstogethertocreatecustomgridlines.TheBeforeRendereventcancelstherenderingofthegridlinesandtheAfterRendereventdrawscustomgridlines.

SubChartSpace1_BeforeRender(chartObject,Cancel)

'Checktoseeifthenextobjecttoberendered'isagridline.IfTypeName(chartObject)="ChGridlines"Then

'Canceltherenderingofgridlines.Cancel.Value=True

EndIf

EndSub

SubChartSpace1_AfterRender(drawObject,chartObject)

DimchChart1DimplPlotAreaDimlLeftDimlRightDimlHeightDimlTopDimlIncrementDimchConstantsDimiCtr

SetchConstants=ChartSpace1.Constants

Page 475: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'SetavariabletothefirstchartinChartspace1.SetchChart1=ChartSpace1.Charts(0)

'Setavariabletotheplotareaofthechart.SetplPlotArea=chChart1.PlotArea

'Checktoseeiftherenderedobjectisagridline.IfTypeName(chartObject)="ChGridlines"Then

'Thenextfourlinesofcodeusetheextentsof'theplotareatocalculatethedimensionsoftheline.'tobedrawn.lLeft=plPlotArea.LeftlTop=plPlotArea.ToplRight=plPlotArea.RightlHeight=plPlotArea.Bottom-lTop

'Determinetheincrementtousebetweengridlines.'Changethedivisortoadjusttheincrement.lIncrement=lHeight/10

'Thenextthreelinesofcodesetthepropertiesofthe'linetobedrawn.drawObject.Line.DashStyle=chConstants.chLineRoundDotdrawObject.Line.Color="Green"drawObject.Line.Weight=chConstants.owcLineWeightMedium

ForiCtr=1To9

'Drawtheline.drawObject.DrawLinelLeft,lTop+iCtr*lIncrement,_lRight,lTop+iCtr*lIncrement

Page 476: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Next

EndIf

EndSub

Page 477: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DrawPolygonMethod

Drawsapolygononthechart.ThepointsforthepolygonarespecifiedinarrayscontainingtheXandYvaluesthatdescribethesegmentsofthepolygon.UsesthecurrentsettingsoftheBorderandInteriorpropertiestodeterminethepropertiesofthenewpolygon.

expression.DrawPolygon(xValues,yValues)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

xValuesRequiredVariant.AnarraycontainingtheXvaluesusedtocalculatethepolygon.

yValuesRequiredVariant.AnarraycontainingtheYvaluesusedtocalculatethepolygon.

Page 478: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheBeforeRendereventtocancelrenderingthecharttitleandtheAfterRendereventtoreplacethecharttitlewithapolygon.

PrivateSubChartSpace1_BeforeRender(chartObject,Cancel)

IfTypeName(chartObject)="ChTitle"ThenCancel.Value=TrueEndIf

EndSub

SubChartSpace1_AfterRender(drawObject,chartObject)

DimalXValues(9)DimalYValues(9)DimchConstantsDimiCutoff

iCutoff=20

SetchConstants=ChartSpace1.Constants

IfTypeName(chartObject)="ChTitle"Then

'Setthearraycontainingthexvaluesfor'theline.alXValues(0)=chartObject.Left+iCutoffalXValues(1)=chartObject.Right-iCutoffalXValues(2)=chartObject.RightalXValues(3)=chartObject.Right

Page 479: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

alXValues(4)=chartObject.Right-iCutoffalXValues(5)=chartObject.Left+iCutoffalXValues(6)=chartObject.LeftalXValues(7)=chartObject.LeftalXValues(8)=chartObject.Left+iCutoff

'Setthearraycontainingtheyvaluesfor'theline.alYValues(0)=chartObject.TopalYValues(1)=chartObject.TopalYValues(2)=chartObject.Top+iCutoffalYValues(3)=chartObject.Bottom-iCutoffalYValues(4)=chartObject.BottomalYValues(5)=chartObject.BottomalYValues(6)=chartObject.Bottom-iCutoffalYValues(7)=chartObject.Top+iCutoffalYValues(8)=chartObject.Top

'Setthepropertiesforthepolygon.drawObject.Interior.SetTwoColorGradientchConstants.chGradientFromCenter,_chConstants.chGradientVariantStart,"Red","Green"

'Drawthepolygon.drawObject.DrawPolygonalXValues,alYValues

EndIf

EndSub

Page 480: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DrawPolyLineMethod

Drawsalinecontainingmultiplesegments.ThepointsforthelinearespecifiedinarrayscontainingtheXandYvaluesthatdescribethesegmentsoftheline.UsesthecurrentsettingsoftheLinepropertytodeterminethepropertiesofthenewline.

expression.DrawPolyLine(xValues,yValues)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

xValuesRequiredVariant.AnarraycontainingtheXvaluesusedtocalculatetheline.

yValuesRequiredVariant.AnarraycontainingtheYvaluesusedtocalculatetheline.

Page 481: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheAfterRendereventtodrawacustomborderaroundChartspace1.

SubChartSpace1_AfterRender(drawObject,chartObject)

DimalXValues(9)DimalYValues(9)DimiCutOffDimchConstants

iCutOff=10

SetchConstants=ChartSpace1.Constants

IfTypeName(chartObject)="ChChart"Then

'Setthearraycontainingthexvaluesfor'theline.alXValues(0)=chartObject.Left+iCutOffalXValues(1)=chartObject.Right-iCutOffalXValues(2)=chartObject.RightalXValues(3)=chartObject.RightalXValues(4)=chartObject.Right-iCutOffalXValues(5)=chartObject.Left+iCutOffalXValues(6)=chartObject.LeftalXValues(7)=chartObject.LeftalXValues(8)=chartObject.Left+iCutOff

'Setthearraycontainingtheyvaluesfor'theline.

Page 482: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

alYValues(0)=chartObject.TopalYValues(1)=chartObject.TopalYValues(2)=chartObject.Top+iCutOffalYValues(3)=chartObject.Bottom-iCutOffalYValues(4)=chartObject.BottomalYValues(5)=chartObject.BottomalYValues(6)=chartObject.Bottom-iCutOffalYValues(7)=chartObject.Top+iCutOffalYValues(8)=chartObject.Top

'Setthepropertiesfortheline.drawObject.Line.Color="blue"drawObject.Line.Weight=chConstants.owcLineWeightThickdrawObject.Line.DashStyle=chConstants.chLineLongDashDot

'Drawtheline.drawObject.DrawPolyLinealXValues,alYValues

EndIf

EndSub

Page 483: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DrawRectangleMethod

Drawsarectangleonachart.UsesthecurrentsettingsoftheBorderandInteriorpropertiestodeterminethepropertiesofthenewrectangle.

expression.DrawRectangle(Left,Top,Right,Bottom)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

LeftRequiredLong.Pixelcoordinateoftheleftedgeoftherectangle.

TopRequiredLong.Pixelcoordinateofthetopedgeoftherectangle.

RightRequiredLong.Pixelcoordinateoftherightedgeoftherectangle.

BottomRequiredLong.Pixelcoordinateofthebottomedgeoftherectangle.

Page 484: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheAfterRendereventtodrawrectanglesasasubstituteforthelegendentriesinthefirstchartofChartspace1.

SubChartSpace1_AfterRender(drawObject,chartObject)

DimchConstants

SetchConstants=ChartSpace1.Constants

IfTypeName(chartObject)="ChLegendEntry"Then

'Settheinterioroftherectangletoapresettexture.'YoucouldsubstituteaURLtoacustomgraphic'forthetexture.drawObject.Interior.SetTexturedchConstants.chTextureSand

'Begindrawingtherectangle.drawObject.BeginObject1

'Drawtherectangle.drawObject.DrawRectanglechartObject.Left,chartObject.Top,_chartObject.Right,chartObject.Bottom

drawObject.EndObject

EndIf

EndSub

Page 485: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DrawTextMethod

Drawsatextstringonachart.

expression.DrawText(bstrText,Left,Top)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

bstrTextRequiredString.Thetexttodrawonthechart.

LeftRequiredLong.Pixelcoordinateoftheleftedgeofthetext.

TopRequiredLong.Pixelcoordinateofthetopedgeofthetext.

Page 486: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatextstringtotheupper-leftcorneroftheplotareaeachtimethatthechartisre-drawn.

SubChartSpace1_AfterRender(drawObject,chartObject)

DimchChart1

SetchChart1=ChartSpace1.Charts(0)'Afterthelegendhasbeenrendered,thenaddthetext'tothechart.IfTypeName(chartObject)="ChLegend"ThendrawObject.DrawText"2000Sales",chChart1.PlotArea.Left+5,_chChart1.PlotArea.TopEndIf

EndSub

Page 487: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 488: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DropZonesMethod

ReturnsaChDropZoneobject.Usethepropertiesofthereturnedobjecttoformatthedropzone.

expression.DropZones(dz)

expressionRequired.AnexpressionthatreturnsaChartspaceobject.

dzRequiredChartDropZonesEnum.Representsthedropzonethatyouwanttoformat.

Page 489: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimchConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 490: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DuplicateFormatMethod

Copiestheformattingandtypeofthespecifiedcharttootherchartsintheworkspacethatareboundtothesamedatasource.Thismethodcanonlybeusedwhenthechartcontrolisboundtoarelationaldatasourcelist.

expression.DuplicateFormat

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 491: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheHasMultipleChartspropertyofthechartcontrolmustbesettoTruebeforeusingthismethod.

Page 492: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecopiestheformattingofthefirstchartinChartspace1toallotherchartsinChartspace1thatareboundtothesamePivotTablelist.

Chartspace1.Charts(0).DuplicateFormat

Page 493: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndEditMethod

Movestheactivecelloutofeditmode.

expression.EndEdit(Accept)

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

AcceptOptionalBoolean.Specifieswhetherthecurrentvalueisaccepted.SettingthisargumenttoFalsediscardsanychangestothedetailcellandthepreviousvalueisrestored.ThedefaultvalueisTrue.

Page 494: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndObjectMethod

EndsthedrawingsequenceforthespecifiedChChartDrawobject.

expression.EndObject

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

Page 495: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheBeforeRendereventtocanceldrawingthegridlinesandplotareaofthefirstchartinChartspace1.TheAfterRendereventthenreplacestheplotareawithanellipsethatisdrawnafterthechartisrendered.

PrivateSubChartSpace1_BeforeRender(chartObject,Cancel)

SelectCaseTypeName(chartObject)

Case"ChGridlines"

'Cancelthedrawingofthegridlines.Cancel.Value=True

Case"ChPlotArea"

'Cancelthedrawingoftheplotarea.Cancel.Value=True

EndSelect

EndSub

PrivateSubChartSpace1_AfterRender(drawObject,chartObject)

DimchConstants

SetchConstants=ChartSpace1.Constants

'Checktoseeifthecharthasbeenrendered.IfTypeName(chartObject)="ChChart"Then

Page 496: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Thenextthreelinesofcodesettheinterior'andborderpropertiesoftheellipse.drawObject.Interior.SetPresetGradient_chConstants.chGradientHorizontal,_chConstants.chGradientVariantStart,_Int((24-1+1)*Rnd+1)drawObject.Border.Weight=1drawObject.Border.Color="black"

'Beginthedrawingobject.drawObject.BeginObject1

'Drawtheellipse.drawObject.DrawEllipsechartObject.Left,chartObject.Bottom,_chartObject.Right,chartObject.Top

drawObject.EndObject

EndIf

EndSub

Page 497: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndUndoMethod

Specifiestheendofanundoblock.ThismeansthatallstatementsbetweenthiscallanditscorrespondingBeginUndomethodcallwillbeundonebyasinglecalltotheUndomethod.Thismakesitpossibleforyoutocombineentiremacrosintoonestatementthatcanbeeasilyundone.Undoblockscanbenested.

expression.EndUndo

expressionAnexpressionthatreturnsaChartSpaceorSpreadsheetobject.

Page 498: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesanundoblockcontainingcodethatsetsthenumberformatandfontforcellD10.YoucanundoalloftheformattingbyclickingUndoonSpreadsheet1'stoolbar.

SubUndoBlock()DimrngCurrent'Enableundo.Spreadsheet1.EnableUndo=True'Startanundoblock.Spreadsheet1.BeginUndoSetrngCurrent=Spreadsheet1.Worksheets("sheet1").Range("D10")'Thefollowingthreelinesofcodeapply'variousformattingtocellD10.rngCurrent.NumberFormat="0.###"rngCurrent.Font.Color="Blue"rngCurrent.Font.Name="TimesNewRoman"'Endtheundoblock.Spreadsheet1.EndUndoEndSub

Page 499: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EuroConvertMethod

YoucanusetheEuroConvertmethodtoconvertanumbertotheeuroorfromtheeurotoaparticipatingcurrency.Youcanalsouseittoconvertanumberfromoneparticipatingcurrencytoanotherbyusingtheeuroasanintermediary(triangulation).TheEuroConvertmethodusesfixedconversionratesestablishedbytheEuropeanCommission.ReturnsaDoublevalue.

expression.euroConvert(Number,SourceCurrency,TargetCurrency,FullPrecision,TriangulationPrecision)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

NumberRequiredDouble.Thenumberyouwanttoconvert.

SourceCurrencyRequiredString.Astringexpression,orreferencetoafieldcontainingthestring,correspondingtotheInternationalStandardsOrganization(ISO)acronymforthecurrencyyouwanttoconvert.CanbeoneoftheISOcodeslistedinthefollowingtable.

CurrencyISOCode

CalculationPrecision

DisplayPrecision

Belgianfranc BEF 0 0Luxembourgfranc LUF 0 0Deutschemark DEM 2 2Spanishpeseta ESP 0 0Frenchfranc FRF 2 2Irishpunt IEP 2 2Italianlira ITL 0 0Netherlandsguilder NLG 2 2Austrianschilling ATS 2 2Portugueseescudo PTE 1 2finishMarkka FIM 2 2euro EUR 2 2Intheprecedingtable,thecalculation

Page 500: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

precisiondetermineswhatcurrencyunittoroundtheresulttobasedontheconversioncurrency.Forexample,whenconvertingtoDeutschemarks,thecalculationprecisionis2,andtheresultisroundedtothenearestpfennig,100pfennigstoamark.Thedisplayprecisiondetermineshowmanydecimalplacesappearinthefieldcontainingtheresult.

LaterversionsoftheEuroConvertmethodmaysupportadditionalcurrencies.

Currency ISOCodeDanishKrone DKKDrachma GRDSwedishKrona SEKPoundSterling GBP

TargetCurrencyRequiredString.Athree-letterstringcorrespondingtotheISOcodeofthecurrencytowhichyouwanttoconvertthenumber.SeetheprevioustablefortheISOcodes.ForalistofISOcodes,seetheSourceCurrencyargumentdescription.

FullPrecisionOptionalVariant.Alogicalvalue(TrueorFalse),oranexpressionthatevaluatestoavalueofTrueorFalse,thatspecifieshowtodisplaytheresult.

Use IfyouwanttoFalse Displaytheresultwiththecurrency-specificroundingrules(see

thetableintheSourceCurrencyargumentdescription).Thecalculationprecisionvalueisusedtocalculatetheresultandthedisplayprecisionvaluetodisplaytheresult.FalseisthedefaultiftheFullPrecisionargumentisomitted.

True Displaytheresultwithallsignificantdigitsresultingfromthecalculation.

TriangulationPrecisionOptionalVariant.Avaluegreaterthanorequalto3thatspecifiesthenumberofsignificantdigitsinthecalculation

Page 501: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

precisionusedfortheintermediateeurovaluewhenconvertingbetweentwonationalcurrencies.

Page 502: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAnytrailingzerosaretruncatedandinvalidparametersreturn#Error.

IfthesourceISOcodeisthesameasthetargetISOcode,theoriginalvalueofthenumberisactive.

Thismethoddoesnotapplyaformat.

TheEuroConvertmethodusesthecurrentratesestablishedbytheEuropeanCommission.Iftherateschange,Microsoftwillupdatethemethod.Togetfullinformationabouttherulesandtheratescurrentlyineffect,seetheEuropeanCommissionpublicationsabouttheeuro.

Page 503: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthevalueoftheUnitPricefieldfromFrenchfrancstoeuros.

DubConvertToEuros()

DimdblSourceNumDimdblConvertedNum

'SetavariabletotheUnitPricefield.dblSourceNum=Document.All("unitprice").Value'ConverttheUnitPricefromFrenchfrancstoeuros.dblConvertedNum=MSODSC.EuroConvert(dblsourcenum,"FRF","EUR",False,3)'PlacetheconvertedvalueintheEuroValuefield.Document.All("EuroValue").Value=dblConvertedNumEndSub

Page 504: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EvaluateMethod

Evaluatesanexpressionthatisintheformoftextandreturnstheresult.Theexpressioncanincludeanycombinationoffunctions,keywords,orothersyntaxthattheSpreadsheetComponentcanresolve.

expression.Evaluate(Expression)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ExpressionRequiredVariant.Theexpressiontoevaluate.

Page 505: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThefollowingtypesofnamesinMicrosoftExcelcanbeusedwiththismethod:

A1-stylereferences.YoucanuseanyreferencetoasinglecellinA1-stylenotation.Allreferencesareconsideredtobeabsolutereferences.

Ranges.Youcanusetherange,intersect,andunionoperators(colon,space,andcomma,respectively)withreferences.

Definednames.Youcanspecifyanynameinthelanguageofthemacro.

Page 506: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusesthetheEvaluatemethodtocalculatethecotangentofanangle.

FunctionCalcCotangent(sngAngleInDegrees)

DimstrExpression

'Puttogethertheexpressiontocalculatethecotangent'oftheangle.strExpression="1/TAN("&sngAngleInDegrees&"*PI()/180)"

'Evaluatethestringandreturntheresult.CalcCotangent=Spreadsheet1.ActiveSheet.Evaluate(strExpression)

EndFunction

Page 507: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 508: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExecuteMethod

ExecutemethodasitappliestotheDataSourceControlobject.

ExecutemethodasitappliestotheOCCommandobject.

Page 509: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExpandMethod

Causesthespecifiedsectiontoexpand.

expression.Expand

expressionAnexpressionthatreturnsaSectionobject.

Page 510: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 511: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExportMethod

ExportmethodasitappliestotheandPivotTableobject.

ExportmethodasitappliestotheSpreadsheetobject.

Page 512: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheSpreadsheetobject.

Page 513: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExportMetaDataMethod

UsethismethodtoreturnaVariant(String)thatcontainsthe<pagingInfo>tagfromthedataretrievalservicesqueryresponsefromthemostrecentbindingrefreshoperation.

expression.ExportMetaData(ShowDialogs)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ShowDialogsOptionalBoolean.SpecifieswhetheradialogboxisdisplayediftheExportMetaDatamethodencountersanerrorthatisreturnedbytheSpreadsheetcomponentitself.WhenShowDialogsissettoTrue,adialogboxisdisplayediftheExportMetaDatamethodencountersanerrorreturnedbytheSpreadsheetcomponent.WhenShowDialogsissettoFalse,dialogboxesforSpreadsheetcomponenterrorsarenotdisplayed.ThedefaultisFalse.

NoteTheShowDialogsargumentdoesnotcontrolwhetheradialogboxwillbedisplayedforerrorsexternaltotheSpreadsheetcomponent,suchaserrorsreturnedbyscriptingcomponents.TopreventadialogboxfromdisplayingforerrorsexternaltotheSpreadsheetcomponent,youmusttrapthoseerrorsinyourscript.

Page 514: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

The<pagingInfo>tagwillnotalwaysbepresentinthequeryresponse.Whenitisnotpresent,theExportMetaDatamethodwillreturnanemptyString.

Page 515: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExportPictureMethod

SavesthespecifiedchartworkspaceorPivotTablelistasagraphicsfile.

expression.ExportPicture(FileName,FilterName,Width,Height)

expressionAnexpressionthatreturnsaChartSpaceorPivotTableobject.

FileNameOptionalString.Specifiesthenameofthesavedfile.Ifyoudonotspecifythisargument,thedefaultfilenameis“Chart.gif”forachartworkspaceor“Pivot.gif”foraPivotTablelist.

FilterNameOptionalString.Specifiesthenameofthegraphicsfilterthatisused.SupportedfilternamesareGIF,JPG,andPNG.ThedefaultisGIF.

WidthOptionalLong.Specifiesthewidthofthegraphic,inpixels.Youmustspecifythisargumentforserver-sidecharts.

HeightOptionalLong.Specifiestheheightofthegraphic,inpixels.Youmustspecifythisargumentforserver-sidecharts.

Page 516: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesavesthechartworkspaceasagraphicsfile.

ChartSpace1.ExportPicture"sales.gif","gif",320,240

Page 517: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 518: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExportXMLMethod

AsitappliestotheDataSourceControlobject.

Page 519: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AsitappliestotheXmlMapobject.

Page 520: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheDataSourceControlobject.

Page 521: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FillDownMethod

Fillsdownfromthetopcellorcellsinthespecifiedrangetothebottomoftherange.Thecontentsandformattingofthecellorcellsinthetoprowarecopiedintotherestoftherowsintherange.

expression.FillDown

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 522: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplefillstherangeA1:A10ontheactiveworksheet,basedonthecontentsofcellA1.

Spreadsheet1.ActiveSheet.Range("A1:A10").FillDown

Page 523: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FillRightMethod

Fillsrightfromtheleftmostcellorcellsinthespecifiedrange.Thecontentsandformattingofthecellorcellsintheleftmostcolumnarecopiedintotherestofthecolumnsintherange.

expression.FillRight

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 524: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplefillstherangeA1:M1ontheactiveworksheet,basedonthecontentsofcellA1.

Spreadsheet1.ActiveSheet.Range("A1:M1").FillRight

Page 525: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 526: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindMethod

FindsspecificinformationinagivenrangeandreturnsaRangeobjectthatrepresentsthefirstcellwherethatinformationisfound.ReturnsNothingifnomatchisfound.Doesnotaffecteithertheselectionortheactivecell.

expression.Find(What,After,LookIn,LookAt,SearchOrder,SearchDirection,MatchCase,MatchByte)

expressionAnexpressionthatreturnsaRangeobject.

WhatRequiredVariant.Thedatatobesearchedfor.

AfterOptionalVariant.Specifiesasinglecellafterwhichthesearchbegins.Thiscorrespondstothepositionoftheactivecellwhenasearchisdonefromtheuserinterface.Rememberthatthesearchbeginsafterthiscell;thespecifiedcellisn’tsearcheduntilthemethodwrapsbackaroundtothiscell.Ifyoudon’tspecifythisargument,thesearchstartsafterthecellintheupper-leftcorneroftherange

LookInOptionalXlFindLookIn.Specifieswhethertosearchformulasorthedisplayedvalue.

LookAtOptionalXlLookAt.SetthisargumenttoxlWholetoforcetheentirecontentsofthecelltomatchthecontentsoftheWhatargument.

SearchOrderOptionalXlSearchOrder.Specifieswhethertosearchbycolumnsorrows.

SearchDirectionOptionalXlSearchDirection.Specifiesthesearchdirection.

MatchCaseOptionalBoolean.Truetomakethesearchcasesensitive.ThedefaultvalueisFalse.

MatchByteOptionalVariant.Usedonlyifyou’veselectedorinstalleddouble-bytelanguagesupport.Truetohavedouble-bytecharactersmatchonlydouble-bytecharacters.Falsetohavedouble-bytecharactersmatchtheirsingle-byteequivalents.

Page 527: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplefindsalloccurrencesof"Mike"intherangeA1:F10andmakesthosecellsbold.

SubFind_Mike()DimssConstantsDimrngFindRangeDimrngFoundCellDimrngFirstFound

SetssConstants=Spreadsheet1.Constants

'Setavariabletotherangetosearch.SetrngFindRange=Spreadsheet1.Sheets("Sheet1").Range("A1:F10")

'FindthefirstoccurrenceofMike.SetrngFoundCell=rngFindRange.Find("Mike",rngFindRange.Cells(1,1),_ssConstants.xlValues,ssConstants.xlPart)

'IfMikewasfound...IfNotrngFoundCellIsNothingThen

'Setavariabletothefirstfoundinstance.SetrngFirstFound=rngFoundCell

Do'Setthefonttobold.rngFoundCell.Font.Bold=True

'FindthenextoccurrenceofMike.SetrngFoundCell=rngFindRange.FindNext(rngFoundCell)

Page 528: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'LoopuntilyoureturntothefirstoccurrenceofMike.LoopUntilrngFoundCell.Address=rngFirstFound.AddressEndIfEndSub

Page 529: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindNextMethod

ContinuesasearchthatwasbegunwiththeFindmethod.FindsthenextcellthatmatchesthosesameconditionsandreturnsaRangeobjectthatrepresentsthatcell.Doesn’taffecttheselectionortheactivecell.

expression.FindNext(After)

expressionRequired.AnexpressionthatreturnsaRangeobject.

AfterOptionalVariant.Thecellafterwhichyouwanttosearch.Thiscorrespondstothepositionoftheactivecellintheuserinterface.NotethatAftermustbeasinglecellintherange.Rememberthatthesearchbeginsaftertheactivecell;theactivecellitselfisn’tsearcheduntiltheFindNextmethodwrapsbackaroundtotheactivecell.Ifthisargumentisn’tspecified,thesearchstartsafterthecellintheupper-leftcorneroftherange.

Page 530: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplefindsalloccurrencesof"Mike"inSheet1andmakesthosecellsbold.

SubFindMike()

DimssConstantsDimrngFindRangeDimrngFoundCellDimrngFirstFound

SetssConstants=Spreadsheet1.Constants

'Setavariabletotherangetosearch.SetrngFindRange=Spreadsheet1.Sheets("Sheet1").UsedRange

'FindthefirstocurenceofMike.SetrngFoundCell=rngFindRange.Find("Mike",rngFindRange.Cells(1,1),_ssConstants.xlValues,ssConstants.xlPart)

'IfMikewasfound...IfNotrngFoundCellIsNothingThen

'Setavariabletothefirstfoundinstance.SetrngFirstFound=rngFoundCell

Do'Setthefonttobold.rngFoundCell.Font.Bold=True

'FindthenextoccurrenceofMike.

Page 531: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetrngFoundCell=rngFindRange.FindNext(rngFoundCell)

'LoopuntilyoureturntothefirstoccurrenceofMike.LoopUntilrngFoundCell.Address=rngFirstFound.Address

EndIf

EndSub

Page 532: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindPreviousMethod

ContinuesasearchthatwasbegunwiththeFindmethod.FindsthepreviouscellthatmatchesthosesameconditionsandreturnsaRangeobjectthatrepresentsthatcell.Doesn’taffecttheselectionortheactivecell.

expression.FindPrevious(After)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

AfterOptionalVariant.Thecellbeforewhichyouwanttosearch.Thiscorrespondstothepositionoftheactivecellintheuserinterface.NotethatAftermustbeasinglecellintherange.Rememberthatthesearchbeginsbeforetheactivecell;theactivecellitselfisn’tsearcheduntiltheFindPreviousmethodwrapsbackaroundtothiscell.Ifthisargumentisn’tspecified,thesearchstartsbeforetheupper-leftcellintherange.

Page 533: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleshowshowtheFindPreviousmethodisusedwiththeFindandFindNextmethods.Beforerunningthisexample,makesurethatSheet1containsatleasttwooccurrencesoftheword“Redmond”incolumnB.

SubFind_Methods()

DimrngFoundCellDimrngFindRange

'Setavariabletotherangetosearch.SetrngFindRange=Spreadsheet1.ActiveSheet.Columns("B")

'FindthefirstoccurenceofRedmondincolumnB.SetrngFoundCell=rngFindRange.Find("Redmond")

'DisplaythelocationofthefirstoccurenceofRedmond.MsgBox"Thefirstoccurrenceisincell"&rngFoundCell.Address

'FindthenextoccurenceofRedmondincolumnB.SetrngFoundCell=rngFindRange.FindNext(after:=rngFoundCell)

'DisplaythelocationofthenextoccurenceofRedmond.MsgBox"Thenextoccurrenceisincell"&rngFoundCell.Address

'FindthepreviousoccurenceofRedmondincolumnB.SetrngFoundCell=rngFindRange.FindPrevious(after:=rngFoundCell)

'DisplaythelocationofthepreviousoccurenceofRedmond.MsgBox"Thepreviousoccurrenceisincell"&rngFoundCell.Address

Page 534: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 535: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FireParametersOutMethod

UsethisthismethodtotriggertheParametersOutReadyevent.ReturnsNothing.

expression.FireParametersOut(InterfaceName,ParamArray)

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

InterfaceNameRequired.NameofaParametersOutProviderinterface,asspecifiedinthesolutionspecificationfile.

ParamArrayOptional.Onedimensionalarrayofstringsinwhicheachstringisthevalueofaparameter.Ifaparameterisnotspecified,thevaluein/ParametersOutProvider/SendParameters/Parameter/DefaultValuewillbeused.Ifbotharemissing,anerrorisreturned.

Page 536: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

Notethatthismethoddoesn'tapplyunlesstheSpreadsheetcomponentisrunninginthecontextofaSpreadsheetWebPartonaWebPartPageonaSharePointsite.

TheSpreadsheetWebPartcanimplementtheIParametersOutProviderinterface.TheParametersOutReadyeventistriggeredwhenaseparateWebPartthatimplementstheIParametersOutProviderinterfaceinvokesitsFireParametersOutmethod.TheParametersOutReadyeventpassesasetofdeveloper-definedparameterstoanotherWebPartthatimplementstheIParametersOutConsumerinterface.

Formoreinformationontheschemaofasolutionspecificationfile,searchtheMicrosoftDeveloperNetwork(MSDN)Websitefor"solutionspecificationfile."Forgeneralinformationonthesolutionspecificationfileandsomeexamples,searchMicrosoftOfficeExcel2003helpfor"spreadsheetwebpart."

Page 537: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FlipHorizontalMethod

Flipsalloftheseriesinthespecifiedcharthorizontally.

expression.FlipHorizontal

expressionAnexpressionthatreturnsaChPlotAreaobject.

Page 538: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleflipsalloftheseriesinthespecifiedcharthorizontally.

ChartSpace1.Charts(0).PlotArea.FlipHorizontal

Page 539: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FlipVerticalMethod

Flipsalloftheseriesinthespecifiedchartvertically.

expression.FlipVertical

expressionAnexpressionthatreturnsaChPlotAreaobject.

Page 540: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleflipsalloftheseriesinthespecifiedchartvertically.

ChartSpace1.Charts(0).PlotArea.FlipVertical

Page 541: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 542: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FollowMethod

FollowmethodasitappliestotheHyperlinkobject.

FollowmethodasitappliestothePivotHyperlinkobject.

Page 543: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresolvesthehyperlinkincellB15ontheactiveworksheet,downloadsthetargetdocument,andthendisplaysthedocument.

Spreadsheet1.ActiveSheet.Range("b15").Hyperlink.Follow

Page 544: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GetContainingSectionMethod

ReturnsthecontainingsectionforthespecifiedHTMLelement.

expression.GetContainingSection(Element)

expressionAnexpressionthatreturnsaDataSourceControlobject.

ElementRequiredObject.RepresentsthespecifiedHTMLelement.

Page 545: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 546: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GetDataPointVisibleMethod

Returnstheindexofthedatapointthatisvisibleinthescrollview.Long.

expression.GetDataPointVisible(datapoint)

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

datapointRequiredChartDataPointEnum.

Page 547: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

Adatapointisconsideredvisibleonlyiftheassociatedcategoryiswithinthescrollview.Thismethodisvalidonlyforbarandcolumncharts.Forothercharttypes,thevaluereturnedisundefined.

Page 548: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampledemonstrateshowtogettheindexofthedatapointthatisvisibleinthescrollview.

DimobjSeriesDimchChartDimlngPointFirstDimlngPointLast

SetchChart=ChartSpace.Constants

'Savethelowestandhighestvisibledatapointindexvaluestovariables.lngPointFirst=_objSeries.GetDataPointVisible(chChart.chDataPointFirst)lngPointLast=_objSeries.GetDataPointVisible(chChart.chDataPointLast)

Page 549: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GetPictureMethod

Returnsapictureofachartfromabinarydatastream.

expression.GetPicture(FilterName,Width,Height)

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

FilterNameOptionalString.Thenameofthegraphicsfiltertouse.Thedefaultvalueis"GIF".

WidthOptionalLong.Thewidthofthechartinpixels.

HeightOptionalLong.Theheightofthechartinpixels.

Page 550: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucanusetheBinaryWritemethodtowritethepicturereturnedbythismethodtothecurrentHTTPsession.

Page 551: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusesanASPscripttocreateachartbasedondatainaSQLServerdatabase.Oncethecharthasbeencreated,anpictureofthechartisdisplayedinthebrowserwindow.

<%DimPictTypeDimNewChartDimchConstants

SetNewChart=CreateObject("OWC11.ChartSpace")

Response.Expires=0Response.Buffer=TrueResponse.Clear

PictType="jpg"Response.ContentType="image/"&PictType

SetchConstants=NewChart.Constants

NewChart.ConnectionString="Provider=SQLOLEDB.1;PersistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=servername;"NewChart.DataMember="OrderDetails"

NewChart.SetDatachConstants.chDimCategories,chConstants.chDataBound,"ProductID"NewChart.SetDatachConstants.chDimValues,chConstants.chDataBound,"Quantity"

NewChart.Charts(0).Type=chConstants.chChartTypeColumn3DNewChart.Charts(0).HasTitle=True

Page 552: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewChart.Charts(0).Title.Caption="Server-RenderedChart"

Response.BinaryWriteNewChart.GetPicture(PictType,500,400)%>

Page 553: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 554: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GetValueMethod

Returnsadatavalueforthespecifiedpointinacustomdatadimension.

expression.GetValue(Dimension,scaled)

expressionAnexpressionthatreturnsaChPointobject.

DimensionRequiredChartDimensionsEnum.Thedimensionfromwhichyouareretrievingthevalue.

ScaledOptionalVariant.Specifieswhethertoreturntheactualvalueofthepoint,oritspercentageasitrelatestotheotherrelatedpoints.SetthisargumenttoTruetoreturnthepercentage.ThisargumentisrelevantonlywhenyouareusingaPie,Doughnut,orStackedColumnchart.

Page 555: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAlternatively,youcanspecifyaChartErrorBarCustomValuesEnumconstantfortheDimensionargumenttoreturnthevalueofanerrorbar.

Page 556: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupMethod

GroupsthespecidfiedserieswiththeseriesspecifiedintheSeriesargument.

expression.Group(Series)

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

SeriesRequiredChSeriesobject.Theseriestogroupthespecifiedserieswith.

Page 557: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HideDetailsMethod

Hidesthedetailscellsforthespecifiedobject.IfthespecifiedobjectisaPivotDataobject,alldetailcellsarehidden.IfthespecifiedobjectisaPivotRowMemberobject,thenalldetailscellsinthatrowarehidden.IfthespecifiedobjectisaPivotColumnMemberobject,thenalldetailscellsinthatcolumnarehidden.

expression.HideDetails

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 558: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesallofthedetailcellsinPivotTable1.

PivotTable1.ActiveData.HideDetails

Page 559: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ImportXmlMethod

Whenthismethodiscalled,thespecifiedSpreadsheetcomponentmapisupdatedwithanXMLdatastream.ReturnsNothing.

expression.ImportXml(XMLData,ShowDialogs,UseIDXPath)

expressionAnexpressionthatreturnsanXmlMapobject.

XMLDataRequiredVariant.AStringorIStreamobjectthatcontainstheXMLdatatobeimported.

ShowDialogsOptionalBoolean.SpecifieswhetheradialogboxisdisplayediftheImportXmlmethodencountersanerrorthatisreturnedbytheSpreadsheetcomponentitself.WhenShowDialogsissettoTrue,adialogboxisdisplayediftheImportXmlmethodencountersanerrorreturnedbytheSpreadsheetcomponent.WhenShowDialogsissettoFalse,dialogboxesforSpreadsheetcomponenterrorsarenotdisplayed.ThedefaultisFalse.

UseIDXPathOptionalBoolean.SpecifieshowtoimportXMLdataintoaSpreadsheetWebPartthatimplementsanIRowConsumerconnectioninterfaceintheRowConsumerelementofitssolutionspecificationfile.WhensettoFalse,theSpreadsheetWebPartimportstheXMLdataaccordingtotheXPathstatementspecifiedintheXPathelementwithintheMapelementintheXMLSpreadsheetfileassociatedwiththeWebPart.WhensettoTrue,theSpreadsheetWebPartimportstheXMLdatausingaroot/rowschema(asshownbelow),andmapstherowelementstotheFieldelementswithintheMapelementoftheXMLSpreadsheetfileassociatedwiththeWebPart.ThedefaultisFalse.

Root/RowSchema

<Root><Row><Field1>Field1Value</Field1><Field2>Field2Value</Field2></Row></Root>

Page 560: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TheSpreadsheetWebPartwillattempttomatcheachfieldtagname(suchasField1andField2intheschemaexampleabove)totheIDattributeofaFieldelementwithintheMapelementofanXMLSpreadsheetfile.Forexample,thefollowingXMLfragmentfromanXMLSpreadsheetfileshowsaFieldelementwithanIDattributevalueof"Field1".

<Mapx2:ID="Products_Map"x2:SchemaID="Schema1"x2:RootElement="Products"><Entryx2:Type="table"x2:ID="2"x2:ShowTotals="false"x2:NoInserts="true"><Range>Products!R2C1:R4C8</Range><HeaderRange>R1C1</HeaderRange><x:FilterOn>True</x:FilterOn><XPath>/Products/Products_Row</XPath><Fieldx2:ID="Field1"><Range>RC</Range><XPath>ProductID</XPath><XSDType>int</XSDType></Field>...

NoteTheShowDialogsargumentdoesnotcontrolwhetheradialogboxwillbedisplayedforerrorsexternaltotheSpreadsheetcomponent,suchaserrorsreturnedbyscriptingcomponents.TopreventadialogboxfromdisplayingforerrorsexternaltotheSpreadsheetcomponent,youmusttrapthoseerrorsinyourscript.

Page 561: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

UsetheImportXmlmethodtoimportthecontentsofanXMLdatafileintocellsorintoanXMLlistmappedtoaspecificschemamap.IfthecontentsoftheXMLdatafiletobeimporteddonotmatchthespecifiedschemamapandtheImportXmloperationfails,anerrordialogboxwillbedisplayedwhentheoptionalShowDialogsargumentissettoTrue.

TheXMLdatabeingimportedneedsto"match"theXmlMapit'sbeingimportedinto—thatis,theXPathscontainedintheXmlMapentriesandfieldsshouldcorrespondtosomeelementorattributeintheimporteddata.

Duringanasynchronousbinding,alldata-bindingobjectmodelcallsthatincludeXmlMap.ImportXmlwillreturnanerrormessagethatsaystherequestedoperationcannotbecompletedbecauseanasynchronousbindingisinprogress.Objectmodelcallswillstarttosucceedwhentheasynchronousbindingiscomplete.

Page 562: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleshowshowyoucanusetheCanQuerypropertytofirstcheckwhetherabindingcanbequeried.Ifitcan,thecoderefreshesthebinding.AneventhandertrapstheBindingCompletedevent,whichthencallstheExportXmlInfofunction,passinganotherinstanceoftheSpreadsheetcomponentasanargumenttothatfunction.IntheExportXmlInfofunction,theExportXMLmethodiscalledandtheXMLdatastreamisreturnedtothecallingfunctionandusedastheinputfortheImportXmlmethod.

DimobjBindingDimobjBindingsDimobjXmlStringInDimobjXmlMap

SetobjXmlMap=Spreadsheet1.ActiveWorkbook.XmlMaps.Item(1)SetobjBindings=Spreadsheet1.ActiveWorkbook.XmlDataBindings

ForEachobjBindingInobjBindingsIfobjBinding.CanQuery=TrueobjBinding.RefreshEndIfNext

SubSpreadsheet1_BindingCompleted(bindingID,Action)

DimobjXmlStringInDimobjXmlMap

'WriteoutthedatainthespecifiedmaptoanXMLdatastream.objXmlStringIn=ExportXmlInfo(Spreadsheet2)

Page 563: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'UsetheXMLdatastreambypassingitastheargumenttotheImportXmlmethod.objXmlMap.ImportXmlobjXmlStringIn

EndSub

FunctionExportXmlInfo(Spreadsheet2)DimobjXmlMap

SetobjXmlMap=Spreadsheet2.ActiveWorkbook.XmlMaps.Item(1)'Returnthemaptothecallingfunction.ExportXmlInfo=objXmlMap.ExportXml()EndFunction

NoteForinformationontrappingtheBindingCompletedeventfromscriptrunninginaWebpage,seetheBindingCompletedeventtopic.

Page 564: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InsertMethod

Insertsacellorarangeofcellsintotheworksheetandshiftsothercellsawaytomakespace.

expression.Insert(Shift)

expressionRequired.AnexpressionthatreturnsaRangeobject.

ShiftOptionalVariant.Specifieswhichwaytoshiftthecells.CanbeoneofthefollowingXlInsertShiftDirectionconstants:xlShiftToRightorxlShiftDown.Ifthisargumentisomitted,MicrosoftExceldecidesbasedontheshapeoftherange.

Page 565: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InsertFieldSetMethod

Insertsafieldsetonthespecifiedaxis.

expression.InsertFieldSet(FieldSet,Before,Remove)

expressionAnexpressionthatreturnsaPivotAxis,PivotDataAxis,PivotFilterAxis,orPivotGroupAxisobject.

FieldSetRequiredPivotFieldSetobject.Specifiesthefieldsettobeinserted.

BeforeOptionalVariant.Specifiestheindexofthefieldsetbeforewhichtheinsertedfieldsetwillbeplaced.

RemoveOptionalBoolean.Thisargumentisreservedforfutureuse,anditsvalueisalwaysTrue.Whenthefieldsetisaddedtothespecifiedaxis,itisremovedfromanyotheraxis.

Page 566: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsafieldsettotherowaxis,dataaxis,andfilteraxisofPivotTable1.

SubAdd_Fields_To_PivotTable()DimvwViewDimptConstantsDimtotOrderCountSetptConstants=PivotTable1.ConstantsSetvwView=PivotTable1.ActiveView'AddtheShipCountryfieldtotherowaxis.vwView.RowAxis.InsertFieldSetvwView.FieldSets("ShipCountry")'AddtheOrderIdfieldtothedataaxis.vwView.DataAxis.InsertFieldSetvwView.FieldSets("OrderID")'AddtheShipViafieldtothefilteraxisvwView.FilterAxis.InsertFieldSetvwView.FieldSets("ShipVia")'Createatotalnamed"OrderCount"thatcountstheOrderIDfield.SettotOrderCount=vwView.AddTotal("OrderCount",vwView.FieldSets("OrderId").Fields("OrderId"),_ptConstants.plFunctionCount)'AddtheOrderCounttotaltothedataaxis.vwView.DataAxis.InsertTotaltotOrderCountEndSub

Page 567: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InsertTotalMethod

AddsaPivotTotalobjecttothePivotTotalscollection.

expression.InsertTotal(Total,Before)

expressionAnexpressionthatreturnsaPivotDataAxisobject.

TotalRequiredPivotTotalobject.Specifiesthetotaltobeinserted.

BeforeOptionalVariant.Specifiestheindexofthetotalbeforewhichtheinsertedtotalwillbeplaced.Ifyoudonotspecifythisargument,thetotalisinsertedattheendofthecollection.

Page 568: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIfthePivotTotalobjectiscurrentlypartofthePivotTotalscollection,theobjectisfirstremovedfromthatcollectionandthenreinsertedintoit.Thischangesthedisplayorderbecausetotalsaredisplayedintheircollectionorder.

Page 569: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatotalnamed"TotalBudget"thatsumsthevaluesintheBudgetfieldtoPivotTable1,thentheninsertsthetotalintothePivotTableview.

SubAdd_Total()DimvwViewDimptConstantsDimtotNewTotal

SetvwView=PivotTable1.ActiveViewSetptConstants=PivotTable1.Constants'Addanewtotalnamed"TotalBudget"tothecurrentview.SettotNewTotal=vwView.AddTotal("TotalBudget",vwView.Fieldsets("budget").Fields(0),_ptConstants.plFunctionSum)'InsertthenewlycreatedtotalintothedetailareaofthePivotTable.vwView.DataAxis.InsertTotaltotNewTotal

EndSub

Page 570: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 571: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsButtonEnabledMethod

IsButtonEnabledmethodasitappliestotheDataPageobject.

IsButtonEnabledmethodasitappliestotheRecordNavigationControlobject.

Page 572: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ItemMethod

ReturnsaNameobjectfromtheNamescollection.

expression.Item(Index,IndexLocal,RefersTo)

expressionRequired.AnexpressionthatreturnsaNamesobject.

IndexOptionalVariant.Thenameornumberofthedefinednametobereturned.

IndexLocalOptionalVariant.Thenameofthedefinedname,inthelanguageoftheuser.Nonameswillbetranslatedifyouusethisargument.

RefersToOptionalVariant.Thisargumentisnotsupported.

Page 573: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumustspecifyone,andonlyone,ofthesethreearguments.

Page 574: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledeletesthename"SortRange"fromtheworkbook.

Spreadsheet1.ActiveWorkbook.Names("SortRange").Delete

Page 575: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LargeScrollMethod

Scrollsthecontentsofthewindowbypages.Thesizeofthepagesisdeterminedbythenumberofrowsandcolumnsvisibleintheactivewindow.

expression.LargeScroll(Down,Up,ToRight,ToLeft)

expressionRequired.AnexpressionthatreturnsaWindowobject.

DownOptionalVariant.Thenumberofpagestoscrollthecontentsdown.

UpOptionalVariant.Thenumberofpagestoscrollthecontentsup.

ToRightOptionalVariant.Thenumberofpagestoscrollthecontentstotheright.

ToLeftOptionalVariant.Thenumberofpagestoscrollthecontentstotheleft.

Page 576: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIfDownandUporToRightandToLeftarebothspecified,thecontentsofthewindowarescrolledbythedifferenceofthearguments.Forexample,ifDownis3andUpis6,thecontentsarescrolledupthreepages.

Anyoftheargumentscanbeanegativenumber.

Page 577: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthecontentsoftheactivewindowofSpreadsheet1downthreepagesandtotherighttwopages.

Spreadsheet1.ActiveWindow.LargeScroll3,,2

Page 578: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LoadMethod

LoadsXMLchartdatafromaURLorlocalfile.ThefilemustconsistofonlychartingXML,anditcannotcontainanyleadingHTML.Thestringmustbeginwith<scriptlanguage="XML">andendwith</script>.

expression.Load(FileNameAsString)

expressionAnexpressionthatreturnsaChartSpaceobject.

FileNameRequiredString.SpecifiesthefilecontainingXMLchartdata.

Page 579: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleloadsthespecifiedXMLdatafile.

ChartSpace1.Load"chart.xml"

Page 580: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LoadTextMethod

Loadsandparsesthespecifiedtextfileintoaworksheet.Thecontentsofthetextfileareloadedintotheworksheetbeginningatthespecifiedcell.Existingcellcontentswillbeoverwritten.

expression.LoadText(File,Delimiters,ConsecutiveDelimAsOne,TextQualifier)

expressionAnexpressionthatreturnsaRangeobject.

FileRequiredString.Specifiesthenameofthetextfile.

DelimitersOptionalString.Specifiesthefielddelimiters.Thedefaultvalueisnodelimiter.

ConsecutiveDelimAsOneOptionalBoolean.Truetohaveconsecutivedelimitersconsideredasasingledelimiter.ThedefaultvalueisFalse.

TextQualifierOptionalString.Specifiesthetextqualifier.Thedefaultvalueisthedoublequotationmarkcharacter.

Page 581: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleinsertsatab-delimitedtextfileintotheactiveworksheetofSpreadsheet1.ThecontentsofthetextfilewillbeginincellB10.

Spreadsheet1.ActiveSheet.Range("B10").LoadText"tabfile.txt",Chr$(9)

Page 582: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MakeCurrentMethod

Makesthespecifiedsectionthecurrentsection.

expression.MakeCurrent(ScrollIntoView)

expressionAnexpressionthatreturnsaSectionobject.

ScrollIntoViewOptionalBoolean.SetthisargumenttoTruetoscrollthesectionintoview.ThedefaultvalueisFalse.

Page 583: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MergeMethod

Createsamergedcellfromthespecifiedrange.Whenyoucreateamergedcell,thevalueintheupper-leftcellinthespecifiedrangeisusedforthemergedcellvalue.Allothercellvaluesinthemergedcellareignored.

expression.Merge(Across)

expressionAnexpressionthatreturnsaRangeobject.Thismethodfailsiftherangeonlypartiallyenclosesapreviouslymergedcell.

AcrossOptionalVariant.Truetomergecellsineachrowinthespecifiedrangeasseparatemergedcells.ThedefaultvalueisFalse.

Page 584: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesamergedcellfromtherangeB2:C5andputsathickredborderaroundthemergedcell.

SubMerge_Cells()DimssConstantsDimrngMerged

SetssConstants=Spreadsheet1.Constants

'MergecellsB2:C5.Spreadsheet1.ActiveSheet.Range("B2:C5").Merge

'Setavariabletothemergedrange.SetrngMerged=Spreadsheet1.ActiveSheet.Range("B2").MergeArea

'Formatthemergedcell.rngMerged.Borders.Color="Red"rngMerged.Borders.Weight=ssConstants.owcLineWeightThickrngMerged.HorizontalAlignment=ssConstants.xlHAlignCenterrngMerged.VerticalAlignment=ssConstants.xlVAlignCenterEndSub

Page 585: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveMethod

Movesthesheettoanotherlocationintheworkbook.

expression.Move(Before,After)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

BeforeOptionalVariant.Thesheetbeforewhichthemovedsheetwillbeplaced.YoucannotspecifyBeforeifyouspecifyAfter.

AfterOptionalVariant.Thesheetafterwhichthemovedsheetwillbeplaced.YoucannotspecifyAfterifyouspecifyBefore.

Page 586: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveDetailLeftMethod

Scrollsthedetailareatotheleftstartingatthespecifiedcolumnmember.

expression.MoveDetailLeft(DetailLeft,DetailLeftOffset,Update)

expressionRequired.AnexpressionthatreturnsaPivotColumnMemberobject.

DetailLeftRequiredLong.Anindexnumberindicatingforthecelltouseasthebasisforscrolling.Forexample,useavalueof2tostartthescrollingatthethirdcolumninthedetailarea.

DetailLeftOffsetRequiredLong.Thenumberofpixelstoscroll.

UpdateOptionalBoolean.Determineswhetherornotthedisplayisupdated.ThedefaultvalueisTrue.

Page 587: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthedetailareatotheleftby10pixelsstartingatthesecondcolumn.

SubScrollDetailColumns()

DimptDataDimpmColumnMember

SetptData=PivotTable1.ActiveData

SetpmColumnMember=ptData.ColumnAxis.Member

'Scrollthefirstcolumninthedetailarea'theleftby10pixels.pmColumnMember.MoveDetailLeft1,10

EndSub

Page 588: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveDetailTopMethod

Scrollsthethedetailareadownstartingatthespecifiedcell.

expression.MoveDetailTop(DetailTop,DetailTopOffset,Update)

expressionRequired.AnexpressionthatreturnsaPivotCellobject.

DetailTopRequiredLong.Anindexnumberindicatingthecelltouseasthebasisforscrolling.Forexample,useavalueof5tostartthescrollingatthesixthrowinthedetailarea.

DetailTopOffsetRequiredLong.Thenumberofpixelstoscroll.Use0toscrolltherecordspecifiedintheDetailTopargumenttothetopofthedetailarea.

UpdateOptionalBoolean.Determineswhetherornotthedisplayisupdated.ThedefaultvalueisTrue.

Page 589: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheMoveDetailLeftmethodtoscrollthedetailareatotheleft.

Page 590: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthefifteenthrowtothefirstrowdisplayedinthedetailarea.

SubScrollDetailArea()

DimptDataDimpmColumnMemberDimpmRowMember

SetptData=PivotTable1.ActiveData

SetpmRowMember=ptData.RowAxis.MemberSetpmColumnMember=ptData.ColumnAxis.Member

'Startingatthe15throwofthedetailarea,scroll100pixels.ptData.Cells(pmRowMember,pmColumnMember).MoveDetailTop

EndSub

Page 591: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveFirstMethod

Movestothefirstrecordinthedataaccesspagerecordset.Thismethodfailsifthecurrentrecordisthefirstrecordintherecordset.

expression.MoveFirst

expressionAnexpressionthatreturnsaDataPageobject.

Page 592: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveLastMethod

Movestothelastrecordinthedataaccesspagerecordset.Thismethodfailsifthecurrentrecordisthelastrecordintherecordset.

expression.MoveLast

expressionAnexpressionthatreturnsaDataPageobject.

Page 593: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveLeftMethod

Scrollsacolumnfieldmemberleftbythespecifiednumberofpixels,oruntilthenextrowmemberhasbeenscrolledtotheleftsideofthedisplay.

expression.MoveLeft(Left,LeftOffset,Update)

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

LeftRequiredPivotColumnMemberobject.Thecolumnmembertoscroll.

LeftOffsetRequiredLong.Thenumberofpixelstoscrollthemember.

UpdateOptionalBoolean.Determineswhetherornotthedisplayisupdated.ThedefaultvalueisTrue.

Page 594: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheMoveToppropertytoscrollrowfieldmembers.

Page 595: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthePivotTableviewtothenextcolumnmember.

SubScrolltoNextColumnMember()

DimptData

SetptConstants=PivotTable1.Constants

SetptData=PivotTable1.ActiveData

'Scrolltothenextcolumnmember.ptData.MoveLeftptData.Left,1000

EndSub

Page 596: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveNextMethod

Movestothenextrecordinthedataaccesspagerecordset.Thismethodfailsifthecurrentrecordisthelastrecordintherecordset.

expression.MoveNext

expressionAnexpressionthatreturnsaDataPageobject.

Page 597: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MovePreviousMethod

Movestothepreviousrecordinthedataaccesspagerecordset.Thismethodfailsifthecurrentrecordisthefirstrecordintherecordset.

expression.MovePrevious

expressionAnexpressionthatreturnsaDataPageobject.

Page 598: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveTopMethod

Scrollsarowfieldmemberupbythespecifiednumberofpixels,oruntilthenextrowmemberhasbeenscrolledtothetopofthedisplay.

expression.MoveTop(Top,TopOffset,Update)

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

TopRequiredPivotRowMemberobject.Therowmembertoscroll.

TopOffsetRequiredLong.Thenumberofpixelstoscrollthemember.

UpdateOptionalBoolean.Determineswhetherornotthedisplayisupdated.ThedefaultvalueisTrue.

Page 599: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheMoveLeftpropertytoscrollcolumnfieldmembers.

Page 600: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthePivotTableviewtothenextrowmember.

SubScrolltoNextRowMember()

DimptData

SetptConstants=PivotTable1.Constants

SetptData=PivotTable1.ActiveData

'Scrolltothenextrowmember.ptData.MoveTopptData.Top,1000

EndSub

Page 601: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NewRecordMethod

Addsanewrecordtothedataaccesspagerecordset.Thismethodfailsiftherecordsetcannotbeupdated.

expression.NewRecord

expressionAnexpressionthatreturnsaDataPageobject.

Page 602: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NzMethod

Usethismethodtoreturnzero,azero-lengthstring(""),oranotherspecifiedvaluewhenavalueisNull.Forexample,youcanusethisfunctiontoconvertaNullvaluetoanothervalueandpreventitfrompropagatingthroughanexpression.ReturnsaVariant.

expression.Nz(Value,ValueIfNull)

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

ValueRequiredVariant.Thevaluetoconvert.

ValueIfNullOptionalVariant.ValuetoreturniftheValueargumentargumentisNull.Thisargumentenablesyoutoreturnavalueotherthanzeroorazero-lengthstring.

Page 603: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodisusefulforexpressionsthatmayincludeNullvalues.Toforceanexpressiontoevaluatetoanon-NullvalueevenwhenitcontainsaNullvalue,usethethismethodtoreturnazero,azero-lengthstring,oracustomreturnvalue.

Forexample,theexpression2+varXwillalwaysreturnaNullvaluewhentheVariantvarXisNull.However,2+MSODSC.Nz(varX)returns2.

Inthenextexample,theoptionalargumentsuppliedtotheNzmethodprovidesthestringtobereturnedifvarFreightisNull.

varResult=MSODSC.Nz(varFreight,"NoFreightCharge")

Page 604: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OverrideDefaultElementFormattingMethod

YouusetheOverrideDefaultElementFormattingmethodtousethedrawingformatofthecurrentChChartDrawobjecttodrawachart.ReturnsNothing.

expression.OverrideDefaultElementFormatting()

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

Page 605: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

MostchartelementsthatgenerateaBeforeRendereventinitializethedrawingsurfacebyusingthedefaultformattingoftheChartcomponent.YoucanusetheOverrideDefaultElementFormattingmethodintheBeforeRendereventproceduretochangethedefaultpropertiesofthecurrentChChartDrawobjectpassedtotheBeforeRendereventasitsdrawObjectparameter.

Page 606: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheOverrideDefaultElementFormattingmethodtochangeapropertyoftheChChartDrawobject:

SubChartspace_BeforeRender(drawObjectAsChChartDraw,chartObjectAsObject,CancelAsByRef) OnErrorResumeNext

'Thisformatwillbeappliedonlytoalllegends. IfTypeName(chartObject)="ChLegend"Then drawObject.border.weight=5 drawObject.border.color="green" drawObject.OverrideDefaultElementFormatting EndIf 'Thisformatwillonlybeappliedtoalltitles. IfTypeName(chartObject)="ChTitle"Then drawObject.border.weight=10 drawObject.border.color="violet" drawObject.OverrideDefaultElementFormatting EndIfEndSub

SubChartspace_AfterRender(drawObjectAsChChartDraw,chartObjectAsObject) SelectCaseTypeName(chartObject) Case"ChLegend","ChTitle" 'ChartspacewillapplytheoverrideddrawObjectformattotheTitleandLegendobjects. drawObject.DrawRectanglechartObject.Left,_ chartObject.Top,chartObject.right,chartObject.bottom EndSelectEndSub

Page 607: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParseTextMethod

Parsesthespecifiedtextstringandplacestheresultinthespecifiedrange.

expression.ParseText(Text,Delimiters,ConsecutiveDelimAsOne,TextQualifier)

expressionAnexpressionthatreturnsaRangeobject.

TextRequiredString.Specifiesthestringtobeparsed.

DelimitersOptionalString.Specifiesthefielddelimiters.

ConsecutiveDelimAsOneOptionalBoolean.Truetohaveconsecutivedelimitersconsideredasonedelimiter.ThedefaultvalueisFalse.

TextQualifierOptionalString.Specifiesthetextqualifier.Thedefaultvalueisthedoublequotationmarkcharacter.

Page 608: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleparsesthespecifiedstringintotherangestartingatcellA1.

Spreadsheet1.ActiveSheet.Range("A1").ParseText"name,address,city,state",","

Page 609: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 610: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PasteMethod

PastemethodasitappliestotheWorksheetobject.

PastemethodasitappliestotheRangeobject.

Page 611: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheWorksheetobject.

AsitappliestotheRangeobject.

Page 612: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PointsToScreenPixelsXMethod

ReturnsaLongvaluethatrepresentsthenumberofpixelsfromtheleftedgeofthespreadsheet'swindowtotheleftedgethefirstcolumninthespreadsheet,plusthevaluespecifiedinthePointsargument.

expression.PointsToScreenPixelsX(Points)

expressionRequired.AnexpressionthatreturnsaWindowobject.

PointsRequiredLong.Thenumberofpixelstoaddtothismethod'sresult.

Page 613: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAlthoughthenameofthismethodsuggeststhatitwillconvertpointvaluestoscreenpixelvalues,itactuallyperformstheactiondescribedaboveusingonlypixelvalues.ForthePointsToScreenPixelsXmethod,thisvaluewillvarybyafixedamount(24pixels)dependingonwhetherrowheadersareturnedon.

Page 614: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplereturns25whenrowheadersareturnedon,andreturns1whenrowheadersareturnedoff.

SubWindow_OnLoad()

MsgBoxSpreadsheet1.ActiveWindow.PointsToScreenPixelsX(0)

EndSub

Page 615: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PointsToScreenPixelsYMethod

ReturnsaLongvaluethatrepresentsthenumberofpixelsfromthetopedgeofthespreadsheet'swindowtothetopedgeofthefirstrowinthespreadsheet,plusthevaluespecifiedinthePointsargument.

expression.PointsToScreenPixelsY(Points)

expressionRequired.AnexpressionthatreturnsaWindowobject.

PointsRequiredLong.Thenumberofpixelstoaddtothismethod'sresult.

Page 616: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAlthoughthenameofthismethodsuggeststhatitwillconvertpointvaluestoscreenpixelvalues,itactuallyperformstheactiondescribedaboveusingonlypixelvalues.ForthePointsToScreenPixelsYmethod,thisvaluewillvarydependingonwhetherthetoolbar(22pixels)andcolumnheaders(17pixels)areturnedon.

Page 617: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplereturns40whenboththetoolbarandcolumnheadersareturnedon,andreturns1whenthetoolbarandcolumnheadersareturnedoff.

SubWindow_OnLoad()

MsgBoxSpreadsheet1.ActiveWindow.PointsToScreenPixelsY(0)

EndSub

Page 618: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 619: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProtectMethod

ProtectmethodasitappliestotheWorksheetobject.

ProtectmethodasitappliestotheWorkbookobject.

Page 620: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettinganunsupportedargumenttoTruewillresultinanrun-timeerror.

Page 621: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheWorksheetobject.

Page 622: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 623: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RangeFromPointMethod

RangeFromPointmethodasitappliestotheChartSpaceobject.

RangeFromPointmethodasitappliestotheWindowobject.

Page 624: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChartSpaceobject.

Page 625: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RectIntersectMethod

ReturnsaRangeobjectthatrepresentstherectangularintersectionofthespecifiedranges.ReturnsNothingifthespecifiedrangesdonotoverlap.

expression.RectIntersect(Range1,Range2)

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject

Range1RequiredRange.

Range2RequiredRange.

Page 626: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleboldsthecellswherethenamedrange"Range1"overlapsthenamedrange"Range2"intheactivesheetofSpreadsheet1.

SubBoldIntersection()

DimrngIntersectDimrngFirstRangeDimrngSecondRange

'Setavariabletothefirstnamedrange.SetrngFirstRange=Spreadsheet1.ActiveSheet.Range("Range1")

'Setavariabletothesecondnamedrange.SetrngSecondRange=Spreadsheet1.ActiveSheet.Range("Range2")

'Setavariabletotheintersectionofthetwonamedranges.SetrngIntersect=Spreadsheet1.RectIntersect(rngFirstRange,rngSecondRange)

'Checkwhetherthenamedrangesoverlap.IfNotrngIntersectIsNothingThen

'Boldthefontintheoverlappingportion'ofthetworanges.rngIntersect.Font.Bold=True

EndIf

EndSub

Page 627: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RectUnionMethod

ReturnsaRangeobjectthatrepresentsthesmallestrangeofcellsthatincludestheunionofthespecifiedranges.

expression.RectUnion(Range1,Range2)

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Range1RequiredRange.

Range2RequiredRange.

Page 628: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodalwaysreturnsarectangularrange.Forexample,ifyouspecifyA1:A5andF1:F10,thereturnvalueistherectangularrangeA1:F10.Also,youcannotusethismethodtocreatearangecontainingnoncontiguousareas.

Page 629: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 630: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RefreshMethod

RefreshmethodasitappliestotheXmlDataBindingobject

Page 631: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RefreshmethodasitappliestoallotherobjectsintheAppliesTolist.

Page 632: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheXmlDataBindingobject.

AsitappliestotheChartSpaceobject

Page 633: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RefreshJetCacheMethod

Refreshesthedataaccesspage'sconnectionwithaMicrosoftAccessdatabase.

expression.RefreshJetCache()

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 634: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemoveFieldSetMethod

Removesafieldsetfromthespecifiedaxis.

expression.RemoveFieldSet(FieldSet)

expressionAnexpressionthatreturnsaPivotDataAxis,PivotFilterAxis,orPivotGroupAxisobject.

FieldSetRequiredVariant.Specifiesthefieldsettoberemoved.CanbeaPivotFieldSetobject,afieldsetname,orafieldsetindexnumber.

Page 635: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleremovestheShipViafieldfromthefilteraxisinPivotTable1.

PivotTable1.ActiveView.FilterAxis.RemoveFieldSet"ShipVia"

Page 636: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemoveTotalMethod

Removesatotalfromthespecifieddataaxis.

expression.RemoveTotal(Total)

expressionAnexpressionthatreturnsaPivotDataAxisobject.

TotalRequiredVariant.Specifiesthetotaltoberemoved.CanbeaPivotTotalobject,atotal’sname,oratotal’sindexnumber.

Page 637: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleremovestheOrderCounttotalfromthecurrentviewinPivotTable1.

PivotTable1.ActiveView.DataAxis.RemoveTotal"OrderCount"

Page 638: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RepaintMethod

Forcesaredrawofthespecifiedobject.

expression.Repaint

expressionRequired.AnexpressionthatreturnsaChartSpaceorSpreadsheetobject.

Page 639: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RequeryMethod

Executesthequerythatreturnedtherecordsetandallrelatedrecordsetsforthespecifiedobject.

expression.Requery

expressionAnexpressionthatreturnsaDataPageobject.

Page 640: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ResetMethod

ResetsthespecifiedHeadingobject.Usethismethodtoresetaspecificroworcolumnheading.UsetheResetHeadingsmethodifyouwanttoresetallrowandcolumnheadingsinawindowtotheirdefaultvalues.

expression.Reset

expressionRequired.AnexpressionthatreturnsaHeadingobject.

Page 641: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresetsthecaptionofcolumnDintheactivewindowofSpreadsheet1toitsdefaultvalue.

Spreadsheet1.ActiveWindow.ColumnHeadings(4).Reset

Page 642: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ResetColorsMethod

Resetsthecolorpaletteofthespecifiedworkbooktothedefaultcolors.

expression.ResetColors

expressionRequired.AnexpressionthatreturnsaWorkbookobject.

Page 643: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleresetsthecolorpaletteoftheworkbookthatisopeninSpreadsheet1backtoitsdefaultsetting.

Spreadsheet1.ActiveWorkbook.ResetColors

Page 644: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ResetHeadingsMethod

Resetstherowandcolumnsheadingsofthespecifiedwindowtotheirdefaultvalues.UsetheResetmethodinsteadifyouwanttoresetspecificrowandcolumnheadings.

expression.ResetHeadings

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 645: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleresetstherowandcolumnheadingsoftheactivewindowinSpreadsheet1totheirdefaultvalues.

Spreadsheet1.ActiveWindow.ResetHeadings

Page 646: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RotateClockwiseMethod

Rotatesallseriesinthespecifiedchartclockwisein90-degreeincrements.

expression.RotateClockwise

expressionAnexpressionthatreturnsaChPlotAreaobject.

Page 647: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplerotatesallseriesinthespecifiedchartclockwise90degrees.

ChartSpace1.Charts(0).PlotArea.RotateClockwise

Page 648: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RotateCounterClockwiseMethod

Rotatesallseriesinthespecifiedchartcounterclockwisein90-degreeincrements.

expression.RotateCounterClockwise

expressionAnexpressionthatreturnsaChPlotAreaobject.

Page 649: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplerotatesallseriesinthespecifiedchartcounterclockwise90degrees.

ChartSpace1.Charts(0).PlotArea.RotateCounterClockwise

Page 650: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SaveMethod

Savesthecurrentrecordtothedatabaseassociatedwiththespecifieddataaccesspage.

expression.Save

expressionAnexpressionthatreturnsaDataPageobject.

Page 651: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ScrollIntoViewMethod

Scrollsthedocumentwindowsothatthecontentsofaspecifiedrectangularareaaredisplayedineithertheupper-leftorlower-rightcornerofthedocumentwindoworpane(dependingonthevalueoftheStartargument).

expression.ScrollIntoView(Left,Top,Width,Height,Start)

expressionRequired.AnexpressionthatreturnsaWindowobject.

LeftRequiredLong.Thehorizontalpositionoftherectangle(inpoints)fromtheleftedgeofthedocumentwindoworpane.

TopRequiredLong.Theverticalpositionoftherectangle(inpoints)fromthetopofthedocumentwindoworpane.

WidthRequiredLong.Thewidthoftherectangleinpoints.

HeightRequiredLong.Theheightoftherectangleinpoints.

StartOptionalVariant.Truetohavetheupper-leftcorneroftherectangleappearintheupper-leftcornerofthedocumentwindoworpane.Falsetohavethelower-rightcorneroftherectangleappearinthelower-rightcornerofthedocumentwindoworpane.ThedefaultvalueisTrue.

Page 652: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheStartargumentisusefulfororientingthescreendisplaywhentherectangleislargerthanthedocumentwindow.

Page 653: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledefinesa100-by-200-pixelrectangleintheactivedocumentwindow,positioned20pixelsfromthetopofthewindowand50pixelsfromtheleftedgeofthewindow.Theexamplethenscrollsthedocumentupandtotheleftsothattheupper-leftcorneroftherectangleisalignedwiththeupper-leftcornerofthewindow.

Spreadsheet1.ActiveWindow.ScrollIntoView50,20,100,200

Page 654: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 655: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectMethod

SelectmethodasitappliestotheChartSpace,ChAxis,ChCategoryLabel,ChChart,ChChartField,ChDataLabel,ChDataLabels,ChErrorBars,ChGridlines,ChLegend,ChLegendEntry,ChPlotArea,ChPoint,ChSeries,ChSurface,ChTitle,ChTrendline,Range,Sheets,Worksheet,andWorksheetsobjects.

SelectmethodasitappliestothePivotTableobject.

Page 656: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleselectsthecellthatisonecolumntotherightofandinthesamerowastheactivecell.

Spreadsheet1.ActiveCell.Offset(0,1).Select

Page 657: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 658: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Select2Method

YouusetheSelect2methodoftheChPointobjecttoworkwithanobjectinthecollectionofcurrentlyselectedobjects.ReturnsNothing.

expression.Select2(selmode)

expressionRequired.AnexpressionthatreturnsaChPointobject.

selmodeOptionalChartSelectMode.

Page 659: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheSelect2methodissimilartotheSelectmethodoftheChPointobject,excepttheSelect2methodhasanoptionalselmodeparameter.Theprimaryselectionistypicallythefirstobjectselected.Otherselectedobjectsaresecondaryselections.OnlytheprimaryselectionisrecognizedbyChartcomponentmethodsandpropertiesthatworkwiththecurrentselection.

Page 660: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 661: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetDataMethod

Setsdataforthespecifiedchartobject.

expression.SetData(Dimension,DataSourceIndex,DataReference)

expressionAnexpressionthatreturnsaChChart,ChErrorBarsChSeries,orChartSpaceobject.

DimensionRequiredChartDimensionsEnumconstant.Specifiesthedatadimensiontobeset.

DataSourceIndexRequiredLong.CanbeaChartSpecialDataSourcesEnumconstant.

DataReferenceOptionalVariant.ForChChartandChSeriesobjects,thisargumentspecifiesthedatareferenceasaMicrosoftExcel-stylerangereference("A1:D4",forexample),orarow-setcolumnname.WhentheDataSourceIndexargumentissettochDataLiteral,youcansetDataReferencetoaone-dimensionalarrayoracomma-delimitedlist.ForChErrorBarsobjects,thisargumentspecifiesanarrayofDoubleorStringvaluesyoucanuseforerror-barvalues.Notethatyoucanusethisargumentonlywithcustomerrorbars(theerror-barTypepropertymustbesettochErrorBarTypeCustom).

Page 662: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAlternatively,youcanspecifyaChartErrorBarCustomValuesEnumconstantfortheDimensionargumenttospecifythevaluestouseforerrorbars.

Youcanbindacharttoonlyonedatasource.Forexample,ifyouhavetwochartsinaChartSpace,youcannotbindthemtodifferentdatasources.However,youcanbindachartordataseriestoasetofliteraldataoncethechartorChartSpacehasbeenboundtoanexternaldatasource.

WhenbindingtoanOLAPdatasource,theDataReferenceargumentcanbindtoafieldset,butnotafield.YoucanpassanarrayoffieldstotheDataReferenceargumenttobindtoaspecificfieldorfieldswhenconnectedtoanOLAPdatasource.

Page 663: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesachartusingliteraldataarrays.

SubBindChartToArrays()

DimasSeriesNames(1)DimasCategories(7)DimaiValues(7)DimchConstantsDimchtNewChart

asSeriesNames(0)="SatisfactionData"

asCategories(0)="VeryGood"asCategories(1)="Good"asCategories(2)="N/A"asCategories(3)="Average"asCategories(4)="NoResponse"asCategories(5)="Poor"asCategories(6)="VeryPoor"

aiValues(0)=10aiValues(1)=22aiValues(2)=6aiValues(3)=31aiValues(4)=5aiValues(5)=14aiValues(6)=12

SetchConstants=ChartSpace1.Constants

Page 664: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'AddanewcharttoChartspace1.SetchtNewChart=ChartSpace1.Charts.Add

'Specifythatthechartisacolumnchart.chtNewChart.Type=chConstants.chChartTypeColumnClustered

'Bindthecharttothearrays.chtNewChart.SetDatachConstants.chDimSeriesNames,chConstants.chDataLiteral,asSeriesNameschtNewChart.SetDatachConstants.chDimCategories,chConstants.chDataLiteral,asCategorieschtNewChart.SeriesCollection(0).SetDatachConstants.chDimValues,chConstants.chDataLiteral,aiValues

EndSub

Thisexamplecreatesachartthatisboundtoaspreadsheet.TheseriesnameisincellB1,thecategorynamesareincellsA2:A28,andthevaluesareincellsB2:B28.

SubBindToSpreadsheet()DimchConstantsDimchtChart1

SetchConstants=ChartSpace1.Constants

'SetthedatasourceofChartSpace1toSpreadsheet1.SetChartSpace1.DataSource=Spreadsheet1

'SetavariabletoanewchartinChartspace1.SetchtChart1=ChartSpace1.Charts.Add

'Setthecharttype.chtChart1.Type=chConstants.chChartTypeLineMarkers

Page 665: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'BindtheseriesnametocellB1inthefirstsheetofSpreadsheet1.chtChart1.SetDatachConstants.chDimSeriesNames,chConstants.chDataBound,"B1"

'BindthecategoryaxistocellA2:A28inthefirstsheetofSpreadsheet1.chtChart1.SetDatachConstants.chDimCategories,chConstants.chDataBound,"A2:A28"

'BindthevaluesofthedataseriestocellsB2:B28inthefirstsheetofSpreadsheet1.chtChart1.SeriesCollection(0).SetDatachConstants.chDimValues,chConstants.chDataBound,"B2:B28"

EndSub

ThefollowingexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreated.Thesmallervaluesaredisplayedinwhite,thenlargervaluesaredisplayedinalightshadeofblue,andfinallythelargestvaluesinthechartaredisplayedindarkblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1DimchConstants

SetchConstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;PersistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=ServerName;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields

Page 666: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'intheOrderdetailstable.ChartSpace1.SetDatachConstants.chDimCategories,chConstants.chDataBound,"ProductID"ChartSpace1.SetDatachConstants.chDimValues,chConstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachConstants.chDimFormatValues,chConstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Specifythatthedivisionsinformattingbecreatedautomatically.segSegment1.HasAutoDivisions=True

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chConstants.chBoundaryValuePercentsegSegment1.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%.segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"

EndSub

Page 667: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetExtentMethod

YouusetheSetExtentmethodtotospecifytheviewextentoftheChScrollViewobjectofaChartcomponent.ReturnsNothing.

expression.SetExtent(HorizontalExtent,VerticalExtent)

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

HorizontalExtentRequiredLong.

VerticalExtentRequiredLong.

Page 668: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

UsingthismethodtospecifythecurrentscrollviewpositionhasthesameeffectassettingtheHorizontalExtentandVerticalExtentpropertiesindividually.IfyouusetheSetExtentmethodratherthantheHorizontalExtentandVerticalExtentpropertiesindividually,however,lessrepaintingwilloccur.

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

TheVerticalPositionandHorizontalPositionpropertiesdescribetheupper-leftcornerofthevisibleplotarea.TheVerticalExtentandHorizontalExtentpropertiesdescribethelower-rightcornerofthevisibleplotarea.Becauseyouwillfrequentlyworkwiththesepropertiestogether,youcanuseSetPositionmethodtospecifytheupper-leftcornerofthevisibleplotareaandtheSetExtentmethodtospecifythelower-rightcorner.

Page 669: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheSetExtentmethodtosettheverticalandhorizontalextentofthescrollviewofacharttozoomby200percent.

DimlngHMaxDimlngVMax

lngHMax=ChartSpace1.Charts(0).ScrollView.HorizontalExtentMax*2lngVMax=ChartSpace1.Charts(0).ScrollView.VerticalExtentMax*2

ChartSpace1.Charts(0).ScrollView.SetExtentlngHMax,lngVMax

Page 670: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 671: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetOneColorGradientMethod

FillsthespecifiedChInteriorobjectwithaone-colorgradient.

expression.SetOneColorGradient(GradientStyle,GradientVariant,GradientDegree,Color)

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

GradientStyleRequiredChartGradientStyleEnum.Thegradientstyle.

GradientVariantRequiredChartGradientVariantEnum.Thegradientvariant.

GradientDegreeRequiredDouble.Thegradientdegree.Canbeavaluefrom0.0(dark)through1.0(light).

ColorOptionalVariant.Theforegroundcolorforthegradient.YoucanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(forexample,redisRGB(255,0,0)).Ifthisargumentisomitted,thentheColorpropertyisused.

Page 672: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorfillofthefirsttwoseriesandtheplotareaofthefirstchartinChartSpace1.

SubFormatInteriorColors()

DimchConstantsDimserSeries1DimserSeries2

SetchConstants=ChartSpace1.Constants

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)SetserSeries2=ChartSpace1.Charts(0).SeriesCollection(1)

'Settheinteriorfillofthefirstseriestoaone-colorgradient.serSeries1.Interior.SetOneColorGradientchConstants.chGradientDiagonalDown,_chConstants.chGradientVariantCenter,0.2,"Blue"

'Settheinteriorfillofthesecondseriestoapresetgradient.serSeries2.Interior.SetPresetGradientchConstants.chGradientFromCenter,_chConstants.chGradientVariantEnd,chConstants.chGradientDaybreak

'Settheinteriorfilloftheplotareatoapattern.ChartSpace1.Charts(0).PlotArea.Interior.SetPatternedchConstants.chPattern10Percent,_"Yellow","Blue"

EndSub

Page 673: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 674: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetPatternedMethod

FillsthespecifiedChInteriorobjectwithapresetpattern.

expression.SetPatterned(patternType,Color,BackColor)

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

patternTypeRequiredChartPatternTypeEnum.Thepatternstyle.

ColorOptionalVariant.Theforegroundcolorforthepattern.YoucanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(forexample,redisRGB(255,0,0)).Ifthisargumentisomitted,thentheColorpropertyisused.

BackColorOptionalVariant.Thebackgroundcolorforthepattern.YoucanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(forexample,redisRGB(255,0,0)).Ifthisargumentisomitted,thentheBackColorpropertyisused.

Page 675: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorfillofthefirsttwoseriesandtheplotareaofthefirstchartinChartSpace1.

SubFormat_Interior_Colors()

DimchConstantsDimserSeries1DimserSeries2

SetchConstants=ChartSpace1.Constants

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)SetserSeries2=ChartSpace1.Charts(0).SeriesCollection(1)

'Settheinteriorfillofthefirstseriestoaone-colorgradient.serSeries1.Interior.SetOneColorGradientchConstants.chGradientDiagonalDown,_chConstants.chGradientVariantCenter,0.2,"Blue"

'Settheinteriorfillofthesecondseriestoapresetgradient.serSeries2.Interior.SetPresetGradientchConstants.chGradientFromCenter,_chConstants.chGradientVariantEnd,chConstants.chGradientDaybreak

'Settheinteriorfilloftheplotareatoapattern.ChartSpace1.Charts(0).PlotArea.Interior.SetPatternedchConstants.chPattern10Percent,_"Yellow","Blue"

EndSub

Page 676: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetPositionMethod

YouusetheSetPositionmethodtotospecifythecurrentviewpositionoftheChScrollViewobjectofaChartcomponent.ReturnsNothing.

expression.SetPosition(HorizontalPosition,VerticalPosition)

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

HorizontalPositionRequiredLong.

VerticalPositionRequiredLong.

Page 677: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

UsingthismethodtospecifythecurrentscrollviewpositionhasthesameeffectassettingtheHorizontalPositionandVerticalPositionpropertiesindividually.IfyouusetheSetPositionmethodratherthantheHorizontalPositionandVerticalPositionpropertiesindividually,however,lessrepaintingwilloccur.

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotarea,anditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechart;theremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

TheVerticalPositionandHorizontalPositionpropertiesdescribetheupper-leftcornerofthevisibleplotarea.TheVerticalExtentandHorizontalExtentpropertiesdescribethelower-rightcornerofthevisibleplotarea.Becauseyouwillfrequentlyworkwiththesepropertiestogether,youcanuseSetPositionmethodtospecifytheupper-leftcornerofthevisibleplotareaandtheSetExtentmethodtospecifythelower-rightcorner.

Page 678: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleshowsthelower-leftcornerofazoomedchartinthelower-leftcornerofthevisibleplotarea.

DimlngVEDimlngHEDimlngVEMDimlngHEMDimobjScrollView

SetobjScrollView=ChartSpace1.Charts(0).ScrollViewlngVE=objScrollView.VerticalExtentlngHE=objScrollView.HorizontalExtentlngVEM=objScrollView.VerticalExtentMaxlngHEM=objScrollView.HorizontalExtentMax

'Forzoomedchart,displaylowerleftcornerofvirtualplotareain'thelowerleftcornerofthevisibleplotarea.If(lngVE<>lngVEM)Or(lngHE<>lngHEM)ThenobjScrollView.SetPosition0,objScrollView.VerticalPosition+(lngVEM-lngVE)EndIf

Page 679: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 680: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetPresetGradientMethod

FillsthespecifiedChInteriorobjectwithapresetgradientstyle.

expression.SetPresetGradient(GradientStyle,gradientVarient,gradientPreset)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

GradientStyleRequiredChartGradientStyleEnum.Thegradientstyle.

gradientVarientRequiredChartGradientVariantEnum.Thegradientvariant.

gradientPresetRequiredChartPresetGradientTypeEnum.Thegradientstyleusedtofillthespecifiedobject.

Page 681: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorfillofthefirsttwoseriesandtheplotareaofthefirstchartinChartSpace1.

SubFormat_Interior_Colors()

DimchConstantsDimserSeries1DimserSeries2

SetchConstants=ChartSpace1.Constants

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)SetserSeries2=ChartSpace1.Charts(0).SeriesCollection(1)

'Settheinteriorfillofthefirstseriestoaone-colorgradient.serSeries1.Interior.SetOneColorGradientchConstants.chGradientDiagonalDown,_chConstants.chGradientVariantCenter,0.2,"Blue"

'Settheinteriorfillofthesecondseriestoapresetgradient.serSeries2.Interior.SetPresetGradientchConstants.chGradientFromCenter,_chConstants.chGradientVariantEnd,chConstants.chGradientDaybreak

'Settheinteriorfilloftheplotareatoapattern.ChartSpace1.Charts(0).PlotArea.Interior.SetPatternedchConstants.chPattern10Percent,_"Yellow","Blue"

EndSub

Page 682: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetRootRecordsetMethod

SetstherootrecordsetforthespecifiedDataSourceControlobject.Usethismethodtochangetherecordsettowhichadataaccesspageisbound.

expression.SetRootRecordset(RecordsetName,Recordset)

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

RecordsetNameRequiredString.Thenametouseforthenewrecordset.IftheDataSourcecontrolcontainsarecordsetofthisname,itwillbereplaced.

RecordsetRequiredRecordsetobject.TheADOrecordset.

Page 683: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodsupportsconnectingtoanyADOrecordset.

Page 684: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangestherootrecordsetusedbythedatasourcecontrol.

SubChangeRootRecordset()DimrstCategoriesDimstrShapeTextDimstrConnectionString

strShapeText=MSODSC.RootRecordsetDefs(0).ShapeText

strConnectionString="Provider=MSDataShape.1;PersistSecurityInfo=True;DataSource"&"=sqlsvr;IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&"DataProvider=SQLOLEDB.1"

SetrstCategories=CreateObject("ADODB.Recordset")

rstCategories.OpenstrShapeText,strConnectionString,1,3

MSODSC.SetRootRecordset"Categories",rstCategories

EndSub

Page 685: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetSolidMethod

FillsthespecifiedChInteriorobjectwithasolidcolor.Usethismethodtoconvertagradient,textured,patterned,orbackgroundfillbacktoasolidfill.

expression.SetSolid(Color)

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

ColorOptionalVariant.ThecolorforthespecifiedChInteriorobject.YoucanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(forexample,redisRGB(255,0,0)).

Page 686: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorfillofthefirsttwoseriesandtheplotareaofthefirstchartinChartSpace1.

SubFormat_Interior_Fills()

DimchConstantsDimserSeries1DimserSeries2

SetchConstants=ChartSpace1.Constants

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)SetserSeries2=ChartSpace1.Charts(0).SeriesCollection(1)

'Settheinteriorfillofthefirstseriestoatwo-colorgradient.serSeries1.Interior.SetTwoColorGradientchConstants.chGradientDiagonalDown,_chConstants.chGradientVariantCenter,"Blue","Silver"

'Settheinteriorfillofthesecondseriestoasolidcolor.serSeries2.Interior.SetSolid"Purple"

'Settheinteriorfilloftheplotareatoapresettexture.ChartSpace1.Charts(0).PlotArea.Interior.SetTextured_chConstants.chTextureParchment,chConstants.chTile

EndSub

Page 687: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetSpreadsheetDataMethod

BindsthespecifiedchartorchartspacetoarangeofcellsononaworksheetintheSpreadsheetComponent.ThechartmustalreadybeboundtoarangeofcellsintheSpreadsheetComponentbeforeyoucallthismethod.

expression.SetSpreadsheetData(DataReference,SeriesByRows)

expressionRequired.AnexpressionthatreturnsaChartSpaceorChChartobject.

DataReferenceRequiredString.Areferencetotherangeofcellstobindto.Thiscanbeintheformofacellreference(A1:D5),oradefinedname.

SeriesByRowsOptionalBoolean.Specifieswhetherornoteachrowrepresentsadataseries.SetthispropertytoFalseifeachcolumnrepresentsadataseries.

Page 688: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartSpace1tocellsA1:F25inthefirstsheetofSpreadsheet1.

ChartSpace1.SetSpreadsheetData"Sheet1!A1:F25",False

Page 689: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 690: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetTexturedMethod

FillsthespecifiedChInteriorobjectwithanimageorapresettexture.

expression.SetTextured(textureFile,TextureFormat,stackUnit,TexturePlacement)

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

textureFileRequiredVariant.Theimageusedtofilltheinterioroftheobject.YoucanspecifyaURLthatpointstoanimagefileoraChartPresetTextureEnumconstant.

TextureFormatOptionalChartTextureFormatEnum.DetermineshowthepictureisdisplayedwithinthespecifiedChInteriorobject.

stackUnitOptionalDouble.SpecifieshowthepictureisstackedandscaledwhentheTextureFormatargumentissettochStackScale.

TexturePlacementOptionalChartTexturePlacementEnum.AffectswherethepictureisdisplayedwithinthespecifiedChInteriorobject.Thissettingonlyaffects3-Dcharts.

Page 691: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorfillofthefirsttwoseriesandtheplotareaofthefirstchartinChartSpace1.

SubFormat_Interior_Fills()

DimchConstantsDimserSeries1DimserSeries2

SetchConstants=ChartSpace1.Constants

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)SetserSeries2=ChartSpace1.Charts(0).SeriesCollection(1)

'Settheinteriorfillofthefirstseriestoatwo-colorgradient.serSeries1.Interior.SetTwoColorGradientchConstants.chGradientDiagonalDown,_chConstants.chGradientVariantCenter,"Blue","Silver"

'Settheinteriorfillofthesecondseriestoasolidcolor.serSeries2.Interior.SetSolid"Purple"

'Settheinteriorfilloftheplotareatoapresettexture.ChartSpace1.Charts(0).PlotArea.Interior.SetTextured_chConstants.chTextureParchment,chConstants.chTile

EndSub

Page 692: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 693: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetTwoColorGradientMethod

FillsthespecifiedChInteriorobjectwithatwo-colorgradient.

expression.SetTwoColorGradient(GradientStyle,GradientVariant,Color,BackColor)

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

GradientStyleRequiredChartGradientStyleEnum.Thegradientstyle.

GradientVariantRequiredChartGradientVariantEnum.Thegradientvariant.IfGradientStyleischGradientFromCenter,theGradientVariantargumentcanonlybechGradientVariantStartorchGradientVariantEnd.

ColorOptionalVariant.Theforegroundcolorofthegradient.YoucanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(forexample,redisRGB(255,0,0)).Ifomitted,theColorpropertyisusedtodeterminetheforegroundcolor.

BackColorOptionalVariant.Thebackgroundcolorofthegradient.YoucanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(forexample,redisRGB(255,0,0)).Ifomitted,theBackColorpropertyisusedtodeterminetheforegroundcolor.

Page 694: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorfillofthefirsttwoseriesandtheplotareaofthefirstchartinChartSpace1.

SubFormat_Interior_Fills()

DimchConstantsDimserSeries1DimserSeries2

SetchConstants=ChartSpace1.Constants

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)SetserSeries2=ChartSpace1.Charts(0).SeriesCollection(1)

'Settheinteriorfillofthefirstseriestoatwo-colorgradient.serSeries1.Interior.SetTwoColorGradientchConstants.chGradientDiagonalDown,_chConstants.chGradientVariantCenter,"Blue","Silver"

'Settheinteriorfillofthesecondseriestoasolidcolor.serSeries2.Interior.SetSolid"Purple"

'Settheinteriorfilloftheplotareatoapresettexture.ChartSpace1.Charts(0).PlotArea.Interior.SetTextured_chConstants.chTextureParchment,chConstants.chTile

EndSub

Page 695: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowMethod

Scrollsthespreadsheetwindowtomovethespecifiedrangeintoview.

expression.Show

expressionAnexpressionthatreturnsaRangeobject.

Page 696: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIfyouspecifyarangethatisnotontheactiveworksheet,thismethodwillnotactivatethatworksheet.However,thespecifiedrangewillbevisiblewhenyouactivatethatworksheet.Forexample,ifSheet1iscurrentlyactiveandyouusethismethodwithcellA500onSheet2,Sheet1remainsactive.CellA500willbeactiveifyouimmediatelyactivateSheet2,eithermanuallyorbyusingtheActivatemethodoftheWorksheetobject.

Page 697: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthespreadsheetuntilcellP75isvisible.

Spreadsheet1.ActiveSheet.Range("p75").Show

Page 698: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAboutMethod

DisplaystheAboutMicrosoftOfficeWebComponentsdialogbox.

expression.ShowAbout

expressionRequired.AnexpressionthatreturnsaSpreadsheetorPivotTableobject.

Page 699: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAllDataMethod

MakesallfilteredrowsvisibleonthespecifiedworksheetandsetsallfilterstoShowAll.

expression.ShowAllData

expressionAnexpressionthatreturnsaWorksheetobject.

Page 700: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemakesallfilteredrowsvisibleontheactiveworksheetandsetsallfilterstoShowAll.

Spreadsheet1.ActiveSheet.ShowAllData

Page 701: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowContextMenuMethod

Displaysacustomizedcontextmenuatthespecifiedscreencoordinates.

expression.ShowContextMenu(x,y,Menu)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

xRequiredLong.Representsthex-coordinatewherethecontextmenuistoappear.

yRequiredLong.Representsthey-coordinatewherethecontextmenuistoappear.

MenuRequiredVariant.Thearraythatcontainsthemenuitemstodisplay.

Page 702: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysacontextmenu.

SubShowMenu()

DimcmContextMenu(4)DimcmClearSubMenu(2)

cmClearSubMenu(0)=Array("&All","ClearAll")cmClearSubMenu(1)=Array("&Formats","ClearFormats")cmClearSubMenu(2)=Array("&Values","ClearValues")

cmContextMenu(0)=Array("Cu&t","owc2")cmContextMenu(1)=Array("&Copy","owc3")cmContextMenu(2)=Array("&Paste","owc4")cmContextMenu(3)=EmptycmContextMenu(4)=Array("Clea&r",cmClearSubMenu)

Spreadsheet1.ShowContextMenu10,40,cmContextMenu

EndSub

Page 703: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowDetailsMethod

Expandsthedetailscellsforthespecifiedobject.IfthespecifiedobjectisaPivotDataobject,alldetailcellsareexpanded.IfthespecifiedobjectisaPivotRowMemberobject,thenalldetailscellsinthatrowareexpanded.IfthespecifiedobjectisaPivotColumnMemberobject,thenalldetailscellsinthatcolumnareexpanded.

expression.ShowDetails

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 704: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleexpandsallofthedetailcellsinPivotTable1.

PivotTable1.ActiveData.ShowDetails

Page 705: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 706: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowHelpMethod

ShowHelpmethodasitappliestotheChartSpaceobject.

ShowHelpmethodasitappliestothePivotTableandSpreadsheetobjects.

Page 707: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SmallScrollMethod

Scrollsthecontentsofthewindowbyrowsorcolumns.

expression.SmallScroll(Down,Up,ToRight,ToLeft)

expressionRequired.AnexpressionthatreturnsaWindowobject.

DownOptionalVariant.Thenumberofrowstoscrollthecontentsdown.

UpOptionalVariant.Thenumberofrowstoscrollthecontentsup.

ToRightOptionalVariant.Thenumberofcolumnstoscrollthecontentstotheright.

ToLeftOptionalVariant.Thenumberofcolumnstoscrollthecontentstotheleft.

Page 708: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIfDownandUporToLeftandToRightarebothspecified,thecontentsofthewindowarescrolledbythedifferenceofthearguments.Forexample,ifDownis3andUpis6,thethecontentsarescrolledupthreerows.

Anyoftheseargumentscanbeanegativenumber.

Page 709: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthecontentsoftheactivewindowofSpreadsheet1downthreerows.

Spreadsheet1.ActiveWindow.SmallScroll3

Page 710: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 711: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SortMethod

Sortsarangeor,ifthespecifiedrangecontainsonlyonecell,thecurrentregion

expression.Sort(ColumnKey,Order,Header)

expressionAnexpressionthatreturnsaRangeobject.

ColumnKeyOptionalLong.Thenumberofthefirstsortcolumn.Thedefaultvalueis1.

OrderOptionalXlSortOrder.Thesortorder.

HeaderOptionalXlYesNoGuess.Determineswhetherthefirstrowcontainsheaders.

Page 712: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesortstherangeA1:F10indescendingorderbasedoncolumnB.

SubSortData()DimssConstants

SetssConstants=Spreadsheet1.Constants

'SortRangeA1:F10oncolumnBindescendingorderandspecifythat'row1containsheadings.Spreadsheet1.ActiveSheetRange("A1:F10").Sort2,_ssConstants.xlDescending,ssConstants.xlYesEndSub

Page 713: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SortAscendingMethod

Sortsafieldonadataaccesspageinascendingorder.

expression.SortAscending

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 714: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodreliesuponthecurrentselectiononthedataaccesspagetodeterminethefieldtosortby.Therefore,youmustsetthefocustothefieldtosortby,whentheprocedurecontainingthismethodisinvokedbyacontrolonthedataaccesspage,suchasacommandbutton.

Page 715: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesortstheProductNamefieldinascendingorder.

SubSortProductNameAscending()

'SetfocustothecontrolfortheProductNamefield.MSODSC.Datapages(0).FirstSection.HTMLContainer.Children("ProductName").Focus

'Sortthefieldindescendingorder.MSODSC.DataPages(0).SortAscending

EndSub

Page 716: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SortDescendingMethod

Sortsafieldonadataaccesspageindescendingorder.

expression.SortDescending

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 717: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodreliesuponthecurrentselectiononthedataaccesspagetodeterminethefieldtosortby.Therefore,youmustsetthefocustothefieldtosortby,whentheprocedurecontainingthismethodisinvokedbyacontrolonthedataaccesspage,suchasacommandbutton.

Page 718: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesortstheProductNamefieldindescendingorder.

SubSortProductNameDescending()

'SetfocustothecontrolfortheProductNamefield.MSODSC.Datapages(0).FirstSection.HTMLContainer.Children("ProductName").Focus

'Sortthefieldindescendingorder.MSODSC.DataPages(0).SortDescending

EndSub

Page 719: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 720: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

StartEditMethod

Placestheactivedetailcellintoeditmode.

expression.StartEdit(InitialValue,ArrowMode,CaretPosition)

expressionRequired.AnexpressionthatreturnsoneoftheaPivotTableobject.

InitialValueOptionalVariant.Specifiestheinitialvaluetousewheneditingthecell.Thecurrentvalueisusedifyoudonotspecifyavalueforthisargument.

ArrowModeOptionalPivotArrowModeEnum.Specifieshowtheleftandrightarrowsfunctionwhiletheuserisineditmode.

CaretPositionOptionalPivotCaretPositionEnum.Specifiesthepositionoftheinsertionpointwithinthecell.

Page 721: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThismethodwillresultinarun-timeerrorifthecurrentselectionisnotadetailcell,orifthecurrentdataisnoteditable.

Page 722: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TextHeightMethod

CalculatesandreturnsaVariantthatrepresentsthewidthofthespecifiedtextinpixels,basedonthecurrentfontsetting.

expression.TextHeight(Text)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

TextRequiredString.Thetextwhosesizeyouwanttocalculate.

Page 723: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TextWidthMethod

CalculatesandreturnsaVariantthatrepresentsthewidthofthespecifiedtextinpixels,basedonthecurrentfontsetting.

expression.TextWidth(Text)

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

TextRequiredString.Thetextwhosesizeyouwanttocalculate.

Page 724: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ToggleFilterMethod

Togglesthestateofthecurrentfilterthathasbeenappliedtothedataaccesspage.Ifthefilterisactive,callingthismethoddeactivatesthefilter.Callingthismethodasecondtimereappliesthefilter.

expression.ToggleFilter

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 725: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampletogglesthefilteronthefirstdataaccesspageinthedatasourcecontrolnamedMSODSC.

MSODSC.DataPages(0).ToggleFilter

Page 726: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UndoMethod

FortheChartSpaceandSpreadsheetobjects,undoesthelastsingleactionorthelastmacroblocksurroundedbyBeginUndoandEndUndomethodcalls.

FortheDataPageobject,restoresthedataaccesspagetotheconditionbeforetherecordsetwaseditediftheeditshavenotbeensaved.

expression.Undo

expressionAnexpressionthatreturnsaChartSpace,DataPage,orSpreadsheetobject.

Page 727: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleundoesthelastactionordisplaysamessageboxifthisactioncannotbeundone.

IfSpreadsheet1.CanUndoThenSpreadsheet1.UndoElseMsgBox"can'tundolastaction"EndIf

Page 728: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UngroupMethod

Movesthespecifiedseriesintoanewlayer.

expression.Ungroup(UseNewScaling)

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

UseNewScalingOptionalBoolean.SetthisargumenttoTruetospecifythattheseriesusesadifferentscalingthanthepreviouslayer.ThedefaultvalueisFalse.

Page 729: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyoumoveaseriesintoanewlayer,youcanassigntheseriestoanaxisthatisbasedonadifferentvaluescale.

Page 730: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesacombinationchartbasedonliteraldata.Thefirstdataseriesisplottedasaline.Theseconddataseriesisplottedascolumns,andonait'sownvalueaxis.

SubWindow_Onload()

DimasSeriesNames(1)DimasCategories(3)DimaiSeries1(3)DimalSeries2(3)DimchConstantsDimchtNewChartDimserUnitSalesDimserDispIncDimaxIncomeAxis

asSeriesNames(0)="UnitSales"asSeriesNames(1)="DisposableIncome"

asCategories(0)="Item1"asCategories(1)="Item2"asCategories(2)="Item3"asCategories(3)="Item4"

aiSeries1(0)=75aiSeries1(1)=84aiSeries1(2)=30aiSeries1(3)=94

alSeries2(0)=14522

Page 731: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

alSeries2(1)=17321alSeries2(2)=9424alSeries2(3)=41782

SetchConstants=ChartSpace1.Constants

'Enagblethedisplayofthelegend.ChartSpace1.HasChartSpaceLegend=True

'AddanewcharttoChartspace1.SetchtNewChart=ChartSpace1.Charts.Add

'Specifythatthechartisacolumnchart.chtNewChart.Type=chConstants.chChartTypeLineMarkers

'Bindthecharttothearrays.chtNewChart.SetDatachConstants.chDimSeriesNames,chConstants.chDataLiteral,asSeriesNameschtNewChart.SetDatachConstants.chDimCategories,chConstants.chDataLiteral,asCategories

SetserUnitSales=chtNewChart.SeriesCollection(0)

serUnitSales.SetDatachConstants.chDimValues,chConstants.chDataLiteral,aiSeries1

SetserDispInc=chtNewChart.SeriesCollection(1)

serDispInc.SetDatachConstants.chDimValues,chConstants.chDataLiteral,alSeries2

'Ungrouptheseries.serDispInc.UngroupTrue

'Addanewvalueaxistothechartbasedonthevaluesintheseries.SetaxIncomeAxis=chtNewChart.Axes.Add(serDispInc.Scalings(chConstants.chDimValues))

Page 732: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Placetheaxisontherightsideofthechart.axIncomeAxis.Position=chConstants.chAxisPositionRight

'Displaytheseriesascolumns.serDispInc.Type=chConstants.chChartTypeColumnClustered

EndSub

Page 733: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UnMergeMethod

Separatesthespecifiedmergedareaintoindividualcells.Whenyouseparateamergedarea,thevalueinthemergedareaisplacedinthecellintheupper-leftcornerofthearea.Allothercellsarecleared.

expression.UnMerge

expressionAnexpressionthatreturnsaRangeobject.

Page 734: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleseparatesthemergedareacontainingcellA1.

Spreadsheet1.ActiveSheet.Range("A1").UnMerge

Page 735: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UnprotectMethod

Removesprotectionfromaworksheetorworkbook.Thismethodhasnoeffectiftheworksheetorworkbookisn'tprotected.ThismethodisequivalenttosettingtheEnabledpropertyoftheProtectionobjecttoFalse.

expression.Unprotect(Password)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

PasswordThisargumentisnotsupportedinthisversionoftheMicrosoftOfficeSpreadsheetComponent.

Page 736: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UpdateMethod

YouusetheUpdatemethodtowritedatacontainedinanXMLmaptoadatasourceboundtoaSOAPWebservice.ReturnsNothing.

expression.Update(ShowDialogs)

expressionRequired.AnexpressionthatreturnsanXmlDataBindingobject.

ShowDialogsOptionalBoolean.SpecifieswhetheradialogboxisdisplayediftheUpdatemethodencountersanerrorthatisreturnedbytheSpreadsheetcomponentitself.WhenShowDialogsissettoTrue,adialogboxisdisplayediftheUpdatemethodencountersanerrorreturnedbytheSpreadsheetcomponent.WhenShowDialogsissettoFalse,dialogboxesforSpreadsheetcomponenterrorsarenotdisplayed.ThedefaultisFalse.

NoteTheShowDialogsargumentdoesnotcontrolwhetheradialogboxwillbedisplayedforerrorsexternaltotheSpreadsheetcomponent,suchaserrorsreturnedbyscriptingcomponents.TopreventadialogboxfromdisplayingforerrorsexternaltotheSpreadsheetcomponent,youmusttrapthoseerrorsinyourscript.

Page 737: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

IftheUpdatemethodfails,theBindingErroreventoftheSpreadsheetcomponentwillfire,andanyscriptingerrorswillbereturned.TocatchanupdateerroryoumustaddcodetotheBindingErrorevent,ortraperrorsinscript.Duringasynchronousbinding,anyefforttoworkwithanXmlDataBindingobjectprogrammaticallywillfail.YoucanusetheAsyncpropertyoftheXmlDataBindingobjecttodetermineifabindingsupportsasynchronousbinding.YouusetheBindingInProgresspropertyoftheXmlDataBindingobjecttodetermineofanasynchronousbindingisinprogress.

Page 738: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleYoucanaddcodetotheBindingCompletedeventoftheSpreadsheetcomponentthatcallstheUpdatemethodoryoucanusetheBindingInProgresspropertytodetermineifdatabindingisinprogress.ThefollowingexampleusestheUpdatemethodtowritedatabacktothedatasourceofaSOAPWebserviceforallXmlDataBindingobjectsinaSpreadsheetcomponent:

SubUpdateBinding(Spreadsheet1)

Spreadsheet1.ActiveWorkbook.XmlDataBindings.Item(2).Update

EndSub

SubSpreadsheet1_BindingCompleted(bindingID,Action)

IfSpreadsheet1.ActiveWorkbook.XmlDataBindings.Item(bindingID).CanUpdate=TrueThen'Writecodeheretoperformanyadditionalactionsonthisupdatebinding.EndIf

EndSub

NoteForinformationontrappingtheBindingCompletedeventfromscriptrunninginaWebpage,seetheBindingCompletedeventtopic.

Page 739: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UpdatePropertyToolboxMethod

UpdatestheCommandsandOptionswindowfromthecurrentlyselectedobject.

expression.UpdatePropertyToolbox

expressionAnexpressionthatreturnsaSpreadsheetobject.

Page 740: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ValidateMethod

YouusetheValidatemethodtovalidatedatainacellorrangeofcellsintheSpreadsheetcomponent.ReturnsNothing.

expression.Validate

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 741: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheeasiestwaytocreateoneormoredatavalidationrulesforcellsinaSpreadsheetcomponentistouseMicrosoftExcel.YoucanuseExceltocreateanewspreadsheet,oropenanexistingspreadsheet,andthenusetheExceldatavalidationfeaturestocreatedatavalidationrules.YousavethespreadsheetasanXMLSpreadsheetfileandthensettheSpreadsheetcomponent'sXmlUrlpropertytothesavedfile.ValidationrulescreatedintheXMLSpreadsheetfiletriggervalidationruleerrormessagesonlywhendataisenteredthroughtheuserinterface.Forexample,whenauserentersdataintoacellthatviolatesavalidationrule,avalidationruleerrormessageisdisplayedtotheuser.However,ifdataisenteredintoacellprogrammatically,oriftheImportXmlmethodisusedtoimportanewXMLdatafileintotheSpreadsheetcomponentthatcontainsinvaliddata,noerrormessagesaretriggered.Inthiscircumstance,youcanusetheValidatemethodtodeterminewhethersuchdataisvalid.

TheValidatemethoddoesnotreturnavalueindicatingthatacellorrangeofcellscontainsinvaliddata.IfyouareusingMicrosoftVisualBasicScriptingEdition(VBScript)tovalidatedata,youmustusetheOnErrorResumeNextstatementonthelineimmediatelyprecedingthecalltotheValidatemethod.InthelineimmediatelyafterthecalltotheValidatemethod,usetheNumberpropertyoftheVBScriptErrobjecttotestwhethervalidationsucceeded.

Page 742: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleillustratesafunctionthatreturnsTrueifthedatainacellisvalidandFalseifnotitisnotvalid.

DimobjRangeSpreadsheet1.xmlurl="MyXmlSpreadsheetFile.xml"SetobjRange=Spreadsheet1.Workbooks(1).ListObject("EntryID").DataBodyRange

IfValidateRange(objRange)=TrueThen'Validationsucceeded.Else'Validationfailed.EndIf

FunctionValidateRange(objRange)DimlngErrorOnErrorResumeNextobjRange.Validate()lngError=Err.NumberIflngError<>0ThenValidateRange=TrueExitFunctionEndIfValidateRange=FalseEndFunction

ThenextexampleaddsdatatoacellandthenusestheValidatemethodtodeterminewhetherthedatasatisfiesthecell'svalidationrule:

DimobjRange

Page 743: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SetobjRange=Spreadsheet1.ActiveCell

objRange.Value=100OnErrorResumeNext

objRange.Validate

IfErr.Number<>0thenobjRange.Value=""EndIf

Page 744: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 745: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ValueToPointMethod

ValueToPointmethodasitappliestotheChAxisobject.

ValueToPointmethodasitappliestotheChSeriesobject.

Page 746: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethexandypropertiesofthereturnedCoordinateobjecttoreturntheXandY-coordinatesforthespecifieddatapoint.

Page 747: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChSeriesobject.

Page 748: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveProperty

ReturnsTrueiftherowrepresentedbytheListRowobjectisselected.Read/writeBoolean.

expression.Active

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

SettingtheActivepropertyofaListRowobjectequaltoTrueisnotreflectedintheRangeobjectreturnedbytheSelectionproperty.Toaddarowtoaselectedrange,youmustusetheSelectmethodinstead.

Page 749: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecheckswhetherthespecifiedrowintheXMLlistisselected.

SubIsRowActive()

DimobjListsDimobjLRowsDimobjLRow

SetobjLists=Spreadsheet1.ActiveSheet.ListObjectsSetobjLRows=objLists.Item(1).ListRows'Savelistrowinformationforthethirdrowtoavariable.SetobjLRow=objLRows.Item(3)

'Displaywhetherthecurrentrowisselected.IfobjLRow.ActiveThenMsgBox("Rowisselected.")ElseMsgBox("Rowisnotselected.")EndIf

EndSub

Page 750: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveCellProperty

ReturnsaRangeobjectthatrepresentstheactivecell.Read-only.

expression.ActiveCell

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

Becarefultodistinguishbetweentheactivecellandtheselection.Theactivecellisasinglecellinsidethecurrentselection.Theselectionmaycontainmorethanonecell,butonlyoneistheactivecell.

Page 751: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthenumberformatintheactivecellontheworksheet.

Spreadsheet1.ActiveCell.NumberFormat="0.##"

Page 752: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveDataProperty

ReturnsaPivotDataobjectthatrepresentsthedataintheactivePivotTablelist.

expression.ActiveData

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 753: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveObjectProperty

ReturnsorsetsanObjectthatrepresentstheselectedcellinthedetailareaofthePivotTablelist.UsetheValuepropertyofthereturnedobjecttochangethevalueoftheselectedcell.

expression.ActiveObject

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 754: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsNothingifnodetailcellsareselected.

Page 755: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablestheeditingofdetailrecordsinPivotTable1,thenplacesthecurrentdateintheselecteddetailcell.Theeditingofdetailrecordsisdisallowedoncethedatehasbeeninsertedintotheselectedcell.

SubEditSelectedCell()

DimobjActiveCell

'Alloweditingofdetailrecords.PivotTable1.ActiveView.AllowEdits=True

'Setavariabletothecurrentlyselectedcell.SetobjActiveCell=PivotTable1.ActiveObject

'Checkwhetheradetailcellisselected.IfNotobjActiveCellIsNothingThen

'Setthevalueofthedetailcell'tothecurrentdate.'Note:Thiswillresultinarun-time'errorifthedatatypeoftheselected'celldoesnotsupportdatevalues.objActiveCell.Value=Date

EndIf

'Disalloweditingofdetailrecords.PivotTable1.ActiveView.AllowEdits=False

EndSub

Page 756: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 757: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActivePaneProperty

ReturnsaPaneobjectthatrepresentstheactivespreadsheetpane.Read-only.

expression.ActivePane

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 758: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthevalueofthecellintheupper-leftcornerofthevisiblerangeintheactivepaneonthespreadsheet.

Spreadsheet1.ActivePane.VisibleRange.Cells(1,1).Value="topleft"

Page 759: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveSheetProperty

Returnsaread-onlyWorksheetobjectthatrepresentstheactiveworksheet.

expression.ActiveSheet

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 760: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangesthenameoftheactiveworksheet.

Spreadsheet1.ActiveSheet.Name="BudgetSheet"

Page 761: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveViewProperty

ReturnsaPivotViewobjectthatrepresentsthelayoutoftheactivePivotTablelist.SettingavariabletotheactiveviewofthePivotTableprovidesyouwithaconvenientmethodtomakechangestotheactiveview.Read-only.

expression.Case

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 762: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleinsertstwofieldsetsintheactiveviewofPivotTable1.

SubInsert_Fieldsets()DimvwView

SetvwView=PivotTable1.ActiveView'AddtheStoreTypefieldtothecolumnaxis.vwView.ColumnAxis.InsertFieldSetvwView.FieldSets("StoreType")'AddthePromotionsfieldtotherowaxis.vwView.RowAxis.InsertFieldSetvwView.FieldSets("Promotions")EndSub

Page 763: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveWindowProperty

ReturnsaWindowobjectthatrepresentsthecurrentwindow.

expression.ActiveWindow

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 764: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidestherowandcolumnheadingsintheactivewindowofSpreadsheet1.

SubHideHeadings()Spreadsheet1.ActiveWindow.DisplayColumnHeadings=FalseSpreadsheet1.ActiveWindow.DisplayRowHeadings=FalseEndSub

Page 765: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ActiveWorkbookProperty

ReturnsaWorkbookobjectthatrepresentstheopenworkbook.

expression.ActiveWorkbook

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 766: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleprotectsthestructureoftheopenworkbookinSpreadsheet1.

Speadsheet1.ActiveWorkbook.Protect,True

Page 767: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 768: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AddressProperty

AddresspropertyasitappliestotheHyperlinkandPivotHyperlinkobjects.

AddresspropertyasitappliestotheRangeobject.

Page 769: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheHyperlinkobject.

AsitappliestotheRangeobject.

Page 770: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AggregatesProperty

ReturnsthePivotAggregatescollectionforthespecifiedcell.

expression.Aggregates

expressionRequired.AnexpressionthatreturnsaPivotCellobject.

Page 771: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 772: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllGroupingDefsProperty

ReturnstheAllGroupingDefscollectionforthedatasourcecontrol.Read-only.

expression.AllGroupingDefs

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 773: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 774: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllIncludeExcludeProperty

ReturnsorsetsaPivotFieldSetAllIncludeExcludeEnumthatrepresentstheinclusionstateofallmembersthatarenotlistedintheIncludedMembersorExcludedMemberslistsforthespecifiedfieldset.Read/write.

expression.AllIncludeExclude

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 775: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheincludedandexcludedmembersoftheStoreStateandStoreCityfieldsinPivotTable1.Membersnotlistedintheincludeandexcludelistsareexcluded.

SubMemberFiltering()

DimfldStoreCityDimfldStoreStateDimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'SetavariabletotheStoreStatefield.SetfldStoreState=ptView.FieldSets("Store").Fields("StoreState")

'SetavariabletotheStoreCityfield.SetfldStoreCity=ptView.FieldSets("Store").Fields("StoreCity")

'ExcludeCaliforniaandWashingtonfromtheStoreStatefield.fldStoreState.ExcludedMembers=Array("CA","WA")

'IncludemembersoftheStoreCityfield.Notethatthecitiesare'instatesthathavebeenexcludedbythepreviousline.Since'StoreStateisaparenttoStoreCity,thentheexcludedstates'aredisplayedinthePivotTable.fldStoreCity.IncludedMembers=Array("LosAngeles","SanDiego",_

Page 776: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

"Seattle","Spokane")

'ExcludeallmembersthatarenotinthelistfortheIncludedMembersand'ExcludedMembersproperties.ptView.FieldSets("Store").AllIncludeExclude=ptConstants.plAllExclude

EndSub

Page 777: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllMemberProperty

ReturnsaPivotMemberobjectthatrepresentsthetopmemberinthespecifiedfieldset.

expression.AllMember

expressionRequired.AnexpressionthatreturnsPivotFieldSetobject.

Page 778: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowAdditionsProperty

GroupLevelobject:ReturnsorsetsaBooleanthatrepresentswhethertheusercanaddrecordstothespecifiedgroup.SetthispropertytoFalsetopreventusersfromaddingrecordstoagroup.ThedefaultvalueisTrue.Read/write.

PivotViewobject:ReturnsorsetsaBooleanthatrepresentswhethertheusercanaddanewrecordtothedetailareaofaPivotTablelist.SetthispropertytoTruetoallowtheusertoinsertnewrecords.ThedefaultvalueifFalse.Read/write.

expression.AllowAdditions

expressionRequired.AnexpressionthatreturnsaGroupLevelorPivotViewobject.

Page 779: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenthispropertyissettoTrue,anasterisk(*)willbedisplayedinablankrowinthedetailarea.AnynewrecordsaddedtothedetailareaofaPivotTablelistarealsoaddedtothesourcedatabase.

YoucannotaddrecordstothedetailareaofthePivotTablelistifthesourcerecordsetdoesnotallowinsertions.

Page 780: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleallowstheusertoaddnewrecordstothedetailareaofPivotTable1.

PivotTable1.ActiveView.AllowAdditions=True

Page 781: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowCustomOrderingProperty

Returnsorsetswhethertheusercanreorderrowaxisorcolumnaxismembers.SetthispropertytoFalsetopreventusersfromrowaxisorcolumnaxismemberreordering.ThedefaultvalueisTrue.Read/writeBoolean.

expression.AllowCustomOrdering

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 782: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplepreventsusersfromreorderingmembersoftherowaxisorcolumnaxisinPivotTable1.

PivotTable1.AllowCustomOrdering=False

Page 783: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowDeletingColumnsProperty

Specifieswhetheraworksheetcolumncanbedeletedwhentheworksheethasbeenprotected.ThedefaultvalueisFalse,butthispropertyhasnoeffectiftheEnabledpropertyoftheProtectionobjectissettoFalse.Read/writeBoolean.

expression.AllowDeletingColumns

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 784: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,enablestheinsertionanddeletionofcolumns,andthenprotectsSheet1.

SubProtect_Worksheet()DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=TrueSetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection'AllowsusertodeletecolumnswhileSheet1isprotected.ptProtSheet1.AllowDeletingColumns=True'AllowsusertoinsertcolumnswhileSheet1isprotected.ptProtSheet1.AllowInsertingColumns=True'ProtectSheet1.ptProtSheet1.Enabled=TrueEndSub

Page 785: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowDeletingRowsProperty

Specifieswhetheraworksheetrowcanbedeletedwhentheworksheethasbeenprotected.ThedefaultvalueisFalse,butthispropertyhasnoeffectiftheEnabledpropertyoftheProtectionobjectissettoFalse.Read/writeBoolean.

expression.AllowDeletingRows

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 786: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,andthenitenablestheinsertionanddeletionofrows,andthenprotectsSheet1.

SubProtect_Worksheet()DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=TrueSetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection'AllowsusertodeleterowswhileSheet1isprotected.ptProtSheet1.AllowDeletingRows=True'AllowsusertoinsertrowswhileSheet1isprotected.ptProtSheet1.AllowInsertingRows=True'ProtectSheet1.ptProtSheet1.Enabled=TrueEndSub

Page 787: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowDeletionsProperty

GroupLevelobject:ReturnsorsetsaBooleanthatrepresentswhethertheusercandeleterecordsfromthespecifiedgroup.SetthispropertytoFalsetopreventusersfromdeletingrecordsfromagroup.ThedefaultvalueisTrue.Read/write.

PivotViewobject:ReturnsorsetsaBooleanthatrepresentswhethertheusercandeletearecordfromdetailareaofaPivotTablelist.SetthispropertytoTruetoallowtheusertodeleterecords.ThedefaultvalueisFalse.Read/write.

expression.AllowDeletions

expressionRequired.AnexpressionthatreturnsaGroupLevelorPivotViewobject.

Page 788: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAnyrecordsthataredeletedfromthedetailareaofaPivotTablelistarealsodeletedfromthesourcedatabase.TheusercannotdeleterecordsfromthedetailareaofthePivotTablelistifthesourcerecordsetdoesnotallowdeletions.

Page 789: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleallowstheusertodeleterecordsfromthedetailareaofPivotTable1.

PivotTable1.ActiveView.AllowDeletions=True

Page 790: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowDetailsProperty

SpecifieswhethertheusercanexpandaninnermemberofthespecifiedPivotTablelisttodisplaydetailrecords.ThedefaultvalueisTrue.Read/writeBoolean.

expression.AllowDetails

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 791: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenthispropertyisFalse,innermembersdonotdisplayexpandindicators,theExpandcommandisdisabledformostaggregates,anddouble-clickinganaggregatedoesnotdisplaydetaildata.IfthispropertyisFalse,theusercanstillviewdetailsprogrammatically.

Page 792: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablesdetailviewingforthePivotTablelist.

PivotTable1.AllowDetails=False

Page 793: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowEditsProperty

GroupLevelobject:ReturnsorsetsaBooleanthatrepresentswhethertheusercaneditrecordsinthespecifiedgroup.SetthispropertytoFalsetopreventusersfromeditingrecordsinagroup.ThedefaultvalueisTrue.Read/write.

PivotViewobject:ReturnsorsetsaBooleanthatrepresentswhethertheusercaneditcellsinthedetailareaofaPivotTablelist.SetthispropertytoTruetoallowtheusertoeditcellsinthedetailarea.ThedefaultvalueisFalse.Read/write.

expression.AllowEdits

expressionRequired.AnexpressionthatreturnsaGroupLevelorPivotViewobject.

Page 794: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksChangingacellvalueresultsinacorrespondingchangeinthesourcedatabase.Fieldsthataremarkedasread-onlyinthesourcedatabasecannotbeeditedinthePivotTablelist.

Page 795: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenableseditinginthedetailareaofPivotTable1.

PivotTable1.ActiveView.AllowEdits=True

Page 796: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 797: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowFilteringProperty

AllowFilteringpropertyasitappliestotheProtectionobject.

AllowFilteringpropertyasitappliestothePivotTableobject.

Page 798: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheProtectionobject.

AsitappliestothePivotTableobject.

Page 799: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowFormattingColumnsProperty

Returnsorsetswhetherornotcolumnscanresizedonaprotectedworksheet.SetthispropertytoTruetoenablecolumnstoberesizedwhentheworksheetisprotected.ThedefaultvalueisFalse.Read/writeBoolean.

expression.AllowFormattingColumns

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 800: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,andthenitenablestheusertoresizerowsandcolumns,andthenprotectsSheet1.

SubProtect_Worksheet()DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=True

SetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection

'AllowsusertoresizerowswhileSheet1isprotected.ptProtSheet1.AllowFormattingRows=True

'AllowsusertoresizecolumnswhileSheet1isprotected.ptProtSheet1.AllowFormattingColumns=True

'ProtectSheet1.ptProtSheet1.Enabled=TrueEndSub

Page 801: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowFormattingRowsProperty

Returnsorsetswhetherornotrowscanresizedonaprotectedworksheet.SetthispropertytoTruetoenablerowstoberesizedwhentheworksheetisprotected.ThedefaultvalueisFalse.Read/writeBoolean.

expression.AllowFormattingRows

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 802: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,andthenitenablestheusertoresizerowsandcolumns,andthenprotectsSheet1.

SubProtect_Worksheet()

DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=True

SetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection

'AllowsusertoresizerowswhileSheet1isprotected.ptProtSheet1.AllowFormattingRows=True

'AllowsusertoresizecolumnswhileSheet1isprotected.ptProtSheet1.AllowFormattingColumns=True

'ProtectSheet1.ptProtSheet1.Enabled=True

EndSub

Page 803: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowGroupingProperty

TrueiftheuserisabletogroupfieldsontherowaxisorthecolumnaxisinthespecifiedPivotTablelist.IfthispropertyissettoFalse,thegroupingbuttonsaredisabledbuttheusercanstillgroupfieldsprogrammatically.ThedefaultvalueisTrue.Read/writeBoolean.

expression.AllowGrouping

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 804: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenthispropertyissettoFalse,pivotingisdisabled.Thismeansthatmembershipintherowandcolumnareasisfixed;youcannotdragafieldtoorfromtheseareas.Allcommandsrelatedtogroupingaredisabled,includingthefollowingcommands:

MovetoColumnArea

MovetoDetail,iftheselectionisafieldintheroworcolumnarea

MovetoFiltering

MovetoRowArea

IfFalse,thereportlayoutisfrozen,buttheusercanstillfilterthedata.

Page 805: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablesfieldgroupingforthePivotTablelist.

PivotTable1.AllowGrouping=False

Page 806: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowHeadingRenameProperty

Specifieswhetherrowandcolumnheadersinaprotectedworksheetcanbecustomized.SetthispropertytoTruetocustomizethecolumnheadersofaprotectedworksheet.ThedefaultvalueisFalse.Read/writeBoolean.

expression.AllowHeadingRename

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 807: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingtheCaptionpropertyofaroworcolumnheadingaftersettingthispropertytoFalseresultsinarun-timeerror.YoumustsettheEnabledpropertyoftheProtectionobjecttoTrueforthispropertytotakeeffect.

Page 808: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,enablestheinsertionanddeletionofcolumns,disablesthecustomizationofrowandcolumnheadings,andthenprotectsSheet1.

SubProtect_Worksheet()

DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=True

SetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection

'AllowsusertodeletecolumnswhileSheet1isprotected.ptProtSheet1.AllowDeletingColumns=True

'AllowsusertoinsertcolumnswhileSheet1isprotected.ptProtSheet1.AllowInsertingColumns=True

'preventrowandcolumnheadingsfrombeingcustomized.ptProtectSheet1.AllowHeadingRename=False

'ProtectSheet1.ptProtectSheet1.Enabled=True

EndSub

Page 809: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowInsertingColumnsProperty

Specifieswhetheraworksheetcolumncanbeinsertedwhentheworksheethasbeenprotected.ThedefaultvalueisFalse,butthispropertyhasnoeffectiftheEnabledpropertyoftheProtectionobjectissettoFalse.Read/writeBoolean.

expression.AllowInsertingColumns

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 810: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,andthenitenablestheinsertionanddeletionofcolumns,andthenprotectsSheet1.

SubProtect_Worksheet()DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=TrueSetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection'AllowsusertodeletecolumnswhileSheet1isprotected.ptProtSheet1.AllowDeletingColumns=True'AllowsusertoinsertcolumnswhileSheet1isprotected.ptProtSheet1.AllowInsertingColumns=True'ProtectSheet1.ptProtSheet1.Enabled=TrueEndSub

Page 811: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowInsertingRowsProperty

Specifieswhetheraworksheetrowcanbeinsertedwhentheworksheethasbeenprotected.ThedefaultvalueisFalse,butthispropertyhasnoeffectiftheEnabledpropertyoftheProtectionobjectissettoFalse.Read/writeBoolean.

expression.AllowInsertingRows

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 812: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,andthenitenablestheinsertionanddeletionofrows,andthenprotectsSheet1.

SubProtect_Worksheet()DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=TrueSetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection'AllowsusertodeleterowswhileSheet1isprotected.ptProtSheet1.AllowDeletingRows=True'AllowsusertoinsertrowswhileSheet1isprotected.ptProtSheet1.AllowInsertingRows=True'ProtectSheet1.ptProtSheet1.Enabled=TrueEndSub

Page 813: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowLayoutEventsProperty

SetthispropertytoTruetoenabletheAfterLayoutevent.ThedefaultvalueisFalse.Read/writeBoolean.

expression.AllowLayoutEvents

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 814: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablesalleventsforChartSpace1.

SubWindow_Onload()

'AllowtheAfterLayouteventtofire.ChartSpace1.AllowLayoutEvents=True

'AllowBeforeRenderandAfterRenderevents'tofireaseachdatapointisrendered.ChartSpace1.AllowPointRenderEvents=True

'AllowBeforeRenderandAfterRenderevents'tofireaseachchartelementisrendered.'TheAfterFinalRendereventwillfireafter'allchartelementshavebeenrendered.ChartSpace1.AllowRenderEvents=True

'AllowtheBeforeScreenTipeventtofire.ChartSpace1.AllowScreenTipEvents=True

EndSub

Page 815: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowMultiFilterProperty

ReturnsorsetswhetherornottheusercanselectmultipleitemswhenthespecifiedfieldsetisinthefilterareaofaPivotTablelist.ThedefaultvalueisTrue.Read/writeBoolean.

expression.AllowMultiFilter

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 816: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSetthispropertytoFalsetoemulatethebehaviorofafieldsetinthefilterareaoftheMicrosoftOffice2000PivotTableComponent.

Page 817: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampledisablestheselectionofmultipleitemsintheMerchantfieldwhenitisinthefilterareaofPivotTable1.

PivotTable1.ActiveView.FieldSets("Merchant").AllowMultiFilter=False

Page 818: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowPointRenderEventsProperty

SetthispropertytoTruetoenabletheBeforeRenderandAfterRendereventstobecalledaseachdatapointisrendered.ThedefaultvalueisFalse.Read/writeBoolean.

expression.AllowPointRenderEvents

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 819: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablesalleventsforChartSpace1.

SubWindow_Onload()

'AllowtheAfterLayouteventtobecalled.ChartSpace1.AllowLayoutEvents=True

'AllowBeforeRenderandAfterRenderevents'tobecalledaseachdatapointisrendered.ChartSpace1.AllowPointRenderEvents=True

'AllowBeforeRenderandAfterRenderevents'tobecalledaseachchartelementisrendered.'TheAfterFinalRendereventwillfireafter'allchartelementshavebeenrendered.ChartSpace1.AllowRenderEvents=True

'AllowtheBeforeScreenTipeventtobecalled.ChartSpace1.AllowScreenTipEvents=True

EndSub

Page 820: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowPropertyToolboxProperty

DetermineswhethertheusercandisplaytheCommandsandOptionsdialogboxatruntime.SettingtheAllowPropertyToolboxpropertytoFalsedisablestheCommandsandOptionsbuttononthetoolbar.ThedefaultvalueisTrue.Read/writeBoolean.

expression.AllowPropertyToolbox

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 821: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablestheCommandsandOptionsbuttonontheSpreadsheeet1toolbaratruntime.

Spreadsheet1.AllowPropertyToolbox=False

Page 822: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowRenderEventsProperty

SetthispropertytoTruetoenabletheBeforeRender,AfterRender,andAfterFinalRenderevents.ThedefaultvalueisFalse.Read/writeBoolean.

expression.AllowRenderEvents

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 823: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablesalleventsforChartSpace1.

SubWindow_Onload()

'AllowtheAfterLayouteventtofire.ChartSpace1.AllowLayoutEvents=True

'AllowBeforeRenderandAfterRenderevents'tofireaseachdatapointisrendered.ChartSpace1.AllowPointRenderEvents=True

'AllowBeforeRenderandAfterRenderevents'tofireaseachchartelementisrendered.'TheAfterFinalRendereventwillfireafter'allchartelementshavebeenrendered.ChartSpace1.AllowRenderEvents=True

'AllowtheBeforeScreenTipeventtofire.ChartSpace1.AllowScreenTipEvents=True

EndSub

Page 824: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowScreenTipEventsProperty

SetthispropertytoTruetoenabletheBeforeScreenTipevent.ThedefaultvalueifFalse.Read/writeBoolean.

expression.AllowScreenTipEvents

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 825: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheBeforeScreenTipeventallowsyoutomodifyScreenTipsbeforetheyaredisplayed.

Page 826: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablesalleventsforChartSpace1.

SubWindow_Onload()

'AllowtheAfterLayouteventtobecalled.ChartSpace1.AllowLayoutEvents=True

'AllowBeforeRenderandAfterRenderevents'tofireaseachdatapointisrendered.ChartSpace1.AllowPointRenderEvents=True

'AllowBeforeRenderandAfterRenderevents'tobecalledaseachchartelementisrendered.'TheAfterFinalRendereventwillbecalledafter'allchartelementshavebeenrendered.ChartSpace1.AllowRenderEvents=True

'AllowtheBeforeScreenTipeventtobecalled.ChartSpace1.AllowScreenTipEvents=True

EndSub

Page 827: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowSortingProperty

Specifieswhetheraworksheetcanbesortedwhentheworksheethasbeenprotected.ThedefaultvalueisFalse,butthispropertyhasnoeffectiftheEnabledpropertyoftheProtectionobjectissettoFalse.Read/writeBoolean.

expression.AllowSorting

expressionRequired.AnexpressionthatreturnsaProtectionobject.

Page 828: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksallcellsonSheet1,enablesthefilteringandsortingofrowsandcolumns,andthenprotectstheworksheet.

SubProtect_Worksheet()DimptProtSheet1

'Lockallcellsontheworksheet.Spreadsheet1.Worksheets("Sheet1").Cells.Locked=TrueSetptProtSheet1=Spreadsheet1.Worksheets("Sheet1").Protection'AllowsusertofilterrowswhileSheet1isprotected.ptProtSheet1.AllowFiltering=True'AllowsusertosortrowsandcolumnswhileSheet1isprotected.ptProtSheet1.AllowSorting=True'ProtectSheet1.ptProtSheet1.Enabled=TrueEndSub

Page 829: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllowUISelectionProperty

Returnsorsetswhetheranelementonachartisselectedwhentheuserclicksonanelementwiththemouse.Read/writeBoolean.

expression.AllowUISelection

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 830: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

IfthispropertyissettoTrue,whenauserclicksonachartelementwiththemouse,thecurrentlistofselectionsisemptiedandreplacedwithonlytheelementthatwasclickedbytheuser.IfthispropertyissettoFalse,whentheuserclicksonanelementwiththemouse,thecurrentlistofselectionsispreservedandthemouseclickeventisignored.ThedefaultvalueisTrue.

Page 831: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampledisablestheAllowUISelectionproperty.

ChartSpace1.AllowUISelection=False

Page 832: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AllPageFieldsProperty

ReturnstheAllPageFieldscollectionforthedatasourcecontrol.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 833: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AlternateDataSourceProperty

ReturnsorsetstheIDofthealternatedatasource(anothercomplexdata-boundcontrolthatwillbeusedasthedatasource).Read/writeString.

expression.AlternateDataSource

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 834: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AlternateRowColorProperty

ReturnsorsetsaStringthatrepresentsthecolortouseforeveryotherrowinthespecifiedgroup.Read/write.

expression.AlternateRowColor

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 835: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AlwaysIncludeInCubeProperty

ReturnsorsetswhetherthespecifiedfieldsetisalwaysincludedinthePivotTablelist'slocalcache.SetthispropertytoTruetoensurethatthespecifiedfieldsetisincludedinthelocalcache.ThedefaultvalueisFalse.Read/writeBoolean.

expression.AlwaysIncludeInCube

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 836: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytoTrueforafieldsetensuresthatcalculatedtotalsthatdependonthefieldsetwillcalculatecorrectly.

Page 837: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AmbientLightIntensityProperty

ReturnsorsetsaDoublespecifyingthepercentageofambientlightilluminatingathree-dimensionalchart.Validsettingsrangefrom0to1.Read/write.

expression.AmbientLightIntensity

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 838: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DBarchartandsetsthelightingoptionsforthechart.

SubFormat3DLightSources()

Dimcht3DBar

'SetavariabletothefirstchartinChartspace1.Setcht3DBar=ChartSpace1.Charts(0)

'Changethecharttoa3DBarchart.cht3DBar.Type=chChartTypeBar3D

'Settheintensityoftheambientlight.cht3DBar.AmbientLightIntensity=0.7

'Settheinclinationofthedirectionallightsource.cht3DBar.DirectionalLightInclination=35

'Settheintensityofthedirectionallightsource.cht3DBar.DirectionalLightIntensity=0.8

'Settherotationofthedirectionallightsource.cht3DBar.DirectionalLightRotation=120

EndSub

Page 839: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AmountProperty

Returnsorsetstheerroramountforfixed-valueandpercentageerrorbars.Youspecifydata-bounderrorbaramountsbyusingtheSetDatamethod.Read/writeDouble.

expression.Amount

expressionRequired.AnexpressionthatreturnsaChErrorBarsobject.

Page 840: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThisvalueismathematicallycorrect,meaningthat5%isrepresentedas0.05andnot5.Anerrorbarwiththefixedamountof5willbecome500%whenchangedtoapercentage.

Page 841: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddserrorbarstoalloftheseriesinthefirstchartofChartSpace1andthensetstheerroramount.

SubAdd_Error_Bars()DimebErrorBarsDimserChartSeriesDimchConstants

SetchConstants=ChartSpace1.Constants

'Loopthroughalloftheseriesinthefirstchart'ofChartSpace1.ForEachserChartSeriesinChartSpace1.Charts(0).SeriesCollection

'Adderrorbarstothecurrentseries.SetebErrorBars=serChartSeries.ErrorBarsCollection.Add

'Settheerrorbarstobeapercentageofthevalue.ebErrorBars.Type=chConstants.chErrorBarTypePercent

'Setthepercentageamount.ebErrorBars.Amount=0.05NextEndSub

Page 842: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 843: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ApplicationProperty

ApplicationpropertyasitappliestoallobjectsintheAppliesTolistexceptfortheOWCLanguageSettingsobject.

ApplicationpropertyasitappliestotheOWCLanguageSettingsobject.

Page 844: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AspectRatioProperty

ReturnsorsetsaLongspecifyingtheratioofheighttothewidthofthespecifiedthree-dimensionalchart.Settingthispropertytoavaluegreaterthan100willmakeachartwhichistallerthanitiswide,whileavaluelessthan100willmakeachartwiderthanitistall.Validsettingsrangefrom0to500.Read/write.

expression.AspectRatio

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 845: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyhasnoeffectona3-DPiechart.UsetheThicknesspropertytoincreasethethicknessofa3-DPiechart.

Page 846: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthenincreasesthewidthanddepthofthechart.

SubFormat3DDepthWidth()

Dimcht3DColumn

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3-DColumnchart.cht3DColumn.Type=chChartTypeColumnClustered3D

'Increasethedepthofthechartinrelation'toit'swidth.cht3DColumn.ChartDepth=125

'Increasethewidthofthechartinrelation'toit'sheight.cht3DColumn.AspectRatio=80

EndSub

Page 847: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AsyncProperty

IndicateswhetherthebindingoftheXMLDataBindingobjectisasynchronousornot.Read-only.

expression.Async

expressionRequired.AnexpressionthatreturnsanXmlDataBindingobject.

Page 848: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YoucanusetheAsyncpropertyoftheXmlDataBindingobjecttofindoutifabindingsupportsasynchronousbinding.ItreturnsTrueifthebindingisasynchronous,otherwiseitreturnsFalse.ThedefaultvalueisFalse.

ItonlyaffectsthebehaviorofQuerybindings.WhenthevalueisTrue,onpageload,theSpreadsheetcomponentwillrenderalongwithanystaticdatabeforetheLoadMode=Normalbindingsactuallyoccurs.Whileasynchronousbindingsareinprogress,theSpreadsheetcomponentwillbenon-interactive(sameasViewOnlymode).Oncethebindingisdoneandtheeventshaveoccured,theuserinterfacewillbecomeinteractive.

WhenthevalueisFalse,thepagewillnotrenderuntilbindingswhereLoadMode=Normalhavecompletedloading.SubsequentrefreshoperationswithuserinterfacecommandsorwithcallstotheRefreshmethodwillnotresponduntilbindingoperationshavecompleted.

Whenanasynchronousbindingisinprogress,anyattempttoworkwithanXmlDataBindingobjectprogrammaticallywillfail.

Page 849: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingVBScriptexamplechecksifthebindingstateofthefirstXMLDataBindingobjectintheXMLDataBindingscollectionisasynchronous.Ifitis,amessageboxisdisplayed.

SubAsync()

DimobjBindingSetobjBinding=Spreadsheet1.ActiveWorkbook.XmlDataBindings.Item(1)

'Checktoseeifthebindingisasynchronous.IfobjBinding.Async=TrueThen

'Alerttheuserifthebindingstateisasynchronous.MsgBox("Thebindingisasynchronous.")

EndIf

EndSub

Page 850: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AutoFilterProperty

ReturnstheAutoFilterobjectforthespecifiedworksheet.

expression.AutoFilter

expressionAnexpressionthatreturnsaWorksheetobject.

Page 851: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDonotconfusethispropertywiththeAutoFiltermethod.ThispropertyreturnstheAutoFilterobjectforagivenworksheet,whereastheAutoFiltermethodappliestoaRangeobjectandturnsontheAutoFilter.

Page 852: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsontheAutoFilterfortherangeA1:C20,setsfiltersforcolumnsAandC,andthenappliesthefilters.

SubApply_AutoFilter()DimafFiltersDimafCol1DimafCol3'TurnonAutoFilter.Spreadsheet1.Worksheets("Sheet1").Range("A1:C20").AutoFilter'SetavariabletotheAutoFilterobject.SetafFilters=Spreadsheet1.Worksheets("sheet1").AutoFilterSetafCol1=afFilters.Filters(1)SetafCol3=afFilters.Filters(3)'AddacriteriathatexcludesbluefromcolumnA.afCol1.Criteria.Add"blue"'AddacriteriathatexcludesgreenfromcolumnA.afCol1.Criteria.Add"green"'AddacriteriathatexcludesyellowfromcolumnC.afCol3.Criteria.Add"yellow"'Applythecriteria.afFilters.ApplyEndSub

Page 853: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AutoFilterModeProperty

ReturnsTrueiftheAutoFilterdrop-downarrowsarecurrentlydisplayed.YoucansetthispropertytoFalsetohidethearrows,butyoucannotsetittoTrue.UsetheAutoFiltermethodtofilteralistanddisplaythedrop-downarrows.Read/writeBoolean.

expression.AutoFilterMode

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 854: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftheAutoFilterdrop-downarrowsarevisiblebutnorowsarecurrentlyfiltered(allrowsarevisible),theAutoFilterModepropertyisTrueandtheFilterModepropertyisFalse.

Page 855: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsofftheAutoFilterfortheactiveworksheet.

Spreadsheet1.ActiveSheet.AutoFilterMode=False

Page 856: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AutoFitProperty

SpreadsheetorPivotTableobjects:TrueiftheoverallsizeofthespreadsheetorPivotTablelistisdeterminedbythenumberofvisiblecolumnsandrows.Therowheightandcolumnwidthcannotexceedthevalueofthespreadsheet’sorPivotTablelist’sMaxHeightandMaxWidthproperties.ThedefaultvalueisTrue.IftheAutoFitpropertyissettoFalse,theoverallsizeofthespreadsheetorPivotTablelistissetbasedonitsWidthandHeightproperties.Read/writeBoolean.

PivotAxisMemberorPivotTotalobjects:Trueifthewidthofthetotalissetautomatically.ThedefaultvalueisTrue.WhenthispropertyissettoTrue,anylayoutchangealsoupdatestheWidthandHeightpropertyvalues.WhenyouchangetheWidthandHeightvaluesprogrammatically,thevalueoftheAutoFitpropertyissettoFalse.Read/writeBoolean.

expression.AutoFit

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 857: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablesautomaticsizingforthePivotTablelistandthensetsitswidth.

NoteTheobjectpropertyoftheOBJECTHTMLelementisusedtoaccesstheWidthpropertyofthePivotTableobject(PivotTable1.Object.Width)becausetheOBJECTelementonanHTMLpagealsohasitsownWidthproperty.ThisisnotnecessarywhenaPivotTablecontrolisonauserformorotherActiveXcontainer.

SubDisableAutoFit()

PivotTable1.AutoFit=FalsePivotTable1.Object.Width=8000

EndSub

Page 858: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AxesProperty

ReturnstheChAxescollectionforthespecifiedchart.UsetheAxespropertytosetthepropertiesforachartaxis.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

expression.Axes

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 859: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatitleto,andchangesthefontofthevalueandcategoryaxesofthefirstchartinChartSpace1.

SubFormat_Chart_Axes()

DimaxCategoryAxisDimaxValueAxis

'SetavariabletotheCategory(X)axis.SetaxCategoryAxis=ChartSpace1.Charts(0).Axes(0)'SetavariabletotheValue(Y)axis.SetaxValueAxis=ChartSpace1.Charts(0).Axes(1)

'Thefollowingtwolinesofcodeenable,andthen'setthetitleforthecategoryaxis.axCategoryAxis.HasTitle=TrueaxCategoryAxis.Title.Caption="SalesbyQuarter"'Thefollowingthreelinesofcodesetthefont'forthevaluesdisplayedonthecategoryaxis.axCategoryAxis.Font="Tahoma"axCategoryAxis.Font.Size=8axCategoryAxis.Font.Bold=True

'Thefollowingtwolinesofcodeenable,andthen'setthetitleforthevalueaxis.axValueAxis.HasTitle=TrueaxValueAxis.Title.Caption="Dollars($)"

Page 860: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Thefollowingthreelinesofcodesetthefont'forthevaluesdisplayedonthevalueaxis.axValueAxis.Font="Tahoma"axValueAxis.Font.Size=8axValueAxis.Font.Bold=Trueendsub

Page 861: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 862: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AxisProperty

AxispropertyasitappliestothePivotResultFieldandPivotResultGroupFieldobjects.

AxispropertyasitappliestothePivotAxisMember,PivotColumnMember,PivotPageMember,andPivotRowMemberobjects.

Page 863: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BackColorProperty

Returnsorsetsthebackgroundcolorforthespecifiedobjectorarea.Whenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-blue(RGB)colorvalueoraStringvaluerepresentingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(forexample,redisRGB(255,0,0)).Read/writeVariant.expression.BackColor

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 864: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyalwaysreturnsthecolorasaLongvaluerepresentinganRGBcolorvalue.

Page 865: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefontsize,foregroundcolor,andbackgroundcolorforthetitlebarinPivotTable1.

SubFormat_Titlebar()DimvwViewSetvwView=PivotTable1.ActiveView'Setthebackgroundcolorofthetitlebar.vwView.Label.BackColor="DarkSalmon"'Setthefontsizeofthetitlebar.vwView.Label.Font.Size=16'Settheforegroundcolorofthetitlebar.vwView.Label.ForeColor="Sienna"EndSub

Page 866: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BackWallProperty

ReturnsaChSurfaceobjectthatrepresentsthebackwallofathree-dimensionalchart.UsethepropertiesandmethodsofthereturnedChSurfaceobjecttoformatthebackwallofthespecifiedchart.

expression.BackWall

expressionRequired.AnexpressionthatreturnsaChPlotAreaobject.

Page 867: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthenformatsthebackwall,sidewall,andfloorofthechart.

SubFormatWallsFloor()

Dimcht3DColumnDimchConstantsDimpaPlotArea

SetchConstants=ChartSpace1.Constants

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Setavariabletotheplotarea.SetpaPlotArea=cht3DColumn.PlotArea

'Changethecharttoa3DColumnchart.cht3DColumn.Type=chConstants.chChartTypeColumnClustered3D

'Formatthebackwallofthechart.paPlotArea.BackWall.Interior.SetSolid"Yellow"paPlotArea.BackWall.Thickness=5

'Formatthesidewallofthechart.paPlotArea.SideWall.Interior.SetSolid"Yellow"paPlotArea.SideWall.Thickness=5

'Formatthefloorofthechart.paPlotArea.Floor.Interior.SetSolid"Blue"

Page 868: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

paPlotArea.Floor.Thickness=5

EndSub

Page 869: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BarWidthProperty

Usetosetorspecifyaspecificwidthforthedatamarkersinbarandcolumncharts.ReturnsLong.Read/writeLong.

expression.BarWidth

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 870: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheBarWidthpropertyisspecifiedinhundredthsofapoint(1/7200ofaninch.)Thedefaultvalueofzero(0)means"automatic".

SettingthispropertychangesthescrollviewextentoftheChScrollViewobjectofachartcontrol.Thispropertyisonlyvalidforbarandcolumncharts.Ithasnoeffectonothercharttypes.ThispropertyhasaneffectonlyiftheHorizontalExtentMaxpropertyforthecolumnchartsandtheVerticalExtentMaxpropertyforthebarchartarenon-zero.

AfteryousettheBarWidthproperty,userswon'tbeabletochangetheHorizontalExtentorVerticalExtentproperties.ChangingtheHorizontalExtentorVerticalExtentpropertieswillhavenoeffectbecausetheBarWidthpropertyvaluewilloverrideanyHorizontalExtentorVerticalExtentvaluesandmaintainthebarwidthuntiltheBarWidthpropertyisdisabled.YoudisabletheBarWidthpropertybysettingittozero(0).

Page 871: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleTheexamplebelowshowsyouhowtosetthebarwidthofthecharttooneinchbysettingitsvalueto7200.Ifyouwanttosetthebarwidthtohalfaninch,thevaluetospecifywouldbe3600.

Chartspace1.Charts(0).Barwidth=7200

Page 872: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BaseNameProperty

Returnsthenameofthespecifiedfieldasitappearsinthesourcedatabase.Read-onlyString.

expression.BaseName

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 873: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAfieldcanhaveseveralnames,asshowninthefollowingtable.

Name DescriptionCaption Thenametheusersees.Name Thenameusedtoidentifythefieldincode.DataField Thenameofthefieldintheunderlyingrecordset.(Thisisnot

necessarilythesameasthebasename;youcanuseadifferentnameifthereisanamingconflictorifyouwanttomakethenameeasiertouseandremember.)

BaseName Thenameofthefieldintheoriginalsourcedatabase.

Page 874: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeginProperty

ReturnsaChSegmentBoundaryobjectthatrepresentsthebeginningofasegmentboundaryonaformatmap.

expression.Begin

expressionRequired.AnexpressionthatreturnsaChSegmentobject.

Page 875: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheValuepropertyofthereturnedChSegmentBoundaryobjecttosetthebeginningvalueforthespecifiedsegmentoftheformatmap.UsetheInterior,Line,andBorderpropertiestoformatthesegmentboundary.

Page 876: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreatedthathighlightsthebottom10%ofthevaluesinredandthetop20%ofvaluesingreen.

SubWindow_Onload()

Dimserseries1DimsegBottom10PctDimsegTop20PctDimchConstants

SetchConstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;PersistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=SeverName;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderdetailstable.ChartSpace1.SetDatachConstants.chDimCategories,chConstants.chDataBound,"ProductID"ChartSpace1.SetDatachConstants.chDimValues,chConstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachConstants.chDimFormatValues,chConstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.Setserseries1=ChartSpace1.Charts(0).SeriesCollection(0)

Page 877: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Addasegmenttotheformatmap.Thissegmentwill'representthebottom10%ofvaluesinthechart.SetsegBottom10Pct=serseries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segBottom10Pct.Begin.ValueType=chConstants.chBoundaryValuePercentsegBottom10Pct.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto10%.segBottom10Pct.Begin.Value=0segBottom10Pct.End.Value=0.1

'Formattheinteriorofthematchingvalues.segBottom10Pct.Begin.Interior.Color="red"segBottom10Pct.End.Interior.Color="red"

'Addasegmenttotheformatmap.Thissegmentwill'representthetop20%ofvaluesinthechart.SetsegTop20Pct=serseries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segTop20Pct.Begin.ValueType=chConstants.chBoundaryValuePercentsegTop20Pct.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto80%,andtheendingvalueto100%.segTop20Pct.Begin.Value=0.8segTop20Pct.End.Value=1

'Formattheinteriorofthematchingvalues.segTop20Pct.Begin.Interior.Color="Green"segTop20Pct.End.Interior.Color="Green"

Page 878: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 879: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingDataProperty

ReturnsorsetstheconfigurationdataforagivenXmlDataBindingobject.Read/writeString.

expression.BindingData

expressionRequired.AnexpressionthatreturnsanXmlDataBindingobject.

Page 880: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheXmlDataBindingobjectcontainsconfigurationdataintheformofXML.TheformatoftheconfigurationdatamustfollowtheSpreadsheetcomponentXMLschemaasdefinedintheXMLspreadsheetfile.TheBindingIdisanewXMLfragmentthatmustbethesameasthecurrentvalue,orarun-timeerrorwillbegenerated.TheBindingIDistheIDattributeofanXmlDataBindingobjectandmustbeuniqueacrossallworksheetsinaworkbook.

Page 881: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplefirstgetsthenumberofXMLDataBindingobjectsintheXmlDataBindingscollectionoftheWorkbookobject.ThenititeratesthrougheachoftheXMLDataBindingobjectstogettheBindingDataproperty.

SubViewBindings()

DimstrXmlDimintBindingDimintCounter

'GetthenumberofXmlDataBindingobjectsintheXmlDataBindingscollection.intBinding=Spreadsheet1.ActiveWorkbook.XmlDataBindings.Count'Displayamessagebox. MsgBox("Thereare"&intBinding&"XmlDataBindingobjectsinthecollection") 'LoopthrougheachXmlDataBindingobjectinthecollection.intCounter=1ForintCounter=1tointBinding

'GettheconfigurationdataforagivenXmlDataBindingobjectfromaXmlDataBindingscollection. strXml=Spreadsheet1.ActiveWorkbook.XmlDataBindings.Item(intCounter).BindingData MsgBox("Bindingitem#"&intCounter&"returnedXML:"&chr(10)&strXml) Next

EndSub

Page 882: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 883: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingInProgressProperty

AsitappliestotheXmlDataBindingobject.

Page 884: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AsitappliestotheXmlDataBindingscollection.

Page 885: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheXmlDataBindingscollection.

Page 886: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BoldProperty

Fontobject:Trueifthespecifiedfontisbold.Read/writeVariant(returnsNullifsomecellsintherangeareboldandsomearenot).UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.

PivotFontandChFontobjects:ReturnsorsetsaBooleanthatdetermineswhetherthefontforthespecifiedobjectisbold.Read/write.

expression.Bold

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Page 887: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsfontpropertiesforthespecifiedaxisinthechartworkspace.

SubSetAxisFont()

Dimaxs

Setaxs=ChartSpace1.Charts(0).Axes(1)

axs.Font.Name="Arial"axs.Font.Size=8axs.Font.Bold=True

EndSub

Page 888: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BookmarkProperty

ReturnsaVariantthatidentifiesthebookmarkinthecurrentADOrecordset.Read-only.

expression.Bookmark

expressionRequired.AnexpressionthatreturnsaPivotDetailCellobject.

Page 889: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BorderProperty

ReturnsaChBorderobjectthatrepresentstheborderofthespecifiedobject.

expression.Border

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 890: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheborderforachartseriesrepresentstheoutlinecoloroncolumn,bar,pie,doughnut,area,andhigh-low-closecharts.Onchartswithmarkers(suchasalinechartwithmarkers),theborderrepresentstheoutlinecolorforthemarkers.

Page 891: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthelineweightoftheborderforthespecifiedseriesinthechartworkspace.

SubSetBorder()

DimchConstants

SetchConstants=ChartSpace1.Constants

ChartSpace1.Charts(0).SeriesCollection(0).Border_.Weight=chConstants.owcLineWeightMedium

EndSub

Page 892: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BordersProperty

ReturnsaBorderscollectionthatrepresentsthefourbordersofarangeofcells.Read-only.

expression.Borders

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 893: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsamedium-weightgreenbordertoeachcellintherangeB5:C10onSheet1.

SubSetBorders()DimssConstantsDimrngBorderSetssConstants=Spreadsheet1.Constants'Setavariabletotherangetoaddthebordersto.SetrngBorder=Spreadsheet1.Worksheets("Sheet1").Range("b5:c10")

'Settheborderweight.rngBorder.Borders.Weight=ssConstants.owcLineWeightMedium'Setthebordercolor.rngBorder.Borders.Color="green"EndSub

Page 894: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 895: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BottomProperty

BottompropertyasitappliestotheChPlotAreaobject.

BottompropertyasitappliestotheChartSpace,ChAxis,ChCategoryLabel,ChChart,ChChartField,ChDataLabel,ChDataLabels,ChDropZone,ChErrorBars,ChLegend,ChLegendEntry,ChPoint,ChSeries,ChScrollView,ChTitle,andChTrendlineobjects.

Page 896: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 897: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BottomRightProperty

BottomRightpropertyasitappliestothePivotRangeobject.

BottomRightpropertyasitappliestothePivotDetailRangeobject.

Page 898: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BoundFieldProperty

ReturnsthePivotFieldobjectusedfordata-bindinginformationwhenthesourceisarecordset.Whenthesourceismultidimensional,thispropertyreturnsNothing.

expression.BoundField

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 899: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BubbleScaleProperty

Returnsorsetsascalefactorforallbubbleseriesonthespecifiedchart.Thedefaultvalueis100,andthevalidrangeis0–300.Thevalueofthispropertyindicatesthebubblesizerelativetothedefaultsetting.SettingtheBubbleScalepropertyto300(threetimesgreaterthanthedefaultvalue)producesachartonwhichthebubblesappearthreetimesthedefaultsize.Read/writeDouble.

expression.BubbleScale

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 900: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthebubblescalefactorforthespecifiedchartinthechartworkspace.NotethatCharts(0)mustrefertoabubblechart.

ChartSpace1.Charts(0).BubbleScale=200

Page 901: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BuildProperty

ReturnsaLongthatrepresentstheMicrosoftOfficeWebComponentsbuildnumber.Read-only.

expression.Build

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 902: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsthesameinformationastheBuildNumberproperty,butasaLonginsteadofasaString.

Page 903: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BuildNumberProperty

ReturnstheMicrosoftOfficeWebComponentsbuildnumber.Read-onlyString.

expression.BuildNumber

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 904: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaystheMicrosoftOfficeWebComponentsbuildnumberintheactivecellofSpreadsheet1.

Spreadsheet1.ActiveCell.Value="MSOWCBuild"&Spreadsheet1.BuildNumber

Page 905: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ButtonBorderProperty

ReturnsaChBorderobjectthatrepresentstheborderofeachbuttoninthespecifieddropzone.UsethepropertiesofthereturnedChBorderobjecttoformattheborderofeachbuttoninthedropzone.

expression.ButtonBorder

expressionRequired.AnexpressionthatreturnsaChDropZoneobject.

Page 906: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 907: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ButtonFontProperty

ReturnsaChFontobjectthatrepresentsthefontofeachbuttoninthespecifieddropzone.UsethepropertiesofthereturnedChFontobjecttoformatthefontofeachbuttoninthedropzone.

expression.ButtonFont

expressionRequired.AnexpressionthatreturnsaChDropZoneobject.

Page 908: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 909: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ButtonInteriorProperty

ReturnsaChInteriorobjectthatrepresentstheinteriorofeachbuttoninthespecifieddropzone.UsethepropertiesofthereturnedChInteriorobjecttoformattheinteriorofeachbuttoninthedropzone.

expression.ButtonInterior

expressionRequired.AnexpressionthatreturnsaChDropZoneproperty.

Page 910: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksBydefault,thechartcontrolusesthecolorsettingspecifiedfor3DObjectsontheAppearancetaboftheDisplayControlPanelastheinteriorcolorfordropzonebuttons.

Page 911: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 912: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 913: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CalculationProperty

ReturnsorsetsanXlCalculationconstantspecifyingthecalculationmode.Read/write.

expression.Calculation

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 914: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleplacesSpreadsheet1intomanualcalculationmode.

SubManualCalculationMode()

DimssConstants

SetssConstants=Spreadsheet1.Constants

'SetSpreadsheet1tomanualcalculationmode.Spreadsheet1.Calculation=ssConstants.xlCalculationManual

EndSub

Page 915: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CalculationVersionProperty

Returnsanumberwhoserightmosttwodigitsaretheminorversionnumberofthecalculationengine,andwhoseotherdigits(ontheleft)arethemajorversionoftheMicrosoftOfficeSpreadsheetComponent.Read-onlyLong.

expression.CalculationVersion

expressionRequired.AnexpressionthatreturnsaSpreadsheetorWorkbookobject.

Page 916: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CanQueryProperty

ReturnsTrueiftheXmlDataBindingobject(asspecifiedinthe<Binding>elementintheXMLSpreadsheetfile)containsachild<DataSource>elementwithaPurposeattribute(/Binding/DataSource/ConnectionInfo@Purpose)thathasthevalue"Query".OtherwiseitreturnsFalse.Read-only.

expression.CanQuery

expressionRequired.AnexpressionthatreturnsanXmlDataBindingobject.

Page 917: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

IfTrueisreturned,thePurposeattributeofthe<DataSource>elementhasthevalue"Query".ThismeansyoucancalltheRefreshmethodoftheXmlDataBindingobjecttorequerythedatasource.NotethatanXMLDataBindingobjectcancontainmorethanone<DataSource>elementtag:oneinwhichPurposehasthevalue"Query"andoneinwhichPurposeis"Update".Forinformationonupdatebindings,seetheCanUpdateproperty.

AnXMLDataBindingobjectrepresentsabindingtoanXMLfile,aSOAPservice,anotherWebpart(onlywhenbindingfromaSpreadsheetWebPart),oradataretrievalserviceconnection.

TheXMLfragmentwherethe<DataSource>elementdetailsappearintheXMLSpreadsheetfilelookssomethinglikethefollowing:

<x2:Bindingx2:ID="Cust_bind_id"x2:LoadMode="Normal"x2:Async="False"><x2:MapID>Cust_MapId</x2:MapID><udc:DataSourceMajorVersion="1"MinorVersion="0"><udc:TypeType="XMLFile"MajorVersion="1"MinorVersion="0"/><udc:Name>sample_name</udc:Name><udc:ConnectionInfoPurpose="Query">...</udc:ConnectionInfo></udc:DataSource>

Page 918: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleattemptstorefreshabinding.ThiswillcauseaneventhandlerfortheBindingCompletedeventtorun,whichdetermineswhetherabindingcanbequeried(thatis,whetheritsPurposeattributehasthevalue"Query").Youcanwritecodeintheeventhandlertoperformanyadditionalactionsonthebinding.

SubRefreshBinding(Spreadsheet1)DimobjBinding

SetobjBinding=Spreadsheet1.ActiveWorkbook.XmlDataBindings("Cust_bind_id")objBinding.Refresh

EndSub

SubSpreadsheet1_BindingCompleted(bindingID,Action)

IfSpreadsheet1.ActiveWorkbook.XmlDataBindings.Item(bindingID).CanQuery=TrueThen'Writecodeheretoperformanyadditionalactionsonthisquerybinding.EndIf

EndSub

NoteForinformationontrappingtheBindingCompletedeventfromscriptrunninginaWebpage,seetheBindingCompletedeventtopic.

Page 919: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CanUndoProperty

Trueifthereisapreviousactionthatcanbeundone.Read-onlyBoolean.

expression.CanUndo

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 920: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleundoesthelastactionperformedordisplaysamessageboxiftheactioncannotbeundone.

SubUndo_Action()IfSpreadsheet1.CanUndoThenSpreadsheet1.UndoElseMsgBox"Can'tundolastaction."EndIfEndSub

Page 921: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CanUpdateProperty

ReturnsTrueiftheXmlDataBindingobject(asspecifiedbythe<Binding>elementintheXMLSpreadsheetfile)containsa<DataSource>elementwithaPurposeattribute(/Binding/DataSource/ConnectionInfo@Purpose)thathasthevalue"Update".OtherwiseitreturnsFalse.Read-only.

expression.CanUpdate

expressionRequired.AnexpressionthatreturnsanXmlDataBindingobject.

Page 922: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

NotethatanXMLDataBindingobjectcancontainmorethanone<DataSource>elementtag:oneinwhichPurposehasthevalue"Query"andoneinwhichPurposeis"Update".Forinformationonupdatebindings,seetheCanUpdateproperty.

AnXMLDataBindingobjectrepresentsabindingtoanXMLfile,aSOAPservice,anotherWebpart(onlywhenbindingfromaSpreadsheetWebPart),oradataretrievalserviceconnection.

TheXMLfragmentwherethedetailsappearintheXMLSpreadsheetfilelookssomethinglikethefollowing:

<udc:DataSourceMajorVersion="1"MinorVersion="0"xmlns:udc="http://schemas.microsoft.com/data/udc"><udc:TypeType="XMLFile"MajorVersion="1"MinorVersion="0"/><udc:Name>Example_Filename<udc:Name/><udc:ConnectionInfoPurpose="Update">...</udc:ConnectionInfo></udc:DataSource>

Page 923: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplefirstdetermineswheteradataretrievalserviceconnectionbindingcanbeupdated(thatis,whetheritsPurposeattributehasthevalue"Update").Ifso,thecodecallstheUpdateBindingfunction,passingintheBindingIdattributevalueastheargument.Becauseupdatebindingsarealwaysperformedsynchronously,thereisnoneedtocheckifthebindingisasynchronous,andthefunctioncallstheUpdatemethodimmediately.

DimobjBinding

SetobjBinding=Spreadsheet1.ActiveWorkbook.XmlDataBindings("Cust_bind_id")IfobjBinding.CanUpdate=TrueThen'Fetchthedataandupdatethecorrespondingmap.UpdateBinding("Cust_bind_id")EndIfNext

FunctionUpdateBinding(strBindingID)DimobjBindingSetobjBinding=Spreadsheet1.ActiveWorkbook.XmlDataBindings(strBindingID)

objBinding.UpdateEndFunction

Page 924: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 925: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CaptionProperty

CaptionpropertyasitappliestotheChSeries,ChTitle,ChTrendline,Heading,Spreadsheet,PivotField,PivotFieldSet,PivotLabel,PivotMemberProperty,PivotTotal,andTitleBarobjects.

CaptionpropertyasitappliestotheChCategoryLabel,PivotAxisMember,PivotColumnMember,PivotMember,PivotPageMember,PivotResultMemberProperty,andPivotRowMemberobjects.

Page 926: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheSpreadsheetobject.

Page 927: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 928: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CaptionHAlignmentProperty

ReturnsorsetsthehorizontalalignmentforthedetailfooterlabelinthespecifiedPivotTablelist.Read/writePivotHAlignmentEnum.

expression.CaptionHAlignment

expressionRequired.AnexpressionthatreturnsaPivotTotalobject.

Page 929: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksCaptionscanbedisplayedonlytotheleftofaggregatesinthedetailfooter.UsetheCaptionHAlignmentpropertytoalignthecaptionclosetotheaggregate(plHAlignRight)ortoalignthecaptionclosetotheleftedgeofthefooter(plHAlignLeft).Ifthereisanotheraggregatedisplayedtotheleft,thecaptionisdisplayedtotherightoftheotheraggregate.Ifthereisnotenoughroomtodisplaythecaption,itisnotvisible.

Page 930: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatstotalsandtheircaptionsinthePivotTable1.

SubSet_Total_Alignment()DimptConstantsDimvwViewDimtotTotal

SetptConstants=PivotTable1.ConstantsSetvwView=PivotTable1.ActiveView'Loopthroughalltotalsintheview.ForEachtotTotalinvwView.DataAxis.Totals'Setthehorizontalalignmentofthetotaltocenter.totTotal.HAlignment=ptConstants.plHAlignCenter'Setthehorizontalalignmentofthecaptiontocenter.totTotal.CaptionHAlignment=ptConstants.plHAlignCenterNextEndSub

Page 931: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CaptionSectionProperty

Trueifthespecifiedgrouplevelhasacaptionsectionshowing.Read/writeBoolean.

expression.CaptionSection

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 932: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThecaptionsectionappearsonadataaccesspageonlyonce,aboveallthevisiblerecordsatagivengrouplevel.Thecaptionsectionremainsvisibleasyouscrollthroughtherecords.

Page 933: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CategoryLabelsProperty

ReturnsthecollectionofChCategoryLabelsforthespecifiedaxis.Validonlyforcategoryandtimescaleaxes.

expression.CategoryLabels

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 934: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CellProperty

ReturnsaPivotCellobjectthatindicatesthelocationoftheaggregatecellordetailcell.UsethispropertytoreturnmoreinformationabouttheselectedareainaPivotTablelist.

expression.Cell

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 935: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleutilizestheDoubleClickeventofPivotTable1todisplaymoreinformationaboutacellinthedetailareaofthePivotTable.ThisexampleassumesthatPivotTable1isusingtheCustomerstableformtheNorthwinddatabase.

SubPivotTable1_DblClick()DimptSelectionDimnRowDimrs

SetptSelection=PivotTable1.Selection

'Ifthecurrentselectionisinthe'detailareaofthePivotTablelist.IfTypeName(ptSelection)="PivotDetailRange"then

nRow=ptSelection.TopLeft.Row

'Setavariabletotherecordsetofthetop-left'cellintheselection.Setrs=ptSelection.TopLeft.Cell.Recordset

'Movethecursorthethecorrectrecordintherecordset.rs.MovenRow

MsgBox"Therowthatwasdouble-clickedwas..."&String(2,vbCrLf)&_"CustomerID="&rs("CustomerID")&vbCrLf&_"CompanyName="&rs("CompanyName")&vbCrLf&_"ContactName="&rs("ContactName")ElseMsgBox"Double-clickonarow!",vbExclamation

Page 936: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndIf

EndSub

Page 937: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 938: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CellsProperty

CellspropertyasitappliestotheRange,Spreadsheet,andWorksheetobjects.

CellspropertyasitappliestothePivotDataandPivotRangeobjects.

Page 939: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRange,Spreadsheet,andWorksheetobjects.

Page 940: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CellsExProperty

ReturnsaPivotCellobjectthatrepresentstheintersectionofthespecifiedrow,column,andpagemembers.

expression.CellsEx(Row,Column,Page)

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

RowRequiredPivotRowMemberobject.Specifiestherowcontainingthereturnedcell.

ColumnRequiredPivotColumnMemberobject.Specifiesthecolumncontainingthereturnedcell.

PageRequiredPivotPageMemberobject.Specifiesthepagecontainingthereturnedcell.

Page 941: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariabletothetotalamountshippedvia2-Dayshippingtopostalcode28016inNorthCarolina.

SubGet2DayShippingToNC()

DimptDataDimpmRowMemberDimpmColMemberDimpmPageMemberDimpmIntersectionDimdblShipTotal

SetptData=PivotTable1.ActiveData

'Setavariabletoarowfieldmember.SetpmRowMember=ptData.RowAxis.Member.ChildAxisMembers("NorthCarolina")

'Setavariabletoacolumnfieldmember.SetpmColMember=ptData.ColumnAxis.Member.ChildAxisMembers("2-Day")

'Setavariabletoapagefieldmember.SetpmPageMember=ptData.PageAxis.Member.ChildAxisMembers("28016")

'Setavariabletotheintersectionoftherow,column,andpagefieldmembers.SetpmIntersection=ptData.CellsEx(pmRowMember,pmColMember,pmPageMember)

'Setavariabletothetotalshippingamountfortheitem.dblShipTotal=pmIntersection.Aggregates("Shipping").Value

EndSub

Page 942: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 943: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartDepthProperty

ReturnsorsetsaLongspecifyingthedepthofathree-dimensionalchartinrelationtoit'swidth.Settingthispropertytoavalueavaluegreaterthan100willmakeachartwhichisdeeperthanitiswide,whileavaluelessthan100willmakeachartwiderthanitisdeep.Validsettingsrangefrom0to500.Read/write.

expression.ChartDepth

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 944: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyhasnoeffectona3-DPiechart.

Page 945: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthenincreasesthewidthanddepthofthechart.

SubFormat_3D_Depth_Width()

Dimcht3DColumn

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3DColumnchart.cht3DColumn.Type=chChartTypeColumnClustered3D

'Increasethedepthofthechartinrelation'toit'swidth.cht3DColumn.ChartDepth=125

'Increasethewidthofthechartinrelation'toit'sheight.cht3DColumn.AspectRatio=80

EndSub

Page 946: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartFieldsProperty

ReturnsaChChartFieldsobjectasthecollectionoffieldsthathavebeenaddedtothespecifieddropzone.

expression.ChartFields

expressionRequired.AnexpressionthatreturnsaChDropZoneobject.

Page 947: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysthenumberoffieldsthathavebeenaddedtotheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Displaythenumberoffieldsthathavebeenaddedtothe'seriesdropzone.MsgBoxdzSeriesDropZone.ChartFields.Count

EndSub

Page 948: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 949: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartLayoutProperty

Returnsorsetsthelayoutforallthechartsinthespecifiedchartworkspace.Read/writeChartChartLayoutEnum.

expression.ChartLayout

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Becausethechartworkspacecancontainoneormorecharts,youcanuseboththeChartLayoutandChartWrapCountpropertiestospecifyhowmultiplechartsarepositioned.TheChartLayoutpropertymakesitpossibletocreatecustomchartarrangements,suchasthreechartspositionedhorizontallyinasinglerow.

Therearetwodistinctlayouttypesforcharts:

ChChartLayoutHorizontalChartsarepositionedhorizontallyfromlefttorightuntilthenumberofchartsspecifiedbytheChartWrapCountpropertyisreached.Whenthisoccurs,anewrowiscreatedbelowtheactiverowandthepositioningprocessbeginsagainattheleft.Thismethodcontinues(wrappingeveryChartWrapCountnumber)untilallchartshavebeenplaced.

ChChartLayoutVerticalChartsarepositionedverticallyfromtoptobottomuntilthenumberofchartsspecifiedbytheChartWrapCountpropertyisreached.Whenthisoccurs,anewcolumniscreatedtotherightoftheactivecolumnandpositioningbeginsagainatthetop.Thismethodcontinues(wrappingeveryChartWrapCountnumberofcharts)untilallchartshavebeenplaced.

Page 950: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheChartWrapCountandChartLayoutpropertiesandthenaddssixadditionalchartstothespecifiedchartworkspace.

SubAddCharts()DimchtChartDimchConstantsDimiCtrSetchConstants=ChartSpace1.Constants'Setthechartworkspacesothataroworcolumn'ofchartsiscreatedforeverytwocharts'inthechartworkspace.ChartSpace1.ChartWrapCount=2'Setthechartworkspacesothatthechartsarelaidourhorizontally.'Sincethiscodeaddssixchartstothechartworkspaceandthe'ChrtWrapCountpropertyhasbeensettowrapeverytwocharts,'thenthecoderesultsinthreerowsoftwocharts.ChartSpace1.ChartLayout=chConstants.chChartLayoutHorizontalForiCtr=1To6'Addacharttothechartworkspace.SetchtChart=ChartSpace1.Charts.Add'Enablethecharttitle.chtChart.HasTitle=True'Addatitletothechartthatindicatestheorder'inwhichthechartwascreated.

Page 951: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

chtChart.Title.Caption="Chart#"&iCtr'Specifythatthechartistobealinechart.chtChart.Type=chConstants.chChartTypeLineNextEndSub

Page 952: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartsProperty

ReturnstheChChartscollectionforthespecifiedchartworkspace.

expression.Charts

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 953: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksBydefault,anewchartworkspacecontainsnocharts.Afteryoucreateanewchartworkspace,youmustaddaChartobjecttoitbeforeyoucancreateachart.UsetheAddmethodtocreateanewchart.

Page 954: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsacharttothespecifiedchartworkspace.

Setcht=ChartSpace1.Charts.Add

Page 955: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartWrapCountProperty

Returnsorsetsthenumberofchartsthatareplacedhorizontallyorverticallybeforewrappingoccurs.Foramorecompletediscussionoflayoutandwrapping,seetheHelptopicfortheChartLayoutproperty.Read/writeLong.

expression.ChartWrapCount

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 956: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheChartWrapCountandChartLayoutpropertiesandthenaddssixadditionalchartstothespecifiedchartworkspace.

SubAddCharts()DimchtChartDimchConstantsDimiCtrSetchConstants=ChartSpace1.Constants'Setthechartworkspacesothataroworcolumn'ofchartsiscreatedforeverytwocharts'inthechartworkspace.ChartSpace1.ChartWrapCount=2'Setthechartworkspacesothatthechartsarelaidourhorizontally.'Sincethiscodeaddssixchartstothechartworkspaceandthe'ChrtWrapCountpropertyhasbeensettowrapeverytwocharts,'thenthecoderesultsinthreerowsoftwocharts.ChartSpace1.ChartLayout=chConstants.chChartLayoutHorizontalForiCtr=1To6'Addacharttothechartworkspace.SetchtChart=ChartSpace1.Charts.Add'Enablethecharttitle.chtChart.HasTitle=True'Addatitletothechartthatindicatestheorder'inwhichthechartwascreated.

Page 957: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

chtChart.Title.Caption="Chart#"&iCtr'Specifythatthechartistobealinechart.chtChart.Type=chConstants.chChartTypeLineNextEndSub

Page 958: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CheckedProperty

Returnswhetherthespecifiedcommandisenabled.Read-onlyBoolean.

expression.Checked

expressionRequired.AnexpressionthatreturnsanOCCommandobject.

Page 959: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheOCCommandId,ChartCommandIdEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachWebcomponent.

Page 960: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChildAxisMembersProperty

ReturnsaPivotAxisMemberscollectionthatrepresentsthechildrenofthespecifiedPivotAxisMemberobject.

expression.ChildAxisMembers

expressionRequired.AnexpressionthatreturnsaPivotAxisMemberobject.

Page 961: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariabletothetotalamountshippedvia2-Dayshippingtopostalcode28016inNorthCarolina.

SubGet2DayShippingToNC()

DimptDataDimpmRowMemberDimpmColMemberDimpmPageMemberDimpmIntersectionDimdblShipTotal

SetptData=PivotTable1.ActiveData

'Setavariabletoarowfieldmember.SetpmRowMember=ptData.RowAxis.Member.ChildAxisMembers

'Setavariabletoacolumnfieldmember.SetpmColMember=ptData.ColumnAxis.Member.ChildAxisMembers

'Setavariabletoapagefieldmember.SetpmPageMember=ptData.PageAxis.Member.ChildAxisMembers

'Setavariabletotheintersectionoftherow,column,andpagefieldmembers.SetpmIntersection=ptData.CellsEx(pmRowMember,pmColMember,pmPageMember)

'Setavariabletothetotalshippingamountfortheitem.dblShipTotal=pmIntersection.Aggregates("Shipping").Value

EndSub

Page 962: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChildColumnMembersProperty

ReturnsaPivotColumnMemberscollectionthatrepresentsthechildrenofthespecifiedPivotColumnMemberobject.

expression.ChildColumnMembers

expressionRequired.AnexpressionthatreturnsaPivotColumnMemberobject.

Page 963: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariabletothetotalamountshippedvia2-Dayshippingtopostalcode28016inNorthCarolina.

SubGet2DayShippingToNC()

DimptDataDimpmRowMemberDimpmColMemberDimpmPageMemberDimpmIntersectionDimdblShipTotal

SetptData=PivotTable1.ActiveData

'Setavariabletoarowfieldmember.SetpmRowMember=ptData.RowAxis.RowMember.ChildRowMembers("NorthCarolina")

'Setavariabletoacolumnfieldmember.SetpmColMember=ptData.ColumnAxis.ColumnMember.ChildColumnMembers

'Setavariabletoapagefieldmember.SetpmPageMember=ptData.PageAxis.PageMember.ChildPageMembers("28016")

'Setavariabletotheintersectionoftherow,column,andpagefieldmembers.SetpmIntersection=ptData.CellsEx(pmRowMember,pmColMember,pmPageMember)

'Setavariabletothetotalshippingamountfortheitem.dblShipTotal=pmIntersection.Aggregates("Shipping").Value

EndSub

Page 964: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChildLabelProperty

GetsorsetsthevalueoftheIDattributeofthelabelassociatedwithacontrol.Read/writeString.

expression.ChildLabel

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 965: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChildMembersProperty

ReturnsaPivotMemberscollectionthatrepresentsthechildmembersofthespecifiedmember.

expression.ChildMembers

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 966: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 967: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChildPageMembersProperty

ReturnsaPivotPageMemberscollectionthatrepresentsthechildrenofthespecifiedPivotPageMemberobject.

expression.ChildPageMembers

expressionRequired.AnexpressionthatreturnsaPivotPageMemberobject.

Page 968: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariabletothetotalamountshippedvia2-Dayshippingtopostalcode28016inNorthCarolina.

SubGet2DayShippingToNC()

DimptDataDimpmRowMemberDimpmColMemberDimpmPageMemberDimpmIntersectionDimdblShipTotal

SetptData=PivotTable1.ActiveData

'Setavariabletoarowfieldmember.SetpmRowMember=ptData.RowAxis.RowMember.ChildRowMembers("NorthCarolina")

'Setavariabletoacolumnfieldmember.SetpmColMember=ptData.ColumnAxis.ColumnMember.ChildColumnMembers("2-Day")

'Setavariabletoapagefieldmember.SetpmPageMember=ptData.PageAxis.PageMember.ChildPageMembers

'Setavariabletotheintersectionoftherow,column,andpagefieldmembers.SetpmIntersection=ptData.CellsEx(pmRowMember,pmColMember,pmPageMember)

'Setavariabletothetotalshippingamountfortheitem.dblShipTotal=pmIntersection.Aggregates("Shipping").Value

EndSub

Page 969: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChildRowMembersProperty

ReturnsaPivotRowMemberscollectionthatrepresentsthechildrenofthespecifiedPivotRowMemberobject.

expression.ChildRowMembers

expressionRequired.AnexpressionthatreturnsaPivotRowMemberobject.

Page 970: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariabletothetotalamountshippedvia2-Dayshippingtopostalcode28016inNorthCarolina.

SubGet2DayShippingToNC()

DimptDataDimpmRowMemberDimpmColMemberDimpmPageMemberDimpmIntersectionDimdblShipTotal

SetptData=PivotTable1.ActiveData

'Setavariabletoarowfieldmember.SetpmRowMember=ptData.RowAxis.RowMember.ChildRowMembers

'Setavariabletoacolumnfieldmember.SetpmColMember=ptData.ColumnAxis.ColumnMember.ChildColumnMembers("2-Day")

'Setavariabletoapagefieldmember.SetpmPageMember=ptData.PageAxis.PageMember.ChildPageMembers("28016")

'Setavariabletotheintersectionoftherow,column,andpagefieldmembers.SetpmIntersection=ptData.CellsEx(pmRowMember,pmColMember,pmPageMember)

'Setavariabletothetotalshippingamountfortheitem.dblShipTotal=pmIntersection.Aggregates("Shipping").Value

EndSub

Page 971: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChildSectionProperty

ReturnsaSectionobjectthatrepresentsthechildsectionforthespecifiedsection.Thispropertyfailsifthespecifiedsectionisnotexpanded.

expression.ChildSection

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 972: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColorProperty

Returnsorsetstheprimarycolorofthespecifiedobject.Read/writeVariant.

Page 973: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Oncharts,youcanalsouseeitherofthefollowingtwospecialconstants:chColorAutomatic(toresetthecolortothedefaultvalue)orchColorNone(toindicatenocolor,ortransparency).However,youcannotsetafontcolortochColorNone.

Page 974: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsamedium-weightgreenbordertoallcellsintherangeB5:C10onthespreadsheet.

SubSetBorder()

SetssConstants=Spreadsheet1.ConstantsSpreadsheet1.ActiveSheet.Range("b5:c10").Borders.Weight=ssConstants.owcLineWeightMediumSpreadsheet1.ActiveSheet.Range("b5:c10").Borders.Color="green"EndSub

Page 975: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 976: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColorIndexProperty

ColorIndexpropertyasitappliestotheBorderobject.

ColorIndexpropertyasitappliestotheBordersobject.

ColorIndexpropertyasitappliestotheFontobject.

ColorIndexpropertyasitappliestotheInteriorobject.

Page 977: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyspecifiesacolorasanindexintotheworkbookcolorpalette.YoucanusetheColorsmethodtoreturnthecurrentcolorpalette.

Thefollowingillustrationshowsthecolor-indexvaluesinthedefaultcolorpalette.

Page 978: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheFontobject.

Page 979: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColorsProperty

Returnsorsetscolorsinthepalettefortheworkbook.Thepalettehas56entries,eachrepresentedbyanRGBvalue.Read/writeVariant.

expression.Colors(Index)

expressionRequired.AnexpressionthatreturnsaWorkbookobject.

IndexOptionalVariant.Thecolornumber(from1to56).Ifthisargumentisn’tspecified,thismethodreturnsanarraythatcontainsall56ofthecolorsinthepalette.

Page 980: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetscolorfiveinthecolorpalettefortheactiveworkbook.

Spreadsheet1.ActiveWorkbook.Colors(5)=RGB(255,0,0)

ThisexamplecreatesatableontheactiveworksheetinSpreadsheet1thatdisplaystheavailablecolorpalette.

SubCreate_Color_Table()DimavarColorArray()DimiCtrDimrngCurrent

'Setanarrayvariabletothecolorsinthecolorpalette.avarColorArray=Spreadsheet1.ActiveWorkbook.Colors

SetrngCurrent=Spreadsheet1.ActiveSheet.Range("A1")

'Loopthroughallofthecolorsinthearray.ForiCtr=1ToUBound(avarColorArray)rngCurrent.Value="Color"&iCtr

'SetthecolorofacellincolumnBto'theappropriatecolor.rngCurrent.Offset(0,1).Interior.Color_=avarColorArray(iCtr)

SetrngCurrent=rngCurrent.Offset(1,0)NextEndSub

Page 981: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColumnProperty

Returnsthenumberofthefirstcolumninthespecifiedrange.Read-onlyLong.

expression.Column

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 982: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefonttoboldineveryothercolumnofthevisiblerangeontheactiveworksheet.

SubBoldColumns()Dimcol

ForEachcolInSpreadsheet1.ActiveSheet.VisibleRange.ColumnsIfcol.ColumnMod2=0Thencol.Font.Bold=TrueNextEndSub

Page 983: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColumnAxisProperty

PivotDataobject:ReturnsaPivotResultColumnAxisobjectthatrepresentsthecolumnaxisinthespecifiedPivotTablelist.

PivotViewobject:ReturnsaPivotGroupAxisobjectthatrepresentsthecolumnaxisinthespecifiedPivotTablelist.

expression.ColumnAxis

expressionRequired.AnexpressionthatreturnsaPivotDataorPivotViewobject.

Page 984: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleinsertstwofieldsetsintothePivotTablelistintheactiveview.

SubAddFieldsToPT()

DimptView

SetptView=PivotTable1.ActiveView

ptView.ColumnAxis.InsertFieldSetptView.FieldSets("StoreType")

ptView.RowAxis.InsertFieldSetptView.FieldSets("Promotions")

EndSub

Page 985: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColumnHeadingsProperty

ReturnsaHeadingscollectionthatrepresentsthecolumnheadingsinthespecifiedwindow.UsetheCaptionpropertytocustomizethecolumnheadings.

expression.ColumnHeadings

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 986: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecreatesacustomdataentrysheetbydisablingsomeuserinterfaceelements,limitingtheviewablerangeintheactivewindow,andcustomizingtherowandcolumnheadings.

SubCreate_Datasheet()DimhdrColHeadingsDimhdrRowHeadingsDimwndActive

SetwndActive=Spreadsheet1.ActiveWindow

'HidevariousUIelements.wndActive.DisplayWorkbookTabs=FalseSpreadsheet1.DisplayToolbar=False

'Displaythetitlebarandsetit'scaption.Spreadsheet1.DisplayTitleBar=TrueSpreadsheet1.TitleBar.Caption="RevenueWorksheet"

'Resizethespreadsheetcomponent.Spreadsheet1.AutoFit=True

'Limittheviewablerangeoftheactivesheet.wndActive.ViewableRange="A1:D5"

'Setavariabletothecolumnheadingsintheactivewindow.SethdrColHeadings=wndActive.ColumnHeadings

'Setavariabletotherowheadingsintheactivewindow.SethdrRowHeadings=wndActive.RowHeadings

Page 987: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'SettheheadingsofcolumnsAthroughD.hdrColHeadings(1).Caption="Qtr1"hdrColHeadings(2).Caption="Qtr2"hdrColHeadings(3).Caption="Qtr3"hdrColHeadings(4).Caption="Qtr4"

'Settheheadingsofrows1though5.hdrRowHeadings(1).Caption="1996"hdrRowHeadings(2).Caption="1997"hdrRowHeadings(3).Caption="1998"hdrRowHeadings(4).Caption="1999"hdrRowHeadings(5).Caption="2000"EndSub

Page 988: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColumnMemberProperty

ReturnsaPivotColumnMemberobjectthatrepresentstheinnermostmemberonthecolumnaxisthatintersectsthespecifiedcell.

expression.ColumnMember

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 989: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColumnMembersProperty

ReturnsaPivotColumnMemberscollectionthatrepresentsallthemembersofthespecifiedcolumn.

expression.ColumnMembers

expressionRequired.AnexpressionthatreturnsaPivotRangeobject.

Page 990: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThecollectionofcolumnmembersdoesnotincludeanymembersthatyouhavefilteredbysettingtheirIsFilteredpropertytoTrue.

Page 991: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 992: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColumnsProperty

ColumnpropertyasitappliestotheRangeobject.

ColumnpropertyasitappliestotheSpreadsheetandWorksheetobjects.

Page 993: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRangeobject.

AsitappliestotheWorksheetobject.

Page 994: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ColumnWidthProperty

Returnsorsetsthewidthofallcolumnsinthespecifiedrange.ReturnsNullifthecolumnsintherangearenotallthesamewidth.UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.Read/writeVariant.

expression.ColumnWidth

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 995: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheformula,columnwidth,andnumberformatforallthecellsintherangeA1:F10ontheactiveworksheet.

SubFormat_Sheet1()DimrngCurrentSetrngCurrent=Spreadsheet1.ActiveSheet.Range("A1:F10")rngCurrent.Formula="=rand()"rngCurrent.ColumnWidth=10rngCurrent.NumberFormat="#.###"EndSub

Page 996: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CommandsProperty

ReturnsanOCCommandsobjectthatrepresentsthecollectionofcommandsavailable.

expression.Commands

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 997: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CommandTextProperty

Returnsorsetsthecommandstringforthespecifiedobject.Read-onlyStringfortheRecordsetDefandSchemaRowsourceobjects;read/writeStringforallotherobjectsintheAppliesTolist.

expression.CommandText

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 998: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksFortypedscCommandText,thispropertyreturnsorsetsatextstring(usuallySQL)thatreturnsasingleresultsetfromtheprovider.

FortypedscCommandFile,thispropertyreturnsorsetstheURLofanXMLfilecontainingdataforthespecifiedSchemaRowsourceobject.

Page 999: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1000: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CompareMemberCaptionsByProperty

ReturnsorsetsaPivotMembersCompareByEnumconstantthatdetermineshowthePivotTablecontrolcomparesmembercaptionstothelistofcustomcaptionssetbytheMemberCaptionsproperty.CaptionsthatmatchthecustomlistestablishedbytheMemberCaptionspropertyarerenamedusingthecustomcaption.Read/write.

expression.CompareMemberCaptionsBy

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 1001: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThedefaultsettingwhenthespecifiedfieldsetisatime-basedfieldisplMembersCompareByName.Otherwise,thedefaultsettingisplMembersCompareByUniqueName.

Page 1002: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1003: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CompareOrderedMembersByProperty

ReturnsorsetsaPivotMembersCompareByEnumconstantthatdetermineshowthePivotTablecontrolsortsmembersofthespecifiedfieldsetwhenacustomsortorderhasbeenestablishedbytheOrderedMembersproperty.Read/write.

expression.CompareOrderedMembersBy

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 1004: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThedefaultsettingwhenthespecifiedfieldsetisatime-basedfieldisplMembersCompareByName.Otherwise,thedefaultsettingisplMembersCompareByUniqueName.

Page 1005: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ConnectionProperty

ReturnsorsetstheADOConnectionobjectusedbythespecifiedobject.Read/writeforthePivotTableobject;read-onlyfortheDataSourceControlandDSCEventInfoobjects.

expression.Connection

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1006: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsecautionwhencallingmethodsorsettingpropertiesfortheConnectionobjectreturnedbythisproperty.Forexample,youshouldnotcalltheConnectionobject'sClosemethod.

ImportantForinformationaboutsecuredataconnections,seeMakingConnectionstoExternalDataSourcesMoreSecure.

Page 1007: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ConnectionFileProperty

ReturnsorsetsaStringthatspecifiestheOfficeDatabaseConnection(.odc)orMicrosoftDataLink(.udl)filethatisusedtoconnectthedataaccesspagetoadatasource.Read/write.

expression.ConnectionFile

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1008: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconnectsthedataaccesspagetoaOfficeDatabaseConnectionfilenamed"SQLNorthwind.odc".

MSODSC.ConnectionFile="SQLNorthwind.odc"

Page 1009: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ConnectionStringProperty

ReturnsorsetstheADOconnectionstringforatwo-tierdatabaseconnection.Read/writeString.

expression.ConnectionString

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1010: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWiththedatasourcecontrol,thispropertyisequivalenttoCurrentProject.BaseConnectionStringinMicrosoftAccess.Whenthedatasourcecontrolcreatesaconnection,thevalueofthedatasourcecontrolConnectionStringpropertymaynotbethesameasthevaluereturnedbytheConnectionStringpropertyoftheConnectionobjectbecausethedatasourcecontrolusesotherOLEDBproviderstosupplyadditionalservices.Forexample,onanHTMLpagecontainingadatasourcecontrolwithID"MSODSC"thefollowingexpressionsmaynotbeequivalent.

ImportantForinformationaboutsecuredataconnections,seeMakingConnectionstoExternalDataSourcesMoreSecure.

MSODSC.ConnectionStringMSODSC.Connection.ConnectionString

Page 1011: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleestablishesaconnectiontoadatabase,queriesthedata,andthenaddsfieldstoPivotTable1whentheWebpagecontainingthePivotTable1isloaded.

SubWindow_OnLoad()

DimsConnStrDimptView'Setavariabletotheconnectionstring.sConnStr="Provider=sqloledb;DataSource=DataServer;InitialCatalog=Testing;IntegratedSecurity=SSPI;"'SettheconnectionstringPivotTable1.ConnectionString=sConnStr

'ReturnalldatafromtheSpendingtable.PivotTable1.CommandText="Select*fromSpending"SetptView=PivotTable1.ActiveView'Thefollowingfourlinesofcodeaddfieldstotherowareaanddata'areasofthePivotTablelist.ptView.RowAxis.InsertFieldSetptView.FieldSets("Project")ptView.RowAxis.InsertFieldSetptView.FieldSets("Year")ptView.DataAxis.InsertFieldSetptView.FieldSets("Budget")ptView.DataAxis.InsertFieldSetptView.FieldSets("Actual")

EndSub

Page 1012: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ConstantsProperty

Returnsanobjectthatallowsscriptuserstousenamedconstants.Read-only.

Formoreinformation,seeUsingNamedConstantsinVBScript.

ThispropertyisrequiredonlyonHTMLpages.Inothercontainers(suchasVisualBasic),youcanusedefinedconstantsfromtheobjectmodeldirectly,withoutfirstusingtheConstantsproperty.UsingtheConstantspropertyinothercontainerswillworkbutisnotrecommended,asitwillcauseyourcodetorunsignificantlyslower.

expression.Constants

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1013: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsamedium-weightgreenbordertoeachcellintherangeB5:C10onthespreadsheet.BecausenamedconstantsarenotavailableinVBScript,theexamplesetsavariabletotheobjectreturnedbytheConstantsproperty.

SubSetBorder()DimssConstants'SetavariabletotheconstantsoftheSpreadsheetcomponent.SetssConstants=Spreadsheet1.Constants'Settheborderweight.Spreadsheet1.Range("b5:c10").Borders.Weight=ssConstants.owcLineWeightMedium'Setthebordercolor.Spreadsheet1.Range("b5:c10").Borders.Color="green"EndSub

Page 1014: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ConsumesRecordsetProperty

Trueforcomplexcontrolsifdataissuppliedbythedatasourcecontrol.Anydata-boundcontrolhaseitheraControlSourceproperty(usedwithasimpleHTMLcontrol)oraConsumesRecordsetproperty(usedwithacomplexcontrolsuchasaPivotTablelistorchartworkspace).Read/writeBoolean.

expression.ConsumesRecordset

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 1015: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ControlProperty

ReturnsaPivotTableobjectthatrepresentsthePivotTablelistforthespecifiedPivotDataorPivotViewobject.

expression.Control

expressionRequired.AnexpressionthatreturnsaPivotDataorPivotViewobject.

Page 1016: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ControlSourceProperty

Returnsorsetsthenameofthecontroltowhichthespecifiedcontrolisbound.Read/writeString.

expression.ControlSource

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 1017: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsorsetsthevaluesoftheNameandSourcepropertiesforthefieldtowhichthespecifiedcontrolisbound.Thepropertyvaluesarereturnedasastringinthefollowingformat:"PageField.Name:PageField.Source"wherethestringsinitalicsarereplacedwiththeactualvaluesoftheNameandSourceproperties.IftheNameandSourcepropertyvaluesareidentical,onlyonevalueisreturned.

Ifyousetthispropertytothenameofaschemafieldinaschemarowsourceusedbythesectioncontainingthespecifiedcontrol,theschemafieldisautomaticallyaddedasapagefield.

Page 1018: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CountProperty

Returnsthenumberofobjectsinthespecifiedcollection.Read-onlyLong.

expression.Count

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1019: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsvariablestothenumberofcolumnsandthenumberofrowsinthevisiblerangeontheactiveworksheet,andthenformatsthecolorofthecellsineveryotherrow.

SubFormat_Odd_Rows()DimrngUsedDimiUsedRowsDimiUsedColumnsDimshtActiveDimiCtrSetshtActive=Spreadsheet1.ActiveSheet'Setavariableottheusedrangeoftheactivesheet.SetrngUsed=shtActive.UsedRange'Getthecountofusedrowsintheactivesheet.iUsedRows=rngUsed.Rows.Count'Getthecountofusedcolumnsintheactivesheet.iUsedColumns=rngUsed.Columns.Count'Loopthrougheveryoddrowintheusedrange.ForiCtr=1ToiUsedRowsStep2'Colorthebackgroundofthecellsgreen.shtActive.Range(shtActive.Cells(iCtr,1),shtActive._Cells(iCtr,iUsedColumns)).Interior.ColorIndex=43NextEndSub

Page 1020: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 1021: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CriteriaProperty

ReturnstheCriteriaobjectforthespecifiedfilter.UsetheAddmethodoftheCriteriaobjectreturnedbythispropertytoaddcriteriatoaFilterobject.Read-only.

expression.Criteria

expressionRequired.AnexpressionthatreturnsaFilterobject.

Page 1022: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsontheAutoFilterfortherangeA1:C20,setsfiltersforcolumnsAandC,andthenappliesthefilters.

SubApply_AutoFilter()DimafFiltersDimafCol1DimafCol3

'TurnonAutoFilter.Spreadsheet1.Worksheets("Sheet1").Range("A1:C20").AutoFilter

'SetavariabletotheAutoFilterobjectSetafFilters=Spreadsheet1.Worksheets("sheet1").AutoFilter

SetafCol1=afFilters.Filters(1)SetafCol3=afFilters.Filters(3)

'AddacriteriathatexcludesbluefromcolumnA.afCol1.Criteria.Add"blue"

'AddacriteriathatexcludesgreenfromcolumnA.afCol1.Criteria.Add"green"

'Addacriteriathatexcludesyellowfromcolumnc.afCol3.Criteria.Add"yellow"

'ApplythecriteriaafFilters.ApplyEndSub

Page 1023: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1024: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CrossesProperty

Returnsorsetsavaluethatindicateshowthespecifiedaxiscrossesanotheraxis.Read/writeChartAxisCrossesEnum.

expression.Crosses

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1025: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecategoryaxistocrossthevalueaxisatvaluezero(0)inthechartworkspaceifacustomcrossingpointhasnotalreadybeensetforthecategoryaxis.

SubFormat_Axis()DimchConstantsDimaxValueAxisDimaxCategoryAxis

SetchConstants=ChartSpace1.ConstantsSetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)SetaxCategoryAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)IfaxCategoryAxis.Crosses=chConstants.chAxisCrossesAutomaticThenaxValueAxis.CrossingAxis=axCategoryAxisaxCategoryAxis.CrossesAtValue=0EndIf

EndSub

Page 1026: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CrossesAtValueProperty

Returnsorsetsthecrossingpointforthespecifiedaxis.Whenyousetthisvalueforanaxis,youaresettingthevalueontheotheraxiswheretheaxisyouaresettingwillcrossthatotheraxis.Forexample,settingthispropertyonthevalue(y)axissetsthecategorynumberwherethevalueaxiswillcrossthecategory(x)axis.Read/writeDouble.

expression.CrossesAtValue

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1027: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecategoryaxistocrossthevalueaxisatvaluezero(0)inthechartworkspace.

SubSetCrossingValue()DimchConstantsDimaxValueAxisDimaxCategoryAxisSetchContants=ChartSpace1.ConstantsSetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)SetaxCategoryAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)axValueAxis.CrossingAxis=axCategoryAxisaxCategoryAxis.CrossesAtValue=0EndSub

Thefollowingexamplecausesthevalueaxistocrossthecategoryaxisatthethirdcategory.

SubSetCrossingCategory()DimchConstantsSetchConstants=ChartSpace1.ConstantsChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).CrossesAtValueEndSub

Page 1028: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CrossingAxisProperty

Returnsorsetsthecrossingaxis.Ifthespecifiedaxisisdeleted,thispropertyissettoNull,andtheCrossespropertyisresettochAxisCrossesAutomatic.Read/writeChAxis.

expression.CrossingAxis

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1029: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecategoryaxistocrossthevalueaxisatvaluezero(0)inthechartworkspace.

SubSetCrossingValue()DimchConstantsDimaxValueAxisDimaxCategoryAxisSetchtContants=ChartSpace1.ConstantsSetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)SetaxCategoryAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)axValueAxis.CrossingAxis=axCategoryAxisaxCategoryAxis.CrossesAtValue=0EndSub

Page 1030: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CSVDataProperty

Returnsorsetsspreadsheetdataasacomma-delimitedlist.Read/writeString.

expression.CSVData

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1031: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthevaluesforcellsA1:G1.

Spreadsheet1.CSVData="1,1,2,3,5,8,13"

Page 1032: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CSVURLProperty

ReturnsorsetstheURL(Internetaddress)forthecomma-delimitedspreadsheetdatafile.Read/writeString.

expression.CSVURL

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1033: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsspreadsheetdatafromafileontheuser'scomputer.

Spreadsheet1.CSVURL="file:\test.csv"

Page 1034: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CurrentArrayProperty

Ifthespecifiedcellispartofanarray,returnsaRangeobjectthatrepresentstheentirearray.Resultsinarun-timeerrorifthespecifiedcellisnotpartofanarray.Read-only.

expression.CurrentArray

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1035: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheHasArraypropertytodeterminewhetherornotacellispartofanarray.

Page 1036: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAssumingthattheactivecellispartofanarray,thisexampleselectsthearray.

Spreadsheet1.ActiveCell.CurrentArray.Select

Page 1037: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CurrentCellProperty

ReturnsaPivotCellobjectthatcontainsthedetailcellthatiscurrentlybeingedited.

expression.CurrentCell

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 1038: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyisrelevantonlywhenthePivotTablelistisconnectedtoarelationaldatasource.

Page 1039: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CurrentRegionProperty

ReturnsaRangeobjectthatrepresentsthecurrentregion.Thecurrentregionisarangeboundedbyanycombinationofblankrowsandblankcolumns.Read-only.

expression.CurrentRegion

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1040: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefunctioninthisexamplereturnsTrue,iftheentirecurrentregionforcellA1ontheactiveworksheetisvisible(ifthecurrentregionextendsoutsidethevisiblerange,thefunctionreturnsFalse).

FunctionIsCurrentRegionVisible()DimrngCurrentDimrngVisibleDimrngIntersect

'SetthevaribletothecurrentregionofcellA1.SetrngCurrent=Spreadsheet1.ActiveSheet.Cells(1,1).CurrentRegion

'Setavariabletothecurrentlyvisiblerange.SetrngVisible=Spreadsheet1.ActiveWindow.VisibleRange'Setavariabletotheoverlappingportionofthecurrentregion'andthevisiblerange.SetrngIntersect=Spreadsheet1.RectIntersect(rngCurrent,rngVisible)

'Iftheoverlappingregionisthesameasthecurrentregion,then'returntrue.IsCurrentRegionVisible=(rngIntersect.Address=rngCurrent.Address)EndFunction

Page 1041: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CurrentSectionProperty

ReturnsaSectionobjectthatrepresentsthecurrentsection(thesectioncontainingthecontrolthatcurrentlyhasthefocus).

expression.CurrentSection

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1042: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CustomGroupMembersProperty

ReturnsaPivotMemberscollectionthatrepresentsthemembersofacustomgroupfield.

expression.CustomGroupMembers

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1043: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1044: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CustomGroupTypeProperty

ReturnsaPivotMemberCustomGroupTypeEnumconstantthatrepresentsthetypeofgroupthatthespecifiedmemberisincludedin.Read-only.

expression.CustomGroupType

expressionRequired.AnexpressionthatreturnsaPivotAxisMemberobject.

Page 1045: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1046: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DashStyleProperty

ReturnsorsetsaChartLineDashStyleEnumconstantindicatingthedashstyleforthespecifiedlineorborder.Read/write.

expression.DashStyle

expressionRequired.AnexpressionthatreturnsaChLineorChBorderobject.

Page 1047: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyisvalidonlyforserieslines.

Page 1048: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangesthefirstchartinChartspace1toalinechartandthenformatsthelineforthefirstdataseriesinthechart.

SubSet_Series_LineStyle()

DimchConstantsDimserSeries1

SetchConstants=ChartSpace1.Constants

'Changethecharttoalinechart.ChartSpace1.Charts(0).Type=chChartTypeLine

'Setavariabletorefertothefirstdataseriesinthechart.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Setthemiterofthelineofthefirstseries.serSeries1.Line.Miter=chConstants.chLineMiterBevel

'Setthelineweightofthefirstseries.serSeries1.Line.Weight=chConstants.owcLineWeightThick

'Setthelinestyleofthefirstseries.serSeries1.Line.DashStyle=chConstants.chLineRoundDot

EndSub

Page 1049: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataProperty

ReturnsaPivotDataobjectthatrepresentsthesourcedataforthePivotTablelist.

expression.Data

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1050: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataAxisProperty

ReturnsaPivotDataAxisobjectthatrepresentsthedataaxis.UsethePivotDataAxisobjectreturnedbythispropertytoinsertfieldsandtotalsonthedataaxisofaPivotTablelist.Read-only.

Page 1051: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatotaltothePivotTablelistintheactiveviewandinsertsafieldsetonthedataaxis.

SubInsertTotal()DimptViewDimptConstantsDimtotNewtotalSetptView=PivotTable1.ActiveViewSetptConstants=PivotTable1.Constants

SettotNewTotal=view.AddTotal("myTotal",view.FieldSets("Freight").Fields(0),_ptConstants.plFunctionSum)ptView.DataAxis.InsertTotaltotNewTotalptView.DataAxis.InsertFieldSetptView.FieldSets("OrderDate")EndSub

Page 1052: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataBodyRangeProperty

ReturnsthedataboundrowsfromaspecifiedListObjectobjectasaRangeobject.Read-onlyRange.

expression.DataBodyRange

expressionRequired.AnexpressionthatreturnsaListObjectobject.

Page 1053: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

SomeRangepropertiesandmethodsarenotsupported.ThepropertiesnotsupportedareLocked,MergeAreaandMergeCells.ThemethodsnotsupportedareDelete,Insert,Merge,andUnMerge.TheDataBodyRangedoesnotincludetheHeaderRowRangeproperty(theheaderrowabovethedataboundrows)ortheInsertRowRangeproperty(theinsertrowbelowthedataboundrows).

Notethatifyouwanttosetcolorsonrows,youcanonlydosoonentirerowswithintheXMLlist.Youcannotsetthecoloroftheinsertrow.

Page 1054: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorcoloroftheDataBodyRangeofaListObjectobjecttoyellowandthebordercolortored.

DimrngDataBody'Setavariabletothedatabodyrange.SetrngDataBody=Spreadsheet1.ActiveSheet.ListObjects(1).DataBodyRange'Settheinteriorcolorandthebordercolorofthedatabodyrange.WithrngDataBody.Interior.ColorIndex=6.Borders.ColorIndex=3EndWith

Page 1055: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataEntryProperty

Trueifthespecifiedpageisusedonlyfordataentry(Falseifthepageincludesapopulatedrecordset).ThedefaultvalueisFalse.Read/writeBoolean.

expression.DataEntry

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1056: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataFieldProperty

ReturnsthenameofthefieldthatthePivotFieldobjectisboundtoifthedataiscomingfromarecordset.Read-onlyString.

expression.DataField

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1057: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataLabelProperty

ReturnsaChDataLabelobjectthatrepresentsthedatalabelassociatedwiththespecifiedtrendline.Read-only.

expression.DataLabel

expressionRequired.AnexpressionthatreturnsaChTrendlineobject.

Page 1058: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatrendlinetothespecifiedseriesinthechartworkspace,setsthefontforthedatalabeltobold,andcausesthetrendlinetodisplayonlyitsequation(theR-squaredvalueisnotdisplayed).

SubAddTrendLine()Dimtrndline

'AddatrendlinetothefirstseriesinthefirstchartinChartSpace1.Settrndline=ChartSpace1.Charts(0).SeriesCollection(0).Trendlines.Add

'Setthefontofthetrendlinetobold.trndline.DataLabel.Font.Bold=True

'DonotdisplaytheR-Squaredvaluewiththetrendline.trndline.IsDisplayingRSquared=False

'Displaytheequationforthetrendline.trndline.IsDisplayingEquation=TrueEndSub

Page 1059: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataLabelsCollectionProperty

ReturnsaChDataLabelsCollectionobjectthatcontainsthedatalabelsforthespecifiedseries.Eachseriescancontainonlyonesetofdatalabels.Read-only.

Formoreinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

expression.DataLabelsCollection

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

Page 1060: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsdatalabelstothespecifiedseriesinthechartworkspace.

ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection.Add

Thisexamplesetsthefontforthedatalabelsforthespecifiedseries.

ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection(0).Font.Bold=True

Page 1061: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataMemberProperty

Returnsorsetsthedatamembername(thenameoftherecordsetthatthespecifiedcontrolwillrequestfromthedatasource).Read/writeDataMember.

expression.DataMember

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1062: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataPageProperty

ReturnsaDataPageobjectthatrepresentsthedataaccesspageforthespecifiedsection.

expression.DataPage

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1063: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAdatapageisaclusterofsectionsthatshareacommonrecordnavigationcontrol.

Page 1064: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataPagesProperty

ReturnstheDataPagescollectionforthedatasourcecontrol.

expression.DataPages

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1065: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataPageSizeProperty

Returnsorsetsthenumberofrecordsshownforthespecifiedbandinglevelonadataaccesspage.Thedefaultvalueis5forabandedpageand1foranon-bandedpage.Read/writeLong.

expression.DataPageSize

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1066: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataSourceProperty

ReturnsorsetstheADODataSourceobjectthatrepresentsthedatasourceforthespecifiedcontrol.

expression.DataSource

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1067: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesachartthatisboundtoaspreadsheet.TheseriesnameisincellB1,thecategorynamesareincellsA2:A28,andthevaluesareincellsB2:B28.

Setc=ChartSpace1.ConstantsSetChartSpace1.DataSource=Spreadsheet1.ObjectChartSpace1.Charts.AddChartSpace1.Charts(0).Type=c.chChartTypeLineMarkersChartSpace1.Charts(0).SetDatac.chDimCategories,0,"a2:a28"ChartSpace1.Charts(0).SetDatac.chDimSeriesNames,0,"b1"ChartSpace1.Charts(0).SeriesCollection(0).SetDatac.chDimValues,0,"b2:b28"

Page 1068: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataSourceNameProperty

ReturnsorsetsaStringspecifyingthenameoftheActiveXcontrolthatservesasthedatasourceforthechartcontrol.ThispropertycanbeusedincontainersthatsupporttheMicrosoftInternetExplorerDocumentObjectModel.Read/write.

expression.DataSourceName

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1069: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleestablishesPivotTable1asthedatasourceforChartspace1andthendisplaysthefieldlistsothattheusercanadddatatothechart.

SubConnectChart()

'BindChartSpace1toPivotTable1.Chartspace1.DataSourceName="PivotTable1"

'Displaythefieldlist.Chartspace1.DisplayFieldList=True

EndSub

Page 1070: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1071: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataSourceTypeProperty

Returnsorsetsthedatasourcetypeforthespecifiedchartworkspace.Read-onlyChartDataSourceTypeEnum.

expression.DataSourceType

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1072: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1073: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataTypeProperty

DataTypepropertyasitappliestotheSchemaFieldandSchemaParameterobjects.

DataTypepropertyasitappliestothePivotFieldobject.

DataTypepropertyasitappliestotheSpreadsheetobject.

Page 1074: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefaultColorProperty

ReturnsaRGB-packedintegerthatrepresentsthespecifiedfillcolorwhentheColorpropertyischColorAutomatic.Read-onlyVariant.

expression.DefaultColor

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1075: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1076: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefaultControlTypeProperty

Returnsorsetsthedefaultcontroltypeforthespecifieddatasourcecontrol.Read/writeDefaultControlTypeEnum.

expression.DefaultControlType

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1077: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefaultMemberProperty

ReturnsaPivotMemberobjectthatrepresentsthedefaultmemberforthespecifiedfieldset.

expression.DefaultMember

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 1078: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyisvalidonlywhenthePivotTablelistisconnectedtoanOLAPdatasource.

ThedefaultmemberisusuallyAlloroneofthetopmembersinthedimension.

Page 1079: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefaultQueryOnLoadProperty

WhenthispropertyissettoTrue,bindingsthathaveaPurposeattributewiththevalue"Query"andaLoadModeattributewiththevalue"Normal"willrefreshwhenthepageloads.WhensettoFalse,nobindingsarerefreshedwhenthepageisloaded.Read/write.

expression.DefaultQueryOnLoad

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1080: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

AnXmlDataBindingobjectcanbeabindingtoanXMLfile,aSOAPservice,anotherWebPart(onlywhenbindingfromaSpreadsheetWebPart),oradataretrievalservice.

ThedefaultvaluefortheDefaultQueryOnLoadpropertyisTrue.ThePurposeattributeisinthedataretrievalserviceconnectionbindingdetailcontainedinthe<DataSource>elementintheXMLSpreadsheetfile(Binding/DataSource/ConnectionInfo@Purpose).TheLoadModeattributeisinthe<Binding>element.TheXMLfragmentwherethesedetailsappearintheXMLSpreadsheetfilelookssomethinglikefollowing:

<x2:Bindingx2:ID="Cust_bind_id"x2:LoadMode="Normal"x2:Async="False"><x2:MapID>Cust_MapId</x2:MapID><udc:DataSourceMajorVersion="1"MinorVersion="0"><udc:TypeType="XMLFile"MajorVersion="1"MinorVersion="0"/><udc:Name>sample_name</udc:Name><udc:ConnectionInfoPurpose="Query">

Page 1081: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefaultRecordsetProperty

ReturnsthedefaultADORecordsetobjectforthespecifiedcontrol.Read-only.

expression.DefaultRecordset

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1082: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoushouldnotusethispropertywithsectionsthatareboundtorecordsets;instead,usetheDataPageobject'sRecordsetproperty.

Page 1083: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefaultSortProperty

Returnsorsetsthefield(orfields)onwhichthespecifiedbandinglevelissorted.Thefieldmustbepartofthebandinglevel.Ifyouusethispropertytospecifymultiplefields,usecommastoseparatethefields.Read/writeString.

expression.DefaultSort

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1084: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DefaultValueProperty

Returnsorsetsthevaluethatisplacedinthespecifiedcontrolwhenevertheusercreatesanewrecord.Appliestoanyboundcontrol,anycontrolwithaValueproperty,oranycontrolthatmeetsbothofthesecriteria.Read/writeStringfortheElementExtensionobject;read/writeVariantforthePivotFieldobject.

expression.DefaultValue

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1085: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DesignModeProperty

Trueifthespreadsheetcontroliscurrentlyindesignmode.Read-onlyBoolean.

expression.DesignMode

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1086: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1087: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailAutoFitProperty

DetailAutoFitpropertyasitappliestothePivotFieldobject.

DetailAutoFitpropertyasitappliestothePivotViewobject.

Page 1088: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailBackColorProperty

Returnsorsetsthebackcolorforthespecifiedfieldwhenthefieldisdisplayedinadetailgrid.Thedefaultbackcoloriswhite.Read/writeVariant.

expression.DetailBackColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1089: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 1090: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailCellsProperty

ReturnsaPivotDetailCellobjectbasedonarowandcolumnindex.UsethispropertytoaccessthepropertiesofindividualcellsinthedetailareaofaPivotTablelist.

expression.Cell(Row,Column)

expressionAnexpressionthatreturnsaPivotCellobject.

RowRequiredLong.Specifiestherowthatcontainsthespecifiedcell.

ColumnRequiredLong.Specifiesthecolumnthatcontainsthespecifiedcell.

Page 1091: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailColumnCountProperty

ReturnsaLongvaluethatrepresentsthenumberofcolumnsofdetailcellsinthespecifiedcell.Read-only.

expression.DetailColumnCount

expressionRequired.AnexpressionthatreturnsaPivotCellobject.

Page 1092: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsingthispropertywhenthePivotTablelistisconnectedtoanOLAPdatasourcewillresultinarun-timeerror.

Page 1093: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailFontProperty

ReturnsaPivotFontobjectthatrepresentsthefontusedwhenthespecifiedfieldisdisplayedinthedetailgrid.Read-only.

expression.DetailFont

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1094: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailForeColorProperty

Returnsorsetstheforegroundcolorforthespecifiedfieldwhenthefieldisdisplayedinadetailgrid.Read/writeVariant.

expression.DetailForeColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1095: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 1096: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsinsertsfieldsintoPivotTable1,addatotal,andthenformatsthefieldinthedetailareaofthePivotTablelist.

SubLayout_PivotTable1()DimvwViewDimptConstantsDimtotOrderCountSetptConstants=PivotTable1.ConstantsSetvwView=PivotTable1.ActiveView'AddtheShipCountryfieldtotherowaxis.vwView.RowAxis.InsertFieldSetvwView.FieldSets("ShipCountry")'AddtheOrderIdfieldtothedataaxis.vwView.DataAxis.InsertFieldSetvwView.FieldSets("OrderID")'AddtheShipViafieldtothefilteraxis.vwView.FilterAxis.InsertFieldSetvwView.FieldSets("ShipVia")'Createatotalnamed"OrderCount"thatcountstheOrderIDfield.SettotOrderCount=vwView.AddTotal("OrderCount",vwView.FieldSets("OrderId").Fields("OrderId"),_ptConstants.plFunctionCount)'AddtheOrderCounttotaltothedataaxis.vwView.DataAxis.InsertTotaltotOrderCount'SetthehorizontalalignmentoftheOrderIDfield.vwView.FieldSets("OrderId").Fields("OrderId").DetailHAlignment=plHAlignCenter

Page 1097: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'SettheforegroundcoloroftheOrderIdfield.vwView.FieldSets("OrderId").Fields("OrderId").DetailForeColor=RGB(100,100,200)EndSub

Page 1098: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1099: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailHAlignmentProperty

Returnsorsetsthewayfieldvaluesarehorizontallyalignedwhenthespecifiedfieldisdisplayedinadetailgrid.Bydefault,valuesareleft-aligned.Read/writePivotHAlignmentEnum.

expression.DetailHAlignment

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1100: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsinsertsfieldsintoPivotTable1,addatotal,andthenformatsthefieldinthedetailareaofthePivotTablelist.

SubLayout_PivotTable1()DimvwViewDimptConstantsDimtotOrderCountSetptConstants=PivotTable1.ConstantsSetvwView=PivotTable1.ActiveView'AddtheShipCountryfieldtotherowaxis.vwView.RowAxis.InsertFieldSetvwView.FieldSets("ShipCountry")'AddtheOrderIdfieldtothedataaxis.vwView.DataAxis.InsertFieldSetvwView.FieldSets("OrderID")'AddtheShipViafieldtothefilteraxis.vwView.FilterAxis.InsertFieldSetvwView.FieldSets("ShipVia")'Createatotalnamed"OrderCount"thatcounts'theOrderIDfield.SettotOrderCount=vwView.AddTotal("OrderCount",vwView.FieldSets("OrderId").Fields("OrderId"),_ptConstants.plFunctionCount)'AddtheOrderCounttotaltothedataaxis.vwView.DataAxis.InsertTotaltotOrderCount

Page 1101: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'SetthehorizontalalignmentoftheOrderIDfield.vwView.FieldSets("OrderId").Fields("OrderId").DetailHAlignment'SettheforegroundcoloroftheOrderIdfield.vwView.FieldSets("OrderId").Fields("OrderId").DetailForeColor=RGB(100,100,200)EndSub

Page 1102: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailLeftProperty

ReturnsorsetsaLongthatrepresentstheleftmostvisiblecolumninthedetailgrid.Read/write.

expression.DetailLeft(Column)

expressionAnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ColumnRequiredPivotMemberobject.Specifiestheleftmostvisiblecolumninthedetailgrid.

Page 1103: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailLeftOffsetProperty

ReturnsorsetsaLongvaluethatrepresentsthenumberofpixelsthatthedatainthedetailareaisoffsettotheleft.Usethispropertytomovethedatainthedetailareatotheleft.Read/write.

expression.DetailLeftOffset

expressionRequired.AnexpressionthatreturnsaPivotColumnMemberobject.

Page 1104: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytoanegativevaluewillresultinarun-timeerror.

Page 1105: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemovesthedatainthedetailareaofPivotTable110pixelstotheleft.

PivotTable1.ActiveData.ColumnAxis.ColumnMember.DetailLeftOffset

Page 1106: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailMaxHeightProperty

Returnsorsetsthemaximumheight(inpixels)thatthedetailgridcanattainwhenthevalueoftheDetailAutoFitpropertyisTrue.Ascrollbarisdisplayediftheheightofthedetailgridwouldexceedthemaximumheight.Thedefaultvalueis250pixels.ThispropertyisignoredifthevalueoftheDetailAutoFitpropertyisFalse.Read/writeLong.

expression.DetailMaxHeight

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1107: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailMaxWidthProperty

Returnsorsetsthemaximumwidth(inpixels)thatthedetailgridcanattainwhenthevalueoftheDetailAutoFitpropertyisTrue.Ascrollbarisdisplayedifthewidthofthedetailgridwouldexceedthemaximumwidth.Thedefaultvalueis1024pixels.ThispropertyisignoredifthevalueoftheDetailAutoFitpropertyisFalse.Read/writeLong.

expression.DetailMaxWidth

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1108: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailRangeProperty

ReturnsaPivotDetailRangeobjectforthespecifiedarea.

expression.DetailRange(TopLeft,BottomRight)

expressionAnexpressionthatreturnsaPivotCellobject.

TopLeftRequiredPivotDetailCellobject.Specifiestheupper-leftcellinthedetailrange.

BottomRightRequiredPivotDetailCellobject.Specifiesthelower-rightcellinthedetailrange.

Page 1109: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailRowCountProperty

ReturnsaLongvaluethatrepresentsthenumberofrowsinthedetailareathatcontainsthespecifiedcell.Read-only.

expression.DetailRowCount

expressionRequired.AnexpressionthatreturnsaPivotCellobject.

Page 1110: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsingthispropertywhenthePivotTablelistisconnectedtoanOLAPdatasourcewillresultinarun-timeerror.

Page 1111: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailRowHeightProperty

Returnsorsetstherowheightforthedetailgrid(inpixels).Thedefaultvalueis10pixels.Read/writeLong.

expression.DetailRowHeight

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1112: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailsExpandedProperty

ReturnswhetherornotthedetailshavebeenexpandedinthedetailareaofthePivotTablelist.Read-onlyBoolean.

expression.DetailsExpanded

expressionRequired.AnexpressionthatreturnsaPivotColumnMemberobject.

Page 1113: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsingthispropertywhenthePivotTablelistisconnectedtoanOLAPdatasourcewillresultinarun-timeerror.

Page 1114: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailSortOrderProperty

Returnsorsetsthesortorderforfieldsonthesummaryaxis.Read/writeVariant.

expression.DetailSortOrder

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1115: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksFieldsaresortedinarrayorder.IfafieldincludedinthesortorderarrayhasitsSortDirectionpropertysettoplSortDirectionDefault,thefieldisignored.

Page 1116: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailTopProperty

Returnsorsetstheindexoftheuppermostvisiblerowinthedetailgrid.Read/writeLong.

expression.DetailTop

expressionRequired.AnexpressionthatreturnsaPivotCellobject.

Page 1117: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailTopOffsetProperty

ReturnsorsetsaLongvaluethatrepresentsthenumberofpixelsthatthespecifiedcellinthedetailareaisoffsettothetop.Usethispropertytomoveacellinthedetailareaupward.Read/write.

expression.DetailTopOffset

expressionRequired.AnexpressionthatreturnsaPivotCellobject.

Page 1118: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytoanegativevaluewillresultinarun-timeerror.

Page 1119: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemovesscrollsthecurrentlyselectedcellinthedetailareaofPivotTable1upby15pixels

PivotTable1.ActiveData.CurrentCell.DetailTopOffset=15

Page 1120: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DetailWidthProperty

Returnsorsetsthewidthofthespecifiedfield(inpixels)whenitisdisplayedinthedetailgrid.Read/writeLong.

expression.DetailWidth

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1121: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1122: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DirectionProperty

DirectionpropertyasitappliestotheChErrorBarsobject.

Page 1123: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DirectionpropertyasitappliestotheSchemaParameterobject.

Page 1124: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChErrorBarsobject.

Page 1125: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DirectionalLightInclinationProperty

ReturnsorsetsaDoublespecifyingtherotationofthedirectionallightsourcealongthex-zplaneofthespecifiedchart.Validsettingsrangefrom-90to90.Settingthispropertyto-90placesthelightsourcedirectlybelowthechart.Settingthispropertyto90placesthelightsourcedirectlyabovethechart.Read/write.

expression.DirectionalLightInclination

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1126: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DBarchartandsetsthelightingoptionsforthechart.

SubFormat3DLightSources()

Dimcht3DBar

'SetavariabletothefirstchartinChartspace1.Setcht3DBar=ChartSpace1.Charts(0)

'Changethecharttoa3-DBarchart.cht3DBar.Type=chChartTypeBar3D

'Settheintensityoftheambientlight.cht3DBar.AmbientLightIntensity=0.7

'Settheinclinationofthedirectionallightsource.cht3DBar.DirectionalLightInclination=35

'Settheintensityofthedirectionallightsource.cht3DBar.DirectionalLightIntensity=0.8

'Settherotationofthedirectionallightsource.cht3DBar.DirectionalLightRotation=120

EndSub

Page 1127: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DirectionalLightIntensityProperty

ReturnsorsetsaDoublespecifyingtheintensityofthedirectionallightsourceforathree-dimensionalchart.Validsettingsrangefrom0to1.Read/write.

expression.DirectionalLightIntensity

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1128: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DBarchartandsetsthelightingoptionsforthechart.

SubFormat_3D_LightSources()

Dimcht3DBar

'SetavariabletothefirstchartinChartspace1.Setcht3DBar=ChartSpace1.Charts(0)

'Changethecharttoa3DBarchart.cht3DBar.Type=chChartTypeBar3D

'Settheintensityoftheambientlight.cht3DBar.AmbientLightIntensity=0.7

'Settheinclinationofthedirectionallightsource.cht3DBar.DirectionalLightInclination=35

'Settheintensityofthedirectionallightsource.cht3DBar.DirectionalLightIntensity=0.8

'Settherotationofthedirectionallightsource.cht3DBar.DirectionalLightRotation=120EndSub

Page 1129: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DirectionalLightRotationProperty

ReturnsorsetsaDoublespecifyingtherotationofthedirectionallightsourceforathree-dimensionalchart.Validsettingsarebetween0and360.Read/write.

expression.DirectionalLightRotation

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1130: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThedirectionallightsourcerotatesaroundthey-axisofthechart.

Page 1131: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DBarchartandsetsthelightingoptionsforthechart.

SubFormat3DLightSources()

Dimcht3DBar

'SetavariabletothefirstchartinChartspace1.Setcht3DBar=ChartSpace1.Charts(0)

'Changethecharttoa3DBarchart.cht3DBar.Type=chChartTypeBar3D

'Settheintensityoftheambientlight.cht3DBar.AmbientLightIntensity=0.7

'Settheinclinationofthedirectionallightsource.cht3DBar.DirectionalLightInclination=35

'Settheintensityofthedirectionallightsource.cht3DBar.DirectionalLightIntensity=0.8

'Settherotationofthedirectionallightsource.cht3DBar.DirectionalLightRotation=120

EndSub

Page 1132: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DirtyProperty

Trueifchangeshavebeenmadetothespreadsheetsincethelasttimeitwassaved.Read/writeBoolean.

expression.Dirty

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1133: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleexportsthespreadsheettoafileifchangeshavebeenmadetoitsincethelasttimeitwassaved.

IfSpreadsheet1.DirtyThenSpreadsheet1.Export"sstest.xls",Spreadsheet1.Constants.ssExportActionNoneEndIf

Page 1134: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1135: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayAlertProperty

ReturnsorsetsaDscDisplayAlertconstantthatindicateswhetherornotanalertwillbedisplayedwhentheBeforeDeleteandBeforeOverwriteeventsarecalled.Read/write.

expression.DisplayAlert

expressionRequired.AnexpressionthatreturnsaDSCEventInfoobject.

Page 1136: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheDisplayAlertpropertyintheBeforeOverwriteeventtopreventtheuserfrombeingpromptedtooverwriteanexistingfilewhentheExportXMLmethodiscalled.

SubMSODSC_BeforeOverwrite(DSCEventInfo)

DimdscConstantsSetdscConstants=MSODSC.Constants

'Don'talerttheuserwhenoverwritinganexistingfile.DSCEventInfo.DisplayAlert=dscConstants.dscDataAlertContinue

EndSub

Page 1137: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayAlertsProperty

Trueifcertainalertsandmessagesaretobedisplayedwhilecodeisrunning.ThedefaultvalueisTrue.SetthispropertytoFalseifyoudon'twanttobedisturbedbypromptsandalertmessages;anytimeamessagerequiresaresponse,thedefaultresponseischosen.

IfyousetthispropertytoFalse,itisnotautomaticallysetbacktoTrue,andmustbesettoTrueformessagesandalertstoappear.Read/writeBoolean.

expression.DisplayAlerts

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1138: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayCalculatedMembersProperty

ReturnsorsetsaBooleanthatdetermineswhethercalculatedmembersaredisplayed.SetthispropertytoFalsetohidecalculatedmembers.ThedefaultvalueisTrue.Read/write.

expression.DisplayCalculatedMembers

expressionRequired.AnexpressionthatreturnsaPivotViewobject

Page 1139: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayColumnHeadingsProperty

Returnsorsetswhethercolumnheadingsaredisplayedinthespecifiedwindow.SetthispropertytoFalsetohidethecolumnsheadings.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayColumnHeadings

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1140: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidestherowandcolumnheadingsintheactivewindowofSpreadsheet1.

SubHideHeadings()Spreadsheet1.ActiveWindow.DisplayColumnHeadings=FalseSpreadsheet1.ActiveWindow.DisplayRowHeadings=FalseEndSub

Page 1141: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayCustomHeadingsProperty

Determineswhethercustomrowandcolumnheadings,iftheyexist,aretobedisplayedinthespecifiedwindow.ThedefaultvalueitTrue.Read/writeBoolean.

expression.DisplayCustomHeadings

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1142: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAlthoughsettingthispropertytoFalsehidescustomrowandcolumnheadings,theyarenotresetthemtotheirdefaultvalues.UsethispropertyinsteadofusingtheResetHeadingsmethodtotemporarilyhidethecustomrowandcolumnheadings.

Page 1143: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplepreventsthedisplayofthecustomrowandcolumnheadingsintheactivewindowofSpreadsheet1.

Spreadsheet1.ActiveWindow.DisplayCustomHeadings=False

Page 1144: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayDesignTimeUIProperty

Truetodisplaythedesign-timeversionoftheCommandsandOptionswindowisdisplayedatruntime.ThedefaultvalueisFalse.Read/writeBoolean.

expression.DisplayDesignTimeUI

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1145: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsSpreadsheet1sothatthedesign-timeCommandsandOptionswindowwillbedisplayedatruntime.

Spreadsheet1.DisplayDesignTimeUI=True

Page 1146: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayEmptyMembersProperty

Trueifemptymembersaredisplayed,eveniftheydonothaveaggregates.ThedefaultvalueisFalse.Read/writeBoolean.

expression.DisplayEmptyMembers

expressionRequired.AnexpressionthatreturnsaPivotGroupAxisobject.

Page 1147: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayExpandIndicatorProperty

Trueifexpansionindicatorsaredisplayedformemberswithavailablechildmembersordetailrecords.Whentheexpansionindicatorishidden,thememberdisplaynameappearsinthisspace.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayExpandIndicator

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 1148: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayFieldButtonsProperty

Returnsorsetswhetherfieldbuttonsanddropzonesaredisplayedonthechart.SetthispropertytoFalsetohidethefieldbuttonsanddropzones.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayFieldButtons

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1149: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyhasnoeffectifthechartcontrolisboundtoaliteraldatasource.

Page 1150: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesthedropzonesandfieldbuttonsonChartspace1.

Chartspace1.DisplayFieldButtons=False

Page 1151: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayFieldListProperty

SetthispropertytoTruetodisplaytheFieldList.ThedefaultvalueisFalse.Read/writeBoolean.

expression.DisplayFieldList

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1152: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayGridlinesProperty

Trueifgridlinesaredisplayedonthespecifiedspreadsheet.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayGridlines

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1153: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesgridlinesonthespreadsheet.

Spreadsheet1.ActiveWindow.DisplayGridlines=False

Page 1154: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayHeadingsProperty

Trueifbothrowandcolumnheadingsaredisplayed;Falseiftherearenoheadingsdisplayed,orifeitherthecolumnorrowheadingsarenotdisplayed.Read/writeBoolean.

expression.DisplayHeadings

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1155: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucanusetheDisplayColumnHeadingsandDisplayRowHeadingspropertiestoindependentlycontrolthedisplayofcolumnandrowheadings.

Page 1156: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidestherowandcolumnheadingsintheactivewindowofSpreadsheet1.

Spreadsheet1.ActiveWindow.DisplayHeadings=False

Page 1157: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayHorizontalScrollBarProperty

Trueifthehorizontalscrollbarisdisplayedonthespecifiedspreadsheet.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayHorizontalScrollBar

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1158: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesthehorizontalscrollbaronthespreadsheet.

Spreadsheet1.ActiveWindow.DisplayHorizontalScrollBar=False

Page 1159: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1160: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayInProperty

ReturnsorsetsaPivotMemberPropertyDisplayEnumconstantthatdetermineswhetherthespecifiedmemberpropertyisdisplayedinthePivotTablelist,ScreenTip,boththePivotTablelistandScreenTip,ornotatall.Read/write.

expression.DisplayIn

expressionRequired.AnexpressionthatreturnsaPivotMemberPropertyobject.

Page 1161: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecaptionsof,andthendisplaysthemembercaptionsoftheStoreNamefield.

SubDisplay_MemberProperties()DimptViewDimptConstantsDimfldStoreName

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetptView=PivotTable1.ActiveView

'SetavariabletotheStoreNamefield.SetfldStoreName=ptView.FieldSets("Store").Fields("StoreName")

'Thefollowingthreelinesofcodespecifythatthememberpropertiesare'displayedinthePivotTablelist.fldStoreName.MemberProperties("StoreManager").DisplayIn=ptConstants.plDisplayPropertyInReportfldStoreName.MemberProperties("StoreType").DisplayIn=ptConstants.plDisplayPropertyInReportfldStoreName.MemberProperties("StoreSqft").DisplayIn=ptConstants.plDisplayPropertyInReport

'Thefollowingthreelinesofcodesetthecaptionforthememberproperties.fldStoreName.MemberProperties("StoreManager").Caption="ManagerName"fldStoreName.MemberProperties("StoreType").Caption="StoreType"fldStoreName.MemberProperties("StoreSqft").Caption="SizeinSQFT"EndSub

Page 1162: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayInFieldListProperty

ReturnsorsetswhetherthespecifiedfieldsetortotalappearsinthePivotTableFieldListdialogbox.SetthispropertytoFalsetopreventthespecifiedfieldsetortotalfromappearinginthePivotTableFieldListdialogbox.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayInFieldList

expressionRequired.AnexpressionthatreturnsaPivotFieldSetorPivotTotalobject.

Page 1163: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsanewtotaltoPivotTable1.Thenewtotalisformattedtodisplayasapercentageoftheparentrowfield,andwillnotappearinthePivotTableFieldListdialogbox.

SubAdd_Total()

DimvwViewDimptConstantsDimtotNewTotal

SetvwView=PivotTable1.ActiveViewSetptConstants=PivotTable1.Constants

'Addanewtotalnamed"TotalBudget"tothecurrentview.SettotNewTotal=vwView.AddTotal("TotalBudget",vwView.FieldSets("Budget").Fields(0),_ptConstants.plFunctionSum)

'InsertthenewlycreatedtotalintothedetailareaofthePivotTable.vwView.DataAxis.InsertTotaltotNewTotal

'Showthetotalsasapercentageoftheparentrowfield.totNewTotal.ShowAs=ptConstants.plShowAsPercentOfRowParent

'DonotdisplaythenewtotalinthePivotTableFieldListdialogbox.totNewTotal.DisplayInFieldList=False

EndSub

Page 1164: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayOfficeLogoProperty

TruetodisplaytheMicrosoftOfficelogoonthetoolbar.Read/writeBoolean.

expression.DisplayOfficeLogo

expressionRequired.AnexpressionthatreturnsaChartSpace,PivotTable,orSpreadsheetobject.

Page 1165: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidestheMicrosoftOfficelogoonPivotTable1'stoolbar.

PivotTable1.DisplayOfficeLogo=False

Page 1166: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayPropertyToolboxProperty

SetthispropertytoTruetodisplaytheCommandandOptionswindow.Read/writeBoolean.

expression.DisplayPropertyToolbox

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1167: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayRowHeadingsProperty

Determineswhetherrowheadingsaredisplayedinthespecifiedwindow.SetthispropertytoFalsetohidetherowheaders.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayRowHeadings

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1168: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidestherowandcolumnheadingsintheactivewindowofSpreadsheet1.

SubHideHeadings()Spreadsheet1.ActiveWindow.DisplayColumnHeadings=FalseSpreadsheet1.ActiveWindow.DisplayRowHeadings=FalseEndSub

Page 1169: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayScreenTipsProperty

ReturnsorsetswhetherScreenTipsaredisplayed.SetthispropertytoFalsetopreventthedisplayofScreenTips.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayScreenTips

expressionRequired.AnexpressionthatreturnsaPivotTableorChartSpaceobject.

Page 1170: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablesScreenTipsforPivotTable1.

PivotTable1.DisplayScreenTips=False

Page 1171: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayTitleBarProperty

Trueifthetitlebaronthespecifiedspreadsheetisdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayTitleBar

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1172: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesthespreadsheet’stitlebar.

Spreadsheet1.DisplayTitleBar=False

Page 1173: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayToolbarProperty

Trueifthetoolbaronthespecifiedspreadsheet,chartspace,orPivotTablelistisdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayToolbar

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1174: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksHidingthetoolbardoesnotchangetheheightofthePivotTablelist,butitdoescausealayoutchange.ThewidthisunchangedunlesstheAutoFitpropertyisTrueandthePivotTablelistwassizedwiderthanthenecessarytoaccommodatethetoolbar.

Page 1175: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesthespreadsheet’stoolbar.

Spreadsheet1.DisplayToolbar=False

Page 1176: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayTotalProperty

ReturnswhetherornottotalsaredisplayedforthespecifiedPivotResultGroupFieldobject.Read-onlyBoolean.

expression.DisplayTotal

expressionRequired.AnexpressionthatreturnsaPivotResultGroupFieldobject.

Page 1177: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayVerticalScrollBarProperty

Trueiftheverticalscrollbaronthespecifiedspreadsheetisdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayVerticalScrollBar

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1178: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesthespreadsheet’sverticalscrollbar.

Spreadsheet1.ActiveWindow.DisplayVerticalScrollBar=False

Page 1179: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayWorkbookTabsProperty

Trueiftheworkbooktabsaredisplayed.SettingthispropertytoFalseforasingleWindowobjectsetsthispropertytoFalseforallwindowsintheworkbook.ThedefaultvalueisTrue.Read/writeBoolean.

expression.DisplayWorkbookTabs

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1180: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DisplayZerosProperty

Trueifzerovaluesaredisplayed.SetthispropertytoFalseifyouwanttohideallzerovaluesinthespecifiedwindow.Read/writeBoolean.

expression.DisplayZeros

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1181: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DivisionsProperty

ReturnsorsetsaLongvaluethatrepresentsthenumberofdivisionsthatappearinthelegendforthespecifiedsegment.Read/write.

expression.Divisions

expressionRequired.AnexpressionthatreturnsaChSegmentobject.

Page 1182: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreatedthatdisplaysthelargervaluesinthechartwithadarkershadeofblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1DimchConstants

SetchConstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;PersistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=ServerName;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderdetailstable.ChartSpace1.SetDatachConstants.chDimCategories,chConstants.chDataBound,"ProductID"ChartSpace1.SetDatachConstants.chDimValues,chConstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachConstants.chDimFormatValues,chConstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

Page 1183: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chConstants.chBoundaryValuePercentsegSegment1.End.ValueType=chConstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%.segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"

segSegment1.HasDiscreteDivisions=True

segSegment1.Divisions=3

EndSub

Page 1184: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1185: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DrawTypeProperty

ReturnsaChartDrawModesEnumconstantindicatingwhichdrawingpassisbeingperformed.Read-only.

expression.DrawType

expressionRequired.AnexpressionthatreturnsaChChartDrawobject.

Page 1186: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1187: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EditModeProperty

ReturnsaPivotEditModeEnumconstantthatindicateswhetherthePivotTablelistiscurrentlyineditmode.Read-only.

expression.EditMode

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 1188: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ElementExtensionsProperty

ReturnstheElementExtensionsobjectforthedatasourcecontrol.

expression.ElementExtensions

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1189: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ElementIDProperty

SpecifiestheIDtagfortheHTMLelementusedwiththespecifiedextension.Read-onlyString.

expression.ElementID

expressionRequired.AnexpressionthatreturnsaElementExtensionobject.

Page 1190: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EnableAutoFilterProperty

Trueifthespecifiedworksheetcanbefiltered.ThispropertyhasnoeffectiftheProtectionEnabledpropertyissettoFalse.Read/writeBoolean.

expression.EnableAutoFilter

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1191: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablesAutoFilterfortheactiveworksheet,andthenprotectstheworksheetinSpreadsheet1.

SubProtectWorksheet_EnableAutoFilterSpreadsheet1.ActiveSheet.EnableAutoFilter=TrueSpreadsheet1.ActiveSheet.Protection.Enabled=TrueEndSub

Page 1192: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EnabledProperty

OCCommandobject:ReturnsaBooleanthatrepresentswhetherornotthespecifiedcommandisenabled.Readonly.

Protectionobject:ReturnsorsetsaBooleanthatdetermineswhetherornotprotectionisenabledforthespecifiedworksheet.SetthispropertytoTruetoprotecttheworksheet.IfthispropertyissettoFalse,theotherProtectionobjectpropertysettingsareignored.Read/write.

expression.Enabled

expressionRequired.AnexpressionthatreturnsanOCCommandorProtectionobject.

Page 1193: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplepreventsauserfrominsertingrowsontheactiveworksheet.

SubPreventInsertingRows()

Dimpt

Setpt=Spreadsheet1.ActiveSheet.Protection

pt.AllowInsertingRows=False

pt.Enabled=True

EndSub

Page 1194: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EnableEventsProperty

Trueifeventsareenabledforthespreadsheetorthechartworkspace.Read/writeBoolean.

expression.EnableEvents

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1195: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplepreventsspreadsheeteventproceduresfromrunning.

Spreadsheet1.EnableEvents=False

Page 1196: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EnableResizeProperty

Trueifthespreadsheetcontrolcanberesizedbytheuser.SetthispropertytoFalsetopreventtheuserfromresizingthespreadsheetcontrol.ThedefaultvalueisTrue.Read/writeBoolean.

expression.EnableResize

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1197: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheheightandwidthofthespreadsheetcontrolandthenpreventstheuserfromresizingthecontrol.

SubSize_Spreadsheet()'Settheheightofthespreadsheetcontrol.Spreadsheet1.Height=4000

'Setthewidthofthespreadsheetcontrol.Spreadsheet1.Width=6000

'Preventtheuserfromresizingthespreadsheetcontrol.Spreadsheet1.ActiveWindow.EnableResize=FalseEndSub

Page 1198: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EnableUndoProperty

Trueiftheundofunctionalityisenabledforthespecifiedspreadsheet.SettingtheEnableUndopropertytoFalsedisablestheundofunctionalityofthespreadsheetcomponent.Read/writeBoolean.

expression.EnableUndo

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1199: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesanundoblockcontainingcodethatsetsthenumberformatandfontforthecellD10.

SubUndo_Block()DimrngCurrent'Enableundo.Spreadsheet1.EnableUndo=True'Startanundoblock.Spreadsheet1.BeginUndoSetrngCurrent=Spreadsheet1.Worksheets("sheet1").Range("D10")'Thefollowingthreelinesofcodeapply'variousformattingtocellD10.rngCurrent.NumberFormat="0.###"rngCurrent.Font.Color="Blue"rngCurrent.Font.Name="TimesNewRoman"'Endtheundoblock.Spreadsheet1.EndUndoEndSub

Page 1200: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1201: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndProperty

EndpropertyasitappliestotheRangeobject.

EndpropertyasitappliestotheChSegmentobject.

Page 1202: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRangeobject.

AsitappliestotheChSegmentobject.

Page 1203: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1204: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndStyleProperty

Returnsorsetstheendstyleforerrorbars.Read/writeChartEndStyleEnum.

expression.EndStyle

expressionRequired.AnexpressionthatreturnsaChErrorBarsobject

Page 1205: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddserrorbarstoalloftheseriesinthefirstchartinChartSpace1andthensetstheerroramountandendstyle.

SubAdd_Error_Bars()DimebErrorBarsDimserChartSeriesDimchConstants

SetchConstants=ChartSpace1.Constants

'Loopthroughalloftheseriesinthefirstchart'inChartSpace1.ForEachserChartSeriesinChartSpace1.Charts(0).SeriesCollection

'Adderrorbarstothecurrentseries.SetebErrorBars=serChartSeries.ErrorBarsCollection.Add

'Settheerrorbarstobeapercentageofthevalue.eberrorBars.Type=chConstants.chErrorBarTypePercent'Setthepercentageamount.ebErrorBars.Amount=0.05'Settheendstyleoftheerrorbars.ebErrorBars.EndStyle=chConstants.chEndStyleNoneNextEndSub

Page 1206: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EntireColumnProperty

ReturnsaRangeobjectthatrepresentstheentirecolumn(orcolumns)containingthespecifiedrange.Read-only.

expression.EntireColumn

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1207: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefontcolorfortheentirecolumncontainingtheactivecell.

Spreadsheet1.ActiveCell.EntireColumn.Font.Color="green"

Page 1208: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EntireRowProperty

ReturnsaRangeobjectthatrepresentstheentirerow(orrows)containingthespecifiedrange.Read-only.

expression.EntireRow

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1209: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefontcolorfortheentirerowcontainingtheactivecell.

Spreadsheet1.ActiveCell.EntireRow.Font.Color="red"

Page 1210: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ErrorProperty

ReturnsanADOErrorobjectthatcontainserrorinformationaboutthespecifiedevent.Read-only.

expression.Error

expressionRequired.AnexpressionthatreturnsaDSCEventInfoobject.

Page 1211: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ErrorBarsCollectionProperty

ReturnsaChErrorBarsCollectioncollectionthatcontainsaChErrorBarsobjectforeachsetoferrorbarsinthespecifiedseries.Aseriescanhaveonlyonesetoferrorbars,sotheChErrorBarsCollectioncollectionnevercontainsmorethanoneobject.Read-only.

expression.ErrorBarsCollection

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

Page 1212: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddserrorbarstoalloftheseriesinthefirstchartinChartSpace1andthensetstheerroramountandendstyle.

SubAdd_Error_Bars()DimebErrorBarsDimserChartSeriesDimchConstants

SetchConstants=ChartSpace1.Constants

'Loopthroughalloftheseriesinthefirstchart'inChartSpace1.ForEachserChartSeriesinChartSpace1.Charts(0).SeriesCollection

'Adderrorbarstothecurrentseries.SetebErrorBars=serChartSeries.ErrorBarsCollection.Add

'Settheerrorbarstobeapercentageofthevalue.eberrorBars.Type=chConstants.chErrorBarTypePercent'Setthepercentageamount.ebErrorBars.Amount=0.05'Settheendstyleoftheerrorbars.ebErrorBars.EndStyle=chConstants.chEndStyleNoneNextEndSub

Page 1213: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExcludedMembersProperty

Returnsorsetsthemembersthatyoudonotwanttobedisplayedinthespecifiedfield.ThispropertycanbesettoasinglememberoraVariantarrayofmembers.ThememberscanbepassedasoneormorePivotMemberobjects,membernames,oruniquemembernames.

expression.ExcludedMembers

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1214: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksMembersthatareexplicitlyexcludedstillappearinthePivotTablelistifoneormoreoftheirchildrenareincluded.Settingthispropertyclearsallprevioussettingsofthispropertyforthespecifiedfield.YoucansettheExcludedMemberspropertytoEmpty(ExcludedMembers=Empty)ortoazero-lengthVariantarray(ExcludedMembers=Array())tocleartheincludedmemberslistforthespecifiedfield.

Page 1215: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheincludedandexcludedmembersoftheStoreStateandStoreCityfieldsinPivotTable1.

SubMember_Filtering()

DimfldStoreCityDimfldStoreStateDimptView

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'SetavariabletotheStoreStatefield.SetfldStoreState=ptView.FieldSets("Store").Fields("StoreState")

'SetavariabletotheStoreCityfield.SetfldStoreCity=ptView.FieldSets("Store").Fields("StoreCity")

'ExcludeCaliforniaandWashingtonfromtheStoreStatefield.fldStoreState.ExcludedMembers=Array("CA","WA")

'IncludemembersoftheStoreCityfield.Notethatthecitiesare'instatesthathavebeenexcludedbythepreviousline.Since'StoreStateisaparenttoStoreCity,thentheexcludedstates'aredisplayedinthePivotTable.fldStoreCity.IncludedMembers=Array("LosAngeles","SanDiego",_"Seattle","Spokane")

EndSub

Page 1216: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1217: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExpandDetailsProperty

ReturnsorsetsaPivotTableExpandEnumconstantthatrepresentswhetherornotfieldsareexpandedwhenaddedtothedetailareaofaPivotTablelist.Read/write.

expression.ExpandDetails

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1218: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsPivotTable1sothatfieldsareneverexpandedwhentheyareaddedtothePivotTablelist.

SubNeverExpand()DimpvtViewDimptConstants

SetptConstants=PivotTable1.Constants

'Setavariabletotheactiveview.SetpvtView=PivotTable1.ActiveView

'Alwaysexpandfieldswhentheyareadded'toaPivotTablelist.pvtView.ExpandMembers=ptConstants.plExpandNever

'Alwaysexpandfieldswhentheyareadded'tothedetailareaPivotTablelist.pvtView.ExpandDetails=ptConstants.plExpandNeverEndSub

Page 1219: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExpandedProperty

PivotCellobject:Trueifthedetailgridisbeingdisplayedforthespecifiedcell.IfthispropertyissettoFalse,thedetailgridisnotdisplayedbutaggregatesaredisplayediftheyareavailable.Read/writeBoolean.

PivotAxisMemberobject:Trueifchildmembersarebeingdisplayedforthespecifiedmember;Falseifchildmembersarecollapsed.Read/writeBoolean.

PivotFieldobject:Returnsorsetstheexpandedstateofallthemembersofthespecifiedfieldatthesametime.SettingtheExpandedpropertyforthefieldimmediatelysetstheExpandedpropertyforallthemembersassociatedwiththefield.SettingtheExpandedpropertyforasinglememberofthefielddoesnotaffecttheExpandedpropertyforthefielditself.Read/writeBoolean.

expression.Expanded

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1220: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExpandedByDefaultProperty

Trueifthespecifiedgrouplevelisexpandedbydefault.ThedefaultvalueisFalse.Read/writeBoolean.

expression.ExpandedByDefault

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1221: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1222: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExpandMembersProperty

ReturnsorsetsaPivotTableExpandEnumconstantthatrepresentswhetherornotfieldsandtheirmembersareexpandedwhenafieldisaddedtoaPivotTablelist.Read/write.

expression.ExpandMembers

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1223: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsPivotTable1sothatfieldsareneverexpandedwhentheyareaddedtothePivotTablelist.

SubNeverExpand()DimpvtViewDimptConstants

SetptConstants=PivotTable1.Constants

'Setavariabletotheactiveview.SetpvtView=PivotTable1.ActiveView

'Alwaysexpandfieldswhentheyareadded'toaPivotTablelist.pvtView.ExpandMembers=ptConstants.plExpandNever

'Alwaysexpandfieldswhentheyareadded'tothedetailareaPivotTablelist.pvtView.ExpandDetails=ptConstants.plExpandNeverEndSub

Page 1224: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1225: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExplosionProperty

ExplosionpropertyasitappliestotheChPointobject.

ExplosionpropertyasitappliestotheChSeriesobject.

Page 1226: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChPointobject.

AsitappliestotheChSeriesobject.

Page 1227: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExpressionProperty

ReturnsorsetsaStringthatrepresentstheexpressionusedtocalculatethespecifiedcalculatedfieldorcalculatedtotal.TheexpressionmustbecompatiblewiththeJetexpressionservice.Read/write.

expression.Expression

expressionRequired.AnexpressionthatreturnsaoneoftheobjectsintheAppliesTolist.

Page 1228: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheExpressionpropertywillreturnablankstringifitisnotusedwithacalculatedfieldorcalculatedtotal.

Page 1229: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampledisplaysthecurrentexpressionusedforacalculatedfieldnamed"Variance"inPivotTable1.WhenyouedittheexpressionandthenclickOK,thenewexpressionisassignedtotheVariancefield.

SubChange_Expression()

DimvwViewDimcfCalcFieldDimstrCurrentExpressionDimstrNewExpression

SetvwView=PivotTable1.ActiveView

'Setavaribletothecalculatedfield.SetcfCalcField=_vwView.Fieldsets("Variance").Fields("Variance")

'Setavariabletothecurrentexpressionusedinthe'Variancefield.strCurrentExpression=cfCalcField.Expression

'Displayaninputboxthatcontainsthecurrentexpressionforthe'Variancefield.EdittheexpressionandthenclickOK.strNewExpression=InputBox("Edittheexpressionusedforthecalculated"&_"fieldandthenclickOK.",,strCurrentExpression)

'SettheexpressionusedtocalculatetheVariancefieldtothe'expressionenteredintheinputbox.cfCalcField.Expression=strNewExpression

Page 1230: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 1231: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExtrudeAngleProperty

ReturnsorsetsaDoublespecifyingthedirectionofextrusionforathree-dimensionalchart.ThispropertyisvalidonlyiftheProjectionModepropertyofthecharthasbeensettochProjectionModeOrthographic.Validvaluesrangefrom0to360.Thedefaultvalueis45.Read/write.

expression.ExtrudeAngle

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1232: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthensetstheprojectionmodeofthechart.

SubSetExtrudeAngle()

Dimcht3DColumnDimchConstants

SetchConstants=Chartspace1.Constants

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3-DColumnchart.cht3DColumn.Type=chChartTypeColumnClustered3D

'Settheprojectionmodetoorthographic.cht3DColumn.ProjectionMode=chConstants.chProjectionModeOrthographic

'Settheextrusionangle.cht3DColumn.ExtrudeAngle=75

EndSub

Page 1233: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldProperty

ReturnsaPivotFieldobjectthatrepresentsthefieldassociatedwiththespecifiedmemberortotal.

expression.Field

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1234: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldLabelBackColorProperty

Returnsorsetsthebackcolorusedforfieldlabelsforrows,columns,andfilters.Thedefaultvalueis25%gray.Read/writeVariant.

expression.FieldLabelBackColor

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1235: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 1236: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldLabelFontProperty

ReturnsaPivotFontobjectthatrepresentsthefieldlabelfontforrows,columns,andfilters.Read-only.

expression.FieldLabelFont

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1237: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldLabelForeColorProperty

Returnsorsetstheforegroundcolorusedforfieldlabelsforrows,columns,andfilters.Read/writeVariant.

expression.FieldLabelForeColor

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1238: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 1239: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldLabelHeightProperty

Returnstheheightofthefieldlabelsforrows,columns,andfilters.Read-onlyLong.

expression.FieldLabelHeight

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1240: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldsProperty

ReturnsthePivotFieldscollectionforthespecifiedfieldset.

expression.Fields

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1241: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldSetProperty

ReturnsaPivotFieldSetobjectthatrepresentsthefieldsettowhichthespecifiedfieldbelongs.

expression.FieldSet

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1242: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldSetsProperty

ReturnsaPivotFieldSetsobjectthatcontainsthefieldsetsassociatedwiththespecifiedaxisorview.

expression.FieldSets

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1243: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1244: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FieldTypeProperty

Returnsthefieldtypeforthespecifiedfield.Read-onlyDscFieldTypeEnum.

expression.FieldType

expressionRequired.AnexpressionthatreturnsaPageFieldproperty.

Page 1245: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1246: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FillTypeProperty

ReturnsaChartFillTypeEnumconstantindicatingthetypeoffillusedforthespecifiedChInteriorobject.Read-only.

expression.FillType

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1247: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucanusethefollowingmethodstosetthetypeoffillforaChInteriorobject:SetOneColorGradient,SetPatterned,SetPresetGradient,SetSolid,SetTextured,andSetTwoColorGradient.

Page 1248: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterProperty

ReturnstheADOfilterstringfortherecordsetthatcorrespondstothedataaccesspage.Read/writeVariant.

expression.Filter

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 1249: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterAxisProperty

PivotDataobject:ReturnsaPivotResultFilterAxisobjectthatrepresentsthefilteraxis.

PivotViewobject:ReturnsaPivotFilterAxisobjectthatrepresentsthefilteraxis.

expression.FilterAxis

expressionRequired.AnexpressionthatreturnsaPivotDataorPivotViewobject.

Page 1250: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterCaptionProperty

ReturnsaStringthatrepresentsthecaptiondisplayedjustbelowafieldsetonthefilteraxis.Read-only.

expression.FilterCaption

expressionRequired.AnexpressionthatreturnsaPivotFieldSetobject.

Page 1251: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftheuserhasselectedonlyoneiteminthespecifiedfield,thispropertywillreturnthatitem.Iftheuserhasselectedmultipleitemsinthefield,thispropertywillmostlikelyreturn"(MultipleItems)".

Page 1252: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterContextProperty

ReturnsaPivotFieldobjectthatrepresentsthecontextbywhichtheconditionalfilterwillbeevaluated.

expression.FilterContext

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1253: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyouapplyaconditionalfiltertoafield,thefiltercanapplytothatfield,oroneofitsparentfieldsinthefieldset.Forexample,assumethatyourPivotTablelistcontainsafieldsetnamedStore.TheStorefieldsetcontainsthefollowingfields:Country,Region,City,andStoreNumber.TheCountryfieldisaparenttotheRegionfield,theRegionfieldisaparenttotheCityfield,andtheCityfieldisaparenttotheStoreNumberfield.

Nowyouwanttofindthetopfivemostprofitablecities.IfyousetthispropertytotheCityfield,thenthetopfivemostprofitablecitieswillbedisplayedinthePivotTablelist.IfyousetthispropertytotheRegionfield,thenthetopfivecitieswillbereturnedforeachregion.

Settingthispropertytoachildofthefieldthatyouareapplyingaconditionalfiltertowillresultinarun-timeerror.Forexample,youcannotsetthispropertytotheStoreNumberfieldwhenyouareapplyingaconditionalfiltertotheCityfield.

Page 1254: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaystheleastprofitablecityineachstate.

SubLeastProfitableByState()

DimptViewDimptConstantsDimfldFilterField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTablelist.SetptView=PivotTable1.ActiveView

'Setavariabletothefieldthatistobefiltered.SetfldFilterField=PivotTable1.ActiveData.RowAxis.Fields("StoreCity")

'Filterthestoresbasedonprofit.SetfldFilterField.FilterOn=ptView.Totals("Profit")

'Setthefunctionusedtofilterthestores.fldFilterField.FilterFunction=ptConstants.plFilterFunctionBottomCount

'Displaytheleastprofitablestore.fldFilterField.FilterFunctionValue=1

'Setthecontextofthefilter.Althoughwearefilteringbasedon'theStoreCityfield,settingthefiltercontexttotheStoreState'fieldmeansthattheleastprofitablestorefromeachstatewillbe'displayed.SetptView.FieldSets("Store").Fields("StoreCity").FilterContext=_

Page 1255: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ptView.FieldSets("Store").Fields("StoreState")

EndSub

Page 1256: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterCrossJoinsProperty

ReturnsorsetsaBooleanthatdetermineshowthePivotTablecontrolprocessesemptymemberswhenretrievingthedataforthecurrentview.ThedefaultvalueisTrue.Read/write.

expression.FilterCrossJoins

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1257: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksInmostcases,donotwanttosetthispropertytoFalse.However,ifyourOLAPcubecontainsafieldsetwherethetopmemberisempty,thenyoumaywanttosetthispropertytoFalse.

Page 1258: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1259: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterFunctionProperty

FilterFunctionpropertyasitappliestothePivotFieldobject.

FilterFunctionpropertyasitappliestotheCriteriaobject.

Page 1260: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterFunctionValueProperty

ReturnsorsetsaVariantrepresentingthevalueusedtofilterafield.ThetypeofvaluewillvarybasedonthecurrentsettingoftheFilterFunctionproperty.Usethefollowingtabletodetermineanappropriatevalueforthisproperty.Read/write.

FilterFunctionsetting AppropriatevaluerangeplFilterFunctionBottomCount Integervaluerepresentinghowmany

ofthebottommembersthatyouwanttodisplay.

plFilterFunctionBottomPercent Doublevaluebetween0and1representingthepercentageofmembersthatyouwanttodisplay.

plFilterFunctionBottomSumplFIlterFunctionNoneplFilterFunctionTopCount Integervaluerepresentinghowmany

ofthetopmembersthatyouwanttodisplay.

plFilterFunctionTopPercent Doublevaluebetween0and1representingthepercentageofmembersthatyouwanttodisplay.

plFilterFunctionTopSum

expression.FilterFunctionValue

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1261: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleappliesaconditionalfiltertotheStoreCityfieldbasedontheProfittotal.Thethreemostprofitablestoresaredisplayed.

SubTopThreeStores()

DimptViewDimptConstantsDimfldFilterField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTablelist.SetptView=PivotTable1.ActiveView

'Setavariabletothefieldthatistobefiltered.SetfldFilterField=PivotTable1.ActiveData.RowAxis.Fields("StoreCity")

'Filterthestoresbasedonprofit.SetfldFilterField.FilterOn=ptView.Totals("Profit")

'Setthefunctionusedtofilterthestores.fldFilterField.FilterFunction=ptConstants.plFilterFunctionTopCount

'Displaythethreemostprofitablestores.fldFilterField.FilterFunctionValue=3

EndSub

Page 1262: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterModeProperty

TrueifanyworksheetrowsarecurrentlyhiddenbyAutoFiltercriteria.ThedefaultvalueisFalse.Read-onlyBoolean.

expression.FilterMode

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1263: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftheAutoFilterdrop-downarrowsarevisiblebutnorowsarecurrentlyfiltered(allrowsarevisible),theAutoFilterModepropertyisTrueandtheFilterModepropertyisFalse.

Page 1264: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsontheAutoFilterfortherangeA1:C20,setsfiltersforcolumnsAandC,andthenappliesthefilters.TheFilterModepropertyreturnsFalseuntiltheAutoFiltercriteriahasbeenappliedtothelist.

SubApply_AutoFilter()DimafFiltersDimafCol1DimafCol3'TurnonAutoFilter.Spreadsheet1.Worksheets("Sheet1").Range("A1:C20").AutoFilter'SetavariabletotheAutoFilterobject.SetafFilters=Spreadsheet1.Worksheets("sheet1").AutoFilterSetafCol1=afFilters.Filters(1)SetafCol3=afFilters.Filters(3)'AddacriteriathatexcludesbluefromcolumnA.afCol1.Criteria.Add"blue"'AddacriteriathatexcludesgreenfromcolumnA.afCol1.Criteria.Add"green"'Addacriteriathatexcludesyellowfromcolumnc.afCol3.Criteria.Add"yellow"'Atthispoint,theFilterModepropertyisFalse'becausetheAutoFiltercriteriahasnotbeenapplied.MsgBoxSpreadsheet1.Worksheets("Sheet1").FilterMode

Page 1265: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Applythecriteria.afFilters.Apply'TheFilterModepropertyisnowTruesinceyou'havehiddenseveralrowsinthelist.MsgBoxSpreadsheet1.Worksheets("Sheet1").FilterModeEndSub

Page 1266: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterOnProperty

ReturnsaPivotTotalobjectthatrepresentsthetotaltousewhenconditionallyfilteringafield.

expression.FilterOn

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1267: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleappliesaconditionalfiltertotheStoreCityfieldbasedontheProfittotal.Thethreemostprofitablestoresaredisplayed.

SubTopThreeStores()

DimptViewDimptConstantsDimfldFilterField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTablelist.SetptView=PivotTable1.ActiveView

'Setavariabletothefieldthatistobefiltered.SetfldFilterField=PivotTable1.ActiveData.RowAxis.Fields("StoreCity")

'Filterthestoresbasedonprofit.SetfldFilterField.FilterOn=ptView.Totals("Profit")

'Setthefunctionusedtofilterthestores.fldFilterField.FilterFunction=ptConstants.plFilterFunctionTopCount

'Displaythethreemostprofitablestores.fldFilterField.FilterFunctionValue=3

EndSub

Page 1268: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FilterOnScopeProperty

Thispropertyestablishesthescopethatisusedwhenconditionallyfilteringafield.YoucanpassaStringcontainingtheuniquenameofamemberoranarrayofuniquenamesofmembers.ReturnsaVariantarraycontainingPivotMemberobjects.Read/write.

expression.FilterOnScope

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1269: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThescopeisbasedononeormoremembersofadifferentfieldthanthefieldthatisbeingfiltered.Forexample,youmaywanttoapplyafiltertotheCustomerfield,whichhasbeenaddedtotherowaxisofyourPivotTablelist,todisplaythethreecustomerstowhomyouhavemadethemostsales.Todothis,yousettheFilterFunctionpropertytoplFilterFunctionTopCount,theFilterFunctionValuepropertyto3,andtheFilterOnpropertytotheTotalSalestotal.ThePivotTablelistdisplaysyourthreebestcustomers.

Ifyouneedtonarrowyourquerytoamorespecificsetofcustomers,thenyouwouldusetheFilterOnScopeproperty.IfyouwanttoseetheyourtopcustomersintheSoutheastregion,thenyouwouldsettheFilterOnScopepropertytoanexpressionthatevaluatestotheSoutheastmemberintheRegionfield.

Page 1270: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplayesthetwotop-sellingproductsinCanada.

SubDisplayTopTwoCanadianSellers()

DimobjPivotViewDimobjPivotDataDimfldProductName

'SetavariabletotheactiveviewofthePivotTable.SetobjPivotView=PivotTable1.ActiveView

'SetavariabletotheactivedataofthePivotTable.SetobjPivotData=PivotTable1.ActiveData

'SetavariabletotheProductNamefield,whichhasbeen'addedtotherowaxisofthePivotTablelist.SetfldProductName=objPivotData.RowAxis.Fields("ProductName")

'ThefollowingtwolinesofcodesetthePivotTablelisttofilterforthe'top2items.fldProductName.FilterFunction=PivotTable1.Constants.plFilterFunctionTopCountfldProductName.FilterFunctionValue=2

'FilterbasedontheUnitSalestotal.SetfldProductName.FilterOn=objPivotView.Totals("UnitSales")

'SetthefilterscopetoincludeonlysalesinCanada.fldProductName.FilterOnScope=objPivotView.FieldSets("Store").Member.ChildMembers("Canada").UniqueName

EndSub

Page 1271: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 1272: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FiltersProperty

ReturnstheFilterscollectionforthespecifiedAutoFilter.TheFilterscollectioncontainsoneFilterobjectforeachcolumninthefilteredrange.Read-only.

expression.Filters

expressionRequired.AnexpressionthatreturnsanAutoFilterobject.

Page 1273: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsontheAutoFilterfortherangeA1:C20,setsfiltersforcolumnsAandC,andthenappliesthefilters.

SubApply_AutoFilter()DimafFiltersDimafCol1DimafCol3'TurnonAutoFilter.Spreadsheet1.Worksheets("Sheet1").Range("A1:C20").AutoFilter'SetavariabletotheAutoFilterobject.SetafFilters=Spreadsheet1.Worksheets("sheet1").AutoFilterSetafCol1=afFilters.Filters(1)SetafCol3=afFilters.Filters(3)'AddacriteriathatexcludesbluefromcolumnA.afCol1.Criteria.Add"blue"'AddacriteriathatexcludesgreenfromcolumnA.afCol1.Criteria.Add"green"'Addacriteriathatexcludesyellowfromcolumnc.afCol3.Criteria.Add"yellow"'Applythecriteria.afFilters.ApplyEndSub

Page 1274: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 1275: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1276: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindAxisMemberProperty

Findsanaxismember,givenareferencetothemember.ReturnsaPivotAxisMemberobject.

expression.FindAxisMember(Path,Format)

expressionRequired.AnexpressionthatreturnsaPivotAxisMemberobject.

PathRequiredString.Avariableorstringthatcontainsareferencetothemembertofind.

FormatRequiredPivotMemberFindFormatEnum.IndicatestheformatusedforthePathargument.

Page 1277: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftherequestedmemberisnotfound,aPivotAxisMemberobjectwiththeIsValidpropertysettoFalseisreturned.Thisallowsyoutorefertoamemberthatmightlaterbeaddedtotheschema.

Thispropertycanbeusedtofindamemberfromthetopmemberofthespecifiedaxis.UsetheMemberproperty(PivotAxisMember.Axis.Member)toreturnthetopmemberofanaxis.

Page 1278: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1279: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindColumnMemberProperty

Findsacolumnmember,givenareferencetothemember.ReturnsaPivotColumnMemberobject.

expression.FindColumnMember(Path,Format)

expressionRequired.AnexpressionthatreturnsaaPivotColumnMemberobject.

PathRequiredString.Avariableorstringthatcontainsareferencetothemembertofind.

FormatRequiredPivotMemberFindFormatEnum.IndicatestheformatusedforthePathargument.

Page 1280: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftherequestedmemberisnotfound,aPivotColumnMemberobjectwiththeIsValidpropertysettoFalseisreturned.Thisallowsyoutorefertoamemberthatmightlaterbeaddedtotheschema.

Thispropertycanbeusedtofindamemberfromthetopmemberofthecolumnaxis.UsetheMemberpropertytoreturnthetopmemberofthecolumnaxis.

Page 1281: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1282: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindMemberProperty

FindMemberpropertyasitappliestothePivotFieldSetobject.

FindMemberpropertyasitappliestothePivotAxisMember,PivotColumnMember,PivotMember,PivotPageMember,andPivotRowMemberobjects.

Page 1283: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftherequestedmemberisnotfound,aPivotMemberobjectwiththeIsValidpropertysettoFalseisreturned.Thisallowsyoutorefertoamemberthatmightlaterbeaddedtotheschema.

Page 1284: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleattemptstofindaspecificwarehouseintheWarehousefieldset.Theuserisalertedifthespecifiedwarehouseisnotfound.

SubFindWarehouse()

DimptViewDimptConstantsDimfsWarehouseDimpmFound

SetptConstants=PivotTable1.Constants

'Setavariabletotheactiveview.SetptView=PivotTable1.ActiveView

'SetavariabletotheWarehousefieldset.SetfsWarehouse=ptView.FieldSets("Warehouse")

'SetavariabletotheresultsoftheFindMemberproperty.SetpmFound=fsWarehouse.FindMember("QualityDistribution,Inc.",ptConstants.plFindFormatMember)

'Checktoseeifthememberwasfound.IfpmFound.IsValid=FalseThen

'Alerttheuserifthememberwasnotfound.MsgBox"Thespecifiedmemberdoesnotexist."

EndIf

EndSub

Page 1285: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 1286: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1287: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindPageMemberProperty

Findsapagemember,givenareferencetothemember.ReturnsaPivotPageMemberobject.

expression.FindPageMember(Path,Format)

expressionRequired.AnexpressionthatreturnsaPivotPageMemberobject.

PathRequiredString.Avariableorstringthatcontainsareferencetothemembertothemembertofind.

FormatRequiredPivotMemberFindFormatEnum.IndicatestheformatusedforthePathargument.

Page 1288: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftherequestedmemberisnotfound,aPivotPageMemberobjectwiththeIsValidpropertysettoFalseisreturned.Thisallowsyoutorefertoamemberthatmightlaterbeaddedtotheschema.

Thispropertycanbeusedtofindamemberfromthetopmemberofthepageaxis.UsetheMemberpropertytoreturnthetopmemberofthepageaxis.

Page 1289: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1290: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FindRowMemberProperty

Findsarowmember,givenareferencetothemember.ReturnsaPivotRowMemberobject.

expression.FindRowMember(Path,Format)

expressionRequired.AnexpressionthatreturnsaPivotRowMemberobject.

PathRequiredString.Avariableorstringthatcontainsareferencetothemembertofind.

FormatRequiredPivotMemberFindFormatEnum.IndicatestheformatusedforthePathargument.

Page 1291: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIftherequestedmemberisnotfound,aPivotRowMemberobjectwiththeIsValidpropertysettoFalseisreturned.Thisallowsyoutorefertoamemberthatmightlaterbeaddedtotheschema.

Page 1292: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FirstSectionProperty

ReturnsaSectionobjectthatrepresentsthefirstsectiononthespecifieddataaccesspage.Read-only.

expression.FirstSection

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 1293: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FirstSliceAngleProperty

Returnsorsetstheangleofthefirstpie-chartordoughnut-chartslice,indegrees(clockwisefromvertical).Appliesonlytopieanddoughnutcharts.Read/writeLong.

expression.FirstSliceAngle

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1294: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheangleofthefirstpie-chartordoughnut-chartsliceto45degrees.Charts(0)mustrefertoapieordoughnutchart.

ChartSpace1.Charts(0).FirstSliceAngle=45

Page 1295: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FloorProperty

ReturnsaChSurfaceobjectthatrepresentsthefloorofathree-dimensionalchart.UsethepropertiesandmethodsofthereturnedChSurfaceobjecttoformatthefloorofthespecifiedchart.

expression.Floor

expressionRequired.AnexpressionthatreturnsaChPlotAreaobject.

Page 1296: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthenformatsthebackwall,sidewall,andfloorofthechart.

SubFormatWallsFloor()

Dimcht3DColumnDimchConstantsDimpaPlotArea

SetchConstants=Chartspace1.Constants

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3DColumnchart.cht3DColumn.Type=chConstants.chChartTypeColumnClustered3D

'Setavariabletotheplotarea.SetpaPlotArea=cht3DColumn.PlotArea

'Formatthebackwallofthechart.paPlotArea.BackWall.Interior.SetSolid"Yellow"paPlotArea.BackWall.Thickness=5

'Formatthesidewallofthechart.paPlotArea.SideWall.Interior.SetSolid"Yellow"paPlotArea.SideWall.Thickness=5

'Formatthefloorofthechart.paPlotArea.Floor.Interior.SetSolid"Blue"

Page 1297: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

paPlotArea.Floor.Thickness=5

EndSub

Page 1298: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FontProperty

ReturnsaChFont,Font,orPivotFontobjectthatrepresentsthefontforthespecifiedobject(thereturnedobjecttypedependsontheobjecttowhichthispropertyisapplied).

expression.Font

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1299: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthenumberformatandfontfortheactivecell.

SubSetFont()

DimrngCurrentCell

SetrngCurrentCell=Spreadsheet1.ActiveCell

rngCurrentCell.NumberFormat="0.###"

rngCurrentCell.Font.Color="Blue"

rngCurrentCell.Font.Name="TimesNewRoman"

EndSub

Page 1300: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FontNameProperty

ReturnsorsetsthenameofthefontinthespecifiedRecordNavigationControlobject.Read/writeString.

expression.FontName

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Example

Thisexamplesetsthefontnameto"CourierNew"forcontrolRNC1.

RNC1.FontName="CourierNew"

Page 1301: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ForeColorProperty

Returnsorsetstheforegroundcolorforthespecifiedobjectorarea.Whenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-blue(RGB)colorvalueoraStringvaluerepresentingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateanRGBcolorvalue(forexample,redisRGB(255,0,0)).Read/writeVariant.expression.ForeColor

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1302: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyalwaysreturnsthecolorasaLongvaluerepresentinganRGBcolorvalue.

Page 1303: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefontsize,foregroundcolor,andbackgroundcolorforthetitlebarinPivotTable1.

SubFormat_Titlebar()DimvwViewSetvwView=PivotTable1.ActiveView'Setthebackgroundcolorofthetitlebar.vwView.Label.BackColor="DarkSalmon"'Setthefontsizeofthetitlebar.vwView.Label.Font.Size=16'Settheforegroundcolorofthetitlebar.vwView.Label.ForeColor="Sienna"EndSub

Page 1304: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FormatProperty

ReturnsorsetsaStringthatrepresentsthenumberformattingforthespecifiedelement.Read/write.

expression.Format

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 1305: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FormatMapProperty

ReturnsaChFormatMapobjectthatrepresentstheformatmapforthespecifiedseries.

expression.FormatMap

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

Page 1306: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FormulaProperty

Returnsorsetstheobject'sformulainA1-stylenotationandinthelanguageofthescript.Ifthecellcontainsaconstant,thispropertyreturnstheconstant.Ifthecellisempty,itreturnsanemptystring.Ifthecellcontainsaformula,theFormulapropertyreturnstheformulaasastringinthesameformatthatitwouldbedisplayediftheformulawerebeingactivelyedited(includingtheequalsign).

Ifyousetthevalueorformulaofacelltoadate,theSpreadsheetcomponentcheckstoseewhetherthatcellisalreadyformattedwithoneofthedateortimenumberformats.Ifnot,theSpreadsheetcomponentchangesthenumberformattothedefaultshortdatenumberformat.

Iftherangeisaoneortwo-dimensionalrange,youcansettheformulatoanarrayofthesamedimensions.Similarly,youcanputtheformulaintoanarray.

Settingtheformulaforamultiple-cellrangefillsallcellsintherangewiththeformula.Read/writeVariant.

expression.Formula

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1307: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheformula,columnwidth,andnumberformatforcellB5onSheet1inSpreadsheet1.

SubSetFormula()DimrngRandomNum

'SetavariabletocellB5onSheet1.SetrngRandomNum=Spreadsheet1.Worksheets("Sheet1").Range("B5")

'InsertaformulaintocellB5.rngRandomNum.Formula="=5*RAND()"

'SetthenumberformatforcellB5.rngRandomNum.NumberFormat="#.###"

'AutofitcolumnB.rngRandomNum.Columns.AutoFit

EndSub

Page 1308: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FormulaArrayProperty

ReturnsorsetsaVariantrepresentingthearrayformulaofarange.Returns(orcanbesetto)asingleformulaoraVisualBasicarray.Ifthespecifiedrangedoesn'tcontainanarrayformula,thispropertyreturnsanullstring("").Read/write.

expression.FormulaArray

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1309: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleentersthearrayformula=SUM(A1:A3)incellsE1:E3ontheactiveworksheet.

Spreadsheet1.ActiveSheet.Range("E1:E3").FormulaArray=_"=SUM(A1:A3)"

Page 1310: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FormulaLocalProperty

Returnsorsetstherangeformulainthelanguagethattheuserisworkingin.Ifthecellcontainsaconstant,thispropertyreturnstheconstant.Ifthecellisempty,itreturnsanemptystring.Ifthecellcontainsaformula,theFormulapropertyreturnstheformulaasastringinthesameformatthatitwouldbedisplayediftheformulawerebeingactivelyedited(includingtheequalsign).

Ifyousetthevalueorformulaofacelltoadate,theSpreadsheetcomponentcheckstoseewhetherthatcellisalreadyformattedwithoneofthedateortimenumberformats.Ifnot,theSpreadsheetcomponentchangesthenumberformattothedefaultshortdatenumberformat.

Iftherangeisaoneortwo-dimensionalrange,youcansettheformulatoanarrayofthesamedimensions.Similarly,youcanputtheformulaintoanarray.

Settingtheformulaforamultiple-cellrangefillsallcellsintherangewiththeformula.Read/writeVariant.

expression.FormulaLocal

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1311: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaystheformulaintheactivecellofSpreadsheet1inthelanguageoftheuser.

MsgBoxSpreadsheet1.ActiveCell.FormulaLocal

Page 1312: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FreezePanesProperty

SetthispropertytoTruetocreatepanesintheactiveworksheet.Thepanesarecreatedaboveandtotheleftoftheactivecell.Forexample,settingthispropertytoTruewhilecellD5istheactivecellresultsinahorizontalpanebetweenrows4and5andaverticalpanebetweencolumnsCandD.SetthispropertytoFalsetoremoveallpanesfromaworksheet.Read/writeBoolean.

expression.FreezePanes

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1313: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatespanesintheactiveworksheet.

Spreadsheet1.ActiveWindow.FreezePanes=True

Page 1314: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1315: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FunctionProperty

Returnsorsetsthefunctiontobeusedforgeneratingaggregatevalues.Read/writePivotTotalFunctionEnum.

expression.Function

expressionRequired.AnexpressionthatreturnsaPivotTotalobject.

Page 1316: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheSumoperatoristhedefaultvaluefornumericdatatypes.TheCountoperatoristhedefaultvalueforotherdatatypes.

Page 1317: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GapDepthProperty

ReturnsorsetsaLongspecifyingtheamountofspacingalongthez-axisforadjacentdataseriesinathree-dimensionalchart.Validvaluesrangefrom0to500.Read/write.

expression.GapDepth

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1318: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytoavalueof100resultsinthegapsthatarethesamethicknessasthedataseriesseries.

Page 1319: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthensetsthegapdepthofthechart.

SubSetGapDepth()

Dimcht3DColumnAsChChart

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3-DColumnchart.cht3DColumn.Type=chChartTypeColumn3D

'Setthegapdepth.cht3DColumn.GapDepth=75

EndSub

Page 1320: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GapWidthProperty

Returnsorsetstheamountofspacingbetweenmarkersinadjacentcategories,asapercentageofthecolumnwidth.Avalueofzeroprovidesnospacebetweenadjacentcategorymarkers,whilepositivevaluescreateagap.Read/writeLong.

expression.GapWidth

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1321: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthespacingbetweenmarkersinadjacentcategoriesto250points.

ChartSpace1.Charts(0).GapWidth=250

Page 1322: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GradientDegreeProperty

ReturnsaDoubleindicatingthegradientdegreeofthespecifiedshadedfillasavaluefrom0.0(dark)through1.0(light).Read-only.

expression.GradientDegree

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1323: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheSetOneColorGradientmethodtosetthegradientdegreeforaChInteriorobject.

Page 1324: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1325: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GradientStyleProperty

ReturnsaChartGradientStyleEnumconstantindicatingthegradientstyleforthespecifiedChInteriorobject.Read-only.

expression.GradientStyle

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1326: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheSetPresetGradient,SetOneColorGradientorSetTwoColorGradientmethodtosetthegradientstyleforaChInteriorobject.

Page 1327: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1328: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GradientVariantProperty

ReturnsaChartGradientVariantEnumconstantindicatingtheshadevariantforthespecifiedChInteriorobject.Read-only.

expression.GradientVariant

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1329: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheOneColorGradientorTwoColorGradientmethodtosetthegradientvariantforaChInteriorobject.

Page 1330: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GridlineColorProperty

ReturnsorsetsthegridlinecolorasanRGBvalue.Read/writeLong.

expression.GridlineColor

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1331: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplesetsthegridlinecoloroftheactivewindowinSpreadsheet1toRed.

Spreadsheet1.ActiveWindow.GridlineColor=RGB(255,0,0)

Page 1332: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1333: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GridlineColorIndexProperty

Returnsorsetsthegridlinecolorasanindexintothecurrentcolorpalette,orasanXlColorIndexconstant.Read/write.

expression.GridlineColorIndex

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1334: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSetthispropertytoxlColorIndexAutomatictospecifytheautomaticcolor.

Thefollowingillustrationshowsthecolor-indexvaluesinthedefaultcolorpalette.

Page 1335: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthegridlinecolorintheactivewindowofSpreadsheet1toblue.

Spreadsheet1.ActiveWindow.GridlineColorIndex=5

Page 1336: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GridXProperty

Returnsorsetsthenumberofdottedgridlinesperinchonthex-axisinthespecifieddataaccesspage’sdesignerdefaultsection.Read/writeLong.

expression.GridX

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1337: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GridYProperty

Returnsorsetsthenumberofdottedgridlinesperinchonthey-axisinthespecifieddataaccesspage’sdesignerdefaultsection.Read/writeLong.

expression.GridY

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1338: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupedAutoFitProperty

Trueifthespecifiedfield'scolumnwidthissetautomaticallywhenthefieldisusedontherowaxisorthecolumnaxis.Tosetthewidthofafield'scolumn,setthepropertytoFalse.Then,settheGroupedWidthpropertyofthefieldtothedesiredwidth.ThedefaultvalueisTrue.Read/writeBoolean.

expression.GroupedAutoFit

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1339: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablestheGroupedAutoFitpropertyofthe"ProductName"fieldinPivotTable1andthensetsthewidthofthefieldto150pixels.

SubSet_ColumnWidth()DimfldProducts'SetavariabletotheProductNamefield.SetfldProducts=PivotTable1.ActiveView.FieldSets("ProductName").Fields(0)'SettheGroupedAutoFitfortheProductNamefield.fldProducts.GroupedAutoFit=False'SetthewidthoftheProductNamefieldto150pixels.fldProducts.GroupedWidth=150EndSub

Page 1340: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupedBackColorProperty

ReturnsorsetsaVariantrepresentingthebackgroundcolorofafiledwhenithasbeengrouped.Read/write.

expression.GroupedBackColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1341: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).

Page 1342: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplegroupstheAgefieldofPivotTable1.Startingatage15,anewgroupwillbecreatedforeveryfiveyearsuntilage80.Then,thefont,foreground,background,heightandalignmentoftheresultinggroupsareformatted.

SubAddGrouping()

DimvwViewDimptConstantsDimpfGroupedField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetvwView=PivotTable1.ActiveView'SetavariabletotheAgefield.SetpfGroupedField=vwView.FieldSets("Age").Fields("Age")'SettheGroupOnpropertysothattheAgefieldwillbe'groupedbytheGroupIntervalsetting.pfGroupedField.GroupOn=ptConstants.plGroupOnInterval

'Createanewgroupingforeveryfiveyears.pfGroupedField.GroupInterval=5

'Startthegroupingatage15.pfGroupedField.GroupStart=15

'Endthegroupingatage80.pfGroupedField.GroupEnd=80

Page 1343: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthefontforthefieldwhenitisgrouped.pfGroupedField.GroupedFont.Bold=True

'Settheforegroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedForeColor="Black"

'SettheBackgroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedBackColor="Blue"

'Settheheightforthefieldwhenitisgrouped.pfGroupedField.GroupedHeight=15

'Setthehorizontalalignmentforthefieldwhenitisgrouped.pfGroupedField.GroupedHAlignment=ptConstants.plHAlignRightEndSub

Page 1344: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupedFontProperty

ReturnsaPivotFontobjectthatrepresentsthefontforthespecifiedfieldwhenithasbeengrouped.

expression.GroupedFont

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1345: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplegroupstheAgefieldofPivotTable1.Startingatage15,anewgroupwillbecreatedforeveryfiveyearsuntilage80.Then,thefont,foreground,background,heightandalignmentoftheresultinggroupsareformatted.

SubAddGrouping()

DimvwViewDimptConstantsDimpfGroupedField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetvwView=PivotTable1.ActiveView'SetavariabletotheAgefield.SetpfGroupedField=vwView.FieldSets("Age").Fields("Age")'SettheGroupOnpropertysothattheAgefieldwillbe'groupedbytheGroupIntervalsetting.pfGroupedField.GroupOn=ptConstants.plGroupOnInterval

'Createanewgroupingforeveryfiveyears.pfGroupedField.GroupInterval=5

'Startthegroupingatage15.pfGroupedField.GroupStart=15

'Endthegroupingatage80.pfGroupedField.GroupEnd=80

Page 1346: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthefontforthefieldwhenitisgrouped.pfGroupedField.GroupedFont.Bold=True

'Settheforegroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedForeColor="Black"

'SettheBackgroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedBackColor="Blue"

'Settheheightforthefieldwhenitisgrouped.pfGroupedField.GroupedHeight=15

'Setthehorizontalalignmentforthefieldwhenitisgrouped.pfGroupedField.GroupedHAlignment=ptConstants.plHAlignRightEndSub

Page 1347: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupedForeColorProperty

ReturnsorsetsaVariantrepresentingtheforegroundcolorofafieldwhenithasbeengrouped.Usethispropertytosetthecolorofagroupeditem.Read/write.

expression.GroupedForeColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1348: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).

Page 1349: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplegroupstheAgefieldofPivotTable1.Startingatage15,anewgroupwillbecreatedforeveryfiveyearsuntilage80.Then,thefont,foreground,background,heightandalignmentoftheresultinggroupsareformatted.

SubAddGrouping()

DimvwViewDimptConstantsDimpfGroupedField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetvwView=PivotTable1.ActiveView'SetavariabletotheAgefield.SetpfGroupedField=vwView.FieldSets("Age").Fields("Age")'SettheGroupOnpropertysothattheAgefieldwillbe'groupedbytheGroupIntervalsetting.pfGroupedField.GroupOn=ptConstants.plGroupOnInterval

'Createanewgroupingforeveryfiveyears.pfGroupedField.GroupInterval=5

'Startthegroupingatage15.pfGroupedField.GroupStart=15

'Endthegroupingatage80.pfGroupedField.GroupEnd=80

Page 1350: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthefontforthefieldwhenitisgrouped.pfGroupedField.GroupedFont.Bold=True

'Settheforegroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedForeColor="Black"

'SettheBackgroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedBackColor="Blue"

'Settheheightforthefieldwhenitisgrouped.pfGroupedField.GroupedHeight=15

'Setthehorizontalalignmentforthefieldwhenitisgrouped.pfGroupedField.GroupedHAlignment=ptConstants.plHAlignRightEndSub

Page 1351: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1352: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupedHAlignmentProperty

ReturnsorsetsaPivotHAlignmentEnumconstantthatrepresentsthehorizontalalignmentofthespecifiedfieldwhenithasbeengrouped.Read/write.

expression.GroupedHAlignment

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1353: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplegroupstheAgefieldofPivotTable1.Startingatage15,anewgroupwillbecreatedforeveryfiveyearsuntilage80.Then,thefont,foreground,background,heightandalignmentoftheresultinggroupsareformatted.

SubAddGrouping()

DimvwViewDimptConstantsDimpfGroupedField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetvwView=PivotTable1.ActiveView'SetavariabletotheAgefield.SetpfGroupedField=vwView.FieldSets("Age").Fields("Age")'SettheGroupOnpropertysothattheAgefieldwillbe'groupedbytheGroupIntervalsetting.pfGroupedField.GroupOn=ptConstants.plGroupOnInterval

'Createanewgroupingforeveryfiveyears.pfGroupedField.GroupInterval=5

'Startthegroupingatage15.pfGroupedField.GroupStart=15

'Endthegroupingatage80.pfGroupedField.GroupEnd=80

Page 1354: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthefontforthefieldwhenitisgrouped.pfGroupedField.GroupedFont.Bold=True

'Settheforegroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedForeColor="Black"

'SettheBackgroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedBackColor="Blue"

'Settheheightforthefieldwhenitisgrouped.pfGroupedField.GroupedHeight=15

'Setthehorizontalalignmentforthefieldwhenitisgrouped.pfGroupedField.GroupedHAlignment=ptConstants.plHAlignRightEndSub

Page 1355: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupedHeightProperty

ReturnsorsetsaLongthatrepresentstheheightofafieldwhenithasbeengrouped.Read/write.

expression.GroupedHeight

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1356: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplegroupstheAgefieldofPivotTable1.Startingatage15,anewgroupwillbecreatedforeveryfiveyearsuntilage80.Then,thefont,foreground,background,heightandalignmentoftheresultinggroupsareformatted.

SubAddGrouping()

DimvwViewDimptConstantsDimpfGroupedField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetvwView=PivotTable1.ActiveView'SetavariabletotheAgefield.SetpfGroupedField=vwView.FieldSets("Age").Fields("Age")'SettheGroupOnpropertysothattheAgefieldwillbe'groupedbytheGroupIntervalsetting.pfGroupedField.GroupOn=ptConstants.plGroupOnInterval

'Createanewgroupingforeveryfiveyears.pfGroupedField.GroupInterval=5

'Startthegroupingatage15.pfGroupedField.GroupStart=15

'Endthegroupingatage80.pfGroupedField.GroupEnd=80

Page 1357: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthefontforthefieldwhenitisgrouped.pfGroupedField.GroupedFont.Bold=True

'Settheforegroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedForeColor="Black"

'SettheBackgroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedBackColor="Blue"

'Settheheightforthefieldwhenitisgrouped.pfGroupedField.GroupedHeight=15

'Setthehorizontalalignmentforthefieldwhenitisgrouped.pfGroupedField.GroupedHAlignment=ptConstants.plHAlignRightEndSub

Page 1358: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupedWidthProperty

Returnsorsetsthewidthofthespecifiedfield(pixels)whenthefieldisdisplayedontherowaxisorthecolumnaxis.Thedefaultvalueis50pixels.ThispropertyisignorediftheGroupedAutoFitpropertyforthespecifiedfieldissettoTrue.Read/writeLong.

expression.GroupedWidth

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1359: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablestheGroupedAutoFitpropertyofthe"ProductName"fieldinPivotTable1andthensetsthewidthofthefieldto150pixels.

SubSet_ColumnWidth()DimfldProducts'SetavariabletotheProductNamefield.SetfldProducts=PivotTable1.ActiveView.FieldSets("ProductName").Fields(0)'SettheGroupedAutoFitfortheProductNamefield.fldProducts.GroupedAutoFit=False'SetthewidthoftheProductNamefieldto150pixels.fldProducts.GroupedWidth=150EndSub

Page 1360: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupEndProperty

ReturnsorsetsaVariantrepresentingtheendingvalueofthegroupingintervalforthespecifiedfield.Read/write.

expression.GroupEnd

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1361: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIfthespecifiedfieldcontainsvaluesgreaterthanthesettingforthisproperty,thenagrouptitled">=(GroupEnd+1)"iscreatedwhereGroupEndisthevaluespecifiedforthisproperty.Thisgroupwillcontainallvaluesthataregreaterthanthesettingforthisproperty.

IfthispropertyisnotsetorissettoEmpty,thenthelargestvalueinthefieldisusedastheendingvalue.

IfthecurrentsettingfortheGroupOnpropertyisplGroupOnPrefixChars,thenyouwillreceivearun-timeerrorwhenyousetthisproperty.

Page 1362: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplegroupstheAgefieldofPivotTable1.Startingatage15,anewgroupwillbecreatedforeveryfiveyearsuntilage80.Then,thefont,foreground,background,heightandalignmentoftheresultinggroupsareformatted.

SubAddGrouping()

DimvwViewDimptConstantsDimpfGroupedField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetvwView=PivotTable1.ActiveView'SetavariabletotheAgefield.SetpfGroupedField=vwView.FieldSets("Age").Fields("Age")'SettheGroupOnpropertysothattheAgefieldwillbe'groupedbytheGroupIntervalsetting.pfGroupedField.GroupOn=ptConstants.plGroupOnInterval

'Createanewgroupingforeveryfiveyears.pfGroupedField.GroupInterval=5

'Startthegroupingatage15.pfGroupedField.GroupStart=15

'Endthegroupingatage80.pfGroupedField.GroupEnd=80

Page 1363: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthefontforthefieldwhenitisgrouped.pfGroupedField.GroupedFont.Bold=True

'Settheforegroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedForeColor="Black"

'SettheBackgroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedBackColor="Blue"

'Settheheightforthefieldwhenitisgrouped.pfGroupedField.GroupedHeight=15

'Setthehorizontalalignmentforthefieldwhenitisgrouped.pfGroupedField.GroupedHAlignment=ptConstants.plHAlignRightEndSub

Page 1364: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupFieldProperty

ReturnsaPivotResultGroupFieldobject.Usethepropertiesofthereturnedobjecttoaccessthesourcefieldandaxispropertiesofthespecifiedaxismember.

expression.GroupField

expressionRequired.AnexpressionthatreturnsaPivotAxisMemberobject.

Page 1365: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupFieldsProperty

ReturnsthePivotResultGroupFieldscollectionforthespecifiedgroupaxis.

expression.GroupFields

expressionRequired.AnexpressionthatreturnsaPivotResultGroupAxisobject.

Page 1366: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupFilterControlProperty

ReturnsorsetstheIDofthelistboxorcomboboxusedtosetcurrency.Read/writeString.

expression.GroupFilterControl

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1367: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupFilterFieldProperty

Returnsorsetsthefilterstringusedbythegroupfiltercontrol(thefieldonwhichthecontrolwillsetcurrency).Thisstringmustbethenameofapagefieldinthegrouplevel'srecordsource.Read/writeString.

expression.GroupFilterField

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1368: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupFooterProperty

Trueifthespecifiedsectionhasafooter.Youcansetthispropertyforanybandinglevelexcepttheinnermostone.ThedefaultvalueisFalse.Read/writeBoolean.

expression.GroupFooter

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1369: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupHeaderProperty

Trueifthespecifiedsectionhasaheader.ThedefaultvalueisTrue.Read/writeBoolean.

expression.GroupHeader

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1370: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupingDefsProperty

ReturnstheGroupingDefscollectionforthespecifiedrecordsetdefinition.ThiscollectioncontainstheGroupingDefobjectsthatcreategroupinglevelsforthedetailrecords.

expression.GroupingDefs

expressionRequired.AnexpressionthatreturnsaRecordsetDefobject.

Page 1371: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1372: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1373: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupingTotalFunctionProperty

ReturnsorsetsaChartGroupingTotalFunctionEnumconstantthatrepresentsthefunctionusedtodisplaythevaluesinagroup.Read/write.

expression.GroupingTotalFunction

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1374: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toalinechart,thenformatsthecategoryaxissothatthevaluesaregroupedbymonth.Theaveragevalueofeachmonthisdisplayedonthechart.

SubFormatTimeScaling()

DimchConstantsDimaxCategory

SetchConstants=ChartSpace1.Constants

'ChangethecharttoaLinechart.ChartSpace1.Charts(0).Type=chConstants.chChartTypeLine

'Setavariabletothecategoryaxis.SetaxCategory=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)

'Specifythatyouwilldeterminethegroupingsettingsofthe'axis.Notethatthislineofcodeisnecessaryonlyifthe'GroupingTypepropertyfortheaxishasbeenpreviouslysetto'chAxisGroupingNone.axCategory.GroupingType=chConstants.chAxisGroupingManual

'Groupthecategoryaxisbymonth.axCategory.GroupingUnitType=chConstants.chAxisUnitMonth

'Createanewgroupingforeverymonth.axCategory.GroupingUnit=1

'Displaytheaverageoftheitemsineachgroup.

Page 1375: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

axCategory.GroupingTotalFunction=chConstants.chFunctionAvg

'Aticklabelisdisplayedforeverymonth.axCategory.TickLabelUnitType=chConstants.chAxisUnitMonth

'Atickmarkisdisplayedforeverythreemonths.axCategory.TickMarkUnitType=chConstants.chAxisUnitQuarter

EndSub

Page 1376: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1377: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupingTypeProperty

ReturnsorsetsaChartAxisGroupingEnumconstantthatrepresentswhetherornottheitemsonachartaxisaregrouped,andifso,whetherthegroupingwasdoneautomatically.Read/write.

expression.GroupingType

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1378: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheChartcontrolautomaticallycreatesatimescaleandgroupsonthecategoryaxiswhenthefollowingconditionsaretrue:

TheChartcontroldetectsthatthecategoryinformationisadate.

TheChartcontrolisboundtoaPivotTablelist,andthePivotTablelistisnotboundtoanOLAPdatasource.

Page 1379: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisablestimescalingonthecategoryaxisofthefirstchartinChartspace1.

SubDisableTimeScaling()

DimchConstantsDimaxCategory

SetchConstants=ChartSpace1.Constants

'Setavariabletothecategoryaxis.SetaxCategory=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionTimescale)

'Disabletimescalingonthecategoryaxis.axCategory.GroupingType=chConstants.chAxisGroupingNone

EndSub

Page 1380: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupingUnitProperty

ReturnsorsetsaLongvaluethatrepresentsthenumberofitemsinagroup.Read/write.

expression.GroupingUnit

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1381: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toalinechart,thenformatsthecategoryaxissothatthevaluesaregroupedbymonth.Theaveragevalueofeachmonthisdisplayedonthechart.

SubFormatTimeScaling()

DimchConstantsDimaxCategory

SetchConstants=ChartSpace1.Constants

'ChangethecharttoaLinechart.ChartSpace1.Charts(0).Type=chConstants.chChartTypeLine

'Setavariabletothecategoryaxis.SetaxCategory=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)

'Specifythatyouwilldeterminethegroupingsettingsofthe'axis.Notethatthislineofcodeisnecessaryonlyifthe'GroupingTypepropertyfortheaxishasbeenpreviouslysetto'chAxisGroupingNone.axCategory.GroupingType=chConstants.chAxisGroupingManual

'Groupthecategoryaxisbymonth.axCategory.GroupingUnitType=chConstants.chAxisUnitMonth

'Createanewgroupingforeverymonth.axCategory.GroupingUnit=1

'Displaytheaverageoftheitemsineachgroup.

Page 1382: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

axCategory.GroupingTotalFunction=chConstants.chFunctionAvg

'Aticklabelisdisplayedforeverymonth.axCategory.TickLabelUnitType=chConstants.chAxisUnitMonth

'Atickmarkisdisplayedforeverythreemonths.axCategory.TickMarkUnitType=chConstants.chAxisUnitQuarter

EndSub

Page 1383: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1384: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupingUnitTypeProperty

ReturnsorsetsaChartAxisUnitTypeEnumconstantthatrepresentshowitemsaregroupedonanaxis.

expression.GroupingUnitType

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1385: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertysetstheGroupingTypepropertytochAxisGroupingManual.

TheChartcontrolautomaticallycreatesatimescaleandgroupsonthecategoryaxiswhenthefollowingconditionsaretrue:

TheChartcontroldetectsthatthecategoryinformationisadate.

TheChartcontrolisboundtoaPivotTablelist,andthePivotTablelistisnotboundtoanOLAPdatasource.

Page 1386: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toalinechart,thenformatsthecategoryaxissothatthevaluesaregroupedbymonth.Theaveragevalueofeachmonthisdisplayedonthechart.

SubFormatTimeScaling()

DimchConstantsDimaxCategory

SetchConstants=ChartSpace1.Constants

'ChangethecharttoaLinechart.ChartSpace1.Charts(0).Type=chConstants.chChartTypeLine

'Setavariabletothecategoryaxis.SetaxCategory=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)

'Specifythatyouwilldeterminethegroupingsettingsofthe'axis.Notethatthislineofcodeisnecessaryonlyifthe'GroupingTypepropertyfortheaxishasbeenpreviouslysetto'chAxisGroupingNone.axCategory.GroupingType=chConstants.chAxisGroupingManual

'Groupthecategoryaxisbymonth.axCategory.GroupingUnitType=chConstants.chAxisUnitMonth

'Createanewgroupingforeverymonth.axCategory.GroupingUnit=1

'Displaytheaverageoftheitemsineachgroup.

Page 1387: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

axCategory.GroupingTotalFunction=chConstants.chFunctionAvg

'Aticklabelisdisplayedforeverymonth.axCategory.TickLabelUnitType=chConstants.chAxisUnitMonth

'Atickmarkisdisplayedforeverythreemonths.axCategory.TickMarkUnitType=chConstants.chAxisUnitQuarter

EndSub

Page 1388: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1389: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupIntervalProperty

GroupIntervalpropertyasitappliestothePivotFieldobject.

GroupIntervalpropertyasitappliestotheGroupLevelandPageFieldobjects.

Page 1390: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestothePivotFieldobject.

Page 1391: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupLevelProperty

ReturnstheGroupLevelobjectforthespecifieddataaccesspage.AGroupLevelobjectcorrespondstoarecordsetproducedbyarecordsetdefinitionorgroupingdefinition.Read-only.

expression.GroupLevel

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 1392: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupLevelsProperty

ReturnstheGroupLevelscollectionforthespecifieddatasourcecontrol.Read-only.

expression.GroupLevels

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1393: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1394: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupOnProperty

GroupOnpropertyasitappliestothePivotFieldobject.

Page 1395: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupOnpropertyasitappliestotheGroupLevelandPageFieldobjects.

Page 1396: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestothePivotFieldobject.

Page 1397: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

GroupStartProperty

ReturnsorsetsaVariantrepresentingthestartingvalueofthegroupingintervalforthespecifiedfield.Read/write.

expression.GroupStart

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1398: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIfthespecifiedfieldcontainsvaluessmallerthanthesettingforthisproperty,thenagroupentitled"<GroupStart"iscreatedwhereGroupStartisthevaluespecifiedforthisproperty.Thisgroupwillcontainallvaluesthataresmallerthanthesettingforthisproperty.

IfthispropertyisnotsetorissettoEmpty,thenthesmallestvalueinthefieldisusedasthestartingvalue.

IfthecurrentsettingfortheGroupOnpropertyisplGroupOnPrefixChars,thenyouwillreceivearun-timeerrorwhenyousetthisproperty.

Page 1399: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplegroupstheAgefieldofPivotTable1.Startingatage15,anewgroupwillbecreatedforeveryfiveyearsuntilage80.Then,thefont,foreground,background,heightandalignmentoftheresultinggroupsareformatted.

SubAddGrouping()

DimvwViewDimptConstantsDimpfGroupedField

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetvwView=PivotTable1.ActiveView'SetavariabletotheAgefield.SetpfGroupedField=vwView.FieldSets("Age").Fields("Age")'SettheGroupOnpropertysothattheAgefieldwillbe'groupedbytheGroupIntervalsetting.pfGroupedField.GroupOn=ptConstants.plGroupOnInterval

'Createanewgroupingforeveryfiveyears.pfGroupedField.GroupInterval=5

'Startthegroupingatage15.pfGroupedField.GroupStart=15

'Endthegroupingatage80.pfGroupedField.GroupEnd=80

Page 1400: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setthefontforthefieldwhenitisgrouped.pfGroupedField.GroupedFont.Bold=True

'Settheforegroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedForeColor="Black"

'SettheBackgroundcolorforthefieldwhenitisgrouped.pfGroupedField.GroupedBackColor="Blue"

'Settheheightforthefieldwhenitisgrouped.pfGroupedField.GroupedHeight=15

'Setthehorizontalalignmentforthefieldwhenitisgrouped.pfGroupedField.GroupedHAlignment=ptConstants.plHAlignRightEndSub

Page 1401: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1402: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HAlignmentProperty

Returnsorsetsthewaydataisalignedinthespecifiedlabelortotal.Read/writePivotHAlignmentEnum.

expression.HAlignment

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1403: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAbsoluteLabelsProperty

Returnsorsetswhetherthelegendentriesforpercentage-calculatedsegmentsaredisplayedasabsolutevaluesinthelegend.SetthispropertytoTrueinordertodisplaytheactualbeginningandendingvaluesforasegmentthatwascalculatedasapercentage.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasAbsoluteLabels

expressionRequired.AnexpressionthatreturnsaChSegmentobject.

Page 1404: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreatedthatdisplaysthelargervaluesinthechartwithadarkershadeofblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1AsChSegmentDimchconstants

Setchconstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;persistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=DataServer;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderDetailstable.ChartSpace1.SetDatachconstants.chDimCategories,chconstants.chDataBound,"ProductID"ChartSpace1.SetDatachconstants.chDimValues,chconstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachconstants.chDimFormatValues,chconstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

Page 1405: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chconstants.chBoundaryValuePercentsegSegment1.End.ValueType=chconstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%.segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"segSegment1.HasAutoDivisions=FalsesegSegment1.HasAbsoluteLabels=TruesegSegment1.HasDiscreteDivisions=False

EndSub

Page 1406: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasArrayProperty

Trueifthespecifiedcellispartofanarrayformula.Read-onlyVariant.

expression.HasArray

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1407: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheCurrentArraypropertytodeterminethethecellsthatarepartofthecurrentarray.

Page 1408: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledetermineswhethertheactivecellinSpreadsheet1ispartofanarray.Isso,thearrayisselected.

IfSpreadsheet1.ActiveCell.HasArrayThen_Spreadsheet1.ActiveCell.CurrentArray.Select

Page 1409: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoAspectRatioProperty

Falseiftheaspectratioofthespecifiedcharthasbeenmodified.SetthispropertytoTruetorestorethespecifiedcharttoit'sdefaultaspectratio.Read-writeBoolean.

expression.HasAutoAspectRatio

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1410: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresetsthefirstchartinChartspace1toitsdefaultaspectratio.

Chartspace1.Charts(0).HasAutoAspectRatio=True

Page 1411: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoCaptionProperty

Trueifthenameforthespecifiedtrendlineisgeneratedautomaticallyfromthetrendlinetypeandseriesindex("Poly.(Series1)",forexample).Settingthetrendline’sCaptionpropertysetsthispropertytoFalse.Read/writeBoolean.

expression.HasAutoCaption

expressionRequired.AnexpressionthatreturnsaChTrendlineobject.

Page 1412: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecaptionforthespecifiedtrendlinecaptionifthecaptioniscurrentlysettobegeneratedautomatically.NotethatSeriesCollection(0)mustrefertoaseriesthatalreadyhasatrendline.

SubSetCaption()DimserZeroDimtrndlineSetserZero=ChartSpace1.Charts(0).SeriesCollection(0)serZero.Line.Color="red"Settrndline=serZero.Trendlines(0)Iftrndline.HasAutoCaptionThentrndline.Caption="datatrend"EndSub

Page 1413: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoChartDepthProperty

Falseifthedepthofthespecifiedcharthasbeenmodified.SetthispropertytoTruetorestorethespecifiedcharttoitsdefaultdepth.Read-writeBoolean.

expression.HasAutoChartDepth

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1414: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresetsthefirstchartinChartspace1toit'sdefaultdepth.

Chartspace1.Charts(0).HasAutoChartDepth=True

Page 1415: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoDivisionsProperty

Returnsorsetswhetherdivisionsareautomaticallycreatedforthespecifiedsegment.ThedefaultvalueisTrue.Read/writeBoolean.

expression.HasAutoDivisions

expressionRequired.AnexpressionthatreturnsaChSegmentobject.

Page 1416: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreatedthatdisplaysthelargervaluesinthechartwithadarkershadeofblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1AsChSegmentDimchconstants

Setchconstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;persistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=DataServer;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderDetailstable.ChartSpace1.SetDatachconstants.chDimCategories,chconstants.chDataBound,"ProductID"ChartSpace1.SetDatachconstants.chDimValues,chconstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachconstants.chDimFormatValues,chconstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

Page 1417: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chconstants.chBoundaryValuePercentsegSegment1.End.ValueType=chconstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"

segSegment1.HasAutoDivisions=False

segSegment1.HasAbsoluteLabels=True

segSegment1.HasDiscreteDivisions=False

EndSub

Page 1418: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoMajorUnitProperty

Trueifthemajorunitforthespecifiedaxisisdeterminedautomatically.ThedefaultvalueisTrue.Youshouldusethispropertyonlyforvalueaxes.Read/writeBoolean.

expression.HasAutoMajorUnit

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1419: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthemajorunitforthespecifiedaxisifthemajorunitiscurrentlysettobedeterminedautomatically.

SubSetMajorUnit()DimchtConstantsdimaxsSetchtConstants=ChartSpace1.ConstantsSetaxs=ChartSpace1.Charts(0).Axes(chtConstants.chAxisPositionValue)Ifaxs.HasAutoMajorUnitThenaxs.MajorUnit=5000EndSub

Page 1420: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoMaximumProperty

Trueifthemaximumscalevalueforthespecifiedaxisissettobedeterminedautomatically.ThedefaultvalueisTrue.Read/writeBoolean.

expression.HasAutoMaximum

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1421: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthemaximumscalevalueforthespecifiedaxisifthemaximumvalueiscurrentlysettobedeterminedautomatically.

SubSetScale()DimchConstantsdimaxisScaleSetchConstants=ChartSpace1.ConstantsSetaxisScale=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).ScalingIfaxisScale.HasAutoMaximumThenaxisScale.Maximum=50000EndSub

Page 1422: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoMinimumProperty

Trueiftheminimumscalevalueforthespecifiedaxisissettobedeterminedautomatically.ThedefaultvalueisTrue.Read/writeBoolean.

expression.HasAutoMinimum

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1423: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheminimumscalevalueforthespecifiedaxisiftheminimumvalueiscurrentlysettobedeterminedautomatically.

SubSetScaling()DimchConstantsDimaxisScaleSetchConstants=ChartSpace1.ConstantsSetaxisScale=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).ScalingIfaxisScale.HasAutoMinimumThenaxisScale.Minimum=10EndSub

Page 1424: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasAutoMinorUnitProperty

Trueiftheminorunitforthespecifiedaxisissettobedeterminedautomatically.ThedefaultvalueisTrue.Youshouldusethispropertyonlyforvalueaxes.Read/writeBoolean.

expression.HasAutoMinorUnit

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1425: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheminorunitforthespecifiedaxistoincrementsof500iftheunitiscurrentlysettobedeterminedautomatically.

SubSetMinorUnit()DimchConstantsDimaxsSetchConstants=ChartSpace1.ConstantsSetaxs=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)Ifaxs.HasAutoMinorUnitThenaxs.MinorUnit=500EndSub

Page 1426: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasBubbleSizeProperty

Trueifeverydatalabelforthespecifiedseriesorchartcurrentlydisplaysitsbubblesize.ThedefaultvalueisFalse.Notethatthispropertyisavailableonlyforbubblecharts.Read/writeBoolean.

expression.HasBubbleSize

expressionRequired.AnexpressionthatreturnsaChDataLabelsobject.

Page 1427: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDatalabelcomponentsarealwaysdisplayedinthefollowingorder:[SeriesName][CategoryName][Value][BubbleSize][Percentage].

Page 1428: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausesthedatalabelsforthespecifiedseriestodisplaytheirbubblesize.NotethatCharts(0)mustrefertoabubblechart.

SubDisplayLabels()DimdlBubbleLabelsSetdlBubbleLabels=ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection.AdddlBubbleLabels.HasBubbleSize=TrueEndSub

Page 1429: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasCategoryNameProperty

Trueifeverydatalabelforthespecifiedseriesorchartcurrentlydisplaysitscategorynameorlabel.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasCategoryName

expressionRequired.AnexpressionthatreturnsaChDataLabelsobject.

Page 1430: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDatalabelcomponentsarealwaysdisplayedinthefollowingorder:[SeriesName][CategoryName][Value][BubbleSize][Percentage]

Page 1431: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausesthedatalabelsforthespecifiedseriestodisplaytheircategoryandseriesnames.

SubShowLabels()Dimdl

Setdl=ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection(0)

'Displaythecategorynames.dl.HasCategoryName=True'Displaytheseriesnames.dl.HasSeriesName=TrueEndSub

Page 1432: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasDetailsProperty

Trueifdetailrecordscanbedisplayedforagivencell;Falseifdetailrecordsarenotavailablefordisplay.Thispropertyisautomaticallyresetwheneverthedataisrequeried.IfthispropertyissettoFalse,theexpansionindicatorsarenotdisplayedforinnermembers.ThispropertyisalwayssettoFalseiftheproviderismultidimensional.Read-onlyBoolean.

expression.HasDetails

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 1433: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasDiscreteDivisionsProperty

Returnsorsetsthemethodusedtointerpolatetheformattingofthespecifiedsegmentbetweenitsbeginningandendingvalues.SettingthispropertytoTruecausestheChartcontroltoassignanumberofdivisionstothesegment.SettingthispropertytoFalsecausestheChartcontroltointerpolatebetweenthebeginningandendingvaluesofthesegmentwithoutcreatingdiscretedivisionsinformatting.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasDiscreteDivisions

expressionRequired.AnexpressionthatreturnsaChSegmentobject.

Page 1434: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksToillustratethedifferenceswhensettingthispropertytoTrueorFalse,assumethatyousetthefollowingpropertiesforasegment:

.Begin.Value=10

.Begin.Interior.Color="White"

.End.Value=50

.End.Interior.Color="Green"

WhensettingthispropertytoTrue,theChartcontrolwouldcreateseveraldivisionswhichcontainadifferentinterpolationoftheabovecolorsettings.However,pointsthatareveryclosetoeachotherinvaluecanbeformattedverydifferentlybecauseeachpointisinadifferentdivision.Apointwithavalueof24maybewhitewhileapointwithavalueof25maybeafairlydarkshadeofgreen,becauseadivisionwascreatedbetween24and25.SettingthispropertytoFalseresultsinamoregradualinterpolationbetweenwhiteandgreen.

Page 1435: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreatedthatdisplaysthelargervaluesinthechartwithadarkershadeofblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1AsChSegmentDimchconstants

Setchconstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;persistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=DataServer;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderDetailstable.ChartSpace1.SetDatachconstants.chDimCategories,chconstants.chDataBound,"ProductID"ChartSpace1.SetDatachconstants.chDimValues,chconstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachconstants.chDimFormatValues,chconstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

Page 1436: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chconstants.chBoundaryValuePercentsegSegment1.End.ValueType=chconstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%.segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"

segSegment1.HasAutoDivisions=False

segSegment1.HasAbsoluteLabels=True

segSegment1.HasDiscreteDivisions=False

EndSub

Page 1437: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasFormulaProperty

Trueifallcellsintherangecontainformulas,Falseifnonecontainformulas,andNullifsomecellscontainformulasandothersdonot.Read-onlyVariant.UsetheIsNullfunctiontodetermineifthereturnvalueisNull.

expression.HasFormula

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1438: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplerecalculatestheactiveworksheetifanycellinthecurrentlyselectedrangecontainsaformula.

SubCalcIfSelectionHasFormulas()DimvntHasFormulaDimrngCurrentSetrngCurrent=Spreadsheet1.Selection'SetavariabletotheHasFormulaproperty'forthecurrentselection.vntHasFormula=rngCurrent.HasFormulaIfIsNull(vntHasFormula)Then'Calculatetheactiveworksheetifthe'selectioncontainsoneormoreformulas.Spreadsheet1.ActiveSheet.CalculateElseIfvntHasFormulaThen'Calculatetheactiveworksheetifall'selectedcellscontainaformula.Spreadsheet1.ActiveSheet.CalculateEndIfEndSub

Page 1439: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasLegendProperty

Trueifthespecifiedcharthasalegend.Read/writeBoolean.

expression.HasLegend

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1440: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthespecifiedcharttohavealegend.

ChartSpace1.Charts(0).HasLegend=True

Page 1441: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasMajorGridlinesProperty

Trueifthespecifiedaxishasmajorgridlines.Notethatanyaxiscanhavegridlines.Read/writeBoolean.

expression.HasMajorGridlines

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1442: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsonthemajorandminorgridlinesonthefirstchartinChartSpace1.

SubEnableGridlines()DimchConstantsDimaxValueAxisSetchConstants=ChartSpace1.Constants'Setavariabletorefertothevalueaxis.SetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)'Enablethemajorgridlinesonthevalueaxis.axValueAxis.HasMajorGridlines=True'Enablethemajorgridlinesonthevalueaxis.axValueAxis.HasMinorGridlines=TrueEndSub

Page 1443: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasMinorGridlinesProperty

Trueifthespecifiedaxishasminorgridlines.Notethatanyaxiscanhavegridlines.Read/writeBoolean.

expression.HasMinorGridlines

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1444: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsonthemajorandminorgridlinesonthefirstchartinChartSpace1.

SubEnableGridlines()DimchConstantsDimaxValueAxisSetchConstants=ChartSpace1.Constants'Setavariabletorefertothevalueaxis.SetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)'Enablethemajorgridlinesonthevalueaxis.axValueAxis.HasMajorGridlines=True'Enablethemajorgridlinesonthevalueaxis.axValueAxis.HasMinorGridlines=TrueEndSub

Page 1445: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasMultipleChartsProperty

ReturnsorsetsaBooleanthatindicateswhetherthespecifiedChartSpacecontainsmultiplecharts.ThedefaultvalueisFalse.Read/write.

expression.HasMultipleCharts

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1446: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasPassiveAlertsProperty

Returnsorsetswhetherpassivealertsaretobeusedwhenanon-criticalerrorinencountered.ThedefaultvalueisTrue.Read/writeBoolean.

expression.HasPassiveAlerts

expressionRequired.AnexpressionthatreturnsaChartspaceobject.

Page 1447: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksPassivealertsarepresentedasasmallexclamationsymbolinthelowerleftcornerofthechartcontrol.Clickingthesymboldisplaysmoreinformationaboutthenon-criticalerrorthathasoccurred.ThisfeatureissimilartotheMicrosoftInternetExplorerfeatureofdisplayinganalertsymbolinthestatusbarwhenscripterrorshaveoccurred.

Page 1448: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasPercentageProperty

Trueifeverydatalabelforthespecifiedseriesorchartcurrentlydisplaysitspercentagevalue.ThedefaultvalueisFalse.Thispropertyisavailableonlyforpie,doughnut,andstackedcharts.Read/writeBoolean.

expression.HasPercentage

expressionRequired.AnexpressionthatreturnsaChDataLabelsobject.

Page 1449: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDatalabelcomponentsarealwaysdisplayedinthefollowingorder:[SeriesName][CategoryName][Value][BubbleSize][Percentage].

Page 1450: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsdatalabelsshowingpercentagevaluetoaseries.NotethatCharts(0)mustrefertoapie,doughnut,orstackedchart.

SubAddPercentabeLabels()DimdlSetdl=ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection.Add'Displaypercentagelabels.dl.HasPercentage=TrueEndSub

Page 1451: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasPlotDetailsProperty

Trueifdetailfieldswillbeplottedwhenthechartdoesnotcontainacategoryfield.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasPlotDetails

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1452: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablesdetailfieldsinChartSpace1tobeplottedwhenthechartdoesnotcontainacategoryfield.

ChartSpace1.HasPlotDetails=True

Page 1453: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasRuntimeSelectionProperty

Returnsorsetstheselectionmodeinthechartsofthespecifiedchartcontrol.WhenthispropertyisTrue,thefirstclickselectstheinnerobject;thesecondclickselectstheouterobject.Forexample,ifthispropertyisTrueandtheuserclicksthethirddatapointinadataseries,onlythatpointisselected.Thesecondtimethattheuserclicksthedatapoint,theentiredataseriesisselected.SettingthispropertytoFalseforcestheentiredataseriestobeselectedwhentheuserclicksthethirddatapointforthefirsttime.Theuserhastoclickthethirddatapointasecondtimeinordertoselectonlythatdatapoint.ThedefaultvalueitTrue.Read/writeBoolean.

expression.HasRuntimeSelection

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1454: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasSelectionMarksProperty

SetthispropertytoTruetodisplayselectionmarkswhentheuserselectsanitemonachart.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasSelectionMarks

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1455: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksInadditiontosettingthispropertytoTrue,youmustalsosettheAllowPropertyToolboxpropertytoTruetoallowtheusertoformatindividualchartelements.

Page 1456: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablestheusertoselectandformatindividualchartelementsinChartspace1.

SubAllow_Formatting()

'AllowtheusertodisplaytheCommandsandOptionsdialogbox.Chartspace1.AllowPropertyToolbox=True

'Displayselectionmarksforchartelements.Chartspace1.HasSelectionMarks=True

EndSub

Page 1457: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasSeriesByRowsProperty

Returnsorsetshowseriesandcategoriesofthechartsinthespecifiedchartcontrolaremappedtotherowsandcolumnsofthedatasource.Bydefault,ifthechartisboundtoarelationaldatasource,thentheseriesofthechartcorrespondtothecolumnsoftheunderlyingPivotTablelist.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasSeriesByRows

expressionRequired.AnexpressionthatreturnsaChartSpacecontrol.

Page 1458: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasSeriesNameProperty

Trueifeverydatalabelforthespecifiedseriesorchartcurrentlydisplaysitsseriesname.ThedefaultvalueisFalse.Thispropertyisavailableonlyforpie,doughnut,andstackedcharts.Read/writeBoolean.

expression.HasSeriesName

expressionRequired.AnexpressionthatreturnsaChDataLabelsobject.

Page 1459: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDatalabelcomponentsarealwaysdisplayedinthefollowingorder:[SeriesName][CategoryName][Value][BubbleSize][Percentage].

Page 1460: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausesthedatalabelsforthespecifiedseriestodisplaytheircategoryandseriesnames.

SubShowLabels()Dimdl

Setdl=ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection(0)

'Displaythecategorynames.dl.HasCategoryName=True'Displaytheseriesnames.dl.HasSeriesName=TrueEndSub

Page 1461: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasSplitProperty

TrueifthescaleforthespecifiedaxishasasplitpointbetweenthevalueofitsSplitMinimumpropertyandthevalueofitsSplitMaximumproperty.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasSplit

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1462: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesplitsthevalueaxisofthefirstchartinChartSpace1andsetsthesplitminimumandsplitmaximumvalues.Thevalueaxisissplit,andvaluesbetween1000and5000willnotbedisplayed.

SubSplit_Value_Axis()DimchConstantsDimscValueAxisSetchConstants=ChartSpace1.Constants'Setavariabletothescalingobjectofthevalueaxis.SetscValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).Scaling'Addasplittothevalueaxis.scValueAxis.HasSplit=True'Specifytheminnimumvalueofthesplit.scValueAxis.SplitMinimum=1000'Specifythemaximumvalueforthesplit.scValueAxis.SplitMaximum=5000EndSub

Page 1463: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasTickLabelsProperty

Trueifthespecifiedaxishasalabelateachmajortickmark.ThedefaultvalueisTrue.Read/writeBoolean.

expression.HasTickLabels

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1464: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsofftick-marklabelsonthecategoryaxisonthefirstchartinChartSpace1.

SubDisableTickLabels()DimchConstantsSetchConstants=ChartSpace1.Constants'Turnoffthetickmarklabelsonthecategoryaxis.ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory).HasTickLabelsEndSub

Page 1465: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasTitleProperty

Trueifthespecifiedchartoraxishasatitle.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasTitle

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1466: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausesthetitleofthespecifiedcharttobedisplayedandsetsthetitlefont.

SubSetChartTitle()

'EnablethecharttitleforthefirstchartinChartSpace1.ChartSpace1.Charts(0).HasTitle=True'Setthetitlecaption.ChartSpace1.Charts(0).Title.Caption="MonthlySales"'Setthetitlefont.ChartSpace1.Charts(0).Title.Font.Name="timesnewroman"EndSub

Page 1467: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasUnifiedScalesProperty

Trueifallchartsinthespecifiedchartcontrolusethesamescalingfortheiraxes.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasUnifiedScales

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1468: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertywillreturnarun-timeerrorwhenthechartcontrolcontainsmultiplechartswithincompatibleaxes.Forexample,anerrorwillbereturnedwhenthechartcontrolcontainsanXY(Scatter)chartandaColumnchart.ThispropertycannotbesetbecauseaColumnchartcontainsacategoryaxis,andtheXY(Scatter)chartdoesnot.

WhenyouusetheAddmethodtoaddanewcharttothechartcontrolaftersettingthispropertytoTrue,thenewchart'saxesarenotautomaticallyunifiedwiththeexistingcharts.YoumustsetthispropertytoFalseandthenbacktoTruetounifythenewchart'saxeswiththeexistingcharts.

Page 1469: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasValueProperty

Trueifeverydatalabelforthespecifiedseriesorchartcurrentlydisplaysitsy-axisvalue.ThedefaultvalueisFalse.Read/writeBoolean.

expression.HasValue

expressionRequired.AnexpressionthatreturnsaChDataLabelsobject.

Page 1470: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDatalabelcomponentsarealwaysdisplayedinthefollowingorder:[SeriesName][CategoryName][Value][BubbleSize][Percentage].

SettingthispropertytoTrueonascatterchartorpolarchartcausesbothx-axisvaluesandy-axisvaluestobedisplayed.

Page 1471: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthedatalabelsforthespecifiedseriestodisplaytheiry-axisvalues.

ChartSpace1.Charts(0).SeriesCollection(0).DataLabelsCollection(0)HasValue

Page 1472: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeaderBackColorProperty

ReturnsorsetsaVariantindicatingthebackgroundcoloroftheheadingsinthedataareaoraniteminthefilterarea.Read/write.

expression.HeaderBackColor

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1473: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).UsetheHeaderFont,HeaderForeColor,andHeaderHAlignmentpropertiesinadditiontothispropertytoformattheheadinginthedataareaoraniteminthefilterareaofaPivotTablelist.

Page 1474: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatstheheaderforthedataareaandthefilterareaofthecurrentviewinPivotTable1.

SubSetHeaderProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Setthebackgroundcolor.ptView.HeaderBackColor="Gray"

'Settheforegroundcolor.ptView.HeaderForeColor="Blue"

'Setthefont.ptView.HeaderFont="Tahoma"

'Setthealignment.ptView.HeaderHAlignment=ptConstants.plHAlignLeft

EndSub

Page 1475: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeaderFontProperty

ReturnsaPivotFontobjectrepresentingthefontfortheheadingsinthedataareaoraniteminthefilterareaofthespecifiedview.

expression.HeaderFont

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1476: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheHeaderBackColor,HeaderForeColor,andHeaderHAlignmentpropertiestoinadditiontothispropertytoformattheheadinginthedataareaoraniteminthefilterareaofaPivotTablelist.

Page 1477: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatstheheaderforthedataareaandthefilterareaofthecurrentviewinPivotTable1.

SubSetHeaderProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Setthebackgroundcolor.ptView.HeaderBackColor="Gray"

'Settheforegroundcolor.ptView.HeaderForeColor="Blue"

'Setthefont.ptView.HeaderFont="Tahoma"

'Setthealignment.ptView.HeaderHAlignment=ptConstants.plHAlignLeft

EndSub

Page 1478: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeaderForeColorProperty

ReturnsorsetsaVariantindicatingtheforegroundcoloroftheheadingsinthedataareaoraniteminthefilterareaofthespecifiedview.Read/write.

expression.HeaderForeColor

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1479: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).UsetheHeaderBackColor,HeaderFont,andHeaderHAlignmentpropertiesinadditiontothispropertytoformattheheadinginthedataareaoraniteminthefilterareaofaPivotTablelist.

Page 1480: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatstheheaderforthedataareaandthefilterareaofthecurrentviewinPivotTable1.

SubSetHeaderProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Setthebackgroundcolor.ptView.HeaderBackColor="Gray"

'Settheforegroundcolor.ptView.HeaderForeColor="Blue"

'Setthefont.ptView.HeaderFont="Tahoma"

'Setthealignment.ptView.HeaderHAlignment=ptConstants.plHAlignLeft

EndSub

Page 1481: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1482: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeaderHAlignmentProperty

ReturnsorsetsaPivotHAlignmentEnumconstantthatrepresentsthehorizontalalignmentofaheadinginthedataareaoraniteminthefilterareaofthespecifiedview.Read/write.

expression.HeaderHAlignment

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1483: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheHeaderBackColor,HeaderForeColor,andHeaderFontpropertiesinadditiontothispropertytoformattheheadinginthedataareaoraniteminthefilterareaofaPivotTablelist.

Page 1484: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatstheheaderforthedataareaandthefilterareaofthecurrentviewinPivotTable1.

SubSetHeaderProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Setthebackgroundcolor.ptView.HeaderBackColor="Gray"

'Settheforegroundcolor.ptView.HeaderForeColor="Blue"

'Setthefont.ptView.HeaderFont="Tahoma"

'Setthealignment.ptView.HeaderHAlignment=ptConstants.plHAlignLeft

EndSub

Page 1485: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeaderHeightProperty

ReturnsaLongvaluethatrepresentstheheightoftheheadersforfieldsonthedataaxisandtheitemsinthefilterfieldofthespecifiedview.Read-only.

expression.HeaderHeight

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1486: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeaderRowRangeProperty

ReturnsaRangeobjectthatrepresentstheheaderrowfromaspecifiedListObjectobject.Read-only.

expression.HeaderRowRange

expressionRequired.AnexpressionthatreturnsaListObjectobject.

Page 1487: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

Ifaheaderrowispresent,aRangeobjectrepresentingtheheaderrowforthespecifiedListObjectobjectisreturned.Ifaheaderrowisn'tpresent,theNothingobjectisreturned.

Page 1488: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleTheexamplebelowsavestheheaderrowrangeinformationtoavariable.

DimrngHeaderRowRangeDimobjList SetobjList=Spreadsheet1.ActiveSheet.ListObjects(1)SetrngHeaderRowRange=objList.HeaderRowRange

Page 1489: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeightProperty

Returnsorsetstheheightofthespecifiedobjectinpoints.

Read-onlyDoublefortheWindowobject.

Read-onlyVariantfortheRangeobject.

Read-writeLongforthePivotAxisMember,PivotColumnMember,PivotPageMember,PivotRowMember,andPivotTableobjects.

Read-onlyLongforallotherobjectsintheAppliesTolist.

expression.Height

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1490: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheAutoFitpropertyofthePivotTablelistissettoFalsewhenthevalueoftheHeightpropertyischanged.

Page 1491: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheheightofthePivotTablelistto36points.

PivotTable1.Object.Height=36

Page 1492: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HeightRatioProperty

Returnsorsetstheheightratioforthespecifiedchartinrelationtotheotherchartsinthechartworkspace.Thedefaultvalueis100.Read/writeLong.

expression.HeightRatio

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1493: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertysetstheheightofthespecifiedchartrelativetotheheightoftheotherchartsinthechartworkspace.Forthispropertytohaveanyeffect,youmusthavemorethanonechartinthechartworkspace.Whenmorethanonechartisdisplayed,thechartsaredisplayedinagrid(formoreinformation,seetheHelptopicsfortheChartLayoutandChartWrapCountproperties).Initially,theHeightRatioandWidthRatiopropertiesaresetto100forallchartsinthegrid,andallchartsarethesamesize.

Tochangetheheightofchartsinthegrid,adjusttheHeightRatiopropertysettings.Forexample,ifeachchartisdisplayedinthreerows,allthechartshaveaninitialHeightRatiosettingof100.Ifyouwantrow3tobeonlyhalftheavailableheight,setitsHeightRatiosettingto200;theremaininghalfofthechartheightisdividedbetweenrows1and2.BecausetheheightspecifiedbytheHeightRatiopropertyisrelative,youcansetthispropertyforthethreerowsto1,1,2;100,100,200;or20,20,40,allofwhichhavethesameeffect.

Ifthechartworkspacecontainschartsdisplayedinmorethanonerow,thelargestHeightRatiosettingineachrowisusedtosettherelativeheightfortheentirerow.

Thispropertyisusefulforcreatingpriceandvolumestockchartsinwhichthevolumechartishalfthesizeofthepricechart.

Page 1494: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HiddenProperty

Trueifthespecifiedrangeiscurrentlyhidden.Therangemustspananentirecolumnorrow.YoucanusetheEntireRowandEntireColumnpropertiestoreturnareferencetoanentireroworcolumn.Read/writeBoolean.

expression.Hidden

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1495: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleloopsthrougharowthatcontainsdatevalues.Whenthemonthinthecelldoesnotmatchthecurrentmonth,thecolumnishidden.Whenthemonthmatchesthecurrentmonthandthecolumnishidden,thenthecolumnisunhidden.

SubHide_Dates()DimrngLoopRangeDimrngCurrCellDimssConstants

SetssConstants=Spreadsheet1.Constants

'Setrangetoloopthroughtherangeofcontiguous'cellsinrow1startingincolumnA.SetrngLoopRange=Spreadsheet1.ActiveSheet.Range("A1",_Spreadsheet1.ActiveSheet.Range("A1").End(ssConstants.xlToRight))

'Loopthroughthecells.ForEachrngCurrCellInrngLoopRange

'Hidethecolumnifthemonthinthecurrentcelldoes'notmatchthecurrentmonth.IfMonth(rngCurrCell.Value)<>Month(Date)ThenrngCurrCell.EntireColumn.Hidden=True

'Ifthemonthinthecurrentcellmatchesthecurrentmonth'andthecolumnishidden,thenunhidethecolumn.ElseIfrngCurrCell.EntireColumn.HiddenThenrngCurrCell.EntireColumn.Hidden=FalseEndIfNext

Page 1496: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 1497: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HoleSizeProperty

Returnsorsetstheholesizeforthespecifieddoughnutchart.Theholesizemustbeavaluefrom0through90(thedefaultvalueis50).Read/writeLong.

expression.HoleSize

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1498: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytozero(0)changesthedoughnutcharttoapiechart(theTypepropertyfortheChChartobjectreturnschChartTypePieStacked).

Page 1499: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsholesizeforthespecifiedchart.NotethatCharts(0)mustrefertoadoughnutchart.

ChartSpace1.Charts(0).HoleSize=25

Page 1500: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1501: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HorizontalAlignmentProperty

ReturnsorsetsaVariantrepresentingthehorizontalalignmentforthespecifiedrange.CanbeanXlHAlignconstant.

expression.HorizontalAlignment

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1502: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleleft-alignstherangeA1:A5onSheet1.

SubAlignRange()

DimssConstantsSetssConstants=Spreadsheet1.Constants

Worksheets("Sheet1").Range("A1:A5").HorizontalAlignment=ssConstants.xlHAlignLeft

EndSub

Page 1503: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HorizontalExtentProperty

YouusetheHorizontalExtentpropertytospecifyordeterminetheextentofthehorizontalviewoftheChScrollViewobject.ReturnsaLong.Read/writeLong.

expression.HorizontalExtent

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

Page 1504: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

Page 1505: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheHorizontalExtentandtheHorizontalExtentMaxpropertiestotoggleachartviewbetweenzoomedandunzoomed(horizontally).Inthisexample,theChartcomponentiscalledChartSpace1.

SubZoomView()DimlngHEM

lngHEM=Chartspace1.Charts(0).ScrollView.HorizontalExtentMax

IfChartspace1.Charts(0).ScrollView.HorizontalExtent=lngHEMThen'Zoomthechart.Chartspace1.Charts(0).ScrollView.HorizontalExtent=(lngHEM/3)Else'Zoomoutonthechart.Chartspace1.Charts(0).ScrollView.HorizontalExtent=lngHEMEndIfEndSub

Page 1506: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HorizontalExtentMaxProperty

UsethispropertytospecifyordeterminethemaximumextentofthehorizontalviewoftheChScrollViewobject.ReturnsaLong.Read/writeLong.

expression.HorizontalExtentMax

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

Page 1507: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.TheHorizontalExtentMaxpropertyrepresentsthetotalheightofachartwhetherthatchartiszoomedornot.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

Page 1508: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheHorizontalExtentandtheHorizontalExtentMaxpropertiestotoggleachartviewbetweenzoomedandunzoomed(horizontally).Inthisexample,theChartcomponentiscalledChartSpace1.

SubZoomView()DimlngHEM

lngHEM=Chartspace1.Charts(0).ScrollView.HorizontalExtentMax

IfChartspace1.Charts(0).ScrollView.HorizontalExtent=lngHEMThen'Zoomthechart.Chartspace1.Charts(0).ScrollView.HorizontalExtent=(lngHEM/3)Else'Zoomoutonthechart.Chartspace1.Charts(0).ScrollView.HorizontalExtent=lngHEMEndIfEndSub

Page 1509: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HorizontalPositionProperty

YouusetheHorizontalPositionpropertytospecifyordeterminethecurrenthorizontalviewpositionoftheChScrollViewobject.ReturnsaLong.Read/writeLong.

expression.HorizontalPosition

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

Page 1510: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

TheHorizontalPositionpropertyprovidesinformationaboutthehorizontalpositionofachart.TheextremeleftoftheviewableareaoftheChartcomponentis0andtheextremerightoftheviewableareaiswherethevalueoftheHorizontalPositionpropertyequalsthevalueoftheHorizontalExtentMaxproperty(althoughyoucansetthetheHorizontalPositionpropertytovaluesgreaterthanthevalueoftheHorizontalExtentMaxpropertyoreventonegativevalues).AslongasthevalueoftheHorizontalExtentpropertyisgreaterthanthevalueoftheHorizontalExtentMaxproperty,theentirechartwillbevisible.

WhentheHorizontalPositionpropertyequalszero,theextremeleftoftheplotareawillbeattheextremeleftofthescrollviewwindow.WhentheHorizontalPositionequalsHorizontalExtentMax,theplotareaispushedtotheleftsothatrightoftheplotareaisvisibleattheleftofthescrollviewwindow.TheHorizontalPositionpropertycanbeanegativenumber.ForexampleifHorizontalPosition=(-0.25*HorizontalExtentMax)thentheplotareawillbepushedtotherightby25%ofthevirtualwidthoftheplotarea.

Page 1511: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplechangesthehorizontalandverticalpositionsofthescrollviewoftheChartcomponent(calledChartSpace1inthisexample).

DimlngHorizontalDimlngVertical

lngHorizontal=ChartSpace1.Charts(0)ScrollView.HorizontalPositionlngVertical=ChartSpace1.Charts(0)ScrollView.VerticalPosition

ChartSpace1.Charts(0)ScrollView.SetPositionlngHorizontal+300,lngVertical+200

Page 1512: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HTMLContainerProperty

ReturnstheHTMLDIVelementthatcontainsthespecifiedsection.Read-only.

expression.HTMLContainer

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 1513: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HTMLDataProperty

PivotTableandRangeobjects:ReturnsaStringthatrepresentsthespecifiedPivotTablelistorrangeasaproperly-formattedHTMLstring.Read-only.

Spreadsheetobject:ReturnsorsetsaStringthatrepresentsthespreadsheetdataasaproperly-formattedHTMLstring.Read/write.

expression.HTMLData

expressionRequired.AnexpressionthatreturnsoneoftheobjectintheAppliesTolist.

Page 1514: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HTMLURLProperty

ReturnsorsetstheURL(Internetaddress)forthespreadsheetHTMLdatafile.Read/writeString.

expression.HTMLURL

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1515: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HwndProperty

ReturnsaLongindicatingthetop-levelwindowhandleofthePivotTablecontrol'swindow.Read-only.

expression.Hwnd

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 1516: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HyperlinkProperty

PivotAxisMember,PivotColumnMember,PivotDetailCell,PivotPageMember,andPivotRowMemberobjects:ReturnsaPivotHyperlinkobjectthatrepresentsthehyperlinkforthespecifiedobject.

Rangeobject:ReturnsaHyperlinkobjectthatrepresentsthehyperlinkforthespecifiedrange.

expression.Hyperlink

expressionRequired.AnexpressionthatreturnsoneoftheobjectintheAppliesTolist.

Page 1517: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresolvesthehyperlinkincellB15ontheactiveworksheet,downloadsthetargetdocument,andthendisplaysthedocument.

Spreadsheet1.ActiveSheet.Range("b15").Hyperlink.Follow

Page 1518: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InclinationProperty

ReturnsorsetsaDoubleindicatingtheinclinationoftheviewofthespecifiedthree-dimensional(3-D)chart.Validvaluesrangefrom-90to90.Read/write.

expression.Inclination

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1519: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertyto90yieldsanoverheadviewofthespecifiedchart.

Page 1520: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthensetstheinclinationoftheview.

SubSetGapDepth()

Dimcht3DColumnAsChChart

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3-DColumnchart.cht3DColumn.Type=chChartTypeColumn3D

'Settheinclination.cht3DColumn.Inclination=45

EndSub

Page 1521: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1522: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IncludeProperty

Returnsorsetstheerrorbarelementsthatwillbeincludedonthespecifiedchart.ThedefaultvalueischErrorBarIncludeBoth.Read/writeChartErrorBarIncludeEnum.

expression.Include

expressionRequired.AnexpressionthatreturnsaChErrorBarsobject.

Page 1523: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddserrorbarstothespecifiedchartandsetstheerrorbarstodisplayonlyplusvalues.

SubFormat_ErrorBars()DimchConstantsDimebErrorBarsSetchConstants=ChartSpace1.Constants'Adderrorbarstothefirstseriesinthefirstchart.SetebErrorBars=ChartSpace1.Charts(0).SeriesCollection(0).ErrorBarsCollection.Add'Includepositivevalues.ebErrorBars.Include=chConstants.chErrorBarIncludePlusValuesEndSub

Page 1524: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IncludedMembersProperty

Returnsorsetsthememberstobedisplayedinthespecifiedfield.ThispropertycanbesettoasinglememberoraVariantarrayofmembers.ThememberscanbepassedasoneormorePivotMemberobjects,membernames,oruniquemembernames.Read/write.

expression.IncludedMembers

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1525: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksMembersnotlistedwhenyousetthispropertymaystillappearinthePivotTablelistiftheirparentmemberisincluded.Settingthispropertyclearsallprevioussettingsofthispropertyforthespecifiedfield.YoucansetthispropertytoEmpty(IncludedMembers=Empty)ortoazero-lengthVariantarray(IncludedMembers=Array())tocleartheincludedmemberslistforthespecifiedfield.

Page 1526: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheincludedandexcludedmembersoftheStoreStateandStoreCityfieldsinPivotTable1.

SubMember_Filtering()

DimfldStoreCityDimfldStoreStateDimptView

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'SetavariabletotheStoreStatefield.SetfldStoreState=ptView.FieldSets("Store").Fields("StoreState")

'SetavariabletotheStoreCityfield.SetfldStoreCity=ptView.FieldSets("Store").Fields("StoreCity")

'ExcludeCaliforniaandWashingtonfromtheStoreStatefield.fldStoreState.ExcludedMembers=Array("CA","WA")

'IncludemembersoftheStoreCityfield.Notethatthecitiesare'instatesthathavebeenexcludedbythepreviousline.Since'StoreStateisaparenttoStoreCity,thentheexcludedstates'aredisplayedinthePivotTable.fldStoreCity.IncludedMembers=Array("LosAngeles","SanDiego",_"Seattle","Spokane")

EndSub

Page 1527: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IndexProperty

Returnstheindexnumberofthespecifiedobjectwithinthecollectionofsimilarobjects.Read/writeLongfortheChSeriesobject;read-onlyLongforallotherobjectsintheAppliesTolist.

expression.Index

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1528: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucansettheindexnumberofaChSeriesobject.Thespecifiedseriesismovedtothespecifiedposition,andotherseriesarereorderedasnecessary.

TheindexvalueofaListRowobjectcorrespondstoitscurrentpositionintheXMLlist.Followingasort,orafteraddingordeletingarow,agivenrowmayhaveanewindexvaluebasedonitsnewposition.

Page 1529: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemovesseries1tothefourthindexpositionofanXYchartcontaining6series.Duringthemove,series2through4arereorderedtoseries1through3.Series0andseries5stayinthesameposition.

ChartSpace1.Charts(0).SeriesCollection(1).Index=4

Page 1530: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InsertRowRangeProperty

ReturnstheRangeobjectoftheinsertrow,ifany,fromaspecifiedListObjectobject.Read-only.

expression.InsertRowRange

expressionRequired.AnexpressionthatreturnsaListObjectobject.

Page 1531: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

SomeRangepropertiesandmethodsarenotsupported.ThepropertiesnotsupportedareLocked,MergeAreaandMergeCells.ThemethodsnotsupportedareDelete,Insert,Merge,andUnMerge.Iftheinsertrowisnotcurrentlyvisible,theNothingobjectwillbereturned.

YoucanreferenceanycellintheinsertrowusingtheInsertRowRangeproperty.PropertiesoftheborderoftheRangereturnedbytheInsertRowRangepropertyarenotsavedafteranewrowisaddedtoanXMLlist.

Page 1532: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleTheexamplebelowgetstheinsertrowrangeinformationanddisplaysit.

DimrngInsertRowDimobjListSetobjList=Spreadsheet1.Worksheets(1).ListObjects(1)

'Savetheinsertrangeinformationtoavariable.SetrngInsertRow=objList.InsertRowRange

MsgBox("Theinsertrowrangeis:"&Chr(10)&rngInsertRow.Address)

Page 1533: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1534: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InteriorProperty

InteriorpropertyasitappliestotheChartSpace,ChChart,ChChartDraw,ChDataLabel,ChDataLabels,ChLegend,ChPlotArea,ChPoint,ChSegmentBoundary,ChSeries,ChSurface,andChTitleobjects.

InteriorpropertyasitappliestotheRangeandTitleBarobjects.

Page 1535: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorcolorforthespecifiedseries.

ChartSpace1.Charts(0).SeriesCollection(0).Interior.Color="red"

Page 1536: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InternalPivotTableProperty

ReturnsaPivotTableobjectthatisusedinternallybythechartcontroltobindtoanexternaldatasource.

expression.InternalPivotTable

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1537: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InternationalProperty

Returnsinformationaboutthecurrentcountry/regionandinternationalsettings.Read-onlyVariant.

expression.International(Index)

expressionRequired.AnexpressionthatreturnsaSpreadsheetoraChartSpaceobject.

IndexRequiredLong.Thesettingtobereturned.CanbeoneoftheXlApplicationInternationalconstantslistedinthefollowingtable.

Index Type MeaningxlCountryCode Long Country/regionversionofthe

MicrosoftOfficeWebComponents.

xlCountrySetting Long CurrentlocalesettinginControlPanel.

xlDecimalSeparator String Decimalseparator.xlThousandsSeparator String Zeroorthousandsseparator.xlListSeparator String Listseparator.xlUpperCaseRowLetter String Uppercaserowletter(forR1C1-

stylereferences).xlUpperCaseColumnLetter String Uppercasecolumnletter.xlLowerCaseRowLetter String Lowercaserowletter.xlLowerCaseColumnLetter String Lowercasecolumnletter.xlLeftBracket String Characterusedinsteadoftheleft

bracket([)inR1C1-stylerelativereferences.

xlRightBracket String Characterusedinsteadoftherightbracket(])inR1C1-stylereferences.

xlLeftBrace String Characterusedinsteadoftheleftbrace({)inarrayliterals.

xlRightBrace String Characterusedinsteadofthe

Page 1538: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

rightbrace(})inarrayliterals.xlColumnSeparator String Characterusedtoseparate

columnsinarrayliterals.xlRowSeparator String Characterusedtoseparaterows

inarrayliterals.xlAlternateArraySeparator String Alternatearrayitemseparatorto

beusedifthecurrentarrayseparatoristhesameasthedecimalseparator.

xlDateSeparator String Dateseparator(/).xlTimeSeparator String Timeseparator(:).xlYearCode String Yearsymbolinnumberformats

(y).xlMonthCode String Monthsymbol(m).xlDayCode String Daysymbol(d).xlHourCode String Hoursymbol(h).xlMinuteCode String Minutesymbol(m).xlSecondCode String Secondsymbol(s).xlCurrencyCode String Currencysymbol.xlGeneralFormatName String NameoftheGeneralnumber

format.xlCurrencyDigits Long Numberofdecimaldigitstobe

usedincurrencyformats.xlCurrencyNegative Long Currencyformatfornegative

currencyvalues:0=(symbolx)or(xsymbol)1=-symbolxor-xsymbol2=symbol-xorx-symbol3=symbolx-orxsymbol-wheresymbolisthecurrencysymbolofthecountryorregion.NotethatthepositionofthecurrencysymbolisdeterminedbyxlCurrencyBefore.

xlNoncurrencyDigits Long Numberofdecimaldigitstobe

Page 1539: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

usedinnon-currencyformats.xlMonthNameChars Long Alwaysreturnsthreecharacters

forbackwardcompatibility.AbbreviatedmonthnamesarereadfromMicrosoftWindowsandcanbeanylength.

xlWeekdayNameChars Long Alwaysreturnsthreecharactersforbackwardcompatibility.AbbreviatedweekdaynamesarereadfromMicrosoftWindowsandcanbeanylength.

xlDateOrder Long Orderofdateelements:0=month-day-year1=day-month-year2=year-month-day

xl24HourClock Boolean Trueifyou’reusing24-hourtime;Falseifyou’reusing12-hourtime.

xlNonEnglishFunctions Boolean Trueifyou’renotdisplayingfunctionsinEnglish.

xlMetric Boolean Trueifyou’reusingthemetricsystem;Falseifyou’reusingtheEnglishmeasurementsystem.

xlCurrencySpaceBefore Boolean Trueifaspaceisaddedbeforethecurrencysymbol.

xlCurrencyBefore Boolean Trueifthecurrencysymbolprecedesthecurrencyvalues;Falseifitfollowsthem.

xlCurrencyMinusSign Boolean Trueifyou’reusingaminussignfornegativenumbers;Falseifyou’reusingparentheses.

xlCurrencyTrailingZeros Boolean Trueiftrailingzerosaredisplayedforzerocurrencyvalues.

xlCurrencyLeadingZeros Boolean Trueifleadingzerosaredisplayedforzerocurrencyvalues.

Page 1540: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

xlMonthLeadingZero Boolean Trueifaleadingzeroisdisplayedinmonths(whenmonthsaredisplayedasnumbers).

xlDayLeadingZero Boolean Trueifaleadingzeroisdisplayedindays.

xl4DigitYears Boolean Trueifyou’reusingfour-digityears;Falseifyou’reusingtwo-digityears.

xlMDY Boolean Trueifthedateorderismonth-day-yearfordatesdisplayedinthelongform;Falseifthedateorderisday-month-year.

xlTimeLeadingZero Boolean Trueifaleadingzeroisdisplayedintimes.

Page 1541: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSymbols,separators,andcurrencyformatsshownintheprecedingtablemaydifferfromthoseusedinyourlanguageorgeographiclocationandmaynotbeavailabletoyou,dependingonthelanguagesupport(U.S.English,forexample)thatyou’veselectedorinstalled.

Page 1542: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsConsistentProperty

ReturnsaBooleanthatindicateswhetherthesourcedatasetisconsistentwiththespecifiedPivotDataobject.Read-only.

expression.IsConsistent

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 1543: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsFalsewhenchangestothedatasethavebeencommitted,butthetotalshavenotbeenupdated.Whenthisoccurs,youcanusetheRefreshmethodofthePivotTableobjecttoupdatethetotals.

Page 1544: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsDataBoundProperty

ReturnsorsetsaBooleanthatdetermineswhetherthespecifiedworksheetisboundtoanoutsidedatasource.Read/write.

expression.IsDataBound

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1545: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsDirtyProperty

ReturnsorsetsaBooleanthatindicateswhetherthePivotTablelisthaschangedsincethelasttimeitwassaved.Read/write.

expression.IsDirty

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 1546: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsDisplayingEquationProperty

Trueiftheequationforthetrendlineforthespecifiedseriesisdisplayedonthechart(inthesamedatalabelastheR-squaredvalue).ThedefaultvalueisTrue.Read/writeBoolean.

expression.IsDisplayingEquation

expressionRequired.AnexpressionthatreturnsaChTrendlineobject.

Page 1547: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatrendlinetothespecifiedseries.Onlythetrendlineequationisdisplayed.

SubAddTrendLine()Dimtrndline'AddatrendlinetothefirstseriesinthefirstchartinChartSpace1.Settrndline=ChartSpace1.Charts(0).SeriesCollection(0).Trendlines.Add'Setthefontofthetrendlinetobold.trndline.DataLabel.Font.Bold=True'DonotdisplaytheR-Squaredvaluewiththetrendline.trndline.IsDisplayingRSquared=False'Displaytheequationforthetrendline.trndline.IsDisplayingEquation=TrueEndSub

Page 1548: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsDisplayingRSquaredProperty

TrueiftheR-squaredvalueforthetrendlineforthespecifiedseriesisdisplayedonthechart(inthesamedatalabelastheequation).SettingthispropertytoTrueautomaticallyturnsondatalabels.ThedefaultvalueisTrue.Read/writeBoolean.

expression.IsDisplayingRSquared

expressionRequired.AnexpressionthatreturnsaChTrendlineobject.

Page 1549: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatrendlinetothespecifiedseries.Onlythetrendlineequationisdisplayed.

SubAddTrendLine()Dimtrndline'AddatrendlinetothefirstseriesinthefirstchartinChartSpace1.Settrndline=ChartSpace1.Charts(0).SeriesCollection(0).Trendlines.Add'Setthefontofthetrendlinetobold.trndline.DataLabel.Font.Bold=True'DonotdisplaytheR-Squaredvaluewiththetrendline.trndline.IsDisplayingRSquared=False'Displaytheequationforthetrendline.trndline.IsDisplayingEquation=TrueEndSub

Page 1550: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsExpandedProperty

Trueifthespecifiedsectionisexpanded.Read-onlyBoolean.

expression.IsExpanded

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 1551: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsFilteredProperty

Trueifthecurrentfilterisapplied.ThedefaultvalueisTrue.Read/writeBoolean.

expression.IsFiltered

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1552: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsFilterOnProperty

Trueifthedataaccesspagefilterisapplied.Read/writeBoolean.

expression.IsFilterOn

expressionRequired.AnexpressionthatreturnsaDataPageobject.

Page 1553: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1554: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsHyperlinkProperty

IsHyperlinkpropertyasitappliestothePivotFieldobject.

IsHyperlinkpropertyasitappliestotheSchemaFieldandSchemaParameterobjects.

Page 1555: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestothePivotFieldobject.

Page 1556: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsIncludedProperty

Trueifthefieldisincludedandactiveinthespecifiedfieldset.Read/writeBoolean.

expression.IsIncluded

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1557: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksInactivefieldsarenotvisibleinthePivotTablelist.AfieldsetmusthaveatleastonefieldforwhichtheIsIncludedpropertyissettoTrue.AttemptingtosetthispropertytoFalsefortheonlyfieldwhereitissettoTruegeneratesarun-timeerror.Thispropertyisignoredwhenthefieldsetisusedonthefilteraxis.Iftheuserhidesthelastfieldintheuserinterface,thefieldsetisremovedfromtheaxis.

Page 1558: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsTotalProperty

Trueifthespecifiedmemberisusedtodisplayasubtotal.Read-onlyBoolean.

expression.IsTotal

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1559: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

IsValidProperty

ReturnsaBooleanthatindicatedwhetherthespecifiedmemberisavalidmemberwithinthespecifiedcontext.Read-only.

expression.IsValid

expressionRequired.AnexpressionthatreturnsaPivotMemberobject.

Page 1560: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleattemptstofindaspecificwarehouseintheWarehousefieldset.Theuserisalertedifthespecifiedwarehouseisnotfound.

SubFindWarehouse()

DimptViewDimptConstantsDimfsWarehouseDimpmFound

SetptConstants=PivotTable1.Constants

'Setavariabletotheactiveview.SetptView=PivotTable1.ActiveView

'SetavariabletotheWarehousefieldset.SetfsWarehouse=ptView.FieldSets("Warehouse")

'SetavariabletotheresultsoftheFindMemberproperty.SetpmFound=fsWarehouse.FindMember("QualityDistribution,Inc.",ptConstants.plFindFormatPathName)

'Checktoseeifthememberwasfound.IfpmFound.IsValid=FalseThen

'Alerttheuserifthememberwasnotfound.MsgBox"Thespecifiedmemberdoesnotexist."

EndIf

EndSub

Page 1561: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ItalicProperty

Trueifthefontstyleisitalic.Read/writeBooleanfortheChFontandPivotFontobjects;read/writeVariantfortheFontobject(returnsNullifsomeportionsofthetextareitalicandsomearenot).UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.

expression.Italic

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1562: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefonttoitalicforthecontentsofcolumnB.

Spreadsheet1.Columns(2).Font.Italic=True

Page 1563: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1564: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ItemProperty

ItempropertyasitappliestotheBordersobject.

ItempropertyasitappliestotheChCategoryLabelsobject.

ItempropertyasitappliestothePivotMemberPropertiesandPivotResultMemberPropertiesobjects.

ItempropertyasitappliestotheRangeobject.

ItempropertyasitappliestotheXmlDataBindingscollection.

ItempropertyasitappliestotheXmlMapsobject.

ItempropertyasitappliestotheListObjectscollection.

ItempropertyasitappliestoallotherobjectsintheAppliesTolist.

Page 1565: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ItemCountProperty

ReturnsaLongspecifyingthenumberofcategorylabelsforthespecifiedchartaxis.Read-only.

expression.ItemCount(Level)

expressionRequired.AnexpressionthatreturnsaChCategoryLabelsobject.

LevelOptionalLong.Thelevelofcategorylabelstoreturnthecountof.Bydefault,thecountoftheinnermostleveloflabelsisreturned.

Page 1566: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1567: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

JoinTypeProperty

Returnsorsetsthewayaquerywillbeformed.Read/writeDscJoinTypeEnum.

expression.JoinType

expressionRequired.AnexpressionthatreturnsaPageRelationshipobject.

Page 1568: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucanusethispropertyonlyifthePageRelationshipobject'sTypepropertyissettodscLookup.

Page 1569: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1570: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LabelProperty

LabelpropertyasitappliestothePivotAxis,PivotDataAxis,PivotFilterAxis,PivotGroupAxis,andPivotViewobjects.

LabelpropertyasitappliestothePivotData,PivotResultAxis,PivotResultColumnAxis,PivotResultDataAxis,PivotResultFilterAxis,PivotResultGroupAxis,PivotResultPageAxis,andPivotResultRowAxisobjects.

Page 1571: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1572: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LanguageIDProperty

ReturnsaLongrepresentingthelocaleidentifier(LCID)fortheinstalllanguage,theuserinterfacelanguage,ortheHelplanguage.Read-only.

expression.LanguageID(id)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

idRequiredMsoAppLanguageID.

Page 1573: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1574: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LanguagePreferredForEditingProperty

ReturnsTrueifthevalueforthemsoLanguageIDconstanthasbeenidentifiedintheregistryasapreferredlanguageforediting.Read-onlyBoolean.

expression.LanguagePreferredForEditing(lid)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

lidRequiredMsoLanguageID.Thelanguagetocheckforintheregistry.

Page 1575: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumusttestallvalidmsoLanguageIDvaluestoenumeratethesetofpreferredlanguages.

Page 1576: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampletestswhethertheU.S.Englishlanguageisregisteredasapreferrededitinglanguage.

IfSpreadsheet1.LanguageSettings._LanguagePreferredForEditing(msoLanguageIDEnglishUS)Then

MsgBox"U.S.Englishisoneofthechoseneditinglanguages."

EndIf

Page 1577: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1578: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LeftProperty

LeftpropertyasitappliestotheChartSpace,ChCategoryLabel,ChChartField,ChDataLabel,ChDataLabels,ChErrorBars,ChLegendEntry,ChPoint,ChSeries,ChTrendline,PivotAggregate,PivotAxisMember,PivotColumnMember,PivotDetailCell,PivotPageMember,PivotResultAxis,PivotResultColumnAxis,PivotResultDataAxis,PivotResultFilterAxis,PivotResultGroupAxis,PivotResultLabel,PivotResultPageAxis,PivotResultRowAxis,PivotRowMember,andPivotTableobjects.

LeftpropertyasitappliestotheChScrollViewobject.

LeftpropertyasitappliestothePivotDataobject.

LeftpropertyasitappliestotheRangeobject.

LeftpropertyasitappliestotheWindowobject.

Page 1579: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollstotheleftthroughthespreadsheetwindowtodisplaycellF1ifthiscelliscurrentlytotheleftofthevisiblerange.

SubScrollSheet

DimrngScroll

SetrngScroll=Spreadsheet1.Range("f1")

IfrngScroll.Left<0ThenSpreadsheet1.ActiveSheet.ScrollrngScroll

EndSub

Page 1580: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Left2Property

ReturnsaLongvaluethatrepresentsthedistancefromtheleftsideofthePivotTablelisttothedataarea.Thispropertyalwaysreturns1.Read-only.

expression.Left2

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 1581: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LeftOffsetProperty

ReturnsorsetsaLongvaluethatrepresentsthenumberofpixelstoscrollthedataareatotheleft.Read/write.

expression.LeftOffset

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 1582: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheTopOffsettoscrollthedataareadown.

Page 1583: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthedataareaofPivotTable1down45pixelsandleft45pixels.

SubScrollDataArea()

DimptData

SetptData=PivotTable1.ActiveData

'Scroll45pixelsdown.ptData.TopOffset=45

'Scrollthedataareatotheleft.ptData.LeftOffset=45

EndSub

Page 1584: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LegendProperty

ReturnsaChLegendobjectthatrepresentsthelegendforthespecifiedchart.

expression.Legend

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1585: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausesthespecifiedcharttodisplayitslegendandthensetsthelegendfont.

SubAddLegend()

'EnablethelegendforthefirstchartinChartspace1.ChartSpace1.Charts(0).HasLegend=True

'Setthefontforthelegend.ChartSpace1.Charts(0).Legend.Font.Name="TimesNewRoman"

EndSub

Page 1586: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LegendEntriesProperty

ReturnsaChLegendEntriescollectionforthespecifiedlegend.

expression.LegendEntries

expressionRequired.AnexpressionthatreturnsaChLegendobject.

Page 1587: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1588: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplehidesthespecifiedlegendentry.

ChartSpace1.Charts(0).Legend.LegendEntries(1).Visible=False

Page 1589: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LengthProperty

Returnsorsetsthemaximumfieldorparameterlength.Read/writeLong.

expression.Length

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1590: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LevelCountProperty

ReturnsaLongindicatingthenumberoflevelsinahierarchicalchartaxis.Read-only.

expression.LevelCount

expressionRequired.AnexpressionthatreturnsaChCategoryLabelsobject.

Page 1591: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LightNormalProperty

ReturnsorsetsaDoublespecifyingtheamountthatthelightisbentfrom90degreesinathree-dimensional(3-D)chart.Validvaluesrangefrom0to1.Read/write.

expression.LightNormal

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1592: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertyto0resultsinaflatlookforyourchart,whilesettingthispropertyto0.5yieldsamorethree-dimensionallook.

Page 1593: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthensetstheLightNormalpropertyofthechart.

SubSetGapDepth()

Dimcht3DColumnAsChChart

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3-DColumnchart.cht3DColumn.Type=chChartTypeColumn3D

cht3DColumn.LightNormal=0.8

EndSub

Page 1594: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LineProperty

ReturnsaChLineobjectthatyoucanusetochangetheappearanceofthespecifiedchartelement.

expression.Line

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1595: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenusedwithotherproperties,theLinepropertycanformataxes,trendlines,linesonlineorstockcharts,errorbars,andgridlines.

Page 1596: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthelinecolorforthespecifiedseries.

ChartSpace1.Charts(0).SeriesCollection(0).Line.Color="red"

Page 1597: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LineStyleProperty

Returnsorsetstheborderlinestyleforthespecifiedrange.CanbeoneoftheLineStyleEnumconstants;returnsNullifthebordersdonotallhavethesamestyle.UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.Read/writeVariant.

expression.LineStyle

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1598: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucannotsetthispropertyforaChBorderobjectthatrepresentsachartelement.

Page 1599: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleputsagreendash-dotborderaroundeachcellintherangeA1:E5.

SubSetBorder()

DimrngCurrentDimssConstants

SetssConstants=Spreadsheet1.Constants

SetrngCurrent=Spreadsheet1.Range("a1:e5")

rngCurrent.Borders.LineStyle=ssConstants.ssConstants.xlDashDot

rngCurrent.Borders.Color="Green"

EndSub

Page 1600: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListBoundFieldProperty

Returnsorsetsthefieldthatisboundinthespecifiedlistorcombobox(asopposedtothefieldthatisdisplayed).Appliesonlytolistboxesandcomboboxes.Read/writeString.

expression.ListBoundField

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 1601: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheListDisplayFieldpropertytoreturnorsetthedisplayedfield.

ThispropertyisusedwiththeListRowSourceandListDisplayFieldpropertiestocontrolhowdataisdisplayedinalistboxorcombobox.Forexample,consideralistboxthatdisplaysproductnamesinasectioncalledOrderDetails.TherecordsetbehindtheOrderDetailssectionincludesafieldnamedProductIDthatrepresentstheproductforagivenOrderDetailrecord.ButinsteadofdisplayingProductIDinatextbox,thepageauthorwantstodisplayproductnamesinadropdownlistbox.ThelistboxcanbefilledwitharecordsetdefinitionnamedProductswhichcontainsfieldscalledProdIDandProductNamefromtheProducttable.Thepropertiesofthislistboxelementwouldbesetasshowninthefollowingtable.

Property ValueListRowSource ProductsListBoundField ProdIDListDisplayField ProductNameControlSource ProductID

Page 1602: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListDisplayFieldProperty

Returnsorsetsthefieldthatisdisplayedinthelistorcombobox(asopposedtothefieldthatisbound).Therecanbeonlyonedisplayedfield.Thispropertyappliesonlytolistboxesandcomboboxes.Read/writeString.

expression.ListDisplayField

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 1603: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheListBoundFieldpropertytoreturnorsettheboundfield.

ThispropertyisusedwiththeListRowSourceandListBoundFieldpropertiestocontrolhowdataisdisplayedinalistboxorcombobox.Forexample,consideralistboxthatdisplaysproductnamesinasectioncalledOrderDetails.TherecordsetbehindtheOrderDetailssectionincludesafieldnamedProductIDthatrepresentstheproductforagivenOrderDetailrecord.ButinsteadofdisplayingProductIDinatextbox,thepageauthorwantstodisplayproductnamesinadropdownlistbox.ThelistboxcanbefilledwitharecordsetdefinitionnamedProductswhichcontainsfieldscalledProdIDandProductNamefromtheProducttable.Thepropertiesofthislistboxelementwouldbesetasshowninthefollowingtable.

Property ValueListRowSource ProductsListBoundField ProdIDListDisplayField ProductNameControlSource ProductID

Page 1604: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1605: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListObjectProperty

AsitappliestotheRangeobject.

Page 1606: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AsitappliestotheWorkbookobject.

Page 1607: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRangeobject.AsitappliestotheWorkbookobject.

Page 1608: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListObjectsProperty

ReturnstheListObjectscollectionfortheWorksheetobject.Read-only.

expression.ListObjects

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1609: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusetheListObjectspropertytoreturntheListObjectscollectionforaspecifiedWorksheetobject.ThenyouiteratethroughtheListObjectscollectiontogeteachListObjectobjectonthatworksheet.

Page 1610: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleworkswitheachListObjectsobjectrelatedtoaSpreadsheetcomponent(namedSpreadsheet1).ThecodeusestheListObjectspropertyofthesecondWorksheetobjecttoreturntheListObjectscollection.ItthengetsthenameoftheListObjectobject.ThisnamecorrespondstothevalueoftheIDattributeofanMapInfo/Map/EntryintheschemamapsyntaxintheXMLSpreadsheetfile.

TheXMLfragmentwherethedetailsappearintheXMLSpreadsheetfilelookssomethinglikethefollowingfragment.Inthisexample,thenameoftheListObjectobjectisCust_MapId:

<x2:MapInfoxmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml"><x2:Mapx2:ID="Cust_MapId"><x2:Entryx2:ID="example_id"x2:Type="table">...</x2:Entry></x2:Map></x2:MapInfo>

DimobjListsDimobjListDimstrName

SetobjLists=Spreadsheet1.Worksheets(2).ListObjects

ForEachobjListinobjLists'SavetheListObjectnametoavariable.strName=objList.Name

'Workwiththatparticularlistobjecthere.

Page 1611: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Next

ThisexamplesetsthelineweightoftheborderforthespecifiedListObjectintheSpreadsheetcomponent(namedSpreadsheet1).

DimssConstants

SetssConstants=Spreadsheet1.Constants'Setavariabletotherangetoaddthebordersto.rngList=Spreadsheet1.ActiveSheet.ListObjects(1).Range'Setwholerangeborderweight.rngList.Weight=ssConstants.owcLineWeightMedium

Page 1612: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListRowsProperty

ReturnsaListRowscollectionthatrepresentsalltherowsofdataintheListObjectobject.Itdoesnotincludetheheaderorinsertrows.Read-only.

expression.ListRows

expressionRequired.AnexpressionthatreturnsaListObjectobject.

Page 1613: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusetheListRowspropertytoreturntheListRowscollectionforaspecifiedListObjectobject.ThenyouiteratethroughtheListRowscollectiontogeteachListRowobjectonthatworksheet.

Page 1614: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleshowsyouhowtoretrievelistrowinformationforaspecificlistrow,inthiscase,theeighthrow.

DimobjListsDimobjLRowsDimobjLRow

SetobjLists=Spreadsheet1.ActiveSheet.ListObjectsSetobjLRows=objLists.Item(1).ListRows'Savethelistrowinformationoflistrownumber8toavariable.SetobjRow=objLRows.Item(8)

'Workwiththelistrowinformationhere.

Page 1615: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ListRowSourceProperty

Specifiesthedatasourceforalistboxorcombobox.Thispropertyappliesonlytolistboxesandcomboboxes,anditmustbesetbeforetheListBoundFieldorListDisplayFieldpropertyisset.Read/writeString.

expression.ListRowSource

expressionRequired.AnexpressionthatreturnsanElementExtensionobject.

Page 1616: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyisusedwiththeListBoundFieldandListDisplayFieldpropertiestocontrolhowdataisdisplayedinalistboxorcombobox.Forexample,consideralistboxthatdisplaysproductnamesinasectioncalledOrderDetails.TherecordsetbehindtheOrderDetailssectionincludesafieldnamedProductIDthatrepresentstheproductforagivenOrderDetailrecord.ButinsteadofdisplayingProductIDinatextbox,thepageauthorwantstodisplayproductnamesinadropdownlistbox.ThelistboxcanbefilledwitharecordsetdefinitionnamedProductswhichcontainsfieldscalledProdIDandProductNamefromtheProducttable.Thepropertiesofthislistboxelementwouldbesetasshowninthefollowingtable.

Property ValueListRowSource ProductsListBoundField ProdIDListDisplayField ProductNameControlSource ProductID

Page 1617: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LoadModeProperty

ReturnsanenumerationconstantthatrepresentsthenumericequivalentoftheLoadModeattributevalueofthe<Binding>elementforaparticulardatabinding.Read-onlyBindingLoadMode.

expression.LoadMode

expressionRequired.AnexpressionthatreturnsanXMLDataBindingobject.

Page 1618: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

AnXMLDataBindingobjectcanbeabindingtoanXMLfile,anarbitrarySOAPservice,anotherWebpart(fortheSpreadsheetWebPart),oradataretrievalservice.TheLoadModepropertydescribesthebindingbehaviorforloading.ThepossibleLoadModepropertysettingsandtheirnumericequivalentareshownbelow.Ifnotprovided,adefaultof"normal"isassumed:

BindingLoadMode DescriptionNormal(0) Foraquerybinding,bindingoccursatfirstload,

whentheuserclickstheRefreshAlltoolbarbutton,RefreshcommandonthetoolstripintheSpreadsheetWebPart,ortheRefreshDatacommandonthecontextmenuintheSpreadsheetcomponent.Bindingcanbedoneprogrammaticallyaswell.

Foranupdatebinding,bindingoccurseverytimetheuserclickstheUpdateDatacommandonthetoolstripintheSpreadsheetWebPart,orwhenusingtheSaveDatacommandonthecontextmenu.Bindingcanalsooccurprogrammatically

OM(1) Foraquerybinding,bindingdoesnotoccuratfirstload,whentheuserclickstheRefreshAlltoolbarbutton,RefreshcommandonthetoolstripintheSpreadsheetWebPart,ortheRefreshDatacommandonthecontextmenuintheSpreadsheetcomponent.BindingalsodoesnotoccurwhentheRefreshmethodiscalledontheSpreadsheetobject.BindingonlyoccurswhentheRefreshmethodoftheXmlDataBindingobjectiscalled.

Foranupdatebinding,bindingdoesnotoccuratfirstload,whentheuserclickstheUpdateDatacommandonthetoolstripintheSpreadsheetWeb

Page 1619: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Part,orwhenusingtheSaveDatacommandonthecontextmenu.BindingonlyoccurswhentheUpdatemethodoftheXmlDataBindingobjectiscalled.

Delay(2) Foraquerybinding,whentheuserclickstheRefreshAlltoolbarbutton,theRefreshcommandonthetoolstripintheSpreadsheetWebPart,ortheRefreshDatacommandonthecontextmenu.Bindingcanbedoneprogrammaticallyaswell.

Foranupdatebinding,thebehavioristhesameasdescribedfortheNormalenumeration.

Page 1620: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1621: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LocationProperty

Returnsorsetsthelocationofthecalculatedfieldevaluation.Read/writeDscLocationEnum.

expression.Location

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1622: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertycontrolswherecalculatedfieldsareevaluated.WhenthispropertyissettodscServer,theexpressionisincludedintheSQLstringsenttothedatabaseandmustbeinthecorrectSQLsyntaxforthedatabase.WhenthispropertyissettodscClient,theexpressionisevaluatedontheclientcomputerusingVisualBasicforApplicationsexpressions.

Page 1623: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LockedProperty

Trueifallcellsinthespecifiedrangearelocked,Falseifnoneofthecellsarelocked,andNullifsomecellsarelockedandsomearenot.ThedefaultvalueisTrue.UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.Read/writeVariant.

expression.Locked

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1624: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksonlythecellsincolumnBontheactivesheetinSpreadsheet1andthenprotectstheworksheet.

SubLockColumnB()DimshtCurrentSetshtCurrent=Spreadsheet1.ActiveSheet'Clearthelockedattributeforallcellsontheactivesheet.shtCurrent.Cells.Locked=False'LockallofthecellsinColumnB.shtCurrent.Columns(2).Locked=True'Enableprotectionontheactivesheet.shtCurrent.Protection.Enabled=TrueEndSub

Page 1625: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LogBaseProperty

Setsthebaseofthelogarithmwhenyouareusinglogscales.Attemptingtosetthispropertytoavaluelessthanorequaltozero(0)causesanerror.Read/writeDouble.

expression.LogBase

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1626: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausesthespecifiedaxistouseabase2logarithmicscale.

SubSetScaling()

DimchConstantsDimscValueAxisScaling

SetchConstants=ChartSpace1.Constants

'Setavariabletothescalingobjectofthevalueaxis.SetscValueAxisScaling=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).Scaling

'Setthescalingtype.scValueAxisScaling.Type=chConstants.chScaleTypeLogarithmic

'Setthebasevalue.scValueAxisScaling.LogBase=2

EndSub

Page 1627: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LookupRelationshipsProperty

ReturnstheLookupRelationshipscollectionforthespecifiedpagerowsource.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

expression.LookupRelationships

expressionRequired.AnexpressionthatreturnsaPageRowsourceobject.

Page 1628: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksLookupRelationshipobjectsrefertorowsourcesthathaveaone-to-manyrelationshipwiththespecifiedpagerowsource.FieldsfromtheserowsourcescanappearinthesamesectionorPivotTablelistasfieldsfromthespecifiedrowsource.

Page 1629: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LookupSchemaRelationshipsProperty

ReturnstheLookupSchemaRelationshipscollectionforthespecifiedschemarowsource.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

expression.LookupSchemaRelationships

expressionRequired.AnexpressionthatreturnsaSchemaRowSourceobject.

Page 1630: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MajorGridlinesProperty

ReturnsaChGridlinesobjectthatrepresentsthemajorgridlinesforthespecifiedaxis.Notethatyoucanusegridlinesonanyaxis.Read-only.

expression.MajorGridlines

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1631: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecolorandlineweightforthegridlinesonthevalueaxisofthefirstchartinChartSpace1.

SubFormat_Gridlines()DimchConstantsDimglMajorGridlinesDimglMinorGridlines

SetchConstants=ChartSpace1.Constants

'Setavariabletothemajorgridlinesonthevalueaxis.SetglMajorGridlines=ChartSpace1.Charts(0).Axes(_chConstants.chAxisPositionValue).MajorGridlines

'Setavariabletotheminorgridlinesonthevalueaxis.SetglMinorGridlines=ChartSpace1.Charts(0).Axes(_chConstants.chAxisPositionValue).MinorGridlines

'Setthecolorandweightofthemajorgridlines.glMajorGridlines.Line.Color="white"glMajorGridlines.Line.Weight=5

'Setthecolorandweightoftheminorgridlines.glMinorGridlines.Line.Color="yellow"glMajorGridlines.Line.Weight=2EndSub

Page 1632: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1633: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MajorTickMarksProperty

Returnsorsetsthemajortick-marktypeforthespecifiedaxis.Read/writeChartTickMarkEnum.

expression.MajorTickMarks

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1634: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsoffmajortickmarksonthespecifiedaxis.

SubDisableMajorTickMarks()DimchConstants

SetchConstants=ChartSpace1.Constants

ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).MajorTickMarks=chConstants.chTickMarkNoneEndSub

Page 1635: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MajorUnitProperty

Returnsorsetsthemajorunitforthespecifiedaxis.Usethispropertyonlywithavalueaxis.Read/writeDouble.

expression.MajorUnit

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1636: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertycausestheHasAutoMajorUnitpropertytobesettoFalse.

Page 1637: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthemajorandminorunitforthevalueaxis.

SubSetValueAxis()DimchConstantsDimaxValueAxis

SetchConstants=ChartSpace1.Constants

SetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)

axValueAxis.MajorUnit=7axValueAxis.MinorUnit=2.5EndSub

Page 1638: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MajorVersionProperty

ReturnsthemajorversionoftheMicrosoftOfficeWebComponentsobjectlibrary.Read-onlyLong.

expression.MajorVersion

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1639: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysthemajorversionofSpreadsheet1.

MsgboxSpreadsheet1.MajorVersion

Page 1640: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1641: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ManySideProperty

ManySidepropertyasitappliestothePageRelatedFieldobject.

ManySidepropertyasitappliestothePageRelationshipobject.

ManySidepropertyasitappliestotheSchemaRelatedFieldandSchemaRelationshipobjects.

Page 1642: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MapDataProperty

YouusetheMapDatapropertytospecifyordeterminetheschemamapforanXmlMapobject.Read/writeString.

expression.MapData

expressionRequired.AnexpressionthatreturnsanXmlMapobject.

Page 1643: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheXmlMapobjectiscreatedwhenanXMLSpreadsheetfilecontainingbindingandmappinginformationisloadedintotheSpreadsheetcomponentbysettingtheXMLURLorXMLDataproperty.YoucancreateanXMLSpreadsheetfilebyimportingandmappingdatatoaworksheetusingMicrosoftOfficeExcel2003,andthensavingtheworkbookasanXMLSpreadsheetfile.SettingtheMapDatapropertywillreplaceanyexistingschemamapwiththenewschemamapyouspecify.

Page 1644: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheMapDatapropertyoftheXmlMapobjecttoreturntheschemamap:

DimobjMapDimstrMapData

ForEachobjMapinSpreadsheet1.ActiveWorkbook.XmlMaps'Savethexmlmapinformationtoavariable.strMapData=objMap.MapData'Workwithmapinfoxmlhere.Next

ThenextexampleisafunctionthatsetstheMapDataproperty:

FunctionChangeMapSchema(objMap,strMapData)OnErrorResumeNextobjMap.MapData=strMapData

IfErr.Number<>0Then ChangeMapSchema=True Else ChangeMapSchema=False EndIfEndFunction

Page 1645: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MarkerProperty

ReturnsaChMarkerobjectthatrepresentsthemarkersforeverypointinthespecifiedseries.Read-only.

expression.Marker

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

Page 1646: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecharttypeandthensetsthemarkertypeandinteriorcolorforthespecifiedseries.

SubSetMarkerStyle()DimchConstantsDimserSeries1

SetchConstants=ChartSpace1.Constants

SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

ChartSpace1.Charts(0).Type=chConstants.chChartTypeLineMarkers

serSeries1.Marker.Style=chConstants.chMarkerStyleSquare

serSeries1.Interior.Color="blue"EndSub

Page 1647: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1648: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MaxHeightProperty

MaxHeightpropertyasitappliestothePivotTableobject.

MaxHeightpropertyasitappliestotheSpreadsheetobject.

Page 1649: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MaximumProperty

Returnsorsetsthemaximumvalueforthespecifiedscale.Read/writeDouble.

expression.Maximum

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1650: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthemaximumandminimumvaluesforthespecifiedaxisscale.

SubSetScalingLimits()DimchConstantsDimaxisScale

SetchConstants=ChartSpace1.Constants

SetaxisScale=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).Scaling

axisScale.Maximum=70axisScale.Minimum=-10EndSub0

Page 1651: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MaxRecordsProperty

Returnsorsetsthemaximumnumberofrecordsthattheconnectionwillreturntothelocalcomputer.Read/writeLong.

expression.MaxRecords

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1652: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1653: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MaxWidthProperty

MaxWidthpropertyasitappliestothePivotTableobject.

MaxWidthpropertyasitappliestotheSpreadsheetobject.

Page 1654: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1655: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MemberProperty

MemberpropertyasitappliestothePivotResultColumnAxis,PivotResultGroupAxis,PivotResultPageAxis,andPivotResultRowAxisobjects.

MemberpropertyasitappliestothePivotFieldSetobject.

Page 1656: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MemberCaptionsProperty

ReturnsorsetsanarrayofVariantvaluesthatcontainsthecaptionsofthemembersinthespecifiedfield.Usethispropertytocustomizethecaptionsofthemembersinafield.Read/write.

expression.MemberCaptions

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1657: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThearraythatyoupasstothispropertycontainsanarrayforeachcaptionthatyouwanttomodify.Thefirstelementinthearraycancontaineitheramembername,uniquename,orareferencetoaPivotMemberobject.Thesecondelementinthearrayisthenewcaptiontobeusedforthemember.

Membersnotspecifiedinthearraywillusethedefaultcaptionsprovidedbythedatasource.

NoteThispropertywillworkonlywithOnlineAnalyticalProcessing(OLAP)datasources.

Page 1658: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplereplacesthecaptionsintheStateProvincefieldoftheCustomersfieldsetwithcaptionsthataremorereadable.

SubNewMemberCaptions()

DimfldStateCaptionsDimavarNewCaptions(2)

SetfldStateCaptions=PivotTable1.ActiveView.FieldSets("Customers")_.Fields("StateProvince")

'Thefollowingthreelinesofcodespecifythenewcaptionsto'bedisplayedforthestatesintheStateProvincefield.avarNewCaptions(0)=Array("[StateProvince].[CA]","California")avarNewCaptions(1)=Array("[StateProvince].[WA]","Washington")avarNewCaptions(2)=Array("[StateProvince].[OR]","Oregon")

'ApplythenewcaptionstotheStateProvincefield.fldStateCaptions.MemberCaptions=avarNewCaptions

EndSub

Page 1659: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1660: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MemberPropertiesProperty

MemberPropertiespropertyasitappliestothePivotFieldobject.

MemberPropertiespropertyasitappliestothePivotAxisMember,PivotColumnMember,PivotPageMember,andPivotRowMemberobjects.

Page 1661: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestothePivotFieldobject.

Page 1662: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MemberPropertiesOrderProperty

ReturnsorsetsanarrayofVariantvaluesthatrepresentstheorderthatthememberpropertiesaretobedisplayedinthespecifiedfield.Usethispropertytorearrangetheorderthatmemberpropertiesaredisplayedin.Read/write.

expression.MemberPropertiesOrder

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1663: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThearraythatyoupasstothispropertycancontainalistofPivotMemberPropertyobjectsoraStringlistofmembercaptions.

Page 1664: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleenablesthemembercaptionsfortheStoreNamefieldinPivotTable1.Then,themembercaptionsarerearranged,andtheircaptionsarecustomized.

SubFormat_MemberProperties()DimptViewDimptConstantsDimfldStoreName

SetptConstants=PivotTable1.Constants

'SetavariabletotheactiveviewofthePivotTable.SetptView=PivotTable1.ActiveView

'SetavariabletotheStoreNamefield.SetfldStoreName=ptView.FieldSets("Store").Fields("StoreName")

'Thefollowingthreelinesofcodespecifythatthememberpropertiesare'displayedinthePivotTablelist.fldStoreName.MemberProperties("StoreManager").DisplayIn=ptConstants.plDisplayPropertyInReportfldStoreName.MemberProperties("StoreType").DisplayIn=ptConstants.plDisplayPropertyInReportfldStoreName.MemberProperties("StoreSqft").DisplayIn=ptConstants.plDisplayPropertyInReport

fldStoreName.MemberPropertiesOrder=Array("StoreType","StoreSqft","StoreManager")

'Thefollowingthreelinesofcodesetthecaptionforthememberproperties.fldStoreName.MemberProperties("StoreManager").Caption="ManagerName"fldStoreName.MemberProperties("StoreType").Caption="StoreType"fldStoreName.MemberProperties("StoreSqft").Caption="SizeinSQFT"EndSub

Page 1665: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 1666: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MemberPropertyProperty

ReturnsaPivotMemberPropertyobjectthatrepresentsthememberpropertyofthespecifiedresultmember.

expression.MemberProperty

expressionRequired.AnexpressionthatreturnsaPivotResultMemberPropertyobject.

Page 1667: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MergeAreaProperty

ReturnsaRangeobjectthatrepresentsthemergedrangecontaininganypartofthespecifiedrange.Thespecifiedrangecancontainmorethanonecell;iftherangedoesnotcontainanymergedcells,itisreturnedunchanged.Read-only.

expression.MergeArea

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1668: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesamergedcellfromtherangeB2:C5inSheet1andputsathickredborderaroundthemergedcell.

SubMerge_Cells()DimssConstantsDimshtCurrentSetssConstants=Spreadsheet1.ConstantsSetshtCurrent=Spreadsheet1.Worksheets("Sheet1")'MergecellsB2:C5.shtCurrent.Range("B2:C5").Merge'Setthebordercolorofthemergedcell.shtCurrent.Range("B2").MergeArea.Borders.Color="Red"'Settheborderweightofthemergedcell.shtCurrent.Range("B2").MergeArea.Borders.Weight=ssConstants.owcLineWeightThickEndSub

Page 1669: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MergeCellsProperty

Trueifthespecifiedrangeiswithinamergedcell.Falseifthespecifiedrangedoesnotcontainamergedcell.Nullifthespecifiedrangecontainsallorpartofamergedcellandothercellsoutsideofthemergedcell.Read/writeVariant.

expression.MergeCells

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1670: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyouselectarangethatcontainsmergedcells,theresultingselectionmaybedifferentfromtheintendedselection.

UsetheAddresspropertytochecktheaddressoftheselectedrange.

UsetheUnMergemethodtounmergethespecifiedrange.

Page 1671: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MinimumProperty

Returnsorsetstheminimumvalueforthespecifiedscale.Read/writeDouble.

expression.Minimum

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1672: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthemaximumandminimumvaluesforthespecifiedaxisscale.

SubSetScalingLimits()DimchConstantsDimaxisScale

SetchConstants=ChartSpace1.Constants

SetaxisScale=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).Scaling

axisScale.Maximum=70axisScale.Minimum=-10EndSub

Page 1673: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MinorGridlinesProperty

ReturnsaChGridlinesobjectthatrepresentstheminorgridlinesforthespecifiedaxis.Notethatyoucanusegridlinesonanyaxis.Read-only.

expression.MinorGridlines

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1674: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecolorandlineweightforthegridlinesonthevalueaxisofthefirstchartinChartSpace1.

SubFormat_Gridlines()DimchConstantsDimglMajorGridlinesDimglMinorGridlines

SetchConstants=ChartSpace1.Constants

'Setavariabletothemajorgridlinesonthevalueaxis.SetglMajorGridlines=ChartSpace1.Charts(0).Axes(_chConstants.chAxisPositionValue).MajorGridlines

'Setavariabletotheminorgridlinesonthevalueaxis.SetglMinorGridlines=ChartSpace1.Charts(0).Axes(_chConstants.chAxisPositionValue).MinorGridlines

'Setthecolorandweightofthemajorgridlines.glMajorGridlines.Line.Color="white"glMajorGridlines.Line.Weight=5

'Setthecolorandweightoftheminorgridlines.glMinorGridlines.Line.Color="yellow"glMajorGridlines.Line.Weight=2EndSub

Page 1675: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1676: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MinorTickMarksProperty

Returnsorsetstheminortick-marktypeforthespecifiedaxis.Read/writeChartTickMarkEnum.

expression.MinorTickMarks

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1677: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsonminorgridlinesandminortickmarksforthespecifiedaxisandsetsthegridlinecolorandtick-markstyle.

SubFormatValueAxis()DimchConstantsDimaxValueAxis

SetchConstants=ChartSpace1.Constants

SetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft)

axValueAxis.HasMinorGridlines=True

axValueAxis.MinorGridlines.Line.Color="green"

axValueAxis.MinorTickMarks=chConstants.chTickMarkOutsideEndSub

Page 1678: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MinorUnitProperty

Returnsorsetstheminorunitforthespecifiedaxis.Usethispropertyonlywithavalueaxis.Read/writeDouble.

expression.MinorUnit

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1679: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertycausestheHasAutoMinorUnitpropertytobesettoFalse.

Page 1680: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthemajorandminorunitforthevalueaxis.

SubSetValueAxis()DimchConstantsDimaxValueAxis

SetchConstants=ChartSpace1.Constants

SetaxValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)

axValueAxis.MajorUnit=7axValueAxis.MinorUnit=2.5EndSub

Page 1681: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MinorVersionProperty

ReturnstheminorversionoftheMicrosoftOfficeWebComponentsobjectlibrary.Read-onlyString.

expression.MinorVersion

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1682: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1683: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MiterProperty

ReturnsorsetsaChartLineMiterEnumconstantindicatingthewaythataline'sexterioredgesarejoined.Read/write.

expression.Miter

expressionRequired.AnexpressionthatreturnsaChLineobject.

Page 1684: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangesthefirstchartinChartspace1toalinechartandthenformatsthelineforthefirstdataseriesinthechart.

SubSet_Series_LineStyle()

DimchConstantsDimserSeries1

SetchConstants=ChartSpace1.Constants

'Changethecharttoalinechart.ChartSpace1.Charts(0).Type=chChartTypeLine

'Setavariabletorefertothefirstdataseriesinthechart.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Setthemiterofthelineofthefirstseries.serSeries1.Line.Miter=chConstants.chLineMiterBevel

'Setthelineweightofthefirstseries.serSeries1.Line.Weight=chConstants.owcLineWeightThick

'Setthelinestyleofthefirstseries.serSeries1.Line.DashStyle=chConstants.chLineRoundDot

EndSub

Page 1685: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveAfterReturnProperty

DetermineswhethertheactivecellwillbemovedwhentheuserpressestheENTERkey.ThedefaultvalueisTrue.UsetheMoveAfterReturnDirectionpropertytodeterminewhichdirectiontheactivecellmoveswhentheuserpressesENTER.Read/writeBoolean.

expression.MoveAfterReturn

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1686: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausestheactivecelltoremainselectedaftertheuserpressestheENTERkey.

Spreadsheet1.MoveAfterReturn=False

Page 1687: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1688: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MoveAfterReturnDirectionProperty

ReturnsorsetsthedirectioninwhichthefocusismovedwhentheuserpressestheENTERkeyandtheMoveAfterReturnpropertyissettoTrue.Read/writeXlDirection.

expression.MoveAfterReturnDirection

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 1689: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecausesthecelltotherightoftheactivecelltobeselectedaftertheuserpressestheENTERkey.

SubMoveAfterEnter()DimssConstantsSetssConstants=Spreadsheet1.Constants'EnabletheMoveAfterReturnproperty.Spreadsheet1.MoveAfterReturn=True'Movethecursoronecelltotherightwhen'theuserpressesENTER.Spreadsheet1.MoveAfterReturnDirection=xlToRightEndSub

Page 1690: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NameProperty

Returnsorsetsthenameofthespecifiedobject.

Read/writeVariantfortheFontobject.

Read/writefortheRangeobject.ReturnsaNameobject.SetusingaString.

Read/writeStringfortheChAxis,ChChart,ChFont,ChSeries,GroupingDef,Name,PageField,PivotFont,PivotHyperlink,PivotTotal,RecordsetDef,SchemaField,SchemaRowsource,andWorksheetobjects.

Read-onlyStringforallotherobjectsintheAppliesTolist.

expression.Name

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1691: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthenameofthespecifiedchart.

ChartSpace1.Charts(0).Name="LineChart"

Afterthechartnamehasbeenset,youcanrefertothechartbyname,asshowninthefollowingexample.

ChartSpace1.Charts("LineChart").HasLegend=True

Page 1692: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1693: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NamesProperty

NamespropertyasitappliestotheSpreadsheetandWorkbookobjects.

NamespropertyasitappliestotheWorksheetobject.

Page 1694: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheSpreadsheetandWorkbookobjects.

Page 1695: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1696: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NextProperty

NextpropertyasitappliestotheRangeobject.

NextpropertyasitappliestotheWorksheetobject.

Page 1697: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRangeobject.

Page 1698: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NextSectionProperty

ReturnsaSectionobjectthatrepresentsthenextphysicalsectiononthespecifiedpage,regardlessofsiblingsorparents.Thispropertyfailsonthefinalsectiononthepage.Read-only.

expression.NextSection

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 1699: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NextSiblingProperty

ReturnsaSectionobjectthatrepresentsthenextsiblinginthecurrentdataaccesspage.Thismaycausethenextpageofrecordstopopulateitself.Thispropertywillnotcrossparents,anditwillfailonthelastsiblingofthecurrentdataaccesspage.

expression.NextSibling

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 1700: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NumberFormatProperty

Returnsorsetsthenumberformatforthespecifiedobject.Read/writeVariantfortheRangeobject;read/writeStringforallotherobjectsintheAppliesTolist.

expression.NumberFormat

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1701: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucandefineanumberformatbyusingthesameformatcodesasMicrosoftExcel.Forinformationonnumberformatcodes,seethe"Createordeleteacustomnumberformat"topicinMicrosoftExcelHelp.

Page 1702: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplesetsthenumberformatfortherangesA1:E10andF1:F10ontheactiveworksheet.

SubFormatCells()

Spreadsheet1.ActiveSheet.Range("A1:E10").NumberFormat="0.###"Spreadsheet1.ActiveSheet.Range("F1:F10").NumberFormat="Currency"

EndSub

Page 1703: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

NumericScaleProperty

Returnsthemaximumnumberofdigitsyoucanhavetotherightofthedecimalpointfornumerictypes.Read-onlyLong.

expression.NumericScale

expressionRequired.AnexpressionthatreturnsaSchemaParameterobject.

Page 1704: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1705: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ObjectTypeProperty

ReturnsaChartSelectionsEnumthatrepresentsthetypeofobjectthatiscurrentlyselected.

expression.ObjectType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1706: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OfflineProperty

ReturnsaBooleanindicatingwhetherMicrosoftInternetExplorerisinofflinemode.Read-only.

expression.Offline

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1707: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangesthetextofalabelcontroltoindicatetheofflinestatusofadataaccesspagebeforethedataaccesspageisboundtoitsdatasource.

SubMSODSC_BeforeInitialBind(DSCEventInfo)

IfMSODSC.Offline=TruethenLabel.innerText="Offline"ElseLabel.innerText="Online"EndIf

EndSub

Page 1708: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OfflinePublicationProperty

ReturnsorsetsaStringthatrepresentsthepublicationtousewhenthedataaccesspageistakenoffline.Read/write.

expression.OfflinePublication

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1709: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyisvalidonlywhentheOfflineTypepropertyissettodscOfflineMerge.

Page 1710: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OfflineSourceProperty

ReturnsorsetsaStringthatrepresentsthedatasourceusedwhenthedataaccesspageisoffline.Read/write.

expression.OfflineSource

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1711: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThevalueusedtosetthispropertyvariesbaseduponthecurrentsettingoftheOfflineTypeandXMLLocationproperties.IftheOfflineTypepropertyissettodscOfflineMerge,thenthispropertyshouldbesettoaconnectionstringforthelocalMSDEdatabase.IftheOfflineTypepropertyissettodscOfflineXMLDataFileandtheXMLLocationpropertyissettodscXMLDataFile,thenthispropertyshouldbesettoastringcontainingthepathtotheXMLdatafile.

Page 1712: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheofflinesettingsfromthedatasourcecontrolnamedMSODSC.

SubSetOfflineSettings()

DimdscConstants

SetdscConstants=MSODSC.Constants

'Settheofflinetype.MSODSC.OfflineType=dscConstants.dscOfflineXMLDataFile

'SetthelocationoftheXMLdatatoadatafile.MSODSC.XMLLocation=dscconstants.dscXMLDataFile

'SettheXMLdatafiletousewhenthepageisoffline.MSODSC.OfflineSource="Q1SalesAnalysis.xml"

EndSub

Page 1713: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1714: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OfflineTypeProperty

ReturnsorsetsaDscOfflineTypeEnumconstantthatrepresentsthetypeofconnectionusedtopersistthedatawhenadataaccesspageistakenoffline.Read/write.

expression.OfflineType

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1715: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheofflinesettingsfromthedatasourcecontrolnamedMSODSC.

SubSetOfflineSettings()

DimdscConstants

SetdscConstants=MSODSC.Constants

'Settheofflinetype.MSODSC.OfflineType=dscConstants.dscOfflineXMLDataFile

'SetthelocationoftheXMLdatatoadatafile.MSODSC.XMLLocation=dscconstants.dscXMLDataFile

'SettheXMLdatafiletousewhenthepageisoffline.MSODSC.OfflineSource="Q1SalesAnalysis.xml"

EndSub

Page 1716: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OffsetProperty

ReturnsaRangeobjectthatrepresentsarangethatisoffsetfromthespecifiedrange.

expression.Offset(RowOffset,ColumnOffset)

expressionRequired.AnexpressionthatreturnsaRangeobject.

RowOffsetOptionalVariant.Thenumberofrows(positive,negative,or0(zero))bywhichtherangeistobeoffset.Positivevaluesareoffsetdownward,andnegativevaluesareoffsetupward.Thedefaultvalueis0.

ColumnOffsetOptionalVariant.Thenumberofcolumns(positive,negative,or0(zero))bywhichtherangeistobeoffset.Positivevaluesareoffsettotheright,andnegativevaluesareoffsettotheleft.Thedefaultvalueis0.

Page 1717: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefontforthecontentsofthecellthatisonecolumntotherightoftheactivecell.

Spreadsheet1.ActiveCell.Offset(0,1).Font.Bold=True

ThisexampleloopsthroughthecontiguousvaluesincolumnAintheactivesheetofSpreadsheet1anddeletesanyrowsthatcontainodd-numberedvalues.

SubDelete_Odd_Values()

Spreadsheet1.ActiveSheet.Range("A1").Select

'Loopuntilanemptycellisselected.DoUntilIsEmpty(Spreadsheet1.ActiveCell)

'Iftheactivecellcontainsanoddnumber.IfSpreadsheet1.ActiveCell.ValueMod2=1Then'Deletetherow.Spreadsheet1.ActiveCell.EntireRow.DeleteElse'Selectthenextcell.Spreadsheet1.ActiveCell.Offset(1,0).SelectEndIfLoopEndSub

Page 1718: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1719: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OneSideProperty

OneSidepropertyasitappliestothePageRelatedFieldobject.

OneSidepropertyasitappliestothePageRelationshipobject.

OneSidepropertyasitappliestotheSchemaRelatedFieldandSchemaRelationshipobjects.

Page 1720: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OrderProperty

Returnsorsetsthepolynomialorderforthespecifiedtrendline(anintegervaluegreaterthan1).Ifyousetthispropertyforalineartrendline,itbecomesapolynomialtrendline.Read/writeLong.

expression.Order

expressionRequired.AnexpressionthatreturnsaChTrendlineobject.

Page 1721: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheorderforthespecifiedtrendline.

ChartSpace1.Charts(0).SeriesCollection(0).Trendlines(0).Order=2

Page 1722: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OrderedMembersProperty

ReturnsorsetsaVariantthatdetermineshowthemembersofafieldaresortedwhentheSortDirectionpropertyissettoplSortDirectionCustom,plSortDirectionCustomAscending,orplSortDirectionCustomDescending.SetthispropertytoanarrayofmembersthatisorderedinthewaythatyouwantthemtoappearinthePivotTablelist.Whensettingthisproperty,youcanpassanarrayofmembernames,memberuniquenames,ormemberobjectreferences.Whenretrievingthisproperty,thearraywillalwayscontainPivotMemberobjectreferences.Read/write.

expression.OrderedMembers

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1723: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAnymembersinthefieldthatarenotlistedinthisarraywillappearbelowthelastmemberlistedinthearray.

Settingthispropertyreplacesthecurrentlist.Toadditemstoanexistinglist,youmustretrievethelistandaddaddmemberstoit,oruseavariabletoholdthecurrentlist,appendtoit,andresetthisproperty.

Itisallowabletopassmembernamesoruniquenamesthatcurrentlydonotexistinthedataresults.Ifyoupassanameoruniquenamethatcannotberesolvedtoaresultingmember,itwillbeconvertedtoaPivotMemberobjectwithitsIsValidpropertysettoFalse.

Toclearthislist,setthispropertytoEmptyoranarrayofzeroelements.

Page 1724: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesacustomsortorderintheTitlefield.

SubCustomSort()

DimptConstantsDimptViewDimpfTitle

SetptConstants=PivotTable1.Constants

SetptView=PivotTable1.ActiveView

'SetavariabletotheTitlefield.SetpfTitle=ptView.FieldSets("Title").Fields("Title")

'SpecifytheorderingforsomeoftheitemsintheTitlefield.pfTitle.OrderedMembers=Array("SalesRepresentative",_"SalesManager","VicePresident,Sales")

'Setthesortdirection.pfTitle.SortDirection=ptConstants.plSortDirectionCustom

EndSub

Page 1725: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1726: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OrientationProperty

PivotFieldSetobject:ReturnsaPivotFieldSetOrientationEnumconstantthatrepresentsthefieldsetorientation.Afieldsetcanbelocatedonboththesummaryaxisandthecolumn,row,orfilteraxisatthesametime.Read-only.

ChAxisobject:ReturnsorsetsaLongthatrepresentstheorientationofthelabelsonthespecifiedaxis.CanbeaChartLabelOrientationEnumconstant.Read/write.

ChScalingobject:ReturnsorsetsaChartScaleOrientationEnumconstantthatrepresentsthescalingorientation.Changingthevalueofthispropertyflipsthechart.Read/write.

expression.Orientation

expressionRequired.AnexpressionthatreturnsoneoftheobjectintheAppliesTolist.

Page 1727: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthescalingorientationforthespecifiedaxis.

SubSetAxisOrientation()

DimchConstants

SetchConstants=ChartSpace1.Constants

ChartSpace1.Charts(0).Axes(1).Scaling.Orientation=chConstants.chScaleOrientationMaxMin

EndSub

Page 1728: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OverlapProperty

Returnsorsetstheamountofoverlapbetweenmarkerswithinasinglecategory.Positivevaluescausethemarkerstooverlap,andnegativevaluescausethemarkerstoseparate.Thedefaultvalueiszero(0),andthevalidrangeisfrom–100through100.Read/writeLong.

expression.Overlap

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1729: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheoverlapvalueforthespecifiedchart.

ChartSpace1.Charts(0).Overlap=25

Page 1730: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageAxisProperty

PivotViewobject:ReturnsaPivotGroupAxisobjectthatrepresentsthepageaxis.

PivotDataobject:ReturnsaPivotResultGroupAxisobjectthatrepresentsthepageaxis.

expression.PageAxis

expressionRequired.AnexpressionthatreturnsaPivotVieworPivotDataobject.

Page 1731: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageFieldsProperty

ReturnsthePageFieldscollectionforthespecifiedrecordsetdefinition.

expression.PageFields

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1732: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1733: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageMemberProperty

PivotCellobject:ReturnsaPivotPageMemberobjectthatrepresentsthepagememberforthespecifiedcell.

PivotResultPageAxisobject:ReturnsaPivotPageMemberobjectthatrepresentsthepagememberforthespecifiedresultaxis.

expression.PageMember

expressionRequired.AnexpressionthatreturnsaPivotCellorPivotResultPageAxisobject.

Page 1734: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRelatedFieldsProperty

ReturnsthePageRelatedFieldscollectionforthespecifiedpagerelationship.Read-only.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

expression.PageRelatedFields

expressionRequired.AnexpressionthatreturnsaPageRelationshipobject.

Page 1735: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRowsourceProperty

ReturnsthePageRowsourceobjectforthespecifiedpagefield.Read-only.

expression.PageRowsource

expressionRequired.AnexpressionthatreturnsaPageFieldobject.

Page 1736: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PageRowsourcesProperty

ReturnsthePageRowsourcescollectionforthespecifiedrecordsetdefinition.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

expression.PageRowsources

expressionRequired.AnexpressionthatreturnsaRecordsetDefobject.

Page 1737: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PanesProperty

ReturnsthePanescollectionforthespecifiedworksheet.

expression.Panes

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1738: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1739: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariableforthevisiblerangeinthespecifiedpaneanddisplaystherange'slocation.

SubSetVisibleRange()

DimrngVisible

SetrngVisible=Spreadsheet1.ActiveSheet.Panes(1).VisibleRange

MsgBox"rngVisible.Address"&vr.Address

EndSub

Page 1740: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParameterValuesProperty

ReturnstheParameterValuescollectionforthespecifiedrecordsetdefinition.

expression.ParameterValues

expressionRequired.AnexpressionthatreturnsaRecordsetDefobject.

Page 1741: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1742: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentProperty

Returnstheparentobjectforthespecifiedobject.

expression.Parent

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1743: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleTheeventprocedureinthisexamplerunswhenevertheuserclicksinthechartworkspace.

SubChartSpace1_Click()

DimchConstantsDimiSeriesNumDimiPointNum

SetchConstants=ChartSpace1.Constants

IfChartSpace1.SelectionType=chConstants.chSelectionPointThen'Pointparentisseries.iSeriesNum=ChartSpace1.Selection.Parent.Index

iPointNum=ChartSpace1.Selection.Index

MsgBox"Series:"&iSeriesNum&"Point:"&iPointNumEndIf

EndSub

Page 1744: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentAxisMemberProperty

ReturnsaPivotAxisMemberobjectthatrepresentstheparentmemberforthespecifiedaxismember.

expression.ParentAxisMember

expressionRequired.AnexpressionthatreturnsaPivotAxisMemberobject.

Page 1745: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsNothingifthispropertyisusedforthetoplevelaxismember.

Page 1746: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentColumnMemberProperty

ReturnsaPivotColumnMemberobjectthatrepresentstheparentmemberforthespecifiedcolumnmember.

expression.ParentColumnMember

expressionRequired.AnexpressionthatreturnsaPivotColumnMemberobject.

Page 1747: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsNothingifthispropertyisusedforthetoplevelcolumnmember.

Page 1748: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentLabelProperty

ReturnsaChCategoryLabelobjectthatrepresentstheparentlabelforthespecifiedlabel.

expression.ParentLabel

expressionRequired.AnexpressionthatreturnsaChCategoryLabelobject.

Page 1749: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsingthispropertywithalabelthatdoesnothaveaparentlabelwillresultinarun-timeerror.

Page 1750: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentMemberProperty

ReturnsaPivotMemberobjectthatrepresentstheparentmemberforthespecifiedmember.

expression.ParentMember

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1751: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentPageMemberProperty

ReturnsaPivotPageMemberobjectthatrepresentstheparentmemberforthespecifiedpagemember.

expression.ParentPageMember

expressionRequired.AnexpressionthatreturnsaPivotPageMemberobject.

Page 1752: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentRecordsetDefProperty

ReturnsaRecordsetDefobjectthatrepresentstheparentforthespecifiedrecordsetdefinition.

expression.ParentRecordsetDef

expressionRequired.AnexpressionthatreturnsaRecordsetDefobject.

Page 1753: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentRowMemberProperty

ReturnsaPivotRowMemberobjectthatrepresentstheparentmemberforthespecifiedrowmember.

expression.ParentRowMember

expressionRequired.AnexpressionthatreturnsaPivotRowMemberobject.

Page 1754: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsNothingifthispropertyisusedforthetoplevelrowmember.

Page 1755: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParentSectionProperty

ReturnsaSectionobjectthatrepresentstheparentofthespecifiedsection.

expression.ParentSection

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 1756: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1757: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PathProperty

ReturnsaStringthatrepresentsthepathtothespecifiedmember.Read-only.

expression.Path(Format)

expressionRequired.AnexpressionthatreturnsaPivotMemberobject.

FormatRequiredPivotMemberFindFormatEnum.

Page 1758: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1759: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PatternProperty

ReturnsaChartPatternTypeEnumconstantindicatingthefillpatternforthespecifiedChInteriorobject.Read-only.

expression.Pattern

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1760: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheSetPatternedmethodtosetthepatternforaChInteriorobject.

Page 1761: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PercentCompleteProperty

ReturnsaLongvaluethatrepresentsthecompletedportionofthecurrentoperation.ThispropertyissupportedonlyintheRecordsetSaveProgressevent.Read-only.

expression.PercentComplete

expressionRequired.AnexpressionthatreturnsaDSCEventInfoobject.

Page 1762: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethispropertywiththeRecordsetSaveProgresseventtoupdateacontrolinthecontainer,suchasthestatusbar.

Usingthispropertywithanunsupportedeventwillresultinarun-timeerror.

Page 1763: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheRecordsetSaveProgesseventtoupdatetheMicrosoftInternetExplorer'sstatusbarwhentherecordsetcontainedbytheDataSourceControlobjectissaved.

SubMSODSC_RecordsetSaveProgress(DSCEventInfo)

'Updatethestatusbarwiththecurrent'completionpercentage.Window.Status=DSCEventInfo.PercentComplete

'Checktoseeifthesavehasbeencompleted.IfDSCEventInfo.PercentComplete=100then

'Clearthestatusbarwhenthesaveiscomplete.Window.Status=""EndIf

EndSub

Page 1764: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PeriodProperty

ReturnsorsetsaLongthatrepresentstheperiodforamoving-averagetrendline.Read/write.

expression.Period

expressionRequired.AnexpressionthatreturnsaChTrendlineobject.

Page 1765: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PerspectiveProperty

ReturnsorsetsaLongindicatingtheamountofperspectiveonathree-dimensionalchart.ThispropertyhasnoeffectiftheProjectionModepropertyofthecharthasbeensettochProjectionModeOrthographic.Validvaluesrangefrom0to80.Read/write.

expression.Perspective

expressionRequired.AnexpressionthatreturnsaChChartobject

Page 1766: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthensetstheperspectiveforthechart.

SubSetPerspective()

Dimcht3DColumn

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3-DColumnchart.cht3DColumn.Type=chChartTypeColumnClustered3D

'Settheperspective.cht3DColumn.Perspective=35

EndSub

Page 1767: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotAxisProperty

ReturnsthePivotResultGroupAxisobjectforthespecifiedcategorylabelordataseries.

expression.PivotAxis

expressionRequired.AnexpressionthatreturnsaChCategoryLabelsorChSeriesCollectionobject.

Page 1768: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1769: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotObjectProperty

PivotObjectpropertyasitappliestotheChPointobject.

PivotObjectpropertyasitappliestotheChCategoryLabel,ChChartField,ChLegendEntry,andChSeriesobjects.

Page 1770: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyreturnsNullifthechartisnotboundtoarelationaldatasource.

Page 1771: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1772: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PlotAllAggregatesProperty

ReturnsorsetsaChartPlotAggregatesEnumconstantthatdetermineswhichfieldsareplottedwhenthechartcontrolisboundtoarelationaldatasource.Read/write.

expression.PlotAllAggregates

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1773: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyisrelevantonlywhenmultiplefieldshavebeenaddedtothedataareaofthechart.

Page 1774: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PlotAreaProperty

ReturnsaChPlotAreaobjectthatrepresentstheplotareaonthespecifiedchart.Notethatpie,doughnut,radar,andpolarchartsdonothaveplotareas.

expression.PlotArea

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1775: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorcolorfortheplotareaonthespecifiedchart.

ChartSpace1.Charts(0).PlotArea.Interior.Color="Green"

Page 1776: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PointsProperty

ReturnstheChPointscollectionforthespecifiedseries.

expression.Points

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

Page 1777: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1778: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheinteriorcolorforpointtwointhespecifiedseries.

ChartSpace1.Charts(0).SeriesCollection(0).Points(2).Interior.Color="green"

Page 1779: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1780: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PositionProperty

Returnsorsetsthepositionoftheobject.

Read/writeChartAxisPositionEnumfortheChAxisobject.

Read/writeChartDataLabelPositionEnumfortheChDataLabelsobject.

Read/writeChartLegendPositionEnumfortheChLegendobject.

Read/writeChartTitlePositionEnumfortheChTitleobject.

expression.Position

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1781: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleputsthelegendforthespecifiedcharttotheleftoftheplotarea.

SubAddLegend()

DimchConstants

SetchConstants=ChartSpace1.Constants

'EnbablethelegendforthefirstchartinChartspace1.ChartSpace1.Charts(0).HasLegend=True

'Setthepositionofthelegend.ChartSpace1.Charts(0).Legend.Position=chConstants.chLegendPositionLeft

EndSub

Page 1782: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PrecisionProperty

Returnsthemaximumnumberofdigitsyoucanusefornumerictypes.Read-onlyLong.

expression.Precision

expressionRequired.AnexpressionthatreturnsaSchemaParameterobject.

Page 1783: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PrefixCharacterProperty

Returnstheprefixcharacterforthespecifiedrange.Returnsanapostrophe(')ifthespecifiedrangecontainsavaluethatwasprecededwithanapostrophewhenitwasenteredintotheworksheet.Returnsablankstringifthespecifiedrangedoesnotcontainaprefixcharacter.Read-onlyVariant.

expression.PrefixCharacter

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1784: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledeletesallprefixcharactersfromtheactiveworksheetinSpreadsheet1.

SubDelete_PrefixCharacters()DimrngCell

'Loopthroughallusedcellsintheactiveworksheet.ForEachrngCellInSpreadsheet1.ActiveSheet.UsedRange

'Ifaprefixcharacterexists,deleteit.IfrngCell.PrefixCharacter<>""ThenrngCell.Value=rngCell.ValueEndIfNextEndSub

Page 1785: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1786: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PresetGradientTypeProperty

ReturnsaChartPresetGradientTypeEnumconstantindicatingthepresetgradienttypeforthespecifiedChInteriorobject.Read-only.

expression.PresetGradientType

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1787: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheSetPresetGradientmethodtosetthepresetgradienttypeforthefill.

Page 1788: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1789: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PresetTextureProperty

ReturnsaChartPresetTextureEnumconstantindicatingthepresettextureforthespecifiedChInteriorobject.Read-only.

expression.PresetTexture

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 1790: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheSetTexturedmethodtosetthepresettextureforaChInteriorobject.

Page 1791: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1792: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PreviousProperty

PreviouspropertyasitappliestotheRangeobject.

PreviouspropertyasitappliestotheWorksheetobject.

Page 1793: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRangeobject.

Page 1794: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PreviousSectionProperty

ReturnsaSectionobjectthatrepresentstheprevioussectiononthespecifiedpage,regardlessofsiblingsorparents.Thispropertyfailsonthefirstsectionofthepage.

expression.PreviousSection

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 1795: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PreviousSiblingProperty

ReturnsaSectionobjectthatrepresentstheprevioussiblinginthecurrentdataaccesspage.Thispropertyfailsonthefirstsiblingofthecurrentdataaccesspage.

expression.PreviousSibling

expressionRequired.AnexpressionthatreturnsaSectionobject.

Page 1796: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PrimaryPageRowsourceProperty

ReturnsaPageRowsourceobjectthatrepresentstheprimarypagerowsourceforthespecifiedrecordsetdefinition.Whenarecordsetdefinitioniscreated,therowsourcenamedintheAddorAddNewmethodbecomestheprimarypagerowsource.

expression.PrimaryPageRowsource

expressionRequired.AnexpressionthatreturnsaRecordsetDefobject.

Page 1797: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PrintQuality3DProperty

ReturnsorsetsaDoubleindicatingtheratiooftheprintedresolutionofathree-dimensional(3-D)charttotheresolutionofyourprinter.Validvaluesrangefrom0to1.Thedefaultvalueis0.25.Read/write.

expression.PrintQuality3D

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1798: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThelowerthevalueofthisproperty,thefasteryour3-Dchartwillprint.However,settingthisvalueofthispropertytoolowmayyieldunsatisfactoryresults.

Page 1799: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthe3-DchartsinChartspace1toprintat75%oftheprinter'sresolution.

Chartspace1.PrintQuality3D=0.75

Page 1800: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1801: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProjectionModeProperty

ReturnsorsetsaChartProjectionModeEnumconstantindicatingtheviewingperspectiveofathree-dimensionalchart.Read/write.

expression.ProjectionMode

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1802: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthensetstheprojectionmodeofthechart.

SubSetExtrudeAngle()

Dimcht3DColumnDimchConstants

SetchConstants=Chartspace1.Constants

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3DColumnchart.cht3DColumn.Type=chChartTypeColumnClustered3D

'Setstheprojectionmodetoorthographic.cht3DColumn.ProjectionMode=chConstants.chProjectionModeOrthographic

'Setstheextrusionangle.cht3DColumn.ExtrudeAngle=75

EndSub

Page 1803: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropertyCaptionFontProperty

ReturnsaPivotFontobjectthatrepresentsthefontsettingsusedtodisplaythecaptionofOLAPmemberpropertiesinthespecifiedview.Usethereturnedobjecttoformatthefontusedformemberpropertycaptions.

expression.PropertyCaptionFont

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1804: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthealignmentandthefontofmemberpropertycaptionsandvaluesintheactiveviewofPivotTable1.

SubFormat_MemberProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Thefollowingthreelinesofcodeformatthe'fontformemberpropertycaptions.ptView.PropertyCaptionFont.Name="Tahoma"ptView.PropertyCaptionFont.Size=8ptview.PropertyCaptionFont.Bold=True

'Left-alignthememberpropertycaptions.ptview.PropertyCaptionHAlignment=ptConstants.plHAlignLeft

'Thefollowingtwolinesofcodeformatthe'fontformemberpropertyvalues.ptview.PropertyValueFont.Name="Tahoma"ptview.PropertyValueFont.Size=8

'Right-alignthememberpropertyvalues.ptview.PropertyValueHAlignment=ptConstants.plHAlignRight

Page 1805: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 1806: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1807: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropertyCaptionHAlignmentProperty

ReturnsorsetsaPivotHAlignmentEnumconstantthatrepresentsthehorizontalalignmentofOLAPmemberpropertycaptionsinthespecifiedview.Usethispropertytosetthehorizontalalignmentofmemberpropertycaptions.Read/write.

expression.PropertyCaptionHAlignment

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1808: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthealignmentandthefontofmemberpropertycaptionsandvaluesintheactiveviewofPivotTable1.

SubFormat_MemberProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Thefollowingthreelinesofcodeformatthe'fontformemberpropertycaptions.ptView.PropertyCaptionFont.Name="Tahoma"ptView.PropertyCaptionFont.Size=8ptview.PropertyCaptionFont.Bold=True

'Left-alignthememberpropertycaptions.ptview.PropertyCaptionHAlignment=ptConstants.plHAlignLeft

'Thefollowingtwolinesofcodeformatthe'fontformemberpropertyvalues.ptview.PropertyValueFont.Name="Tahoma"ptview.PropertyValueFont.Size=8

'Right-alignthememberpropertyvalues.ptview.PropertyValueHAlignment=ptConstants.plHAlignRight

Page 1809: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 1810: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropertyCaptionWidthProperty

ReturnsorsetsaLongthatrepresentsthewidthofthecaptionofamemberpropertythatisdisplayedinthespecifiedfield.Read/write.

expression.PropertyCaptionWidth

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1811: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropertyHeightProperty

ReturnsorsetsaLongthatrepresentstheheightofamemberpropertythatisdisplayedinthespecifiedfield.Read/write.

expression.PropertyHeight

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1812: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropertyValueFontProperty

ReturnsaPivotFontobjectthatrepresentsthefontsettingsusedtodisplaythevalueofOLAPmemberpropertiesinthespecifiedview.Usethereturnedobjecttoformatthefontusedformemberpropertyvalues.

expression.PropertyValueFont

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1813: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthealignmentandthefontofmemberpropertycaptionsandvaluesintheactiveviewofPivotTable1.

SubFormat_MemberProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Thefollowingthreelinesofcodeformatthe'fontformemberpropertycaptions.ptView.PropertyCaptionFont.Name="Tahoma"ptView.PropertyCaptionFont.Size=8ptview.PropertyCaptionFont.Bold=True

'Left-alignthememberpropertycaptions.ptview.PropertyCaptionHAlignment=ptConstants.plHAlignLeft

'Thefollowingtwolinesofcodeformatthe'fontformemberpropertyvalues.ptview.PropertyValueFont.Name="Tahoma"ptview.PropertyValueFont.Size=8

'Right-alignthememberpropertyvalues.ptview.PropertyValueHAlignment=ptConstants.plHAlignRight

Page 1814: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 1815: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1816: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropertyValueHAlignmentProperty

ReturnsorsetsaPivotHAlignmentEnumconstantthatrepresentsthehorizontalalignmentofOLAPmemberpropertyvaluesinthespecifiedview.Usethispropertytosetthehorizontalalignmentofmemberpropertyvalues.Read/write.

expression.PropertyValueHAlignment

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 1817: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthealignmentandthefontofmemberpropertycaptionsandvaluesintheactiveviewofPivotTable1.

SubFormat_MemberProperties()

DimptViewDimptConstants

SetptConstants=PivotTable1.Constants

'SetavariabletothecurrentPivotTableview.SetptView=PivotTable1.ActiveView

'Thefollowingthreelinesofcodeformatthe'fontformemberpropertycaptions.ptView.PropertyCaptionFont.Name="Tahoma"ptView.PropertyCaptionFont.Size=8ptview.PropertyCaptionFont.Bold=True

'Left-alignthememberpropertycaptions.ptview.PropertyCaptionHAlignment=ptConstants.plHAlignLeft

'Thefollowingtwolinesofcodeformatthe'fontformemberpropertyvalues.ptview.PropertyValueFont.Name="Tahoma"ptview.PropertyValueFont.Size=8

'Right-alignthememberpropertyvalues.ptview.PropertyValueHAlignment=ptConstants.plHAlignRight

Page 1818: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndSub

Page 1819: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropertyValueWidthProperty

ReturnsorsetsaLongthatrepresentsthewidthofthevalueofamemberpropertythatisdisplayedinthespecifiedfield.Read/write.

expression.PropertyValueWidth

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1820: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PropNamesProperty

ReturnsastringarraycontainingthevaluesoftheIDattributeforeachFieldelementintheschemamapfortheXMLlist(/Map/Entry/Field@ID)inleft-to-rightorder,whichcorrespondstotheorderingof/Field/Rangeelementsinthemap.Read-onlyVariant.

expression.PropNames

expressionRequired.AnexpressionthatreturnsaListObjectobject.

Page 1821: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

ForXMLlistscreatedbysavingafilefromMicrosoftOfficeExcel2003asanXMLSpreadsheetfile,theIDvaluesreturnedbythePropNamepropertycorrespondtothecolumnnamesintheheaderrowoftheXMLlistrepresentedbytheListObjectobject.TheorderingofthevaluesreturnedinthearraydependsonthesettingoftheRightToLeftproperty.

Page 1822: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleshowshowtogetthecolumnnamesinalistwhentheactivecelliswithinthelist:

DimstrFieldNameDimobjListObject

SetobjListObject=Spreadsheet1.ActiveCell.ListObjectForEachstrFieldNameinobjListObject.PropNames'strFieldNamenowcontainselement(field)nameforacolumninthelist.Next

Page 1823: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProtectContentsProperty

Trueifthecontentsofthesheetareprotected.Read-onlyBoolean.

expression.ProtectContents

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1824: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProtectionProperty

ReturnsaProtectionobjectthatcontainstheprotectionpropertiesforthespecifiedworksheet.TheprotectionpropertiesareignorediftheEnabledpropertyissettoFalse.

expression.Protection

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1825: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplelocksthecellsincolumnBandenablesprotectionforthesheet.

SubProtectColumnB()

'Unlockallofthecellsintheactivesheet.Spreadsheet1.ActiveSheet.Cells.Locked=False

'LockthecellsincolumnB.Spreadsheet1.Columns(2).Locked=True

'Protectthelockedcells.Spreadsheet1.ActiveSheet.Protection.Enabled=True

EndSub

Page 1826: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProtectionModeProperty

Trueifuser-interface-onlyprotectionisenabled.AlwaysreturnsTrue.Read-onlyBoolean.

expression.ProtectionMode

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1827: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProtectStructureProperty

Trueiftheorderofthesheetsintheworkbookisprotected.Read-onlyBoolean.

expression.ProtectStructure

expressionRequired.AnexpressionthatreturnsaWorkbookobject.

Page 1828: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProviderFormattedValueProperty

ReturnsaVariantthatrepresentsthevalueofthespecifiedaggregateasitisformattedbythedatasource.Read-only.

expression.ProviderFormattedValue

expressionRequired.AnexpressionthatreturnsaPivotAggregateobject.

Page 1829: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ProviderTypeProperty

ReturnsaProviderTypeconstantthatrepresentsthetypeofdataproviderforthespecifiedPivotTablelist.Read-only.

expression.ProviderType

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 1830: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1831: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RangeProperty

AsitappliestotheAutoFilterobject.

AsitappliestothePivotDataobject.

AsitappliestotheRange,Spreadsheet,andWorksheetobjects.

Page 1832: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AsitappliestotheListObjectobject.

Page 1833: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AsitappliestotheListRowobject.

Page 1834: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheRange,Spreadsheet,andWorksheetobjects.

Page 1835: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RangeSelectionProperty

ReturnsaRangeobjectthatrepresentstheselectedcellsontheworksheetinthespecifiedwindow.Read-only.

expression.RangeSelection

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1836: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyinidenticalinfunctionalitytotheSelectionproperty.

Page 1837: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetssetsthefontoftheselectedcellstobold.

Spreadsheet1.ActiveWindow.RangeSelection.Font.Bold=True

Page 1838: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1839: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ReadingOrderProperty

ReturnsorsetsaLongrepresentingthereadingorderforthespecifiedobject.CanbeaXlReadingOrderconstant.Read/write.

expression.ReadingOrder

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1840: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSomeoftheseconstantsmaynotbeavailabletoyou,dependingonthelanguagesupport(U.S.English,forexample)thatyou'veselectedorinstalled.

Page 1841: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordNavigationSectionProperty

Trueifthereisanavigationsectionforanygivenbandingsection.ThedefaultvalueisTrue.Read/writeBoolean.

expression.RecordNavigationSection

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1842: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordSelectorProperty

ReturnsorsetsaBooleanthatindicateswhetherornottodisplaytherecordselectorforthespecifiedgroup.Read/write.

expression.RecordSelector

expressionRequired.AnexpressionthatreturnsaGroupLevelobject.

Page 1843: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetProperty

PivotCellobject:ReturnsanADORecordsetobjectthatcontainsthedetailrecordsforthecelliftheyareavailable.

PivotDataobject:ReturnsanADORecordsetobjectthatcontainsthedetailrecordsforthespecifiedPivotDataobjectiftheyareavailable.

DataPageobject:ReturnsanADORecordsetobjectforthespecifieddataaccesspage.

expression.Recordset

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1844: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetDefProperty

ReturnsthecontainingRecordsetDefobjectforthespecifiedpagefieldorpagerowsource.

expression.RecordsetDef

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1845: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetDefsProperty

ReturnstheRecordsetDefscollectionforthedatasourcecontrol.

expression.RecordsetDefs

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1846: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1847: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetLabelProperty

Returnsorsetstherecordsetlabelfortherecordnavigationcontrolwhenthepageisnotbandedandonerecordisdisplayed,andwhenthepageisbandedandtwoormorerecordsaredisplayed.Read/writeString.

expression.RecordsetLabel

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1848: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThelabelconsistsoftwostringsseparatedbyasemicolon.Thefirststringrepresentsthelabelthatisdisplayedwhenonerecordisdisplayedonthepage,andthesecondstringrepresentsthelabelthatisdisplayedwhentwoormorerecordsaredisplayedonthepage.Thelabelcancontainthefollowingplaceholdersfordisplayingrecordsetinformationonthepage.

Placeholder Description|0 Thenumberofthecurrentrecord,orthenumberofthefirst

visiblerecordinthegroup.|1 Thenumberofthelastvisiblerecordinthegroup.|2 Thenumberofrecordsintherecordset.

Page 1849: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstherecordsetlabel.Ifthepageisbandedandrecords1through5outof8aredisplayed,thelabelsays"Categories1-5of8."Ifthepageisnotbandedandthefirstrecordisdisplayed,thelabelsays"Category1of8."

ProductNavigation.RecordsetLabel=_"Category|1of|2;Categories|0-|1of|2"

Page 1850: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1851: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetTypeProperty

Returnsorsetstherecordsettypeforthedatasourcecontrol.Read/writeDscRecordsetTypeEnum.

expression.RecordsetType

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1852: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordSourceProperty

ElementExtensionandGroupLevelobjects:ReturnsorsetsaStringthatrepresentstherecordsource(thenameofarecordsetdefinitionorgroupingdefinition)forthesection.AppliesonlytoDIVsections.Read/write.

RecordNavigationControlobject:ReturnsorsetsaDataMemberobjectthatrepresentstherecordsourceforthesection.Read/write.

expression.RecordSource

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1853: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RefersToProperty

Returnsorsetstheformulathatthenameasdefinedrefersto,inthelanguageofthescriptandinA1-stylenotation,beginningwithanequalsign.Read/writeVariant.

expression.RefersTo

expressionRequired.AnexpressionthatreturnsaNameobject.

Page 1854: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplecreatesalistofallthenamesintheactiveworkbook,alongwiththeformulastowhichtheyrefer.

SubList_All_Names()DimnmCurrentNameDimrngCurrent

SetrngCurrent=Spreadsheet1.ActiveSheet.Range("A1")

'Loopthroughallofthenamesintheactiveworkbook.ForEachnmCurrentNameInSpreadsheet1.ActiveWorkbook.Names

'Writethecurrentnametotheworksheet.rngCurrent.Value=nmCurrentName.Name

'Writethedefinitionofthecurrentnametotheworksheet.rngCurrent.Offset(0,1).Value="'"&nmCurrentName.RefersTo

SetrngCurrent=rngCurrent.Offset(1,0)NextEndSub

Page 1855: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RefersToLocalProperty

ReturnsorsetsaVariantrepresentingtheformulathatthenamerefersto.Theformulaisinthelanguageoftheuser,andit'sinA1-stylenotation,beginningwithanequalssign.Read/write.

expression.RefersToLocal

expressionRequired.AnexpressionthatreturnsaNameobject.

Page 1856: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexamplecreatesalistofallthenamesintheactiveworkbook,alongwiththeformulastowhichtheyrefer,inthelanguageoftheuser.

SubList_All_Names()DimnmCurrentNameDimrngCurrent

SetrngCurrent=Spreadsheet1.ActiveSheet.Range("A1")

'Loopthroughallofthenamesintheactiveworkbook.ForEachnmCurrentNameInSpreadsheet1.ActiveWorkbook.Names

'Writethecurrentnametotheworksheet.rngCurrent.Value=nmCurrentName.Name

'Writethedefinitionofthecurrentnametotheworksheet.rngCurrent.Offset(0,1).Value="'"&nmCurrentName.RefersToLocal

SetrngCurrent=rngCurrent.Offset(1,0)NextEndSub

Page 1857: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RefersToRangeProperty

ReturnstheRangeobjectreferredtobyaNameobject.IftheNameobjectdoesn'trefertoarange(forexample,ifitreferstoaconstantoraformula),thispropertygeneratesarun-timeerror.Read-only.

expression.RefersToRange

expressionRequired.AnexpressionthatreturnsaNameobject.

Page 1858: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ResyncCommandProperty

SpecifiesanSQLcommandparameterizedbythekeyfieldvaluesfromthespecifiedrecordset’suniquetablesuchthatthecommandreturnsexactlyonerecord.Theresynccommandisexecutedto"fixup"arowafteranupdateorinsertionismade.Read/writeString.

expression.ResyncCommand

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1859: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumustsetthispropertyforanyformbasedonastoredprocedurethatcontainsajoinorexpressioncolumn.Inallothercases,MicrosoftAccesscanfixtablesautomatically.Ifyoudonotsetthisproperty,userswillnotseefixed-upfieldvaluesafteranupdateorinsertion,buttheupdateorinsertionwillstillbeexecutedcorrectly.

Page 1860: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ReturnValueProperty

Returnsorsetsthereturnvalueforthespecifiedevent.YoucancancelthedefaultactionforsomeeventsbysettingthispropertytoFalse.Read/writeBoolean.

expression.ReturnValue

expressionRequired.AnexpressionthatreturnsaDSCEventInfoobject.

Page 1861: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheBeforeInserteventtopreventtheuserfromaddinganotherrecordtotherecordsetonceitreaches75records.

SubMSODSC_BeforeInsert(DSCEventInfo)DimrstCurrentData

'Setavariabletotherecordset.SetrstCurrentData=DSCEventInfo.DataPage.Recordset

'Checktoseeiftherecordsethasreacheditslimit.IfrstCurrentData.RecordCount>=75then

'Displayamessagetotheuser.MsgBox"Cannotaddanymorerecords."

'Canceltheinsertionoftherecord.DSCEventInfo.ReturnValue=FalseEndIfEndSub

Page 1862: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RevisionNumberProperty

ReturnstheMicrosoftOfficeWebComponentsrevisionnumber.Read-onlyString.

expression.RevisionNumber

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1863: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1864: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RightProperty

RightpropertyasitappliestotheChPlotAreaobject.

RightpropertyasitappliestotheChartSpace,ChAxis,ChCategoryLabel,ChChart,ChChartField,ChDataLabel,ChDataLabels,ChDropZone,ChErrorBars,ChLegend,ChLegendEntry,ChPoint,ChSeries,ChScrollView,ChTitle,andChTrendlineobjects.

Page 1865: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RightToLeftProperty

Trueifright-to-leftlanguagesupportisenabled.Forexample,settingthispropertytoTruecausesscrollbarstobedisplayedontheleft.Read/writeBoolean.

expression.RightToLeft

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1866: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RotationProperty

ReturnsorsetsaDoubleindicatingtherotationindegreesofthespecifiedthree-dimensionalchart.Validvaluesrangefrom0to360.Read/write.

expression.Rotation

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1867: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthenrotatesthechart145degrees.

SubSetGapDepth()

Dimcht3DColumnAsChChart

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Changethecharttoa3-DColumnchart.cht3DColumn.Type=chChartTypeColumn3D

'Rotatethechart.cht3DColumn.Rotation=145

EndSub

Page 1868: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowProperty

Returnsthenumberofthefirstrowinthespecifiedrange.Read-onlyLong.

expression.Row

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1869: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemakeseveryotherrowgreeninthecurrentregionforcellA1.

SubFormatRows()

DimrngCurrentRow

'Loopthroughalloftherowsinthecurrentregion.ForEachrngCurrentRowInSpreadsheet1.Cells(1,1).CurrentRegion.Rows

'Checktoseeiftherownumberisanevennumber.IfrngCurrentRow.RowMod2=0Then

'Settheinteriorcoloroftherow.rngCurrentRow.Interior.Color="LightGreen"EndIfNextEndSub

Page 1870: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowAxisProperty

PivotDataobject:ReturnsaPivotResultRowAxisobjectthatrepresentstherowaxis.

PivotViewobject:ReturnsaPivotGroupAxisobjectthatrepresentstherowaxis.

expression.RowAxis

expressionRequired.AnexpressionthatreturnsoneoftheobjectintheAppliesTolist.

Page 1871: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleinsertstwofieldsetsintothePivotTablelistintheactiveview.

SubAddFieldsToPT()

DimptView

SetptView=PivotTable1.ActiveView

ptView.ColumnAxis.InsertFieldSetptView.FieldSets("StoreType")

ptView.RowAxis.InsertFieldSetptView.FieldSets("Promotions")

EndSub

Page 1872: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowHeadingsProperty

ReturnsaHeadingscollectionthatrepresentstherowheadingsinthespecifiedwindow.UsetheCaptionpropertytocustomizetherowheadings.

expression.RowHeadings

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1873: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecreatesacustomdataentrysheetbydisablingsomeuserinterfaceelements,limitingtheviewablerangeintheactivewindow,andcustomizingtherowandcolumnheadings.

SubCreate_Datasheet()DimhdrColHeadingsDimhdrRowHeadingsDimwndActive

SetwndActive=Spreadsheet1.ActiveWindow

'HidevariousUIelements.wndActive.DisplayWorkbookTabs=FalseSpreadsheet1.DisplayToolbar=False

'Displaythetitlebarandsetit'scaption.Spreadsheet1.DisplayTitleBar=TrueSpreadsheet1.TitleBar.Caption="RevenueWorksheet"

'Resizethespreadsheetcomponent.Spreadsheet1.AutoFit=True

'Limittheviewablerangeoftheactivesheet.wndActive.ViewableRange="A1:D5"

'Setavariabletothecolumnheadingsintheactivewindow.SethdrColHeadings=wndActive.ColumnHeadings

'Setavariabletotherowheadingsintheactivewindow.SethdrRowHeadings=wndActive.RowHeadings

Page 1874: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'SettheheadingsofcolumnsAthroughD.hdrColHeadings(1).Caption="Qtr1"hdrColHeadings(2).Caption="Qtr2"hdrColHeadings(3).Caption="Qtr3"hdrColHeadings(4).Caption="Qtr4"

'Settheheadingsofrows1though5.hdrRowHeadings(1).Caption="1996"hdrRowHeadings(2).Caption="1997"hdrRowHeadings(3).Caption="1998"hdrRowHeadings(4).Caption="1999"hdrRowHeadings(5).Caption="2000"EndSub

Page 1875: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowHeightProperty

Returnsorsetstheheight(inpoints)ofallrowsinthespecifiedrange.ReturnsNulliftherowsarenotallthesameheight.UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.Read/writeVariant.

expression.RowHeight

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 1876: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstherowheightto15pointsforrows1through10.

Spreadsheet1.Range("a1:a10").RowHeight=15

Page 1877: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowMemberProperty

ReturnsaPivotRowMemberobjectthatrepresentstheinnermemberontherowaxisthatintersectsthespecifiedcell.

expression.RowMember

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1878: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowMembersProperty

ReturnsaPivotRowMemberscollectionthatcontainsthemembersontherowaxis.

expression.RowMembers

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1879: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1880: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowsProperty

Rangeobject:ReturnsaRangeobjectthatrepresentsalltherowsinthespecifiedrange.

Spreadsheetobject:ReturnsaRangeobjectthatrepresentsalltherowsontheactiveworksheet.

Worksheetobject:ReturnsaRangeobjectthatrepresentsalltherowsonthespecifiedworksheet.

expression.Rows

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1881: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemakeseveryotherrowboldinthecurrentregionforcellA1.

SubBoldEvenRows()

DimrngCurrentRow

'Loopthroughtherowsinthecurrentregion.ForEachrngCurrentRowInSpreadsheet1.Cells(1,1).CurrentRegion.

'Checkwhentherthecurrentrownumberisanevennumber.IfrngCurrentRow.RowMod2=0Then

'Boldthefontinthecurrentrow.rngCurrentRow.Font.Bold=TrueEndIfNextEndSub

Thisexamplemakesrow2bold.

Spreadsheet1.Rows(2).Font.Bold=True

Page 1882: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ScalingProperty

ReturnstheChScalingobjectforthespecifiedaxis.

expression.Scaling

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 1883: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsasecondvalue(y)axistotherightsideofthespecifiedchart.Thesecondaxisusesthesamescaleastheprimaryvalueaxis.

SubAddAxis()

DimchConstantsDimaxisScale

SetchConstants=ChartSpace1.Constants

SetaxisScale=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).

ChartSpace1.Charts(0).Axes.AddaxisScale

EndSub

Page 1884: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1885: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ScalingsProperty

ReturnsaChScalingobjectforthespecifiedchartorseries.

expression.Scalings(Dimension)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

DimensionRequiredChartDimensionsEnum.Specifiesthedimensiontobereturned.

Page 1886: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheminimumvalueforthespecifiedChScalingobject.

SubSetScaling()

DimchConstants

SetchConstants=ChartSpace1.Constants

ChartSpace1.Charts(0).SeriesCollection(0).Scalings_(chConstants.chDimCategories).Minimum=-10EndSub

Page 1887: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaFieldsProperty

ReturnstheSchemaFieldscollectionforthespecifiedschemarowsource.

expression.SchemaFields

expressionRequired.AnexpressionthatreturnsaSchemaRowsourceobject.

Page 1888: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1889: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaParametersProperty

ReturnstheSchemaParameterscollectionforthespecifiedschemarowsource.

expression.SchemaParameters

expressionRequired.AnexpressionthatreturnsaSchemaRowsourceobject.

Page 1890: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1891: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRelatedFieldsProperty

ReturnstheSchemaRelatedFieldscollectionforthespecifiedschemarelationship.

expression.SchemaRelatedFields

expressionRequired.AnexpressionthatreturnsaSchemaRelationshipobject.

Page 1892: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1893: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRelationshipsProperty

ReturnstheSchemaRelationshipscollectionforthedatasourcecontrol.

expression.SchemaRelationships

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1894: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SchemaRowsourcesProperty

ReturnstheSchemaRowsourcescollectionforthedatasourcecontrol.

expression.SchemaRowsources

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 1895: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksIndesignmode,thiscollectionisautomaticallypopulatedwithinformationfromthedatabase.Inbrowsemode,thiscollectioncontainsanyschemaobjectsthatareusedonthespecifiedpage,plusanythatareexplicitlyaddedbytheuser.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1896: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ScreenUpdatingProperty

Trueifscreenupdatingisturnedon.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ScreenUpdating

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1897: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytoFalsecausesthechartworkspaceorspreadsheettostopredrawing.Topreventscreenflickerortopreventtheuserfromseeingindividualupdates,setthispropertytoFalse,performyourupdateoperations,andthenresetthispropertytoTrue.AftersettingtheScreenUpdatingpropertytoFalse,thechartworkspaceorspreadsheetwillstillredrawiftheuserrefreshesthepage,andiftheRepaintmethodiscalledonthecontrol.

Page 1898: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleturnsoffscreenupdating.

Spreadsheet1.ScreenUpdating=False

Page 1899: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ScrollColumnProperty

Returnsorsetsthenumberoftheleftmostcolumninthepaneorwindow.Ifthepanesarefrozen,thispropertyexcludesthefrozenareas.Read/writeLong.

expression.ScrollColumn

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1900: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemovescolumnCsothatit'stheleftmostcolumninthewindow.

Spreadsheet1.ActiveWindow.ScrollColumn=3

Page 1901: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ScrollRowProperty

Returnsorsetsthenumberoftherowthatappearsatthetopofthepaneorwindow.Ifthepanesarefrozen,thispropertyexcludesthefrozenareas.Read/writeLong.

expression.ScrollRow

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1902: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemovesrowtentothetopofthewindow.

Spreadsheet1.ActiveWindow.ScrollRow=10

Page 1903: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ScrollViewProperty

YouusetheScrollViewpropertytoreturntheChScrollViewobjectforachart.Read-onlyChScrollView.

expression.ScrollView

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1904: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheChartSpaceobjectsupportsmultiplechartsandeachiscanbescrolledindependently.ThereisoneChScrollViewobjectperchart.YouusethepropertiesandmethodsoftheChScrollViewobjecttoretrieveinformationaboutandcontrolthescrollviewofachart.

Page 1905: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheScrollViewpropertytoworkwiththeSetPositionmethodoftheChScrollViewobject:

Chartspace1.Charts(1).ScrollView.SetPosition(HorizontalPosition.Value+200,VerticalPosition.Value+200)

Page 1906: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SectionProperty

ReturnsaSectionobjectthatrepresentsthesectionwherethespecifiedeventoccurred.

expression.Section

expressionRequired.AnexpressionthatreturnsaDSCEventInfoobject.

Page 1907: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SegmentsProperty

ReturnsaChSegmentsobjectthatrepresentsthecollectionofsegmentsinthespecifiedformatmap.

expression.Segments

expressionRequired.AnexpressionthatreturnsaChFormatMapobject.

Page 1908: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreated.Thesmallervaluesaredisplayedinwhite,thenlargervaluesaredisplayedinalightshadeofblue,andfinallythelargervaluesinthechartaredisplayedwithindarkblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1Dimchconstants

Setchconstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;persistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=DataServer;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderDetailstable.ChartSpace1.SetDatachconstants.chDimCategories,chconstants.chDataBound,"ProductID"ChartSpace1.SetDatachconstants.chDimValues,chconstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachconstants.chDimFormatValues,chconstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

Page 1909: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Specifythatthedivisionsinformattingbecreatedautomatically.segSegment1.HasAutoDivisions=True

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chconstants.chBoundaryValuePercentsegSegment1.End.ValueType=chconstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%.segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"

EndSub

Page 1910: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectedSheetsProperty

ReturnsaSheetscollectionthatrepresentsalltheselectedsheetsinthespecifiedwindow.Thiscollectionwillonlycontainonesheet,theactivesheet.

expression.SelectedSheets

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 1911: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectionProperty

ChartSpaceobject:ReturnsanObjectthatrepresentstheselectedobject.UsetheTypeNamefunctiontodeterminethetypeoftheselectedobject.

PivotTableobject:ReturnsorsetsanObjectthatrepresentstheselectedobject.

SpreadsheetandWindowobjects:ReturnsaRangeobjectthatrepresentstheselectedcells.

expression.Selection

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1912: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleTheprocedureinthisexamplerunswhenevertheselectioninthechartworkspacechanges.Iftheuserselectsanaxis,theproceduredisplaystheminimumandmaximumvaluesfortheaxis.

SubChartSpace1_SelectionChange()

DimchConstantsDimminvalDimmaxval

SetchConstants=ChartSpace1.Constants

IfChartSpace1.SelectionType=chConstants.chSelectionAxisThen

minval=ChartSpace1.Selection.Scaling.Minimum

maxval=ChartSpace1.Selection.Scaling.Maximum

MsgBox"minimum="&minval&"maximum="&maxvalEndIf

EndSub

Page 1913: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectionCollectionProperty

TheSelectionCollectionpropertytoreturnstheChSelectionCollectioncollectionoftheChartSpaceobject.

expression.SelectionCollection

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 1914: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheChSelectionCollectionobjectcontainsallcurrentlyselectedobjectsinachart.Thefirstiteminthecollectionistheprimaryselection.Additionalitemsaresecondaryselections.ThenumberofitemsinthiscollectioncanneverbezerobecausetheobjectreturnedbyChartSpace.SelectionCollection(0)isthesameobjectasthatreturnedbytheSelectionpropertyoftheChartSpaceobject.Thefirstobjectinthecollectioncanbeanychartobjectselection,butallsubsequentobjectsmustbepoints.IftheSelectionpropertyisnullandtherearenosecondaryselections,theSelectionCollectionwillequal0.

MultipleitemscannotbeselectedintheuserinterfaceoftheChartcomponent.Itemsmustbeaddedtoorremovedfromaselectionprogrammatically.Tocapturemultipleselectionswhenauserclicksonachart,youmustmonitorthemousemoveandmousebuttoneventsandidentifytheitemsbeingselectedusingtheRangeFromPointmethodoftheChartSpaceobject.Topreventthebuilt-inselectionhandlingbehavioroftheChartcomponentfrominterferingwithprogrammatictrackingofmultipleselections,youmustmakesurethattheAllowUISelectionpropertyoftheChartSpaceobjectissettoFalse.

Page 1915: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleshowshowtousetheSelectionCollectionpropertytoiteratethroughasetofselecteddatapointsinachart.

DimintCountDimintIndexWithChartSpace.Charts(0).SeriesCollection(0).Points(0).Select21.Points(1).Select21.Points(2).Select21.Points(3).Select21.Points(4).Select21EndWithintCount=ChartSpace.SelectionCollection.Count

ForintIndex=0TointCount-1MsgBox"Item("&iIndex&")="&TypeName(ChartSpace.SelectionCollectionNext

Page 1916: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1917: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectionTypeProperty

ChartSpaceobject:ReturnsaChartSelectionsEnumconstantthatrepresentsthetypeofobjectcurrentlyselectedinthechartworkspace.Read-only.

PivotTableobject:ReturnsaStringthatrepresentsthetypeofobjectcurrentlyselectedinthePivotTablelist.Read-only.

expression.SelectionType

expressionRequired.AnexpressionthatreturnsaChartSpaceorPivotTableobject.

Page 1918: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleTheprocedureinthisexamplerunswhenevertheselectioninthechartworkspacechanges.Iftheuserselectsanaxis,theproceduredisplaystheminimumandmaximumvaluesfortheaxis.

SubChartSpace1_SelectionChange()

DimchConstantsDimminvalDimmaxval

SetchConstants=ChartSpace1.Constants

IfChartSpace1.SelectionType=chConstants.chSelectionAxisThen

minval=ChartSpace1.Selection.Scaling.Minimum

maxval=ChartSpace1.Selection.Scaling.Maximum

MsgBox"minimum="&minval&"maximum="&maxvalEndIf

EndSub

Page 1919: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SeparatorProperty

Returnsorsetsthestringthatseparatesdatalabelcomponentsinthespecifiedseriesorchart.Read/writeString.

expression.Separator

expressionRequired.AnexpressionthatreturnsaChDataLabelsobject.

Page 1920: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangesthedata-labelseparatorcharacterforthespecifiedseries.

SubFormatDataLabels()

DimdlDataLabels

'Adddatalabelstothefirstseries.SetdlDataLabels=ChartSpace1.Charts(0).SeriesCollection(0)_.DataLabelsCollection.Add

'Displaythecategorynameinthedatalabels.dlDataLabels.HasCategoryName=True

'Setthedatalabelseperator.dlDataLabels.Separator=":"

EndSub

Page 1921: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SeriesCollectionProperty

ReturnstheChSeriesCollectioncollectionforthespecifiedchart.

expression.SeriesCollection

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1922: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1923: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthelinecolortoredforthespecifiedseries.

ChartSpace1.Charts(0).SeriesCollection(0).Line.Color="red"

Page 1924: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ServerFilterProperty

Returnsorsetstheserverfilterforthespecifiedobject.Read/writeString.

expression.ServerFilter

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1925: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAserverfilterisacriterionforspecifyingthetypeortypesofrecordstobefetchedfromtheserver.ThedatamodeladdsaserverfilterstringtotheWHEREclauseoftheSQLstatementthatitgenerates.YoucansetaserverfilteronlyonrecordsetsthathaveaprimaryrowsourceoftypedscTableordscView.

Page 1926: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1927: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SheetsProperty

SheetspropertyasitappliestotheSpreadsheetobject.

SheetspropertyasitappliestotheWorkbookobject.

Page 1928: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheWorkbookobject.

Page 1929: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAllProperty

ClearsAutoFiltercriteriawhensettoTrue.AddingcriteriasetsthispropertytoFalse.IftherearenocriteriaandthispropertyissettoFalse,nodatawillbeshown.Read/writeBoolean.

expression.ShowAll

expressionRequired.AnexpressionthatreturnsaCriteriaobject.

Page 1930: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleclearstheAutoFiltercriteriaforcolumn1ontheactiveworksheetandreappliestheAutoFiltertotheworksheet.

SubReapplyAutoFilter()

DimafAutoFilter

'Setavariabletothecurrentfiltersettings.SetafAutoFilter=Spreadsheet1.ActiveSheet.AutoFilter

'Showallrecords.afAutoFilter.Filters(1).Criteria.ShowAll=True

'Reapplythefilters.afAutoFilter.Apply

EndSub

Page 1931: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1932: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAsProperty

ReturnsorsetsaPivotShowAsEnumconstantthatrepresentshowaPivotTotalobjectisdisplayed.Read-write.

expression.ShowAs

expressionRequired.AnexpressionthatreturnsaPivotTotalobject.

Page 1933: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsanewtotaltoPivotTable1.Thenewtotalisformattedtodisplayasapercentageoftheparentrowfield,andwillnotappearinthePivotTableFieldListdialogbox.

SubAdd_Total()

DimvwViewDimptConstantsDimtotNewTotal

SetvwView=PivotTable1.ActiveViewSetptConstants=PivotTable1.Constants

'Addanewtotalnamed"TotalBudget"tothecurrentview.SettotNewTotal=vwView.AddTotal("TotalBudget",vwView.FieldSets("Budget").Fields(0),_ptConstants.plFunctionSum)

'InsertthenewlycreatedtotalintothedetailareaofthePivotTable.vwView.DataAxis.InsertTotaltotNewTotal

'Showthetotalsasapercentageoftheparentrowfield.totNewTotal.ShowAs=ptConstants.plShowAsPercentOfRowParent

'DonotdisplaythenewtotalinthePivotTableFieldListdialogbox.totNewTotal.DisplayInFieldList=False

EndSub

Page 1934: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAsValueProperty

ReturnsaVariantthatrepresentsthevalueofthespecifiedPivotAggregateobjectwithoutpercentageformatting.Usethispropertytoreturnthevalueofacell'saggregatewhentheShowAspropertyhasbeensettooneofthefollowingvalues:plShowAsPercentOfColumnParent,plShowAsPercentOfColumnTotal,plShowAsPercentOfGrandTotal,plShowAsPercentOfRowParent,plShowAsPercentOfRowTotal.Read-only.

expression.ShowAsValue

expressionRequired.AnexpressionthatreturnsaPivotAggregateobject.

Page 1935: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaystheaggregateforthethirdmemberoftherowfieldinamessagebox.

SubGetTotal()

DimptDataDimpmRowMemDimpmColMem

'SetavariabletothePivotTabledata.SetptData=PivotTable1.ActiveData

'Setavariabletothethirditemcontainedinthefield'thathasbeenaddedtotherowaxis.SetpmRowMem=ptData.RowAxis.Member.ChildMembers(2)

'Inthisexample,therearenofieldsonthecolumnaxis.SetpmColMem=ptData.ColumnAxis.Member

'Displaythevalueoftheaggregate.MsgBoxptData.Cells(pmRowMem,pmColMem).Aggregates(0).ShowAsValue

EndSub

Page 1936: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowDelButtonProperty

TrueiftheDeletebutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowDelButton

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1937: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowFilterBySelectionButtonProperty

TrueiftheFilterbySelectionbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowFilterBySelectionButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1938: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowFirstButtonProperty

TrueiftheFirstbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowFirstButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1939: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowHelpButtonProperty

TrueiftheHelpbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowHelpButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1940: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowLabelProperty

Trueiftherecordnavigationcontrollabelisdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowLabel

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1941: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowLastButtonProperty

TrueiftheLastbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowLastButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1942: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowNewButtonProperty

TrueiftheNewbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowNewButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1943: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowNextButtonProperty

TrueiftheNextbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowNextButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1944: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowPrevButtonProperty

TrueifthePreviousbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowPrevButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1945: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowSaveButtonProperty

TrueiftheSavebutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowSaveButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1946: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowSortAscendingButtonProperty

TrueiftheSortAscendingbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowSortAscendingButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1947: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowSortDescendingButtonProperty

TrueiftheSortDescendingbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowSortDescendingButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1948: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowToggleFilterButtonProperty

TrueiftheToggleFilterbutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowToggleFilterButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1949: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowUndoButtonProperty

TrueiftheUndobutton(recordnavigationcontrol)isdisplayed.ThedefaultvalueisTrue.Read/writeBoolean.

expression.ShowUndoButton

expressionRequired.AnexpressionthatreturnsaRecordNavigationControlobject.

Page 1950: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SideWallProperty

ReturnsaChSurfaceobjectthatrepresentsthesidewallofathree-dimensionalchart.UsethepropertiesandmethodsofthereturnedChSurfaceobjecttoformatthesidewallofthespecifiedchart.

expression.SideWall

expressionRequired.AnexpressionthatreturnsaChPlotAreaobject.

Page 1951: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DColumnchartandthenformatsthebackwall,sidewall,andfloorofthechart.

SubFormatWallsFloor()

Dimcht3DColumnDimchConstantsDimpaPlotArea

SetchConstants=Chartspace1.Constants

'SetavariabletothefirstchartinChartspace1.Setcht3DColumn=ChartSpace1.Charts(0)

'Setavariabletotheplotarea.SetpaPlotArea=cht3DColumn.PlotArea

'Changethecharttoa3DColumnchart.cht3DColumn.Type=chConstants.chChartTypeColumnClustered3D

'Formatthebackwallofthechart.paPlotArea.BackWall.Interior.SetSolid"Yellow"paPlotArea.BackWall.Thickness=5

'Formatthesidewallofthechart.paPlotArea.SideWall.Interior.SetSolid"Yellow"paPlotArea.SideWall.Thickness=5

'Formatthefloorofthechart.paPlotArea.Floor.Interior.SetSolid"Blue"

Page 1952: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

paPlotArea.Floor.Thickness=5

EndSub

Page 1953: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SizeProperty

Returnsorsetsthefontormarkersize(inpoints).ReturnsNullifitisusedonarangeinwhichthecharactersarenotallthesamesize.UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.Read/writeVariantfortheFontobject;read/writeLongforallotherobjectsintheAppliesTolist.

expression.Size

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1954: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefontsizeto6pointsforthespecifiedaxis.

Setc=ChartSpace1.ConstantsChartSpace1.Charts(0).Axes(c.chAxisPositionLeft).Font.Size=6

Page 1955: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1956: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SizeRepresentsProperty

Returnsorsetswhatthebubblesizerepresentsonabubblechart.Read/writeChartSizeRepresentsEnum.

expression.SizeRepresents

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 1957: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheSizeRepresentspropertyforabubblechart.

SubSetSizeParameter()

DimchConstants

SetchConstants=Chartspace1.Constants

ChartSpace1.Charts(0).SizeRepresents=chConstants.chSizeIsArea

EndSub

Page 1958: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SolveOrderProperty

ReturnsorsetsaLongthatrepresentsthesolveorderforthespecifiedtotal.Read/write.

expression.SolveOrder

expressionRequired.AnexpressionthatreturnsaPivotTotalobject.

Page 1959: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1960: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SortDirectionProperty

Returnsorsetsthedirectioninwhichthespecifiedfieldistobesorted.Read/writePivotFieldSortDirectionEnum.

expression.SortDirection

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1961: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThefieldissortedbasedonthesortingrulesoftheunderlyingdataprovider.Forexample,adataprovidermightsortdatesalphanumerically(February,January,andsoon)orinachronologicalmonthlysequence(January,February,andsoon)

Page 1962: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SortOnProperty

Returnsorsetsthetotalusedtosortthespecifiedfield.Read/writePivotTotal.

expression.SortOn

expressionRequired.AnexpressionthatreturnsaPivotFieldobject..

Page 1963: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SortOnScopeProperty

Returnsorsetsthearrayofstringsusedtonarrowthesortingscopeforthespecifiedfield.Read/writeVariant.

expression.SortOnScope

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1964: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceProperty

Returnsorsetsthesourceforthespecifiedpagefieldorpagerowsource.Read/writeString.

expression.Source

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 1965: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceAxisProperty

ReturnsaPivotAxisobjectthatrepresentsthesourceaxisofthespecifiedresultaxis.

expression.SourceAxis

expressionRequired.AnexpressionthatreturnsaPivotResultAxisobject.

Page 1966: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceColumnAxisProperty

ReturnsaPivotGroupAxisobjectthatrepresentsthesourceaxisofthespecifiedresultaxis.

expression.SourceColumnAxis

expressionRequired.AnexpressionthatreturnsaPivotResultColumnAxisobject.

Page 1967: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceDataAxisProperty

ReturnsaPivotDataAxisobjectthatrepresentsthesourceaxisofthespecifiedresultaxis.

expression.SourceDataAxis

expressionRequired.AnexpressionthatreturnsaPivotResultDataAxisobject.

Page 1968: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceFieldProperty

ReturnsaPivotFieldobjectthatrepresentsthesourcefieldforthespecifiedresultfield.

expression.SourceField

expressionRequired.AnexpressionthatreturnsaPivotResultFieldobject.

Page 1969: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceFilterAxisProperty

ReturnsaPivotFilterAxisobjectthatrepresentsthesourceaxisofthespecifiedresultaxis.

expression.SourceFilterAxis

expressionRequired.AnexpressionthatreturnsaPivotResultFilterAxisobject.

Page 1970: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceLabelProperty

ReturnsaPivotLabelobjectthatrepresentsthesourcelabelofthespecifiedresultlabel.

expression.SourceLabel

expressionRequired.AnexpressionthatreturnsaPivotResultLabelobject.

Page 1971: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceMemberProperty

ReturnsaPivotMemberobjectthatrepresentsthesourcememberforthespecifiedaxismember.

expression.SourceMember

expressionRequired.AnexpressionthatreturnsaPivotAxisMemberobject.

Page 1972: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourcePageAxisProperty

ReturnsaPivotGroupAxisobjectthatrepresentsthesourceaxisofthespecifiedresultaxis.

expression.SourcePageAxis

expressionRequired.AnexpressionthatreturnsaPivotResultPageAxisobject.

Page 1973: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SourceRowAxisProperty

ReturnsaPivotGroupAxisobjectthatrepresentsthesourceaxisforthespecifiedresultaxis.

expression.SourceRowAxis

expressionRequired.AnexpressionthatreturnsaPivotResultRowAxisproperty.

Page 1974: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SplitMaximumProperty

IfthespecifiedChScalingobjecthasasplit,thispropertyreturnsorsetsthemaximumvalueforthesplit.ThisvalueshouldbegreaterthanthevalueoftheSplitMinimumproperty.Read/writeDouble.

expression.SplitMaximum

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1975: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesplitsthevalueaxisofthefirstchartinChartSpace1andsetsthesplitminimumandsplitmaximumvalues.Thevalueaxisissplit,andvaluesbetween1000and5000willnotbedisplayed.

SubSplit_Value_Axis()DimchConstantsDimscValueAxisSetchConstants=ChartSpace1.Constants'Setavariabletothescalingobjectofthevalueaxis.SetscValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).Scaling'Addasplittothevalueaxis.scValueAxis.HasSplit=True'Specifytheminnimumvalueofthesplit.scValueAxis.SplitMinimum=1000'Specifythemaximumvalueforthesplit.scValueAxis.SplitMaximum=5000EndSub

Page 1976: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SplitMinimumProperty

IfthespecifiedChScalingobjecthasasplit,thispropertyreturnsorsetstheminimumvalueforthesplit.ThisvalueshouldbelessthanthevalueoftheSplitMaximumproperty.Read/writeDouble.

expression.SplitMinimum

expressionRequired.AnexpressionthatreturnsaChScalingobject.

Page 1977: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesplitsthevalueaxisofthefirstchartinChartSpace1andsetsthesplitminimumandsplitmaximumvalues.Thevalueaxisissplit,andvaluesbetween1000and5000willnotbedisplayed.

SubSplit_Value_Axis()DimchConstantsDimscValueAxisSetchConstants=ChartSpace1.Constants'Setavariabletothescalingobjectofthevalueaxis.SetscValueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).Scaling'Addasplittothevalueaxis.scValueAxis.HasSplit=True'Specifytheminnimumvalueofthesplit.scValueAxis.SplitMinimum=1000'Specifythemaximumvalueforthesplit.scValueAxis.SplitMaximum=5000EndSub

Page 1978: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

StandardHeightProperty

Returnsthestandard(default)heightofalltherowsintheworksheetinpoints.Read-onlyDouble.

expression.StandardHeight

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1979: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresetstherowsandcolumnsintheactivesheetofSpreadsheet1totheirdefaultsize.

SubReset_Height_Width()DimshtActiveSetshtActive=Spreadsheet1.ActiveSheet

shtActive.Rows.RowHeight=shtActive.StandardHeightshtActive.Columns.ColumnWidth=shtActive.StandardWidthEndSub

Page 1980: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

StandardWidthProperty

Returnsthestandard(default)widthofallthecolumnsintheworksheet.ThewidthofonecharacterintheNormalstyleisusedastheunitofmeasure.Read/writeDouble.

expression.StandardWidth

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 1981: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleresetstherowsandcolumnsintheactivesheetofSpreadsheet1totheirdefaultsize.

SubReset_Height_Width()DimshtActiveSetshtActive=Spreadsheet1.ActiveSheet

shtActive.Rows.RowHeight=shtActive.StandardHeightshtActive.Columns.ColumnWidth=shtActive.StandardWidthEndSub

Page 1982: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1983: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

StatusProperty

ReturnsaDscStatusEnumconstantthatrepresentsthestatusofthecurrentevent.ThispropertyissupportedonlyintheAfterDeleteevent.Read-only.

expression.Status

expressionRequired.AnexpressionthatreturnsaDSCEventInfoobject.

Page 1984: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsingthispropertywithanunsupportedeventwillresultinarun-timeerror.

Page 1985: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 1986: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

StyleProperty

Returnsorsetsthemarkerstyleforthespecifiedseriesorchart.Read/writeChartMarkerStyleEnum.

expression.Style

expressionRequired.AnexpressionthatreturnsaChMarkerobject.

Page 1987: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthemarkerstyleforthespecifiedseries.

SubSetMarkerStyle()

DimchConstants

SetchConstants=ChartSpace1.Constants

ChartSpace1.Charts(0).SeriesCollection(0).Marker_.Style=chConstants.chMarkerStyleStar

EndSub

Page 1988: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SublistRelationshipsProperty

ReturnstheSublistRelationshipscollectionforthespecifiedrecordsetdefinition.

expression.SublistRelationships

expressionRequired.AnexpressionthatreturnsaRecordsetDefobject.

Page 1989: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAsublistrelationshipreferstoarowsourceinanotherrecordsetdefinitionthathasamany-to-onerelationshipwiththeprimarypagerowsourceinthespecifiedrecordsetdefinition.

Forinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1990: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SublistSchemaRelationshipsProperty

ReturnstheSublistSchemaRelationshipscollectionforthespecifiedschemarowsource.

expression.SublistSchemaRelationships

expressionRequired.AnexpressionthatreturnsaSchemaRowsourceobject.

Page 1991: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 1992: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalBackColorProperty

Returnsorsetsthebackcolorforthesubtotalinthespecifiedfield.Forsubtotals,thisproperty’ssettingoverridestheTotalBackColorpropertysetting.Read/writeVariant.

expression.SubtotalBackColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1993: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 1994: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalFontProperty

ReturnsaPivotFontobjectthatrepresentsthefontforsubtotals.

expression.SubtotalFont

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1995: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalForeColorProperty

Returnsorsetstheforegroundcolorforsubtotalsinthespecifiedfield.Thisproperty’ssettingoverridestheTotalForeColorpropertysetting.Read/writeVariant.

expression.SubtotalForeColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1996: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 1997: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalLabelBackColorProperty

Returnsorsetsthebackcolorforthesubtotalinthespecifiedfield.Read/writeVariant.

expression.SubtotalLabelBackColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 1998: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 1999: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalLabelFontProperty

ReturnsaPivotFontobjectthatrepresentsthefontforsubtotallabelsinthespecifiedfield.

expression.SubtotalLabelFont

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 2000: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalLabelForeColorProperty

Returnsorsetstheforegroundcolorforsubtotallabelsinthespecifiedfield.Read/writeVariant.

expression.SubtotalLabelForeColor

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 2001: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 2002: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2003: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalLabelHAlignmentProperty

ReturnsorsetsaPivotHAlignmentEnumconstantthatrepresentsthehorizontalalignmentofthesubtotallabelsforthespecifiedfield.Read/write.

expression.SubtotalLabelHAlignment

expressionRequired.AnexpressionthatreturnsaPivotFieldobject.

Page 2004: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SubtotalsProperty

Trueifthesubtotalisdisplayedforthespecifiedfield.Read/writeBoolean.

expression.Subtotals(Subtotals)

expressionAnexpressionthatreturnsaPivotFieldobject.Thefieldmustbeonaroworcolumnaxis.

SubtotalsRequiredLong.Specifiesthesubtotal.

Page 2005: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TabRatioProperty

Returnsorsetstheratioofthewidthoftheworkbook'stabareatothewidthofthewindow'shorizontalscrollbar(asanumberbetween0(zero)and1;thedefaultvalueis0.6).Changingthevalueofthispropertyhasaninverseeffectonthelengthofthewindow'shorizontalscrollbar.Increasingthispropertyfromthedefaultvaluedecreasesthelengthofthescrollbar,whiledecreasingthispropertyfromthedefaultvalueincreasesthelengthofthescrollbar.Read/writeDouble.

expression.TabRatio

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 2006: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplemakestheworkbooktabhalfthewidthofthehorizontalscrollbar.

Spreadsheet1.ActiveWindow.TabRatio=0.5

Page 2007: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2008: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TextProperty

TextpropertyasitappliestothePivotAggregateandPivotDetailCellobjects.

TextpropertyasitappliestotheRangeobject.

Page 2009: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariablefortheformattedvalueofcellA1.

txt=Spreadsheet1.Range("a1").Text

Page 2010: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2011: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TextureFormatProperty

ReturnsaChartTextureFormatEnumconstantindicatingtheformatusedtodisplaythetextureforthespecifiedChInteriorobject.Thispropertywillreturnarun-timeerrorifthespecifiedinteriorisnotfilledwithatextureorapicture.Read-only.

expression.TextureFormat

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 2012: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TextureNameProperty

ReturnsaStringindicatingthenameofandpathtothepicturefilethatwasusedtofillthespecifiedChInteriorobject.Thispropertywillreturnarun-timeerroriftheinteriorofthespecifiedobjectwassettoapresettexture.Read-only.

expression.TextureName

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 2013: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheSetTexturedmethodtosetthetexturefileforthefill.

Page 2014: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2015: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TexturePlacementProperty

ReturnsaChartTexturePlacementEnumconstantindicatinghowthetexturehasbeenappliedtothespecifiedChInteriorobject.Read-only.

expression.TexturePlacement

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 2016: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertyonlyaffects3-Dcharts.

Page 2017: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TextureStackUnitProperty

ReturnsaDoubleindicatingthetexturestackunitforthespecifiedChInteriorobject.Thispropertywillreturnarun-timeerrorunlesstheSetTexturemethodwasusedtofilltheinterioroftheobjectandthemethod'sTextureFormatargumentissettoavalueofchStackScale.Read-only.

expression.TextureStackUnit

expressionRequired.AnexpressionthatreturnsaChInteriorobject.

Page 2018: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ThicknessProperty

ReturnsorsetsaLongspecifyingthethicknessofthespecifieddataseriesorsurfaceinathree-dimensionalchart.Read/write.

expression.Thickness

expressionRequired.AnexpressionthatreturnsaChSeriesoraChSurfaceobject.

Page 2019: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethispropertytosetthethicknessofalineina3-DLinechartorthethicknessofthepieina3-DPiechart.

Page 2020: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toa3-DLinechartandthensetsthethicknessforeachlineinthechart.

SubSetLineThickness()

Dimcht3DLineDimserSeries

'SetavariabletothefirstchartinChartspace1.Setcht3DLine=ChartSpace1.Charts(0)

'Changethecharttoa3DLinechart.cht3DLine.Type=chChartTypeLine3D

'Setthethicknessofeachlineinthechart.ForEachserSeriesIncht3DLine.SeriesCollectionserSeries.Thickness=4NextEndSub

Page 2021: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TickLabelSpacingProperty

Returnsorsetsthenumberofcategoriesbetweentick-marklabelsforthespecifiedaxis.Appliesonlytocategoryaxes.Read/writeLong.

expression.TickLabelSpacing

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 2022: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthenumberofcategoriesbetweentick-marklabelsforthespecifiedaxistotwo.

ChartSpace1.Charts(0).Axes(1).TickLabelSpacing=2

Page 2023: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2024: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TickLabelUnitTypeProperty

ReturnsorsetsaChartAxisUnitTypeEnumconstantthatrepresentstheintervalusedtodisplaytickmarklabelsonatime-scaledcategoryaxis.Read/write.

expression.TickLabelUnitType

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 2025: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toalinechart,thenformatsthecategoryaxissothatthevaluesaregroupedbymonth.Theaveragevalueofeachmonthisdisplayedonthechart.

SubFormatTimeScaling()

DimchConstantsDimaxCategory

SetchConstants=ChartSpace1.Constants

'ChangethecharttoaLinechart.ChartSpace1.Charts(0).Type=chConstants.chChartTypeLine

'Setavariabletothecategoryaxis.SetaxCategory=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)

'Specifythatyouwilldeterminethegroupingsettingsofthe'axis.Notethatthislineofcodeisnecessaryonlyifthe'GroupingTypepropertyfortheaxishasbeenpreviouslysetto'chAxisGroupingNone.axCategory.GroupingType=chConstants.chAxisGroupingManual

'Groupthecategoryaxisbymonth.axCategory.GroupingUnitType=chConstants.chAxisUnitMonth

'Createanewgroupingforeverymonth.axCategory.GroupingUnit=1

'Displaytheaverageoftheitemsineachgroup.

Page 2026: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

axCategory.GroupingTotalFunction=chConstants.chFunctionAvg

'Aticklabelisdisplayedforeverymonth.axCategory.TickLabelUnitType=chConstants.chAxisUnitMonth

'Atickmarkisdisplayedforeverythreemonths.axCategory.TickMarkUnitType=chConstants.chAxisUnitQuarter

EndSub

Page 2027: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TickMarkSpacingProperty

Returnsorsetsthenumberofcategoriesbetweentickmarksonthespecifiedaxis.Appliesonlytocategoryaxes.UsetheMajorUnitandMinorUnitpropertiestosettick-markspacingonvalueaxes.Read/writeLong.

expression.TickMarkSpacing

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 2028: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthenumberofcategoriesbetweentickmarksonthespecifiedaxistotwo.

ChartSpace1.Charts(0).Axes(1).TickMarkSpacing=2

Page 2029: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2030: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TickMarkUnitTypeProperty

ReturnsorsetsaChartAxisUnitTypeEnumconstantthatrepresentstheintervalusedtodisplaytickmarksonatime-scaledcategoryaxis.Read/write.

expression.TickMarkUnitType

expressionRequired.AnexpressionthatreturnsaChAxisobject.

Page 2031: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleconvertsthefirstchartinChartspace1toalinechart,thenformatsthecategoryaxissothatthevaluesaregroupedbymonth.Theaveragevalueofeachmonthisdisplayedonthechart.

SubFormatTimeScaling()

DimchConstantsDimaxCategory

SetchConstants=ChartSpace1.Constants

'ChangethecharttoaLinechart.ChartSpace1.Charts(0).Type=chConstants.chChartTypeLine

'Setavariabletothecategoryaxis.SetaxCategory=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)

'Specifythatyouwilldeterminethegroupingsettingsofthe'axis.Notethatthislineofcodeisnecessaryonlyifthe'GroupingTypepropertyfortheaxishasbeenpreviouslysetto'chAxisGroupingNone.axCategory.GroupingType=chConstants.chAxisGroupingManual

'Groupthecategoryaxisbymonth.axCategory.GroupingUnitType=chConstants.chAxisUnitMonth

'Createanewgroupingforeverymonth.axCategory.GroupingUnit=1

'Displaytheaverageoftheitemsineachgroup.

Page 2032: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

axCategory.GroupingTotalFunction=chConstants.chFunctionAvg

'Aticklabelisdisplayedforeverymonth.axCategory.TickLabelUnitType=chConstants.chAxisUnitMonth

'Atickmarkisdisplayedforeverythreemonths.axCategory.TickMarkUnitType=chConstants.chAxisUnitQuarter

EndSub

Page 2033: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TimeValueProperty

ReturnsaVariantthatrepresentsthevalueofthespecifiedmemberwiththeappropriatedateoftimeformat.Read-only.

expression.TimeValue

expressionRequired.AnexpressionthatreturnsaPivotMemberobject.

Page 2034: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2035: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TipTextProperty

TipTextpropertyasitappliestotheChSeriesobject.

TipTextpropertyasitappliestotheOCCommandobject.

Page 2036: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleAsitappliestotheChSeriesobject.

Page 2037: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TitleProperty

ReturnsaChTitleobjectthatrepresentsthetitleofthespecifiedaxisorchart.

expression.Title

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2038: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthespecifiedcharttoincludeatitleandsetsthetitletext.

SubSetChartTitle()

'Enablethecharttitle.ChartSpace1.Charts(0).HasTitle=True

'Setthecharttitle.ChartSpace1.Charts(0).Title.Caption="SatisfactionData"

EndSub

Page 2039: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2040: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TitleBarProperty

TitleBarpropertyasitappliestothePivotViewobject.

TitleBarpropertyasitappliestotheSpreadsheetobject.

Page 2041: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthetitlecaptionforthespreadsheet.

Spreadsheet1.TitleBar.Caption="MonthlySales"

Page 2042: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ToolbarProperty

ReturnsanMSComctlLib.Toolbarobjectthatrepresentsthetoolbar.

expression.Toolbar

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2043: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethereturnedMSComctlLib.ToolbarobjecttocustomizethetoolbarintheMicrosoftOfficeWebComponents.Youcanaddorremovebuilt-inbuttonsaswellascustombuttons.

Page 2044: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2045: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TopProperty

ToppropertyasitappliestotheChartSpace,ChCategoryLabel,ChChartField,ChDataLabel,ChDataLabels,ChErrorBars,ChLegendEntry,ChPoint,ChSeries,ChTrendline,PivotAggregate,PivotAxisMember,PivotColumnMember,PivotDetailCell,PivotPageMember,PivotResultAxis,PivotResultColumnAxis,PivotResultDataAxis,PivotResultFilterAxis,PivotResultGroupAxis,PivotResultLabel,PivotResultPageAxis,PivotResultRowAxis,PivotRowMember,andPivotTableobjects.

ToppropertyasitappliestotheChScrollViewobject.

ToppropertyasitappliestothePivotDataobject.

ToppropertyasitappliestotheRangeobject.

ToppropertyasitappliestotheWindowobject.

Page 2046: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsavariableforthedistancefromthetopofthespreadsheetwindowtocellA35.

t2=Spreadsheet1.Range("A35").Top

Page 2047: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Top2Property

ReturnsaLongvaluethatrepresentsthetopofthedataareaofthePivotTablelist.Read-only.

expression.Top2

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 2048: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThispropertywillreturnavalueof1ifthetoolbarisnotdisplayed.

Page 2049: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2050: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TopLeftProperty

TopLeftpropertyasitappliestothePivotRangeobject.

TopLeftpropertyasitappliestothePivotDetailRangeobject.

Page 2051: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TopOffsetProperty

ReturnsorsetsaLongvaluethatrepresentsthenumberofpixelstoscrollthedataareadown.Read/write.

expression.TopOffset

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 2052: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheLeftOffsettoscrollthedataareatotheleft.

Page 2053: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplescrollsthedataareaofPivotTable1down45pixelsandleft45pixels.

SubScrollDataArea()

DimptData

SetptData=PivotTable1.ActiveData

'Scroll45pixelsdown.ptData.TopOffset=45

'Scrollthedataareatotheleft.ptData.LeftOffset=45

EndSub

Page 2054: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalProperty

ReturnsaPivotTotalobjectthatrepresentsthetotalforthespecifiedaggregate.

expression.Total

expressionRequired.AnexpressionthatreturnsaPivotAggregateobject.

Page 2055: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalAllMembersProperty

Trueiffilteredmembersareincludedinsubtotals.IfthispropertyissettoFalse,subtotalsdonotincludemembersthathavebeenfilteredoutoftheview.ThedefaultvalueisFalse.Read/writeBoolean.

expression.TotalAllMembers

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 2056: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalBackColorProperty

Returnsorsetsthebackgroundcolorforalltotals.Read/writeVariant.

expression.TotalBackColor

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 2057: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 2058: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalColumnMemberProperty

ReturnsaPivotColumnMemberobjectthatrepresentsthememberusedtodisplaythegrandtotal..

expression.TotalColumnMember

expressionRequired.AnexpressionthatreturnsaPivotColumnMemberobject.

Page 2059: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalFontProperty

ReturnsaPivotFontobjectthatrepresentsthefontusedforaggregatesdisplayedinacellorinadetailgridfooter.

expression.TotalFont

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 2060: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalForeColorProperty

Returnsorsetstheforegroundcolorforalltotals.Read/writeVariant.

expression.TotalForeColor

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 2061: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenyousetthisproperty,youcanuseeitheraLongvaluerepresentingared-green-bluecolorvalueoraStringvaluenamingavalidHTMLcolorvalue.Forexample,tosettheobjectcolortored,youcouldusethehexadecimalvalue&HFF,thedecimalvalue255,orthestringvalue"red."InMicrosoftVisualBasic,youcanusetheRGBfunctiontocreateared-green-bluecolorvalue(redisRGB(255,0,0)).ThispropertyalwaysreturnsthecolorasaLongvaluerepresentingared-green-bluecolorvalue.

Page 2062: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalMemberProperty

ReturnsaPivotAxisMemberobjectthatrepresentsthememberusedtodisplaysubtotals.

expression.TotalMember

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2063: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2064: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalOrientationProperty

Returnsorsetstheorientationusedtodisplaysummarytotalswhenthereismorethanonetotal.Read/writePivotViewTotalOrientationEnum.

expression.TotalOrientation

expressionRequired.AnexpressionthatreturnsaPivotViewobject.

Page 2065: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalPageMemberProperty

ReturnsaPivotPageMemberobjectthatrepresentsthememberusedtodisplaythegrandtotal.

expression.TotalPageMember

expressionRequired.AnexpressionthatreturnsaPivotPageMemberobject.

Page 2066: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalRowHeightProperty

ReturnsorsetsaLongvaluethatrepresentstheheightoftherowthatcontainsthesubtotalforthespecifiedmember.Read/write.

expression.TotalRowHeight

expressionRequired.AnexpressionthatreturnsaPivotRowMemberobject.

Page 2067: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalRowMemberProperty

ReturnsaPivotRowMemberobjectthatrepresentsthememberusedtodisplaythegrandtotal.

expression.TotalRowMember

expressionRequired.AnexpressionthatreturnsaPivotRowMemberobject.

Page 2068: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalsProperty

PivotDataAxisandPivotResultDataAxisobjects:ReturnsaPivotTotalscollectionthatcontainsallthePivotTotalobjectsonthesummaryaxis.Thetotalsaredisplayedinthesummaryareaforeachcell.

PivotViewobject:ReturnsaPivotTotalscollectionthatcontainsallthetotalsinthecurrentview.

expression.Totals

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2069: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2070: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TotalTypeProperty

Returnsorsetsthetypeoftotal.Read/writeDscTotalTypeEnum.

expression.TotalType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2071: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksValuesotherthandscNonearevalidonlywithpagefieldsoftypedscGrouping.

Page 2072: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2073: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TypeProperty

TypepropertyasitappliestotheChAxisobject.

TypepropertyasitappliestotheChChartandChSeriesobjects.

TypepropertyasitappliestotheChErrorBarsobject.

TypepropertyasitappliestotheChScalingobject.

TypepropertyasitappliestotheChTrendlineobject.

TypepropertyasitappliestothePageRelationshipobject.

TypepropertyasitappliestothePivotFieldobject.

TypepropertyasitappliestothePivotFieldSetobject.

TypepropertyasitappliestothePivotTotalobject.

TypepropertyasitappliestotheSchemaRowsourceobject.

TypepropertyasitappliestotheSectionobject.

TypepropertyasitappliestotheWorksheetobject.

TypepropertyasitappliestotheWindowobject.

Page 2074: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthecharttypeforthespecifiedchart.

SubSetChartType()

DimchConstants

SetchConstants=ChartSpace1.Constants

ChartSpace1.Charts(0).Type=chConstants.chChartTypeLineMarkers

EndSub

Page 2075: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2076: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UnderlineProperty

Returnsorsetsthefontunderlinestyleforthespecifiedrange.Read/writeUnderlineStyleEnumfortheChFontandPivotFontobjects;read/writeVariantfortheFontobject(returnsNullifthecharactersinthefontdonotallhavethesameunderlinestyle;otherwise,returnsoneoftheUnderlineStyleEnumconstants).UsetheIsNullfunctiontodeterminewhetherthereturnvalueisNull.

expression.Underline

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2077: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsasingleunderlinetoallcellvaluesinrow1.

SubFormatFont()

DimssConstants

SetssConstants=Spreadsheet1.Constants

Spreadsheet1.Rows(1).Font.Underline=ssConstants.owcUnderlineStyleSingle

EndSub

Page 2078: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UniqueNameProperty

Returnstheuniquenameofthespecifiedobject(theuniquememberreferencereturnedbytheprovider).ReturnsNullifthemembersourceisaRecordsetDefobject.Read-onlyString.

expression.UniqueName

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2079: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UniqueTableProperty

Specifiesthenameoftheupdatabletablewhenaformisboundtoamultitablevieworstoredprocedure.Read/writeString.

expression.UniqueTable

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2080: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsableHeightProperty

Returnsthemaximumheightofthespaceinpixelsthatawindowcanoccupyintheapplicationwindowarea.ReturnsthesamevalueastheHeightproperty.Read-onlyDouble.

expression.UsableHeight

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 2081: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoucanusetheUsableWidthpropertytoreturnthemaximumpossiblewidthforawindow.

Page 2082: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsableWidthProperty

Returnsthemaximumwidthofthespaceinpixelsthatawindowcanoccupyintheapplicationwindowarea.ReturnsthesamevalueastheWidthproperty.Read-onlyDouble.

expression.UsableWidth

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 2083: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheUsableHeightpropertytoreturnthemaximumpossibleheightforawindow.

Page 2084: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsedRangeProperty

ReturnsaRangeobjectthatrepresentstheusedrangeonthespecifiedworksheet.

expression.UsedRange

expressionRequired.AnexpressionthatreturnsaWorksheetobject.

Page 2085: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleadjuststherowheightandcolumnwidthfortheusedrangeontheactiveworksheettofitthedatacontainedintherange.

SubAutoFitSpreadsheet()

DimrngUsedRange

'Setavariabletotheusedrangeintheactivesheet.SetrngUsedRange=Spreadsheet1.ActiveSheet.UsedRange

'Autofittherows.rngUsedRange.AutoFitRows

'Autofitthecolumns.rngUsedRange.AutoFitColumns

EndSub

Page 2086: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UseRemoteProviderProperty

Trueifthedatasourcecontrolisusingaremoteprovider.Read/writeBoolean.

expression.UseRemoteProvider

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2087: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenthispropertyissettoTrue,thedatasourcecontrolusestheMicrosoftRemoteDataServicesproviderfordataconnections.YoucanusethispropertyonlywithpagesthatarereadfromaMicrosoftInternetInformationServerusinganHTTPorHTTPSaddress.TheMicrosoftRemoteDataServicesproviderfetchesdatabypassingHTTPorHTTPSrequeststoIIS,whichthenmakesanOLEDBconnectiontothedatabase.

Page 2088: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UserModeProperty

ReturnsaBooleanthatindicateswhetherthePivotTablelistisinview-onlymode.Read-only.

expression.UserMode

expressionRequired.AnexpressionthatreturnsaPivotTableobject.

Page 2089: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UseStandardHeightProperty

TrueiftherowheightoftheRangeobjectequalsthestandardheightofthesheet.ReturnsNulliftherangecontainsmorethanonerowandsomeoftherowsarestandardheight.ReturnsFalsewhennoneoftherowsarethestandardheight.Read/writeVariant.

expression.UseStandardHeight

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 2090: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheheightofrowfouronSheet1inSpreadsheet1tothestandardheight.

Spreadsheet1.Worksheets("Sheet1").Rows(4).UseStandardHeight=True

Page 2091: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UseStandardWidthProperty

TrueifthecolumnwidthoftheRangeobjectequalsthestandardwidthofthesheet.ReturnsNulliftherangecontainsmorethanonecolumnandsomeofthecolumnsarestandardwidth.Falsewhennoneofthecolumnsarethestandardwidth.Read/writeVariant.

expression.UseStandardWidth

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 2092: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthewidthofcolumnBonSheet1inSpreadsheet1tothestandardwidth.

Spreadsheet1.Worksheets("Sheet1").Columns("B").UseStandardWidth

Page 2093: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UseXMLDataProperty

ReturnsorsetswhetherthedataaccesspagewillbindtoXMLdata.Read/writeBoolean.

expression.UseXMLData

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 2094: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheXMLLocationpropertytosetwhetherthedataislocatedinanXMLdataisland,oraseparateXMLdatafile.UsetheXMLDataTargetpropertytospecifythepathorIDtousewhenbindingtothedata.

Page 2095: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsthedataaccesspagetoanXMLdatafile.

SubMSODSC_BeforeInitialBind(DSCEventInfo)

DimdscConstants

SetdscConstants=MSODSC.Constants

'Settheofflinetype.MSODSC.XMLLocation=dscConstants.dscXMLDataFile

'SetthelocationoftheXMLdatatoadatafile.MSODSC.XMLDataTarget="Q1SalesAnalysis.xml"

'BindtotheXMLdata.MSODSC.UseXMLData=True

EndSub

Page 2096: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2097: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ValueProperty

ValuepropertyasitappliestotheChSegmentBoundaryobject.

ValuepropertyasitappliestotheNameandSpreadsheetobjects.

ValuepropertyasitappliestotheBorders,ByRef,ParameterValue,andPivotDetailCellobjects.

ValuepropertyasitappliestotheRangeobject.

Page 2098: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ValuepropertyasitappliestothePivotAggregate,PivotAxisMember,PivotColumnMember,PivotMember,PivotPageMember,PivotResultMemberProperty,PivotRowMember,andSchemaPropertyobjects.

Page 2099: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecreatesamergedcellfromthespecifiedrangeandthenplacesavalueinthemergedcell.

SubMergeCells()

Spreadsheet1.Range("A1:C3").Merge

Spreadsheet1.Range("A1").Value="Monday"

EndSub

Page 2100: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Value2Property

ReturnsorsetsaVariantrepresentingthecellvalue.Read/write.

expression.Value2

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 2101: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheonlydifferencebetweenthispropertyandtheValuepropertyisthattheValue2propertydoesn’tusetheCurrencyandDatedatatypes.Youcanreturnvaluesformattedwiththesedatatypesasfloating-pointnumbersbyusingtheDoubledatatype.

Page 2102: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleillustratesthedifferencesbetweentheValueandtheValue2properties.

SubValue_vs_Value2()DimrngCell1DimrngCell2

'Setavariabletothecellsusedinthisexample.SetrngCell1=Spreadsheet1.ActiveSheet.Range("A1")SetrngCell2=Spreadsheet1.ActiveSheet.Range("A2")

'Setthenumberformatsusedbythecellsinthisexample.rngCell1.NumberFormat="Currency"rngCell2.NumberFormat="ShortDate"

'SetthevalueofcellA1toacurrencyvalue.rngCell1.Value="$123.456789"

'SetthevalueofcellA2toadate.rngCell2.Value="9/7/1970"

'UsetheValuepropertytoreturnthevalueofcellA1.MsgBox"CurrencyreturnedbytheValueProperty="&_rngCell1.Value

'UsetheValue2propertytoreturnthevalueofcellA1.MsgBox"CurrencyreturnedbytheValue2Property="&_rngCell1.Value2

'UsetheValuepropertytoreturnthevalueofcellA2.

Page 2103: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MsgBox"DatereturnedbytheValueProperty="&_rngCell2.Value

'UsetheValue2propertytoreturnthevalueofcellA2.MsgBox"DatereturnedbytheValue2Property="&_rngCell2.Value2EndSub

Page 2104: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2105: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ValueTypeProperty

ReturnsorsetsaChartBoundaryValueTypeEnumconstantthatrepresentshowtheValuepropertyofthespecifiedsegmentboundaryisinterpreted.Read/write.

expression.ValueType

expressionRequired.AnexpressionthatreturnsaChSegmentBoundaryobject.

Page 2106: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenthispropertyissettochBoundaryValuePercent,thentheValuepropertyofthespecifiedsegmentboundarymustbebetween0and1.

Page 2107: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplebindsChartspace1totheOrderDetailstableintheSQLServerNorthwinddatabase.Then,aformatmapiscreatedthatdisplaysthelargervaluesinthechartwithadarkershadeofblue.

SubWindow_Onload()

DimserSeries1DimsegSegment1AsChSegmentDimchconstants

Setchconstants=ChartSpace1.Constants

'ThefollowingtwolinesofcodebindChartspace1totheOrderDetailstableinthe'NorthwindSQLServerdatabase.ChartSpace1.ConnectionString="Provider=SQLOLEDB.1;PersistSecurityInfo=TRUE;"&_"IntegratedSecurity=SSPI;InitialCatalog=Northwind;"&_"DataSource=DataServer;"ChartSpace1.DataMember="OrderDetails"

'ThefollowingtwolinesofcodebindChartspace1totheQuantityandProductIDfields'intheOrderDetailstable.ChartSpace1.SetDatachconstants.chDimCategories,chconstants.chDataBound,"ProductID"ChartSpace1.SetDatachconstants.chDimValues,chconstants.chDataBound,"Quantity"

'Createaformatmap.ChartSpace1.SetDatachconstants.chDimFormatValues,chconstants.chDataBound,"Quantity"

'SetavariabletothefirstseriesinthefirstchartinChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

Page 2108: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Addasegmenttotheformatmap.SetsegSegment1=serSeries1.FormatMap.Segments.Add

'Measurethesegmentboundariesbaseduponapercentage.segSegment1.Begin.ValueType=chconstants.chBoundaryValuePercentsegSegment1.End.ValueType=chconstants.chBoundaryValuePercent

'Setthebeginningvalueto0%,andtheendingvalueto100%.segSegment1.Begin.Value=0segSegment1.End.Value=1

'Formattheinteriorofthematchingvalues.segSegment1.Begin.Interior.Color="White"segSegment1.End.Interior.Color="Blue"

EndSub

Page 2109: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VersionProperty

ReturnstheMicrosoftOfficeWebComponentsversion.Read-onlyString.

expression.Version

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2110: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2111: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VerticalAlignmentProperty

Returnsorsetstheverticalalignmentofthespecifiedobject.CanbeanXlVAlignconstant.Read/writeVariant.

expression.VerticalAlignment

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 2112: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampletop-alignsthecontentsofcellsC7:G10onSheet1inSpreadsheet1.

SubSetAlignment()DimrngAlignDimssConstants

SetssConstants=Spreadsheet1.Constants

SetrngAlign=Spreadsheet1.Worksheets("Sheet1").Range("C7:G10")

'Centerthecontentsoftherangehorizontally.rngAlign.HorizontalAlignment=ssConstants.xlHAlignCenter

'Verticallyalignthecontentsoftherangeatthetopofthecells.rngAlign.VerticalAlignment=ssConstants.xlVAlignTopEndSub

Page 2113: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VerticalExtentProperty

YouusetheVerticalExtentpropertytospecifyordeterminetheextentoftheverticalviewoftheChScrollViewobject.ReturnsaLong.Read/writeLong.

expression.VerticalExtent

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

Page 2114: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

Page 2115: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheVerticalExtentMaxpropertytotoggleachartviewbetweenazoomedandunzoomed.

SubToggleZoom()IfobjChart.ChScrollView.VerticalExtent=objChart.ChScrollView.VerticalExtentMaxThen'Zoomchartandmakeitscrollable.objChart.ChScrollView.VerticalExtent=(objChart.ChScrollView.VerticalExtentMax/2)objChart.ChScrollView.HorizontalExtent=(objChart.ChScrollView.HorizontalExtentMax/2)Else'Unzoomchartandremovescrolling.objChart.ChScrollView.VerticalExtent=objChart.ChScrollView.VerticalExtentMaxobjChart.ChScrollView.HorizontalExtent=objChart.ChScrollView.HorizontalExtentMaxEndIfEndSub

Page 2116: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VerticalExtentMaxProperty

YouusetheVerticalExtentMaxpropertytospecifyordeterminethemaximumextentoftheverticalviewoftheChScrollViewobject.ReturnsaLong.Read/writeLong.

expression.VerticalExtentMax

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

Page 2117: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.TheVerticalExtentMaxpropertyrepresentsthetotalheightofachartwhetherthatchartiszoomedornot.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

Page 2118: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheVerticalExtentMaxpropertytotoggleachartviewbetweenazoomedandunzoomed:

SubToggleZoom()IfobjChart.ChScrollView.VerticalExtent=objChart.ChScrollView.VerticalExtentMax'Zoomchart.objChart.ChScrollView.VerticalExtent=(objChart.ChScrollView.objChart.ChScrollView.HorizontalExtent=(objChart.ChScrollView.HorizontalExtentMax/2)Else'Unzoomchart.objChart.ChScrollView.VerticalExtent=objChart.ChScrollView.objChart.ChScrollView.HorizontalExtent=objChart.ChScrollView.HorizontalExtentMaxEndIfEndSub

Page 2119: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VerticalPositionProperty

YouusetheVerticalPositionpropertytospecifyordeterminethecurrentverticalviewpositionoftheChScrollViewobject.ReturnsaLong.Read/writeLong.

expression.VerticalPosition

expressionRequired.AnexpressionthatreturnsaChScrollViewobject.

Page 2120: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YouusemethodsandpropertiesoftheChScrollViewobjecttoretrieveinformationaboutandcontroltheviewofachart.TheportionoftheChartcomponentthatdisplaysthechartitselfisthevisibleplotareaanditcandisplaytheentirechartoraportionofthechart.Whenonlyaportionofthechartisdisplayedinthevisibleplotarea,theeffectisasifyouhavezoomedinonthatportionofthechartandtheremainderofthechartiscontainedwithinavirtualplotareathatextendsbeyondtheboundaryofthevisibleplotarea.ForinformationonhowthevaluesofthepropertiesoftheChScrollViewobjectrelatetoeachother,seetheChScrollViewobjecttopic.

WhentheVerticalPositionpropertyequalszero,thetopoftheplotareawillbeatthetopofthescrollviewwindow.TheVerticalPositionpropertycanbeanegativenumber.ForexampleifVerticalPosition=(-0.25*VerticalExtentMax),theplotareawillbepusheddownby25%ofthevirtualheightoftheplotarea.

Page 2121: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingcodeshowsdifferentwaysofworkingwiththepropertiesandmethodsoftheChScrollViewobject.

DimlngVPDimlngHPDimlngVEDimlngHEDimlngVEMDimlngHEMDimobjScrollView

SetobjScrollView=ChartSpace1.Charts(0).ScrollViewlngVP=objScrollView.VerticalPositionlngHP=objScrollView.HorizontalPositionlngVE=objScrollView.VerticalExtentlngHE=objScrollView.HorizontalExtentlngVEM=objScrollView.VerticalExtentMaxlngHEM=objScrollView.HorizontalExtentMax

'Togglethescrollviewbetweenunzoomedand200%zoomed:IflngVE=lngVEMAndlngHE=lngHEMThen'Chartisnotzoomedsozoomto200%.objScrollView.VerticalExtentMax=objScrollView.VerticalExtentMax*2objScrollView.HorizontalExtentMax=objScrollView.HorizontalExtentMax*2Else'Chartiszoomed,returnittounzoomedstate.objScrollView.VerticalExtentMax=objScrollView.VerticalExtentobjScrollView.HorizontalExtentMax=objScrollView.HorizontalExtentEndIf

Page 2122: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Forzoomedchart,displaylowerleftcornerofvirtualplotareain'thelowerleftcornerofthevisibleplotarea.IflngVE<>lngVEMOrlngHE<>lngHEMThen'Movebottomedgeofvirtualplotareatobottomofvisibleplotarea.objScrollView.VerticalPosition=objScrollView.VerticalPosition+(lngVEM-lngVM)'Moveleftedgeofvirtualplotareatoleftedgeofvisilbleplotarea.objScrollView.HorizontalPosition=0EndIf

'ThisexampledoesthesamethingasthepreviousexampleusingtheSetPositionmethod.IflngVE<>lngVEMOrlngHE<>lngHEMThenobjScrollView.SetPosition0,objScrollView.VerticalPosition+(lngVEM-lngVE)EndIf

Page 2123: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ViewProperty

ReturnsaPivotViewobjectthatrepresentsthecurrentviewforthespecifiedobject.

expression.View

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2124: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ViewableRangeProperty

Returnsorsetstherangeofcellsthattheusercanview.Thismakesitpossibletohideworksheetcells(thatcontainintermediatecalculations,forexample).Read/writeString.

expression.ViewableRange

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2125: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDonotconfusethispropertywiththeVisibleRangeproperty,whichreturnsaRangeobjectthatrepresentsallthecellsthatarecurrentlyvisible.

Page 2126: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheviewablerangeonthespreadsheet.

SubShrink_Viewable_Range()

'SettheviewablerangeofthewindowtocellsA1:D10.Spreadsheet1.ActiveWindow.ViewableRange="A1:D10"'Resizethespreadsheettoeliminatethegrayarea.Spreadsheet1.Autofit=TrueEndSub

Page 2127: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ViewOnlyModeProperty

TrueiftheMicrosoftOfficeWebComponentsareinview-onlymode.TheWebComponentswillbeinview-onlymodeiftheuserdoesnothavetheappropriatelicenseinstalledontheircomputer.Read-onlyBoolean.

expression.ViewOnlyMode

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2128: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ViewportLeftProperty

ReturnsorsetsaLongvaluethatrepresentstheleftsideoftheviewabledatarange.Usethispropertytoscrollthatdataareatotheleftbyaspecificnumberofpixels.Read/write.

expression.ViewportLeft

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 2129: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheViewportToppropertytoreturnorsetthetopoftheviewabledatarange.

Settingthispropertytoaninvalidvaluewillresultinarun-timeerror.Forexample,settingthispropertyto5000whenthedatarangecannotbescrolledbythatmanypixelswillresultinarun-timeerror.

Page 2130: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ViewportTopProperty

ReturnsorsetsaLongvaluethatrepresentsthetopoftheviewabledatarange.Usethispropertytoscrollthatdataareadownbyaspecificnumberofpixels.Read/write.

expression.ViewportTop

expressionRequired.AnexpressionthatreturnsaPivotDataobject.

Page 2131: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheViewportLeftpropertytoreturnorsettheleftsideoftheviewabledatarange.

Settingthispropertytoaninvalidvaluewillresultinarun-timeerror.Forexample,settingthispropertyto5000whenthedatarangecannotbescrolledbythatmanypixelswillresultinarun-timeerror.

Page 2132: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2133: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VisibleProperty

ChDataLabel,ChLegendEntry,PivotLabel,andTitleBarobjects:ReturnsorsetsaBooleanthatdetermineswhetherthespecifiedobjectisvisible.SetthispropertytoFalsetohidethespecifiedobject.Read/write.

SheetsandWorksheetsobjects:ReturnsorsetsaVariantthatdetermineswhetherthespecifiedobjectisvisible.SetthispropertytoFalsetohidethespecifiedobject.Read/write.

Windowobject.ReturnsaBooleanthatindicateswhetherthespecifiedwindowisvisible.Read-only.

Worksheetobject.ReturnsorsetsaXlSheetVisibilityconstantthatdeterminesthevisibilityofthespecifiedworksheet.Read/write.

expression.Visible

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2134: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysthelegendforthespecifiedchartandhidesthespecifiedlegendentry.

SubShowLegend()

ChartSpace1.Charts(0).HasLegend=TrueChartSpace1.Charts(0).Legend.LegendEntries(1).Visible=False

EndSub

Page 2135: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

VisibleRangeProperty

ReturnsaRangeobjectthatrepresentsallthecellsthatarecurrentlyvisible.Read-only.

expression.VisibleRange

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2136: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksDonotconfusethispropertywiththeViewableRangeproperty,whichreturnsaStringthatspecifiestherangethattheusercanview(partofthatrangemaynotbecurrentlyvisible).

Page 2137: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthefonttoboldineveryothercolumninthevisiblerangeontheactiveworksheet.

SubBold_Odd_Columns()DimrngColumn'Loopthroughthevisiblecolumns.ForEachrngColumnInSpreadsheet1.ActiveWindow.VisibleRange.Columns'Setthefonttoboldifthecolumnisodd-numbered.IfrngColumn.ColumnMod2=0ThenrngColumn.Font.Bold=TrueEndIfNextEndSub

ThefunctioninthisexamplereturnsTrueiftheentirecurrentregionforcellA1isvisible(ifthecurrentregionextendsoutsidethevisiblerange,thefunctionreturnsFalse).

FunctionIsCurrentRegionVisible()DimrngCurrentDimrngVisibleDimrngIntersect

'SetthevaribletothecurrentregionofcellA1.SetrngCurrent=Spreadsheet1.ActiveSheet.Cells(1,1).CurrentRegion'Setavariabletothecurrentlyvisiblerange.SetrngVisible=Spreadsheet1.ActiveWindow.VisibleRange

Page 2138: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setavariabletotheoverlappingportionofthecurrentregion'andthevisiblerange.SetrngIntersect=Spreadsheet1.RectIntersect(rngCurrent,rngVisible)'Iftheoverlappingregionisthesameasthecurrentragion,then'returntrue.IsCurrentRegionVisible=(rngIntersect.Address=rngCurrent.Address)EndFunction

Page 2139: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WatermarkBorderProperty

ReturnsaChBorderobjectthatrepresentstheborderofthewatermarkinthespecifieddropzone.UsethepropertiesofthereturnedChBorderobjecttoformattheborderofthedropzone'swatermark.

expression.WatermarkBorder

expressionRequired.AnexpressionthatreturnsaChDropZoneobject.

Page 2140: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 2141: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WatermarkFontProperty

ReturnsaChFontobjectthatrepresentsthefontofthewatermarkinthespecifieddropzone.UsethepropertiesofthereturnedChFontobjecttoformatthefontofthedropzone'swatermark.

expression.WatermarkFont

expressionRequired.AnexpressionthatreturnsaChDropZoneobject.

Page 2142: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 2143: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WatermarkInteriorProperty

ReturnsaChInteriorobjectthatrepresentstheinteriorofthewatermarkinthespecifieddropzone.UsethepropertiesofthereturnedChInteriorobjecttoformattheinteriorofthedropzone'swatermark.

expression.WatermarkInterior

expressionRequired.AnexpressionthatreturnsaChDropZoneobject.

Page 2144: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleformatsthebuttonandthewatermarkoftheseriesdropzoneinChartspace1.

SubSetupDropZone()

DimdzSeriesDropZoneDimChConstants

SetchConstants=Chartspace1.Constants

'SetavariabletotheseriesdropzoneinChartspace1.SetdzSeriesDropZone=ChartSpace1.DropZones(chConstants.chDropZoneSeries)

'Thenextthreelinesofcodeformatthebuttonofthedropzone.dzSeriesDropZone.ButtonBorder.Weight=chConstants.owcLineWeightMediumdzSeriesDropZone.ButtonInterior.SetSolid"Red"dzSeriesDropZone.ButtonFont.Size=14

'Thenextthreelinesofcodeformatthewatermarkofthedropzone.dzSeriesDropZone.WatermarkBorder.Color="Red"dzSeriesDropZone.WatermarkFont.Color="Red"dzSeriesDropZone.WatermarkInterior.SetSolid"Green"

EndSub

Page 2145: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WeightProperty

Returnsorsetstheweightforthespecifiedborderorline.CanbeoneoftheLineWeightEnumconstants,orcanbeNullifthebordersarenotallthesameweight.Read/writeVariant.

expression.Weight

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2146: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetstheaxislineandborderweightofthecharttothick.

SubFormatChart()

DimchConstants

SetchConstants=ChartSpace1.Constants

ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue).Line_.Weight=chConstants.owcLineWeightThick

ChartSpace1.Border.Weight=chConstants.owcLineWeightThick

EndSub

Page 2147: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2148: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WidthProperty

WidthpropertyasitappliestotheWindowobject.

WidthpropertyasitappliestothePivotAxisMember,PivotColumnMember,PivotFieldSet,PivotPageMember,PivotRowMember,PivotTable,andPivotTotalobjects.

WidthpropertyasitappliestothePivotAggregate,PivotDetailCell,PivotResultAxis,PivotResultColumnAxis,PivotResultDataAxis,PivotResultFilterAxis,PivotResultGroupAxis,PivotResultLabel,PivotResultPageAxis,andPivotResultRowAxisobjects.

WidthpropertyasitappliestotheRangeobject.

Page 2149: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheAutoFitpropertyofthePivotTablelistissettoFalsewhenthevalueoftheWidthpropertyischanged.

Page 2150: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthewidthofthePivotTablelistto150points.

PivotTable1.Object.Width=150

Page 2151: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WidthRatioProperty

Returnsorsetsthewidthratioforthespecifiedchartinrelationtotheotherchartsinthechartworkspace.Thedefaultvalueis100.Read/writeLong.

expression.WidthRatio

expressionRequired.AnexpressionthatreturnsaChChartobject.

Page 2152: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForthispropertytohaveanyeffect,youmusthavemorethanonechartinthechartworkspace.Whenmorethanonechartisdisplayed,thechartsaredisplayedinagrid(formoreinformation,seetheHelptopicsfortheChartLayoutandChartWrapCountproperties).Initially,theHeightRatioandWidthRatiopropertiesaresetto100forallchartsinthegrid,andallchartsarethesamesize.

Tochangethewidthofchartsinthegrid,adjusttheWidthRatiopropertysettings.Forexample,ifeachchartisdisplayedinthreecolumnsallchartshaveaninitialWidthRatiosettingof100.Ifyouwantcolumn3tobeonlyhalftheavailablecolumnwidth,setitsWidthRatiosettingto200;theremaininghalfofthechartwidthwillbedividedbetweencolumns1and2.BecausethewidthspecifiedbytheWidthRatiopropertyisrelative,youcansetthispropertyforthethreecolumnsto1,1,2;100,100,200;or20,20,40.allofwhichhavethesameeffect.

Ifthechartworkspacecontainschartsdisplayedinmorethanonecolumn,thelargestWidthRatiosettingineachcolumnisusedtosettherelativewidthfortheentirecolumn.

Thispropertyisusefulforcreatingpriceandvolumestockchartsinwhichthevolumechartishalfthesizeofthepricechart.

Page 2153: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WindowNumberProperty

Returnsthewindownumber.Alwaysreturns1inthisversionoftheMicrosoftOfficeSpreadsheetComponent.Read-onlyLong.

expression.WindowNumber

expressionRequired.AnexpressionthatreturnsaWindowobject.

Page 2154: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WindowsProperty

ReturnsaWindowscollectionthatrepresentsthewindowsintheopenworkbook.

expression.Windows

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2155: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksAlthougheachworksheetintheopenworkbookhasitsownwindow,thispropertyalwaysreturnsareferencetotheactiveworksheet'swindow.

Page 2156: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorkbooksProperty

ReturnsaWorkbookscollectionthatrepresentstheopenworkbook.

expression.Workbooks

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 2157: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorksheetProperty

ReturnsaWorksheetobjectthatrepresentstheworksheetcontainingthespecifiedrange.Read-only.

expression.Worksheet

expressionRequired.AnexpressionthatreturnsaRangeobject.

Page 2158: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleactivatestheworksheetinSpreadsheet1thatcontainstherangenamed"Revenue."

Spreadsheet1.Range("Revenue").Worksheet.Activate

Page 2159: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

WorksheetsProperty

ReturnsaWorksheetscollectionthatrepresentstheworksheetsintheopenworkbook.

expression.Worksheets

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2160: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XMLDataProperty

ReturnsorsetstheXMLdataforthespecifiedcomponent.Read/writeString.

expression.XMLData

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2161: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XmlDataBindingsProperty

YouusetheXmlDataBindingspropertytoreturnanXmlDataBindingscollection.Read-onlyXmlDataBindingscollection.

expression.XmlDataBindings

expressionRequired.AnexpressionthatreturnsaWorkbookobject.

Page 2162: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheXmlDataBindingscollectioncontainsoneormoreXmlDataBindingobjects.EachXmlDataBindingobjectcontainsconfigurationdatathatbindstheSpreadsheetcomponenttoadataretrievalservice,aSOAPWebService,anXMLfile,oranotherSpreadsheetcomponent.

Page 2163: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheXmlDataBindingspropertyoftheWorkbookobjecttoreturnamemberoftheXmlDataBindingscollectionandthenworkwiththeXMLthatrepresentsthebindinginformation:

DimobjBindingsDimobjBindingDimstrBindingInfo

SetobjBindings=Spreadsheet1.ActiveWorkbook.XmlDataBindings

ForEachobjBindinginobjBindings'SavetheXMLbindinginformationtoavariable.strBindingInfo=objBinding.BindingData'Workwithbindinginformationhere.Next

Page 2164: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XMLDataTargetProperty

ReturnsorsetsaStringthatrepresentsthelocationoftheXMLdatatoloadorsave.Read/write.

expression.XMLDataTarget

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 2165: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleexportsthecurrentdatainthedatasourcecontrolnamedMSODSCtoanXMLdatafile.

SubExportData()

DimdscConstants

SetdscConstants=MSODSC.Constants

'SetthelocationoftheXMLdatatoadatafile.MSODSC.XMLLocation=dscConstants.dscXMLDataFile

'Setthespecifictargettoexportto.MSODSC.XMLDataTarget="Q1SalesAnalysis.xml"

'Exportthecurrentdata.MSODSC.ExportXMLEndSub

Page 2166: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2167: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XMLLocationProperty

ReturnsorsetsaDscXMLLocationEnumconstantthatspecifieswhethertheXMLdataistobeloadedorsavedfromanXMLdatafileoranXMLdataislandinsideofthecurrentdataaccesspage.Read/write.

expression.XMLLocation

expressionRequired.AnexpressionthatreturnsaDataSourceControlobject.

Page 2168: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleexportsthecurrentdatainthedatasourcecontrolnamedMSODSCtoanXMLdatafile.

SubExportData()

DimdscConstants

SetdscConstants=MSODSC.Constants

'SetthelocationoftheXMLdatatoadatafile.MSODSC.XMLLocation=dscConstants.dscXMLDataFile

'Setthespecifictargettoexportto.MSODSC.XMLDataTarget="Q1SalesAnalysis.xml"

'Exportthecurrentdata.MSODSC.ExportXML

EndSub

Page 2169: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XmlMapProperty

YouusetheXmlMappropertytoreturnanXmlMapobjectrepresentingtheXMLschemamapassociatedwithanXmlDataBindingobject.ReturnsanXmlMapobject.Read-only.

expression.XmlMap

expressionRequired.AnexpressionthatreturnsanXmlDataBindingobject.

Page 2170: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

YoucanusetheMapDatapropertyoftheXmlMapobjecttospecifyordeterminethemappinginformationforthedatasourcespecifiedintheXmlDataBindingobject.

Page 2171: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheXmlMappropertytoreturntheschemamapassociatedwithabinding.

DimobjBindingsDimobjBindingDimstrMapInfo

SetobjBindings=Spreadsheet1.ActiveWorkbook.XmlDataBindings

ForEachobjBindinginobjBindings'SavetheXMLbindinginformationtoavariable.SetstrMapInfo=objBinding.XmlMap'Workwithbindinginformationhere.Next

Page 2172: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XmlMapsProperty

YouusetheXmlMapspropertyoftheWorkbookobjecttoreturnanXmlMapscollection.ReturnsanXmlMapscollection.Read-only.

expression.XmlMaps

expressionRequired.AnexpressionthatreturnsaWorkbookobject.

Page 2173: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheXmlMapsobjectisacollectionofalloftheXmlMapobjectsassociatedwithaSpreadsheetcomponent.AnXmlMapisanXMLschemamapthatspecifieshowtomapdatafromadatasourceintheSpreadsheetcomponent.

YoucancreateanewXmlMapobjectbyusingtheAddmethodoftheXmlMapscollection.TheXmlMapobjectisalsoavailablewhenyousettheXmlUrlpropertyofaSpreadsheetcomponenttothenameofanXMLSpreadsheetfile,orastringcontainingproperlyconfiguredXMLdata,thatcontainsthebindingandmappingconfigurationfortheSpreadsheetcomponent.YoucancreateanXMLSpreadsheetfilebycreatingadataboundspreadsheetusingMicrosoftExcelandthensavingtheworkbookasanXMLSpreadsheet.

Page 2174: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleillustrateshowtousetheXmlMapspropertyoftheWorkBookobjecttoreturnanXmlMapscollection.

DimobjMapsDimobjMapDimstrMapInfo

SetobjMaps=Spreadsheet1.ActiveWorkbook.XmlMaps

ForEachobjMapinobjMaps'SavetheXMLmapinformationtoavariable.strMapInfo=objMap.MapData'Workwithmapinformationhere.Next

Page 2175: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XMLURLProperty

ReturnsorsetsaStringrepresentingtheURLtoanExtensibleMarkupLanguage(XML)file.Settingthispropertydiscardsthecurrently-openworkbookandloadsthespecifiedXMLfileintoanewworkbook.Read/write.

expression.XMLURL

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

Page 2176: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleloadsthecontentsofthespecifiedXMLfileintoSheet1ofSpreadsheet1.

Spreadsheet1.XMLURL="http://example.microsoft.com/Test.xml"

Page 2177: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ZOrderProperty

ReturnsorsetsaLongthatspecifiesthetheorderinwhichaseriesisrenderedfromfronttoback.Read/write.

expression.ZOrder

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

Page 2178: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSetthispropertyto0torendertheseriesatthefrontofthechart.

Thispropertyaffectsonlyclusteredoroverlapping3-DArea,Bar,Column,andLinecharts.

Page 2179: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AfterDeleteEvent

Occursafterarecordhasbeendeleted,orthedeletionofarecordhasbeencanceled.Usethiseventisyouwanttoperformasetofactionswhenarecordisdeleted.

PrivateSubObject_AfterDelete(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2180: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheStatuspropertyoftheDSCEventInfoobjecttodeterminewhethertherecorddeletionwascanceled.

UsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

Page 2181: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysamessageboxthatindicatesthestatusoftherecorddeletionthatfiredtheevent.

SubMSODSC_AfterDelete(DSCEventInfo)

DimdscConstants

SetdscConstants=MSODSC.Constants

'Checkthestatusoftherecorddeletion.SelectCaseDSCEventInfo.Status

'Therecordwasdeleted.CasedscConstants.dscDeleteOK

MsgBox"Recorddeletedsuccessfully."

'Thedeletionwascanceledviacode.CasedscConstants.dscDeleteCancel

MsgBox"Recorddeletioncanceledbycode."

'Thedelectionwascanceledbytheuser.CasedscConstants.dscDeleteUserCancelMsgBox"Recorddeletioncanceledbyuser."

EndSelect

EndSub

Page 2182: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AfterFinalRenderEvent

Occursafterallchartelementshavebeenrendered.

PrivateSubChartSpace_AfterFinalRender(ByValdrawObjectAsChChartDraw)

drawObjectAChChartDrawobject.Usethemethodsandpropertiesofthisobjecttodrawobjectsonthechart.

Page 2183: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumustsettheAllowRenderEventspropertytoTrueinordertousethisevent.

Page 2184: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AfterInsertEvent

Occursafterarecordhasbeeninserted.Usethiseventifyouwanttoperformasetofactionswhenarecordisinserted.

PrivateSubObject_AfterInsert(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2185: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

Page 2186: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AfterLayoutEvent

Occursafterallchartsinthespecifiedchartcontrolhavebeenlaidout,butbeforetheyhavebeenrendered.Duringthisevent,youcanrepositiontheChTitle,ChLegend,ChChart,andChAxisobjectsofeachchartbychangingtheirLeftandTopproperties.YoucanrepositiontheChPlotAreaobjectbychangingitsLeft,Top,Right,andBottomproperties.Thesepropertiescannotbechangedoutsideofthisevent.

PrivateSubChartSpace_AfterLayout(ByValdrawObjectAsChChartDraw)

drawObjectAChChartDrawobject.Usethemethodsandpropertiesofthisobjecttomanipulatedrawingobjectsonthechart.

Page 2187: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheAllowLayoutEventspropertymustbesettoTrueinordertocapturethisevent.

Page 2188: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheAfterLayouteventtomovethetitleforthefirstchartinChartspace1totheleftsideofthechart.Itthenmovesthelegendtowardsthetopofthechart.

PrivateSubChartSpace1_AfterLayout(drawObject)

'Movethetitletotheleftsideofthechart.ChartSpace1.Charts(0).Title.Left=1

'Movethelegendtowardsthetopofthechart.ChartSpace1.Charts(0).Legend.Top=20

EndSub

Page 2189: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AfterRenderEvent

OccursaftertheobjectrepresentedbythechartObjectargumenthasbeenrendered.

PrivateSubChartSpace_AfterRender(ByValdrawObjectAsChChartDraw,ByValchartObjectAsObject)

drawObjectAChChartDrawobject.Usethemethodsandpropertiesofthisobjecttomanipulatedrawingobjectsonthechart.

chartObjectTheobjectthathasjustbeenrendered.UsetheTypeNamefunctiontodeterminewhattypeofobjecthasjustbeenrendered.

Page 2190: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumustsettheAllowRenderEventsandAllowPointsRenderEventspropertiestoTrueinordertousethiseventwithallchartobjects.

Page 2191: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatextstringtotheupper-leftcorneroftheplotareaeachtimethatthechartisredrawn.

SubChartSpace1_AfterRender(drawObject,chartObject)

DimchChart1

SetchChart1=ChartSpace1.Charts(0)'Afterthelegendhasbeenrendered,thenaddthetext'tothechart.IfTypeName(chartObject)="ChLegend"ThendrawObject.DrawText"2000Sales",chChart1.PlotArea.Left+5,_chChart1.PlotArea.Top

EndIf

EndSub

ThisexampleillustrateshowyoucanusetheBeforeRenderandAfterRendereventstogethertocreatecustomgridlines.TheBeforeRendereventcancelstherenderingofthegridlinesandtheAfterRendereventdrawscustomgridlines.

SubChartSpace1_BeforeRender(drawObject,chartObject,Cancel)

'Checktoseeifthenextobjecttoberendered'isagridline.IfTypeName(chartObject)="ChGridlines"Then

'Canceltherenderingofgridlines.

Page 2192: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Cancel.Value=True

EndIf

EndSub

SubChartSpace1_AfterRender(drawObject,chartObject)

DimchChart1DimplPlotAreaDimlLeftDimlRightDimlHeightDimlTopDimlIncrementDimchConstantsDimiCtr

SetchConstants=ChartSpace1.Constants

'SetavariabletothefirstchartinChartspace1.SetchChart1=ChartSpace1.Charts(0)

'Setavariabletotheplotareaofthechart.SetplPlotArea=chChart1.PlotArea

'Checktoseeiftherenderedobjectisagridline.IfTypeName(chartObject)="ChGridlines"Then

'Thenextfourlinesofcodeusetheextentsof'theplotareatocalculatethedimensionsoftheline'tobedrawn.lLeft=plPlotArea.Left

Page 2193: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

lTop=plPlotArea.ToplRight=plPlotArea.RightlHeight=plPlotArea.Bottom-lTop

'Determinetheincrementtousebetweengridlines.'Changethedivisortoadjusttheincrement.lIncrement=lHeight/10

'Thenextthreelinesofcodesetthepropertiesofthe'linetobedrawn.drawObject.Line.DashStyle=chConstants.chLineRoundDotdrawObject.Line.Color="Green"drawObject.Line.Weight=chConstants.owcLineWeightMedium

ForiCtr=1To9

'Drawtheline.drawObject.DrawLinelLeft,lTop+iCtr*lIncrement,_lRight,lTop+iCtr*lIncrement

NextEndIf

EndSub

Page 2194: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

AfterUpdateEvent

Occursafterarecordisupdatedwithnewdataortherecordlosesfocus.

PrivateSubObject_AfterUpdate(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2195: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

Page 2196: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysinformationaboutthesectionthatcontainstherecordthatwasupdated.

SubMSODSC_AfterUpdate(DSCInfo)

MsgBoxDSCInfo.Section.HTMLContainer.All(1).InnerText

EndSub

Page 2197: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeCollapseEvent

Occurswhenthecollapsebuttonisclickedonadataaccesspage.

PrivateSubObject_BeforeCollapse(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2198: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeContextMenuEvent

Occursbeforeacontextmenuistobeshown.Acontextmenuisshownwhentheuserright-clicksortheypresstheApplicationkey.

PrivateSubObject_BeforeContextMenu(ByValxAsLong,ByValyAsLong,ByValMenuAsByref,ByValCancelAsByRef)

xRepresentsthex-coordinatewherethecontextmenuistoappear.

yRepresentsthey-coordinatewherethecontextmenuistoappear.

MenuSettheValuepropertyofthisobjecttoanarraythatcontainsthemenuitemstodisplay.

CancelSettheValuepropertyofthisobjecttoTruetocancelthekeystroke.

Page 2199: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethiseventtocustomizethecontextmenusintheMicrosoftOfficeWebComponents.

Page 2200: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysacustomcontextmenu.Themenucontainsfouroptions,thelastoptiondisplaysasubmenu.

SubSpreadsheet1_BeforeContextMenu(x,y,Menu,Cancel)

DimcmContextMenu(4)DimcmClearSubMenu(2)

cmClearSubMenu(0)=Array("&All","ClearAll")cmClearSubMenu(1)=Array("&Formats","ClearFormats")cmClearSubMenu(2)=Array("&Values","ClearValues")

cmContextMenu(0)=Array("Cu&t","owc2")cmContextMenu(1)=Array("&Copy","owc3")cmContextMenu(2)=Array("&Paste","owc4")cmContextMenu(3)=EmptycmContextMenu(4)=Array("Clea&r",cmClearSubMenu)

Menu.Value=cmContextMenu

EndSub

Page 2201: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeDeleteEvent

Occursbeforearecordisdeleted.Usethiseventifyouwanttoapplyasetofconditionsbeforearecordisdeleted.

PrivateSubObject_BeforeDelete(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2202: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettheReturnValuepropertyoftheDSCEventInfoobjecttoFalsetocancelthedeletionofarecord.Whenyoucancelthedeletionofarecord,theAfterDeleteeventstillfires.

UsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

UsetheDisplayAlertpropertytodeterminewhetherornottheuserispromptedwhenthiseventiscalled.

Page 2203: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecancelsthedeletionofarecordifthe"Discontinued"fieldissettheNo.

SubMSODSC_BeforeDelete(DSCEventInfo)

DimtxtDiscontinued

'Setavariabletothetextboxthatcontainsthevalue'oftheDiscontinuedfieldfortherecordthatistobedeleted.SettxtDiscontinued=DSCEventInfo.Section.HTMLContainer_.Children("Discontinued")

'Checkthevalueofthecontrol.IftxtDiscontinued.Value="No"Then

'Displayamessagetotheuser.Msgbox"Donotdeleteproductsthathavenot"&_"beendiscontinued."

Cancelthedeletionoftherecord.DSCEventInfo.ReturnValue=FalseEndIf

EndSub

Page 2204: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeExpandEvent

Occurswhenevertheexpandbuttonisclickedonadataaccesspage.

PrivateSubObject_BeforeExpand(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2205: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeFirstPageEvent

Occursbeforethefirstsetofrecordsisdisplayedonabandeddataaccesspage.

PrivateSubObject_BeforeFirstPage(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2206: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeInitialBindEvent

Occursbeforethecontrolsonthespecifieddataaccesspageareboundtotherecordsetforthefirsttime.Usethiseventtosetthepropertiesforthedataaccesspagebeforethecontrolsarepopulatedwithdata.

PrivateSubObject_BeforeInitialBind(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2207: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThiseventdoesnotsupportanyoftheDSCEventInfoproperties.

Page 2208: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeInsertEvent

Occurswhenthefirstcharacterisenteredintoanewrecord,butbeforetherecordisaddedtotherecordset.

PrivateSubObject_BeforeInsert(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2209: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettheReturnValuepropertyoftheDSCEventInfoobjecttoFalsetocanceltheinsertionofanewrecord.

YoucanusetheDataPagepropertyoftheDSCEventInfoobjecttogetmoreinformationaboutthedataaccesspage.

Page 2210: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheBeforeInserteventtopreventtheuserfromaddinganotherrecordtotherecordsetonceitreaches75records.

SubMSODSC_BeforeInsert(DSCEventInfo)DimrstCurrentData

'Setavariabletotherecordset.SetrstCurrentData=DSCEventInfo.DataPage.Recordset

'Checktoseeiftherecordsethasreacheditslimit.IfrstCurrentData.RecordCount>=75then

'Displayamessagetotheuser.MsgBox"Cannotaddanymorerecords."

'Canceltheinsertionoftherecord.DSCEventInfo.ReturnValue=FalseEndIfEndSub

Page 2211: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeKeyDownEvent

Occurswhenauserpressesakeyonthekeyboard,butbeforethecontrolhasprocessedthekeystroke.Iftheuserholdsthekeydown,thiseventrepeatsitselfatthekey-repeatintervalthathasbeensetontheuser’scomputer.

PrivateSubObject_BeforeKeyDown(ByValKeyCodeAsLong,ByValShiftAsLong,ByValCancelAsByRef)

ObjectAChartSpace,PivotTable,orSpreadsheetobject.

KeyCodeAnintegerthatrepresentsthekeycodeofthekeythatwaspressedorreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeys.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,and4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

CancelSettheValuepropertyofthisobjecttoTruetocancelthekeystroke.

Page 2212: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksCancelingthiseventalsocancelstheBeforeKeyPressandKeyPressevents,butdoesnotpreventthetheKeyDownorKeyUpeventsfromfiring.

Thesequenceofkeyboard-relatedeventsis:

1. BeforeKeyDown

2. KeyDown

3. BeforeKeyPress

4. KeyPress

5. BeforeKeyUp

6. KeyUp

Page 2213: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeKeyPressEvent

Occurswhenauserpressesandreleasesakeyonthekeyboard,butbeforethecontrolhasprocessedthekeystroke.Iftheuserholdsthekeydown,thiseventrepeatsitselfatthekey-repeatintervalthathasbeensetontheuser’scomputer.

PrivateSubObject_BeforeKeyPress(ByValKeyAsciiAsLong,ByValCancelAsByRef)

ObjectAChartSpace,PivotTable,orSpreadsheetobject.

KeyAsciiAnintegerthatrepresentsthekeycodeofthekeythatwaspressedorreleased.

CancelSettheValuepropertyofthisobjecttoTruetocancelthekeystroke.

Page 2214: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksCancelingthiseventdoesnotpreventtheKeyPressorKeyUpeventsfromfiring.

Thesequenceofkeyboard-relatedeventsis:

1. BeforeKeyDown

2. KeyDown

3. BeforeKeyPress

4. KeyPress

5. BeforeKeyUp

6. KeyUp

Page 2215: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeKeyUpEvent

Occurswhenauserreleasesakeyonthekeyboard,butbeforethecontrolhasprocessedthekeystroke.

PrivateSubObject_BeforeKeyUp(ByValKeyCodeAsLong,ByValShiftAsLong,ByValCancelAsByRef)

ObjectThenameoftheChartSpace,PivotTable,orSpreadsheetobjectthatthiseventappliesto..

KeyCodeAnintegerthatrepresentsthekeycodeofthekeythatwaspressedorreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeys.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,and4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,orALTkeyswerepressed.

CancelSettheValuepropertyofthisobjecttoTruetocancelthekeystroke.

Page 2216: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksCancelingthiseventdoesnotpreventtheKeyUpeventfromfiring.

Thesequenceofkeyboard-relatedeventsis:

1. BeforeKeyDown

2. KeyDown

3. BeforeKeyPress

4. KeyPress

5. BeforeKeyUp

6. KeyUp

Page 2217: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeLastPageEvent

Occursbeforethelastsetofrecordsisdisplayedonabandeddataaccesspage.

PrivateSubObject_BeforeLastPage(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2218: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeNextPageEvent

Occursbeforethenextsetofrecordsisdisplayedonabandeddataaccesspage.

PrivateSubObject_BeforeNextPage(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2219: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeOverwriteEvent

Occurswhenanexistingfileisabouttobeoverwritten.

PrivateSubObject_BeforeOverwrite(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2220: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThiseventmayoccurwhenyouusetheExportXMLmethodtoexportthecurrentrecordset.SettheReturnValuepropertyoftheDSCEventInfoobjecttoFalsetopreventtheexistingfilefrombeingoverwritten.SettheDisplayAlertpropertyoftheDSCEventInfoobjecttodscDataAlertContinuetooverwritethefilewithoutpromptingtheuser.

Note:FilesthatwerenotcreatedbytheDataSourceControlwillnotbeoverwritten.

Page 2221: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleallowsafilecreatedbytheExportXMLmethodtobeoverwrittenwithoutpromptingtheuser.

SubMSODSC_BeforeOverwrite(DSCEventInfo)

DimdscConstantsSetdscConstants=MSODSC.Constants

'Don'talerttheuserwhenoverwritinganexistingfile.DSCEventInfo.DisplayAlert=dscConstants.dscDataAlertContinue

EndSub

Page 2222: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforePreviousPageEvent

Occursbeforetheprevioussetofrecordsisdisplayedonabandeddataaccesspage.

PrivateSubObject_BeforePreviousPage(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2223: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeRenderEvent

OccursbeforetheobjectpassedinthechartObjectargumenthasbeenrendered.

PrivateSubObject_BeforeRender(ByValdrawObjectAsChChartDraw,ByValchartObjectAsObject,CancelAsByRef)

ObjectThenameoftheChartSpaceobjectthatyouaretrappingthiseventfor.

drawObjectAreferencetotheChChartDrawobject.UsetheDrawTypepropertyofthereturnedobjecttodeterminewhattypeofrenderingisabouttooccur.

chartObjectTheobjectthatistoberendered.UsetheTypeNamefunctiontodeterminethetypeoftheobject.

CancelSettheValuepropertyofthisobjecttoTruetocanceltherenderingoftheobjectrepresentedbychartObject.

Page 2224: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksYoumustsettheAllowRenderEventsandAllowPointsRenderEventspropertiestoTrueinordertousethiseventwithallchartobjects.

Page 2225: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleillustrateshowyoucanusetheBeforeRenderandAfterRendereventstogethertocreatecustomgridlines.TheBeforeRendereventcancelstherenderingofthegridlinesandtheAfterRendereventdrawscustomgridlines.

SubChartSpace1_BeforeRender(drawObject,chartObject,Cancel)

'Checktoseeifthenextobjecttoberendered'isagridline.IfTypeName(chartObject)="ChGridlines"Then

'Canceltherenderingofgridlines.Cancel.Value=TrueEndIfEndSub

SubChartSpace1_AfterRender(drawObject,chartObject)DimchChart1DimplPlotAreaDimlLeftDimlRightDimlHeightDimlTopDimlIncrementDimchConstantsDimiCtr

SetchConstants=ChartSpace1.Constants

'SetavariabletothefirstchartinChartspace1.SetchChart1=ChartSpace1.Charts(0)

Page 2226: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

'Setavariabletotheplotareaofthechart.SetplPlotArea=chChart1.PlotArea

'Checktoseeiftherenderedobjectisagridline.IfTypeName(chartObject)="ChGridlines"Then

'Thenextfourlinesofcodeusetheextentsof'theplotareatocalculatethedimensionsoftheline'tobedrawn.lLeft=plPlotArea.LeftlTop=plPlotArea.ToplRight=plPlotArea.RightlHeight=plPlotArea.Bottom-lTop

'Determinetheincrementtousebetweengridlines.'Changethedivisortoadjusttheincrement.lIncrement=lHeight/10

'Thenextthreelinesofcodesetthepropertiesofthe'linetobedrawn.drawObject.Line.DashStyle=chConstants.chLineRoundDotdrawObject.Line.Color="Green"drawObject.Line.Weight=chConstants.owcLineWeightMedium

ForiCtr=1To9

'Drawtheline.drawObject.DrawLinelLeft,lTop+iCtr*lIncrement,_lRight,lTop+iCtr*lIncrementNextEndIfEndSub

Page 2227: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product
Page 2228: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2229: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeScreenTipEvent

BeforeScreenTipeventasitappliestotheChartSpaceobject.

BeforeScreenTipeventasitappliestothePivotTableobject.

Page 2230: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethiseventtocustomizeScreenTipsdisplayedinachartorPivotTablelist.

Page 2231: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BeforeUpdateEvent

Occurswhendataischanged,butbeforetherecordsetisupdated.Usethiseventtovalidatedatabeforeitiscommittedtothedatabase.

PrivateSubObject_BeforeUpdate(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2232: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

SettheReturnValuepropertyoftheDSCEventInfoobjecttoFalsetocanceltheupdate.

Page 2233: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplecancelstheupdatingoftherecordsetwhentheuserentersavaluegreaterthan0fortheUnitsOnOrderfieldwhentheUnitsInStockfieldisgreaterthan100.

SubMSODSC_BeforeUpdate(DSCEventInfo)

DimtxtUnitsOnOrderDimtxtUnitsInStock

'Setavariabletothetextboxthatcontainsthevalue'fortheUnitsOnOrderfield.SettxtUnitsOnOrder=DSCEventInfo.Section.HTMLContainer_.Children("UnitsOnOrder")

'Setavariabletothetextboxthatcontainsthevalue'fortheUnitsInStockfield.SettxtUnitsInStock=DSCEventInfo.Section.HTMLContainer_.Children("UnitsInStock")

'CheckthevalueoftheUnitsOnOrderField.IfCLng(txtUnitsOnOrder.Value)>0then

'CheckthevalueoftheUnitsInStockField.IfCLng(txtUnitsInStock.Value)>100then

'Displayamessagetotheuser.MsgBox"Don'treorderthepartuntilfewerthan100areinstock."

'Canceltheupdate.DSCEventInfo.ReturnValue=False

Page 2234: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndIfEndIf

EndSub

Page 2235: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingAddedEvent

OccurswhenaneworexistingXmlDataBindingobjectisaddedormodifiedthroughtheEditQuerycommand.

PrivateSubSpreadsheet1_BindingAdded(BindingId)

BindingIdTheuniqueIDofanXmlDataBindingobject.

Page 2236: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheBindingIdisautomaticallygeneratedbytheSpreadsheetcomponentwhenyoubindtoadataretrievalserviceconnection(.uxdc)file.MicrosoftExcelalsoautomaticallygeneratestheBindingIdwhenyouuseExceltocreateadata-boundspreadsheetandlatersaveitasanXMLSpreadsheetfile.IntheXMLSpreadsheetfile,theXMLfragmentthatcontainstheBindingIdlookssomethinglikethefollowing:

<x2:Bindingx2:ID="Bind_id89929"x2:LoadMode="Normal"x2:Async="False">YoucanalsomanuallyassignaBindingIdvaluebyaddingtherelevantXMLfragmentthatcontainsdata-bindingdetailsintoanXMLSpreadsheetfile.

Page 2237: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleinMicrosoftVisualBasicScriptingEdition(VBScript)tracksthenumberofXmlDataBindingobjecteventsanddisplaystheBindingIdofthegiveneventwhenitoccurs.

'globalXmlDataBindingobjectBindingAddedeventcounter.DimgintCounterBindingAddedgintCounterBindingAdded=0

SubSpreadsheet1_BindingAdded(BindingId)

gintCounterBindingAdded=gintCounterBindingAdded+1MsgBox("BindingAddedandBindingIDis:"&BindingId)

EndSub

Page 2238: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingCompletedEvent

OccursafterdataissuccessfullyloadedintoorexportedfromamapthroughaRefreshorUpdatemethod.

PrivateSubSpreadsheet_BindingCompleted(BindingId,Action)

BindingIdRequiredString.TheuniqueIDofanXmlDataBindingobject.YoucanalsomanuallyassignaBindingIdvaluebyaddingtherelevantXMLfragmentthatcontainsdata-bindingdetailsintoanXMLSpreadsheetfile.

ActionReferstothetypeofbindingoperationthatwascompleted.Thepossiblevaluesare"Refresh"and"Update".

Page 2239: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

AuniqueBindingIdisautomaticallygeneratedbytheSpreadsheetcomponentwhenyoubindtoadataretrievalserviceconnection(.uxdc)file.MicrosoftExcelalsoautomaticallygeneratesaBindingIdwhenyouuseExceltocreateadata-boundspreadsheetandlatersaveitasanXMLspreadsheetfile.IntheXMLSpreadsheetfile,theXMLfragmentthatcontainstheBindingIdlookssomethinglikethefollowing:

<x2:Bindingx2:ID="bind_id0"x2:Async="True"xmlns:x2="urn:schemas-microsoft-com:office:excel2"xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp"xmlns:udc="http://schemas.microsoft.com/data/udc"xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"xmlns:udcs="http://schemas.microsoft.com/data/udc/soap"><x2:MapID>map_id0</x2:MapID><udc:DataSourceMajorVersion="1"MinorVersion="0"><udc:Name/><udc:TypeType="SOAP"MajorVersion="1"MinorVersion="0"> <udc:SubTypeType="DSP"MajorVersion="1"MinorVersion="0"/></udc:Type><udc:ConnectionInfoPurpose="Query"><udcs:SOAPAction>http://schemas.microsoft.com/sharepoint/dsp/queryRequest</udcs:SOAPAction><udcs:Locationhref="Data_Retrieval_Services_URL">SQLDataAdapter</udcs:Location><soap-env:Body><dsp:queryRequest><dsp:dsQueryselect="/database[@id='Database_Name']/table[@id='Table_Name']"resultContent="dataOnly"><dsp:QueryRowLimit="10"QueryType="DSPQ"><dsp:Fields><dsp:FieldName="Column_Name"/></dsp:Fields></dsp:Query></dsp:dsQuery>

Page 2240: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

</dsp:queryRequest></soap-env:Body><soap-env:Header><dsp:versions><dsp:version>1.0</dsp:version></dsp:versions><dsp:dataRoot><dsp:root>SQL_Server</dsp:root></dsp:dataRoot><dsp:requestservice="DspSql"document="content"method="query"/><dsp:authentication><dsp:basic><dsp:useExplicit><dsp:userId>user_name</dsp:userId><dsp:password>password</dsp:password></dsp:useExplicit></dsp:basic></dsp:authentication></soap-env:Header></udc:ConnectionInfo></udc:DataSource></x2:Binding>

TheBindingCompletedeventistriggeredafterdataissuccessfullyloadedintoorexportedoutofamapthroughaRefreshorUpdatemethod.ThiseventisalsotriggeredwhenthepageisfirstrenderedforquerybindingswheretheLoadModeattributeoftheBindingelementissetto"normal".

Duringanasynchronousbinding,somemethodsrelatedtodatabindingwillgeneraterun-timeerrorssayingthattherequestedoperationcannotbecompletedbecauseanasynchronousbindingisinprogress.Callstothesemethodssucceedwhentheasynchronousbindingisdone.Formoreinformation,seetheXMLDataBindingobjectdocumentation.

SolutiondevelopersshouldtraptheBindingCompletedand

Page 2241: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingErroreventstofindoutwhenthebindingisfinished.NotethatusingtheBindingCompletedeventtoselectanXMLrowdoesnotsendthatrowtoapart-to-partbindingconsumerwhenthepageisloaded.UsetheWindow.Onloadeventforthatpurpose.

ThefollowingXMLfragmentexampleshowsLoadMode="normal":

<x2:Bindingx2:ID="Bind_id89929"x2:LoadMode="normal"x2:Async="true"xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml"> ...</x2:Binding>

ThefollowingexampleshowshowtotraptheBindingCompletedeventfromscriptrunninginaWebpagewhenthepageisfirstloadedandwhenevertheuserrefreshesthebounddata(thebehaviorwhentheLoadModeattributeissetto"normal").Toworkcorrectly,youmustputtheeventhandlerfortheBindingCompletedeventina<SCRIPT>tagthatislocatedbeforethe<OBJECT>tagoftheSpreadsheetcomponent.

<SCRIPTlanguage=vbscriptfor="Spreadsheet1"event="BindingCompleted(bindingID,Action)">

IfSpreadsheet1.ActiveWorkbook.XmlDataBindings.Item(bindingID).CanQuery=TrueThen

MsgBox"BindingCompleted."

EndIf

</SCRIPT>

<OBJECTid=Spreadsheet1classid=CLSID:0002E559-0000-0000-C000-000000000046>...</OBJECT>

Page 2242: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingDeletedEvent

OccurswhenanewXmlDataBindingobjectisdeleted.

PrivateSubSpreadsheet_BindingDeleted(BindingId)

BindingIdRequiredString.TheuniqueIDofanXmlDataBindingobject.TheuniqueBindingIdisautomaticallygeneratedbytheSpreadsheetcomponentwhenyoubindtoadataretrievalserviceconnection(.uxdc)file.MicrosoftExcelalsoautomaticallygeneratestheBindingIdwhenyouuseExceltocreateadata-boundspreadsheetandlatersaveitasanXMLSpreadsheetfile.IntheXMLSpreadsheetfile,theXMLfragmentthatcontainstheBindingIdlookssomethinglikethefollowing:<x2:Bindingx2:ID="Bind_id89929"x2:LoadMode="normal"x2:Async="False">.YoucanalsomanuallyassignaBindingIdvaluebyaddingtherelevantXMLfragmentthatcontainsdata-bindingdetailsintoanXMLSpreadsheetfile.

Page 2243: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampletracksthenumberofBindingDeletedeventsanddisplaystheBindingIdofthegiveneventwhenitoccurs.

'globalXmlDataBindingobjectBindingDeletedeventcounter.DimgintCounterBindingDeletedgintCounterBindingDeleted=0

SubSpreadsheet1_BindingDeleted(BindingId)gintCounterBindingDeleted=gintCounterBindingDeleted+1MsgBox"BindingDeletedandBindingIdis:"&BindingIdEndSub

Page 2244: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingErrorEvent

OccursafteranerrorisreceivedfromthedatasourcefollowingacalltoRefreshorUpdatemethodoperation.

PrivateSubSpreadsheet1_BindingError(BindingId,Action,DialogText,FaultCode,FaultString,FaultDetail)

BindingIdRequiredString.TheuniqueIDofanXmlDataBindingobject.TheuniqueBindingIdisautomaticallygeneratedbytheSpreadsheetcomponentwhenyoubindtoadataretrievalserviceconnection(.uxdc)file.MicrosoftExcelalsoautomaticallygeneratestheBindingIdwhenyouuseExceltocreateadata-boundspreadsheetandlatersaveitasanXMLSpreadsheetfile.IntheXMLSpreadsheetfile,theXMLfragmentthatcontainstheBindingIdlookssomethinglikethefollowing:<x2:Bindingx2:ID="Bind_id89929"x2:LoadMode="normal"x2:Async="False">.YoucanalsomanuallyassignaBindingIdvaluebyaddingtherelevantXMLfragmentthatcontainsdata-bindingdetailsintoanXMLSpreadsheetfile.

ActionRequiredString.Referstothetypeofbindingoperationthatwascompleted.Thepossiblevaluesare"Refresh"and"Update".

DialogTextRequiredString.Referstotheerrorstringmappedtothefaultcodereceived.

FaultCodeRequiredString.Correspondstothe<FaultCode>elementinthefaultmessage—forexample,"Client.Dsp.Authentication".

FaultStringRequiredString.Correspondstothe<FaultString>elementinthefaultmessage—forexample,"Can'tlogonuser<username>".

FaultDetailRequiredString.Correspondstothe<Detail>elementinthefaultmessage—forexample,<dsp:queryResponsestatus="failure"xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp"></dsp:queryResponse><dsp:author>authorName</dsp:author>ThesestringsmatchthestructureofdataretrievalserviceconnectionSOAPfaultmessages.

Page 2245: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

ForXMLSpreadsheetfilesandpart-to-partbindings,theDialogTexterrorstringwillbepresentinthefaultmessagebutnotintheFaultCode,FaultStringandFaultDetailparameters.ForarbitrarySOAPbindings,FaultCodeandFaultStringarereturnedbyallXMLWebservicesfaultmessages—buttheoptionalelementFaultDetailisnotreturnedbymostXMLWebservices,includingdataretrievalservices.

WhenaRefreshorUpdatemethodfails,theBindingErroreventfiresandanerrordialogboxisdisplayed.Tocatchtheerrorinscript,solutiondevelopersshouldtraptheBindingErrorevent.Theerrorwon'tbereturnedbytheRefreshorUpdatemethodsorbyInternetExplorer.WhenRefreshorUpdateiscalledonanasynchronousbinding,thesemethodsreturnimmediately.

SolutiondevelopersshouldtraptheBindingCompletedandBindingErroreventstofindoutwhenthebindingisfinished.NotethatusingtheBindingCompletedeventtoselectanXMLrowdoesnotsendthatrowtoapart-to-partbindingconsumerwhenthepageisloaded.UsetheWindow.Onloadeventforthispurpose.

Page 2246: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

BindingUpdatedEvent

OccurswhentheBindingDatapropertyofanexistingXmlDataBindingobjectischanged.

PrivateSubSpreadsheet1_BindingUpdated(BindingId)

BindingIdRequiredString.TheuniqueIDofanXmlDataBindingobject.

BindingIdRequiredString.TheuniqueIDofanXmlDataBindingobject.TheuniqueBindingIdisautomaticallygeneratedbytheSpreadsheetcomponentwhenyoubindtoadataretrievalserviceconnection(.uxdc)file.MicrosoftExcelalsoautomaticallygeneratestheBindingIdwhenyouuseExceltocreateadata-boundspreadsheetandlatersaveitasanXMLSpreadsheetfile.IntheXMLSpreadsheetfile,theXMLfragmentthatcontainstheBindingIdlookssomethinglikethefollowing:<x2:Bindingx2:ID="Bind_id89929"x2:LoadMode="normal"x2:Async="False">.YoucanalsomanuallyassignaBindingIdvaluebyaddingtherelevantXMLfragmentthatcontainsdata-bindingdetailsintoanXMLSpreadsheetfile.

Page 2247: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

TheXmlDataBindingobjectcontainsconfigurationdataintheformofXML.YoucanusetheBindingDatapropertytoreturnorsettheconfigurationdataforagivenXmlDataBindingobject.

Page 2248: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2249: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ButtonClickEvent

Occurswhenevertheuserclicksanavigationbutton.

PrivateSubRecordNavigationControl_ButtonClick(NavButtonAsNavButtonEnum)

NavButtonSpecifiesthebuttonthat,whenclicked,triggerstheButtonClickevent.CanbeoneoftheNavButtonEnumconstants.

Page 2250: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2251: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChangeEvent

Occurswheneverdatainoneormorecellschanges.Botheditsandcopy-and-pasteoperationscausethiseventtooccur.

PrivateSubRange_Change()

Page 2252: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThiseventoccursaftertheEndEditevent;atthispoint,thedatahasalreadybeenchangedandthechangecannotbecanceled.

ThiseventrequirestheWithEventskeyword,soitcannotbeusedwithVBScriptorJScript.

Page 2253: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleupdatesalabelcontrolonaVisualBasicformwhenthevalueincellA1ofSheet1inSpreadsheet1changes.

DimWithEventsrngRange1AsRange

PrivateSubForm_Load()

'Setavariabletotherangeforwhichyouwanttocapture'theChangeevent.SetrngRange1=Spreadsheet1.Worksheets("Sheet1").Range("A1")

EndSub

PrivateSubrngRange1_Change()'ChangethecaptionofLabel1tothecurrentvalue'ofcellA1.Label1.Caption=rngRange1.ValueEndSub

Page 2254: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ClickEvent

Occurswhenevertheuserclicksthespecifiedcontrol.

PrivateSubobject_Click()

objectAChartSpace,PivotTable,orSpreadsheetobject.

Page 2255: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2256: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CommandBeforeExecuteEvent

Occursbeforeacommandisexecuted.Usethiseventwhenyouwanttoimposecertainrestrictionsbeforeacommandisexecuted.

PrivateSubobject_CommandBeforeExecute(ByValCommandAsVariant,ByValCancelAsByRef)

objectAChartSpace,PivotTable,orSpreadsheetobject.

CommandRequired.Thecommandthathasbeenexecuted.

CancelRequired.SettheValuepropertyofthisobjecttoTruetocancelthecommand.

Page 2257: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheOCCommandId,ChartCommandIdEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachoftheMicrosoftOfficeWebComponents.

Page 2258: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplerefreshesPivotTable1whentheexportcommandisinvokedsothatthelatestdataisexportedtoMicrosoftExcel.

SubPivotTable1_CommandBeforeExecute(Command,Cancel)

DimptConstants

SetptConstants=PivotTable1.Constants

'ChecktoseeiftheExportcommand'hasbeeninvoked.IfCommand=ptConstants.plCommandExportThen

'RefreshthePivotTablelist.PivotTable1.Refresh

EndIf

EndSub

Page 2259: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CommandCheckedEvent

OccurswhenthethespecifiedMicrosoftOfficeWebComponentdetermineswhetheracommandischecked.

PrivateSubobject_CommandChecked(ByValCommandAsVariant,ByValCheckedAsByRef)

objectAChartSpace,PivotTable,orSpreadsheetobject.

CommandRequired.Thecommandthathasbeenexecuted.

CheckedRequired.SettheValuepropertyofthisobjecttoTruetouncheckthecommand.

Page 2260: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheOCCommandId,ChartCommandIdEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachWebcomponent.

Page 2261: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CommandEnabledEvent

OccurswhenthethespecifiedMicrosoftOfficeWebComponentcommandisenabled.

PrivateSubobject_CommandEnabled(ByValCommandAsVariant,ByValEnabledAsByRef)

objectAChartSpace,PivotTable,orSpreadsheetobject.

CommandRequired.Thecommandthathasbeenexecuted.

EnabledRequired.SettheValuepropertyofthisobjecttoTruetodisablethecommand.

Page 2262: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheOCCommandID,ChartCommandIDEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachWebcomponent.

Page 2263: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CommandExecuteEvent

Occursafteracommandisexecuted.Usethiseventwhenyouwanttoexecuteasetofcommandsafteraparticularcommandisexecuted.

PrivateSubobject_CommandExecute(ByValCommandAsVariant,ByValSucceededAsBoolean)

objectAChartSpace,PivotTable,orSpreadsheetobject.

CommandThecommandthathasbeenexecuted.

SucceededReturnsTrueifthecommandsucceeded.

Page 2264: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheOCCommandId,ChartCommandIdEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachoftheOfficeWebComponents.

Page 2265: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplewritesthecurrentdateandtimetoaHTMLtextboxcontroleverytimethatPivotTable1isrefreshed.

SubPivotTable1_CommandExecute(Command,Succeeded)

DimptConstants

SetptConstants=PivotTable1.Constants

'ChecktoseeifthePivotTablelisthasbeenrefreshed.IfCommand=ptConstants.plCommandRefreshThen

'Writethecurrentdataandtimetothetextbox.TextBox.Value="PivotTableLastRefeshedon"&_Date&"at"&Time

EndIf

EndSub

Page 2266: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CommandTipTextEvent

OccurswhenthethespecifiedMicrosoftOfficeWebComponentqueriesacommand'sScreenTiptext.

PrivateSubobject_CommandTipText(ByValCommandAsVariant,ByValCaptionAsByRef)

objectAChartSpace,PivotTable,orSpreadsheetobject.

CommandThecommandthathasbeenexecuted.

CaptionTheValuepropertyofthisobjectcontainstheScreenTiptextforthecommand.

Page 2267: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksTheOCCommandId,ChartCommandIdEnum,PivotCommandId,andSpreadsheetCommandIdconstantscontainlistsofthesupportedcommandsforeachWebcomponent.

Page 2268: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

CurrentEvent

Occurswhenarecordbecomesthecurrentrecord.

PrivateSubObject_Current(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2269: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2270: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataChangeEvent

Occurswhencertainpropertiesarechangedorwhencertainmethodsareexecuted.SeethePivotDataReasonEnumconstantformoreinformationaboutthepropertiesandmethodsthatcantriggerthisevent.

PrivateSubObject_DataChange(ByValReasonAsPivotDataReasonEnum)

ObjectThenameofthePivotTableobjectthatyouaretrappingthiseventfor.

ReasonUsethevalueofthePivotDataReasonEnumconstanttodeterminethereasonthatthiseventwastriggered.

Page 2271: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataErrorEvent

Occurswheneveradataerroroccurs.

PrivateSubObject_DataError(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2272: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataPageCompleteEvent

Occurswhenthespecifieddataaccesspagefinishesloading.

PrivateSubObject_DataPageComplete(DSCEventInfoAsDSCEVENTINFO)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2273: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DataSetChangeEvent

Occurswheneverachartworkspaceisdata-boundandthedatasetchanges—forexample,whenafilteroperationtakesplace.Thiseventalsooccurswheninitialdataisavailablefromthedatasource.

PrivateSubObject_DataSetChange()

ObjectThenameoftheChartSpaceobjectthatthiseventappliesto.

Page 2274: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2275: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DblClickEvent

Occurswhenevertheuserdouble-clicksthespecifiedcontrol.

PrivateSubobject_DblClick()

objectAChartSpace,PivotTable,orSpreadsheetobject.

Page 2276: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DirtyEvent

Occurswhenthecontentsofadataaccesspagearechangedbytheuser.

PrivateSubObject_Dirty(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2277: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettheReturnValuepropertyoftheDSCEventInfoobjecttoFalsetorestorethepreviousvalue.

UsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

ThiseventfiresbeforetheBeforeUpdateevent.

Page 2278: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

EndEditEvent

OccurswhenevertheuserswitchesfromeditmodeonthespecifiedSpreadsheetControlorPivotTablelist.YoucanusethiseventtovalidatedataentryinaworksheetorinthedetailareaofaPivotTablelist.

PrivateSubObject_EndEdit(ByValAcceptAsBoolean,ByValFinalValueAsByRef,ByValCancelAsByRef,ByValErrorDescriptionAsByRef)

ObjectAPivotTableorSpreadsheetobject.

AcceptSpecifieswhetherornotthespecifiedcontrolisacceptingtheedit.IfthisargumentisFalse,thenthecontrolisleavingeditmodebecausetheusercancelledtheedit.IfthisargumentisTrue,thenyoucancanceltheedit.

FinalValueTheValuepropertyofthisargumentreturnsthevaluethatistobeenteredintotheworksheetorPivotTablelist.

CancelSettheValuepropertyofthisargumenttoTruetocanceltheeditandleavetheuserineditmode.

ErrorDescriptionSettheValuepropertyofthisargumenttothetextthatyouwanttodisplaytotheuser.Thedefaulttextis"Thenewvaluewasnotaccepted.".

Page 2279: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

FocusEvent

Occurswhenasectioninadataaccesspagereceivesfocus.

PrivateSubObject_Focus(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2280: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

Page 2281: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

InitializeEvent

OccurswhentheSpreadsheetComponentisloading,butbeforeitisloadedcompletely.

PrivateSubObject_Initialize()

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

Page 2282: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethiseventtoinitializethesettingsforthespreadsheet.

Page 2283: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheInitializeeventtosetthespreadsheetdatafromafileontheuser'scomputer.

SubSpreadsheet1_Initialize()

'LoadaCSVfileintothespreadsheet.Spreadsheet1.CSVURL="Data.csv"

EndSub

Page 2284: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

KeyDownEvent

Occurswhenevertheuserpressesakeyonthekeyboard.Iftheuserholdsthekeydown,thiseventrepeatsitselfatthekey-repeatintervalthathasbeensetontheuser’scomputer.

PrivateSubObject_KeyDown(ByValKeyCodeAsLong,ByValShiftAsLong)

ObjectThenameoftheChartSpace,PivotTableorSpreadsheetobjectthatyouaretrappingthiseventfor.

KeyCodeALongthatrepresentsthekeycodeofthekeythatwaspressedorreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeys.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,and4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

Page 2285: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Thesequenceofkeyboard-relatedeventsis:

1. BeforeKeyDown

2. KeyDown

3. BeforeKeyPress

4. KeyPress

5. BeforeKeyUp

6. KeyUp

Page 2286: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

KeyPressEvent

Occurswhenevertheuserpressesandreleasesakeyonthekeyboard.

PrivateSubObject_KeyPress(ByValKeyAsciiAsLong)

ObjectThenameoftheChartSpace,PivotTableorSpreadsheetobjectthatyouaretrappingthiseventfor.

KeyAsciiALongthatrepresentsthekeycodeofthekeythatwaspressedorreleased.

Page 2287: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThiseventwillnotbecallediftheBeforeKeyDowneventiscancelled.

ForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Thesequenceofkeyboard-relatedeventsis:

1. BeforeKeyDown

2. KeyDown

3. BeforeKeyPress

4. KeyPress

5. BeforeKeyUp

6. KeyUp

Page 2288: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

KeyUpEvent

Occurswhenevertheuserreleasesakeyonthekeyboard.

PrivateSubObject_KeyUp(ByValKeyCodeAsLong,ByValShiftAsLong)

ObjectThenameoftheChartSpace,PivotTableorSpreadsheetobjectthatyouaretrappingthiseventfor.

KeyCodeALongthatrepresentsthekeycodeofthekeythatwaspressedorreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeys.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,and4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

Page 2289: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Thesequenceofkeyboard-relatedeventsis:

1. BeforeKeyDown

2. KeyDown

3. BeforeKeyPress

4. KeyPress

5. BeforeKeyUp

6. KeyUp

Page 2290: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

LoadCompletedEvent

OccurswhentheSpreadsheetComponenthascompletedloading.

PrivateSubObject_LoadCompleted()

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

Page 2291: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MouseDownEvent

Occurswhenevertheuserpressesamousebuttonwhilethepointerispositionedoverthespreadsheet,PivotTablelist,orthechartworkspace.

PrivateSubObject_MouseDown(ByValButtonAsLong,ByValShiftAsLong,ByValxAsLong,ByValyAsLong)

ObjectThenameoftheChartSpace,PivotTableorSpreadsheetobjectthatyouaretrappingthiseventfor.

ButtonThemousebuttonthatwasreleased.Returns1iftheprimarymousebuttonwasreleased,2ifthesecondarymousebuttonwasreleased,or4ifthemiddlemousebuttonwasreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeyswhentheeventoccurred.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,or4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

xTheXcoordinateofthemousepointer.

yTheYcoordinateofthemousepointer.

Page 2292: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2293: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MouseMoveEvent

OccurswhenevertheusermovesthemousepointeroverthePivotTablelistorthechartworkspace.

PrivateSubObject_MouseMove(ByValButtonAsLong,ByValShiftAsLong,ByValxAsLong,ByValyAsLong)

ObjectThenameoftheChartSpaceorPivotTableobjectthatyouaretrappingthiseventfor.

ButtonThemousebuttonthatwasreleased.Returns1iftheprimarymousebuttonwasreleased,2ifthesecondarymousebuttonwasreleased,or4ifthemiddlemousebuttonwasreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeyswhentheeventoccurred.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,or4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

xTheXcoordinateofthemousepointer.

yTheYcoordinateofthemousepointer.

Page 2294: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2295: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MouseOutEvent

Occurswhenevertheusermovesthemousepointeroutofacellonaspreadsheet.

PrivateSubObject_MouseOut(ByValButtonAsLong,ByValShiftAsLong,ByValTargetAsRange)

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

ButtonThemousebuttonthatwasreleased.Returns1iftheprimarymousebuttonwasreleased,2ifthesecondarymousebuttonwasreleased,or4ifthemiddlemousebuttonwasreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeys.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,or4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

TargetARangeobjectthatrepresentsthecellorcellsthatthemousepointerwasmovedoutof.

Page 2296: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2297: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MouseOverEvent

Occurswhenevertheusermovesthemousepointeroveracellonthespecifiedspreadsheet.

PrivateSubObject_MouseOut(ByValButtonAsLong,ByValShiftAsLong,ByValTargetAsRange)

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

ButtonThemousebuttonthatwasreleased.Returns1iftheprimarymousebuttonwasreleased,2ifthesecondarymousebuttonwasreleased,or4ifthemiddlemousebuttonwasreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeys.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,or4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

TargetARangeobjectthatrepresentsthecellorcellsthatthemousepointerwasmovedover.

Page 2298: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2299: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MouseUpEvent

Occurswhenevertheuserreleasesamousebuttonwhilethepointerispositionedoverthespreadsheet,PivotTablelist,orthechartworkspace.

PrivateSubObject_MouseUp(ByValButtonAsLong,ByValShiftAsLong,ByValxAsLong,ByValyAsLong)

ObjectThenameoftheChartSpace,PivotTableorSpreadsheetobjectthatyouaretrappingthiseventfor.

ButtonThemousebuttonthatwasreleased.Returns1iftheprimarymousebuttonwasreleased,2ifthesecondarymousebuttonwasreleased,4ifthemiddlemousebuttonwasreleased.

ShiftThestateoftheSHIFT,CTRL,andALTkeyswhentheeventoccurred.Returns1iftheSHIFTkeywaspressed,2iftheCTRLkeywaspressed,and4iftheALTkeywaspressed.Returns0ifneithertheSHIFT,CTRL,norALTkeyswerepressed.

xThexcoordinateofthemousepointer.

yTheycoordinateofthemousepointer.

Page 2300: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2301: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

MouseWheelEvent

Occurswhentheuserrotatesthemousewheelonamousedevicethathasawheel.

PrivateSubObject_MouseWheel(ByValPageAsBoolean,ByValCountAsLong)

ObjectThenameoftheChartSpace,PivotTable,orSpreadsheetobjectthatyouaretrappingthiseventfor.

PageReturnsTrueifthepagewaschanged.

CountThenumberoflinesthatwerescrolled.

Page 2302: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ParametersOutReadyEvent

TheParametersOutReadyeventoccurswhenasetofparametersispassedfromaconnectedWebPartthatimplementstheIParametersOutProviderinterfacetoaSpreadsheetWebPartthatimplementstheIParametersOutConsumerinterface.

expression.ParametersOutReady(InterfaceNameAsString,ParamValuesAsVariant)

expressionRequired.AnexpressionthatreturnsaSpreadsheetobject.

InterfaceNameThenameoftheIParametersOutConsumerinterfacereceivingtheevent(asdefinedinthesolutionspecificationfile:InterfaceConnections/ParametersOutConsumer@Name).

ParamValuesAnarrayofstringsthatcontainstheparametersprovidedbytheWebPartimplementingtheIParametersOutProviderinterface.

Page 2303: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

ThiseventappliesonlytoaSpreadsheetWebPartonaWebPartPageonaSharePointsite.FormoreinformationontheSpreadsheetWebPart,searchExcelhelpandtheMicrosoftDeveloperNetwork(MSDN)Website.

TheParametersOutReadyeventfireswhenaseparateWebPartthatimplementstheIParametersOutProviderinterfaceinvokestheFireParametersOutmethod.TheParamValuesparameterisanarrayofstringsinwhicheachstringcontainsthevalueofaparameter.TheParamValuesparametermusthavethesamelengthandorderastheitemslistedintheIParametersOutProviderinterfacedeclaration.Whenthiseventfires,youcanquerytheWebPartdatasourcetogettheupdateddatathathasbeensenttothedatasourcebytheWebPartthatimplementstheIParametersOutProviderinterface.

Page 2304: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2305: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotTableChangeEvent

OccurswheneveraPivotTablelistfield,fieldset,ortotalisaddedordeleted.

PrivateSubPivotTable_PivotTableChange(ReasonAsPivotTableReasonEnum)

ReasonSpecifieshowthePivotTablelistchanged.CanbeoneofthePivotTableReasonEnumconstants.

Page 2306: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2307: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

QueryEvent

OccurswheneveraPivotTablelistquerybecomesnecessary.Thequerymaynotoccurimmediately;itmaybedelayeduntilthenewdataisdisplayed.

PrivateSubPivotTable_Query()

Page 2308: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordExitEvent

Occurswhentheusernavigatestoanotherrecord,refreshethedataaccesspage,orclosesthedataaccesspage.

PrivateSubObject_RecordExit(DSCEventInfoAsDSCEventInfo)

ObjectThenameoftheDataSourceControlobjectthatthiseventappliesto.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2309: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksThiseventoccursaftertheBeforeUpdateevent,butbeforetherecordischanged.

Inthecaseofabandeddataaccesspage,movingamongchildrecordsforthesameparentdoesnotfirethisevent.

SettingtheReturnValuepropertyoftheDSCEventInfoobjecttoFalsecancelsthiseventandpreventstherecordfrombeingchanged.

UsetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttodeterminethedataaccesspage,section,andrecordsetthatwasupdated.

Page 2310: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RecordsetSaveProgressEvent

OccursrepeatedlywhentheExportXMLmethodiscalled.Usethiseventtoprovidefeedbacktotheuserwhenarecordsetisexported.

PrivateSubObject_RecordsetSaveProgress(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2311: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsethePercentCompletepropertytodeterminethecurrentprogressoftheexportoperation.

YoucannotusethiseventtoupdatethecontentsofthecurrentHTMLdocument.

Page 2312: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheRecordsetSaveProgesseventtoupdateMicrosoftInternetExplorer'sstatusbarwhentherecordsetcontainedbytheDataSourceControlissaved.

SubMSODSC_RecordsetSaveProgress(DSCEventInfo)

'Updatethestatusbarwiththecurrent'completionpercentage.Window.Status=DSCEventInfo.PercentComplete

'Checktoseeifthesavehasbeencompleted.IfDSCEventInfo.PercentComplete=100then

'Clearthestatusbarwhenthesaveiscomplete.Window.Status=""EndIf

EndSub

Page 2313: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RowReadyEvent

TheRowReadyeventprocedureoftheSpreadsheetcomponentiscalledwhenaListObjectobjectisloadedintothecomponent,whenasinglerowinaListObjectobjectisselected,andwhentheRefreshmethodoftheXmlDataBindingobjectiscalled,regardlessofthesuccessorfailureofthatmethod.

PrivateSubSpreadsheet1_RowReady(XDTNameAsString,RowDataArrayAsVariant,SelectionStatusAsString)

XDTNameContainsthevalueoftheNamepropertyoftheListObjectobject.

RowDataArrayThisparametercontainsanarrayofvaluesfromeachcellintheselectedrowwhenSelectionStatusreturns"Standard".ThearraywillbeemptywhenSelectionStatusreturns"New"or"None".

SelectionStatusContainsoneofthevaluesdescribedinthefollowingtable:

Value DescriptionNew Indicatesthatthenew,orinsertrow,isselected.Thearrayof

valuesinRowDataArraywillbeempty.None Indicatesthatnorowisselected.Thearrayofvaluesin

RowDataArraywillbeempty.Standard Indicatesthatanexistingrowisselected.Thearrayofvalues

inRowDataArraycontainvaluesfromeachcellintheselectedrow.

Page 2314: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Remarks

IfthiseventfiresasaresultofloadinganewXMLSpreadsheetfileorXMLdataintothecontrol,thevalueoftheSelectionStatusparameterwillbe"None".TheSpreadsheetcomponentwillfiretheRowReadyeventanytimetheactivecellismovedtoadifferentrowinalist.TheRowReadyeventwillnotfireifauserclickswithinaselectedrow,orclicksoutsideofthelist,andthenselectsmultiplerowswithinthelist.

Page 2315: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThefollowingexampleusestheRowReadyeventproceduretoworkwiththeinformationcontainedintheeventprocedureparameters:

SubSpreadsheet1_RowReady(XDTName,RowDataArray,SelectionStatus)DimstrCellDataDimintItem

SelectCaseSelectionStatus Case"None" Case"New" Case"Standard" ForintItem=0toUBound(RowDataArray)-1 strCellData=RowDataArray(intItem)'Workwithdataincellsofselectedrowhere. NextCaseElse EndSelectEndSub

Page 2316: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectionChangeEvent

Occurswhenevertheusermakesanewselection.Theusercannotcancelthisevent.

PrivateSubObject_SelectionChange()

ObjectThenameoftheChartSpace,PivotTable,orSpreadsheetobjectthatthiseventappliesto.

Page 2317: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

YoucanusetheSelectionpropertytodeterminetheobjecttypeofthecurrentselection,asshowninthefollowingexample.

PrivateSubPivotTable_SelectionChange()IfTypeName(PivotTable.Selection)="PivotTotal"Then'HandleselectionofatotalhereEndIfEndSub

Page 2318: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SelectionChangingEvent

Occurswhenevertheusermovesthemousepointerwhileselectingarange.Thiseventdoesnotoccurwhentheuserselectsarangebyusingthekeyboard.Theusercannotcancelthisevent.

PrivateSubObject_SelectionChanging(ByValRangeAsRange)

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

RangeARangeobjectthatrepresentstherangeofcellsthatarebeingselected.

Page 2319: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2320: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SheetActivateEvent

Occurswhenaworksheetisactivated.

PrivateSubObject_SheetActivate(ByValShAsWorksheet)

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

ShRequiredWorksheet.Theworksheetthathasbeenactivated.

Page 2321: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenauserchangesworksheets,theSheetDeactivateeventiscalledbeforetheSheetActivateevent.

Page 2322: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysthenameoftheactivatedworksheeteachtimethataworksheetisactivatedinSpreadsheet1.

SubSpreadsheet1_SheetActivate(Sh)

MsgBoxSh.Name

EndSub

Page 2323: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SheetCalculateEvent

Occursafteranyworksheethasbeencalculated.

PrivateSubObject_SheetCalculate(ByValShAsWorksheet)

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

ShAWorksheetobjectthatrepresentstheworksheetthatwascalculated.

Page 2324: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleusestheSheetCalculateeventtomonitorthestatusofthevalueincellA5inSheet1ofSpreadsheet1.

SubSpreadsheet1_SheetCalculate(Sh)

DimrngRangeToWatch

'Setavariabletothecellthatyouwanttowatch.SetrngRangeToWatch=Spreadsheet1.Worksheets("Sheet1").Range("A5")

'IfthecalculatedsheetisSheet1...IfSh.Name="Sheet1"Then

'...andthevalueofthecelltowatchislessthant10...IfrngRangeToWatch.Value<10Then

'...alerttheuserofthestatus.MsgBox"Inventoryislessthan10.Reorderthepart."EndIf

EndIf

EndSub

Page 2325: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SheetChangeEvent

Occurswhencellsinanyworksheetarechangedbytheuserorbyanexternallink.

PrivateSubObject_SheetChange(ByValShAsObject,ByValTargetAsRange)

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

ShAWorksheetobjectthatrepresentsthesheet.

TargetARangeobjectthatrepresentsthechangedrange.

Page 2326: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleillustrateshowtousetheSheetChangeeventtoperformconditionalformattingoncellsA1:10inSheet1ofSpreadsheet1.

SubSpreadsheet1_SheetChange(Sh,Target)DimrngIntersectDimrngCondFormat

'Setavariabletotherangetobeconditionallyformatted.Inthis'case,therangeiscellsA1:A10onSheet1.SetrngCondFormat=Spreadsheet1.Worksheets("Sheet1").Range("A1:A10")

'ChecktoseeifthechangewasmadeonSheet1.IfSh.Name="Sheet1"Then

'Setavariabletotheintersectionofthechangedcell'andtheconditionalformattingrange.SetrngIntersect=Spreadsheet1.RectIntersect(Target,rngCondFormat)

'Checktoseeifthechangedcellintersectswiththe'conditionalformattingrange.IfNotrngIntersectIsNothingThen

'Formatthetargetcellbasedonitsvalue.SelectCaseTarget.Value

CaseIs>=25Target.Font.Color="Green"Target.Font.Bold=TrueTarget.Font.Italic=FalseCaseIs>=10

Page 2327: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

Target.Font.Color="Blue"Target.Font.Bold=FalseTarget.Font.Italic=TrueCaseIs<10Target.Font.Color="Red"Target.Font.Bold=TrueTarget.Font.Italic=FalseEndSelectEndIfEndIfEndSub

Page 2328: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SheetDeactivateEvent

Occurswhenaworksheetisdeactivated.

PrivateSubObject_SheetDeactivate(ByValShAsWorksheet)

ObjectThenameoftheSpreadsheetobjectthatyouaretrappingthiseventfor.

ShRequiredWorksheet.Theworksheetthathasbeendeactivated.

Page 2329: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksWhenauserchangesworksheets,thiseventiscalledbeforetheSheetActivateevent.

Page 2330: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampledisplaysthenameofthedeactivatedworksheeteachtimethataworksheetisdeactivatedinSpreadsheet1.

SubSpreadsheet1_SheetDeactivate(Sh)

MsgBoxSh.Name&"wasjustdeactivated."

EndSub

Page 2331: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

SheetFollowHyperlinkEvent

Occurswhenahyperlinkisclicked.

PrivateSubobject_SheetFollowHyperlink(ByValShAsWorksheet,TargetAsHyperlink)

objectRequired.ThenameofaSpreadsheetobjectthatyouaretrappingthiseventfor.

ShRequired.Theworksheetthathasbeendeactivated.

TargetRequired.Thehyperlinkthathasbeenclicked.

Page 2332: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplekeepsalogofhyperlinksclickedinSpreadsheet1.ThenameofthesheetcontainingthehyperlinkandthetargetaddressarewrittentoSheet3eachtimethatahyperlinkisclicked.

SubSpreadsheet1_SheetFollowHyperlink(Sh,Target)

DimssConstantsDimrngNewItemDimshtListSheet

SetssConstants=Spreadsheet1.Constants

'SetavariabletoSheet3.SetshtListSheet=Spreadsheet1.ActiveWorkbook.Worksheets("Sheet3")

'SetavariabletothefirstavailablecellincolumnAofSheet3.SetrngNewItem=shtListSheet.Range("A262144").End(ssConstants.xlUp).Offset(1,0)

'WritethenameofthesheettoColumnAofSheet3.rngNewItem.Value=Sh.Name

'WritethetargetaddressofthehyperlinktoColumnBofSheet3.rngNewItem.Offset(0,1).Value=Target.Address

EndSub

Page 2333: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2334: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

StartEditEvent

StartEditeventasitappliestotheSpreadsheetobject.

StartEditEventasitappliestothePivotTableobject.

Page 2335: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2336: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UndoEvent

OccurswhentheuserclickstheUndobuttononthenavigationcontrol,ortheDirtyeventiscanceled.Thiseventfiresbeforethedataisreturnedtoitsoriginalvalues.Usethiseventtosettheconditionsunderwhichtheuserisallowedtoundoachange.

PrivateSubObject_Undo(ByValDSCEventInfoAsDSCEventInfo)

ObjectADataSourceControlobject.

DSCEventInfoTheDSCEventInfoobjectthatcontainsinformationabouttheevent.

Page 2337: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettheReturnValuepropertyoftheDSCEventInfoobjecttoFalsetocanceltheundoaction.

YoucanusetheDataPageandSectionpropertiesoftheDSCEventInfoobjecttogetmoreinformationaboutthepage.

Page 2338: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2339: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ViewChangeEvent

ViewChangeeventasitappliestotheChartSpaceobject.

ViewChangeeventasitappliestothePivotTableobject.

ViewChangeeventasitappliestotheSpreadsheetobject.

Page 2340: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutusingeventswithVBScript,seeDeclaringandUsingEventProceduresinVBScript.

Page 2341: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ShowAll

Page 2342: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

OfficeWebComponentsConstants

ThistopicprovidesalistofallconstantsintheOfficeWebComponentsobjectmodel.Forinformationonhowtousetheseconstants,seeUsingNamedConstantsinVBScript.

AddinClientTypeEnum

BindingLoadMode

Chart3DSurfaceEnum

ChartAxisCrossesEnum

ChartAxisGroupingEnum

ChartAxisPositionEnum

ChartAxisTypeEnum

ChartAxisUnitTypeEnum

ChartBoundaryValueTypeEnum

ChartChartLayoutEnum

ChartChartTypeEnum

ChartColorIndexEnum

ChartCommandIdEnum

ChartDataGroupingFunctionEnum

ChartDataLabelPositionEnum

ChartDataPointEnum

ChartDataSourceTypeEnum

ChartDimensionsEnum

ChartDrawModesEnum

ChartDropZonesEnum

ChartEndStyleEnum

Page 2343: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartErrorBarCustomValuesEnum

ChartErrorBarDirectionEnum

ChartErrorBarIncludeEnum

ChartErrorBarTypeEnum

ChartFillStyleEnum

ChartFillTypeEnum

ChartGradientStyleEnum

ChartGradientVariantEnum

ChartGroupingTotalFunctionEnum

ChartLabelOrientationEnum

ChartLegendPositionEnum

ChartLineDashStyleEnum

ChartLineMiterEnum

ChartMarkerStyleEnum

ChartPatternTypeEnum

ChartPivotDataReferenceEnum

ChartPlotAggregatesEnum

ChartPresetGradientTypeEnum

ChartPresetTextureEnum

ChartProjectionModeEnum

ChartScaleOrientationEnum

ChartScaleTypeEnum

ChartSelectionMarksEnum

ChartSelectionsEnum

ChartSelectMode

ChartSeriesByEnum

Page 2344: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartSizeRepresentsEnum

ChartSpecialDataSourcesEnum

ChartTextureFormatEnum

ChartTexturePlacementEnum

ChartTickMarkEnum

ChartTitlePositionEnum

ChartTrendlineTypeEnum

DefaultControlTypeEnum

DscAdviseTypeEnum

DscDisplayAlert

DscDropLocationEnum

DscDropTypeEnum

DscEncodingEnum

DscFetchTypeEnum

DscFieldTypeEnum

DscGroupOnEnum

DscHyperlinkPartEnum

DscJoinTypeEnum

DscLocationEnum

DscObjectTypeEnum

DscOfflineTypeEnum

DscPageRelTypeEnum

DscRecordsetTypeEnum

DscRowsourceTypeEnum

DscSaveAsEnum

DscStatusEnum

Page 2345: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DscTotalTypeEnum

DscXMLLocationEnum

ExpandBitmapTypeEnum

LineStyleEnum

LineWeightEnum

MsoAppLanguageID

MsoLanguageID

NavButtonEnum

NotificationType

OCCommandId

PivotArrowModeEnum

PivotCaretPositionEnum

PivotCommandId

PivotDataReasonEnum

PivotEditModeEnum

PivotExportActionEnum

PivotFieldFilterFunctionEnum

PivotFieldGroupOnEnum

PivotFieldSetAllIncludeExcludeEnum

PivotFieldSetOrientationEnum

PivotFieldSetTypeEnum

PivotFieldSortDirectionEnum

PivotFieldTypeEnum

PivotFilterUpdateMemberStateEnum

PivotHAlignmentEnum

PivotMemberCustomGroupTypeEnum

Page 2346: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

PivotMemberFindFormatEnum

PivotMemberPropertyDisplayEnum

PivotMembersCompareByEnum

PivotScrollTypeEnum

PivotShowAsEnum

PivotTableExpandEnum

PivotTableReasonEnum

PivotTotalFunctionEnum

PivotTotalTypeEnum

PivotViewReasonEnum

PivotViewTotalOrientationEnum

ProviderType

SectTypeEnum

SheetCommandEnum

SheetExportActionEnum

SheetExportFormat

SheetFilterFunction

SpreadSheetCommandId

SynchronizationStatus

TipTypeEnum

UnderlineStyleEnum

XlApplicationInternational

XlBordersIndex

XlBorderWeight

XlCalculation

XlColorIndex

Page 2347: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XlConstants

XlDeleteShiftDirection

XlDirection

XlFindLookIn

XlHAlign

XlInsertShiftDirection

XlLineStyle

XlLookAt

XlOrientation

XlRangeValueType

XlReadingOrder

XlReferenceStyle

XlSearchDirection

XlSearchOrder

XlSheetType

XlSheetVisibility

XlSortOrder

XlUnderlineStyle

XlVAlign

XlWindowType

XlYesNoGuess

Page 2348: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

TrendlinesProperty

ReturnstheChTrendlinescollectionforthespecifiedseries.Notethataseriescanhaveonlyonetrendline.

expression.Trendlines

expressionRequired.AnexpressionthatreturnsaChSeriesobject.

Page 2349: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksForinformationaboutreturningasinglememberofacollection,seeReturninganObjectfromaCollection.

Page 2350: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexampleaddsatrendlinetothespecifiedseriesandthenhidesthetrendline’sR-squaredvalue.

SubAddTrendline()

DimserSeries1

'SetavariabletothefirstseriesinthefirstchartofChartspace1.SetserSeries1=ChartSpace1.Charts(0).SeriesCollection(0)

'Addatrendlinetotheseries.serSeries1.Trendlines.Add

'HidetheRSquaredvalueforthetrendline.serSeries1.Trendlines(0).IsDisplayingRSquared=False

EndSub

Page 2351: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasChartSpaceLegendProperty

Trueifthespecifiedchartworkspacehasalegend.Read/writeBoolean.

expression.HasChartSpaceLegend

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 2352: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytoFalsecausesthelegendtobedeletedfromthechartworkspace.Whenthishappens,allcustomformattingislostandmustberesetifthepropertyissubsequentlysettoTrue.

Page 2353: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthechartworkspacetitleandpositionsthechartworkspacelegendontheleftsideoftheworkspace.

SubFormat_ChartSpace()DimchConstantsSetchConstants=ChartSpace1.Constants'Enablethetitleforthechartspace.ChartSpace1.HasChartSpaceTitle=True

'Setthechartspacetitle.ChartSpace1.ChartSpaceTitle.Caption="MonthlySalesData"'Enablethelegendforthechartspace.ChartSpace1.HasChartSpaceLegend=True

'Specifythepositionofthechartspacelegend.ChartSpace1.ChartSpaceLegend.Position=chConstants.chLegendPositionLeftEndSub

Page 2354: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartSpaceLegendProperty

ReturnsaChLegendobjectthatrepresentsthechartworkspacelegend.Usethispropertytosetthepropertiesforthechartworkspacelegend.NotethattheChartSpaceLegendpropertyrepresentsthelegendfortheentirechartworkspace.UsetheLegendpropertyoftheChChartobjecttosetthelegendforindividualchartswithinthechartworkspace.ReturnsNothingifthechartworkspacedoesnothavealegend.Read-only.

expression.ChartSpaceLegend

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 2355: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthechartworkspacetitleandpositionsthechartworkspacelegendontheleftsideoftheworkspace.

SubSetLegend()DimchConstantsSetchConstants=ChartSpace1.Constants'Enablethetitleforthechartworkspace.ChartSpace1.HasChartSpaceTitle=True'Setthetitleforthechartworkspace.ChartSpace1.ChartSpaceTitle.Caption="MonthlySalesData"'Enablethelegendforthechartworkspace.ChartSpace1.HasChartSpaceLegend=True'Positionthelegendforthechartworkspace.ChartSpace1.ChartSpaceLegend.Position=chConstants.chLegendPositionLeftEndSub

Page 2356: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

HasChartSpaceTitleProperty

Trueifthespecifiedchartworkspacehasatitle.Read/writeBoolean.

expression.HasChartSpaceTitle

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 2357: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksSettingthispropertytoFalsecausesthetitletobedeletedfromthechartworkspace.Whenthishappens,allcustomformattingislostandmustberesetifthepropertyissubsequentlysettoTrue.

Page 2358: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthechartworkspacetitleandpositionsthechartworkspacelegendontheleftsideoftheworkspace.

SubFormat_ChartSpace()DimchConstantsSetchConstants=ChartSpace1.Constants'Enablethetitleforthechartspace.ChartSpace1.HasChartSpaceTitle=True

'Setthechartspacetitle.ChartSpace1.ChartSpaceTitle.Caption="MonthlySalesData"'Enablethelegendforthechartspace.ChartSpace1.HasChartSpaceLegend=True

'Specifythepositionofthechartspacelegend.ChartSpace1.ChartSpaceLegend.Position=chConstants.chLegendPositionLeftEndSub

Page 2359: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ChartSpaceTitleProperty

ReturnsaChTitleobjectthatrepresentsthechartworkspacetitle.Usethispropertytosetthepropertiesforthechartworkspacetitle.NotethattheChartSpaceTitlepropertyrepresentsthetitlefortheentirechartworkspace.UsetheTitlepropertyoftheChChartobjecttosetthetitleforindividualchartswithinthechartworkspace.ReturnsNothingifthechartworkspacedoesnothaveatitle.Read-only.

expression.ChartSpaceTitle

expressionRequired.AnexpressionthatreturnsaChartSpaceobject.

Page 2360: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplesetsthechartworkspacetitleandpositionsthechartworkspacelegendontheleftsideoftheworkspace.

SubSetLegend()DimchConstantsSetchConstants=ChartSpace1.Constants'Enablethetitleforthechartworkspace.ChartSpace1.HasChartSpaceTitle=True'Setthetitleforthechartworkspace.ChartSpace1.ChartSpaceTitle.Caption="MonthlySalesData"'Enablethelegendforthechartworkspace.ChartSpace1.HasChartSpaceLegend=True'Positionthelegendforthechartworkspace.ChartSpace1.ChartSpaceLegend.Position=chConstants.chLegendPositionLeftEndSub

Page 2361: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

XProperty

ReturnsaLongthatrepresentstheX-coordinateofthedatapointcurrentlystoredintheCoordinateobject.Read-only.

expression.x

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2362: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheValueToPointmethodtoreturnthecoordinatesofadatapointtoaCoordinateobject.

UsetheypropertytoreturntheY-coordinateofthedatapointcurrentlystoredintheCoordinateobject.

Page 2363: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangesthetitleofthefirstchartinChartspace1tothepixelcoordinatesofadatapointinthefirstseriesofthechart.

SubGetPixelCoordinates()

DimchChart1DimlXPosDimlYPosDimcoPointCoordinates

'SetavariabletothefirstchartinChartspace1.SetchChart1=ChartSpace1.Charts(0)

'Enablethetitleforthechart.chChart1.HasTitle=True

'SetaCoordinateobjecttothecoordinatesofadatapoint.SetcoPointCoordinates=chChart1.SeriesCollection(0).ValueToPoint("Pears",10)

'SetavariabletotheX-coordinate.lXPos=coPointCoordinates.x

'SetavariabletotheY-coordinate.lYPos=coPointCoordinates.y

'Setthechart'stitlestothepixelcoordinatesofthespecified'datapoint.chChart1.Title.Caption="X("&lXPos&")Y("&lYPos&")"

EndSub

Page 2364: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

YProperty

ReturnsaLongthatrepresentstheYcoordinateofthedatapointcurrentlystoredintheCoordinateobject.Read-only.

expression.y

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Page 2365: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

RemarksUsetheValueToPointmethodtoreturnthecoordinatesofadatapointtoaCoordinateobject.

UsethexpropertytoreturntheXcoordinateofthedatapointcurrentlystoredintheCoordinateobject.

Page 2366: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ExampleThisexamplechangesthetitleofthefirstchartinChartspace1tothepixelcoordinatesofadatapointinthefirstseriesofthechart.

SubGetPixelCoordinates()

DimchChart1DimlXPosDimlYPosDimcoPointCoordinates

'SetavariabletothefirstchartinChartspace1.SetchChart1=ChartSpace1.Charts(0)

'Enablethetitleforthechart.chChart1.HasTitle=True

'SetaCoordinateobjecttothecoordinatesofadatapoint.SetcoPointCoordinates=chChart1.SeriesCollection(0).ValueToPoint("Pears",10)

'SetavariabletotheX-coordinate.lXPos=coPointCoordinates.x

'SetavariabletotheY-coordinate.lYPos=coPointCoordinates.y

'Setthechart'stitlestothepixelcoordinatesofthespecified'datapoint.chChart1.Title.Caption="X("&lXPos&")Y("&lYPos&")"

EndSub

Page 2367: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

ReturninganObjectfromaCollection

TheItempropertyreturnsasingleobjectfromacollection.ThefollowingexamplesetsthevariablethisCharttoaChChartobjectthatrepresentschartone.

SetthisChart=ChartWorkspace1.Charts.Item(1)

TheItempropertyisthedefaultpropertyformostcollections,soyoucanwritethesamestatementmoreconciselybyomittingtheItemkeyword.

SetthisChart=ChartWorkspace1.Charts(1)

SomecollectionsuseanenumeratedtypewiththeirItempropertytoreturnspecificmembersofthecollection.Forexample,theChAxescollectionusestheChartAxisPositionEnumenumeratedtype,asshowninthefollowingexample.

SetchConstants=ChartSpace1.ConstantsSetvalueAxis=ChartSpace1.Charts(0).Axes.Item(chConstants.chAxisPositionLeft)SetcategoryAxis=ChartSpace1.Charts(0).Axes.Item(chConstants.chAxisPositionBottom)

Again,youcanomittheItemkeyword,asshowninthefollowingexample.

SetchConstants=ChartSpace1.ConstantsSetvalueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft)SetcategoryAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionBottom)

Formoreinformationaboutaspecificcollection,seetheHelptopicforthatcollection.

Page 2368: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

UsingNamedConstantsinVBScript

YoucannotusenamedconstantsinVBScriptcode.ThefollowingexampleworksinVisualBasicbutdoesnotworkinVBScript.

SetvalueAxis=ChartSpace1.Charts(0).Axes(chAxisPositionLeft)

VBScriptregardsthenamedconstantchAxisPositionLeftasjustanotheruninitializedvariable,soitsvalueis0(zero).BecausetheactualvalueofchAxisPositionLeftis–3,thiscodedoesnotworkasexpectedinVBScript.

TheConstantspropertyreturnsanobjectthatallowsVBScriptprogrammerstousenamedconstants.Thispropertyappliestoeachofthetop-levelcontainerobjects(ChartSpace,DataSourceControl,PivotTable,andSpreadsheet).ItreturnsanobjectthatcontainsallofthenamedconstantsavailableintheMicrosoftOfficeWebComponentstypelibrary(nomatterwhichobjecttheConstantspropertyisappliedto,italwaysreturnsthecompletesetofnamedconstants).

TousenamedconstantsinVBScript,youcansetanobjectvariabletotheobjectreturnedbytheConstantspropertyandthenusethatobjecttoqualifythenamedconstantsinyourcode,asshowninthefollowingexample.

SetchConstants=ChartSpace1.ConstantsSetvalueAxis=ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft)

YoucanalsousetheConstantspropertydirectlyinanexpression,asshowninthefollowingexample.

Spreadsheet1.ActiveSheet.Export"sstest.xls",Spreadsheet1.Constants.ssExportActionNone

NoteYoucanusetheConstantspropertyinVisualBasic,butitis

Page 2369: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

neitherrequirednorrecommended.UsingtheConstantspropertyincontainerswhereitisnotrequiredwillcauseyourcodetorunsignificantlyslower.

Page 2370: Microsoft Office 2003 Web Components Visual Basic Reference · (MSDN) Web site for the latest information about programming with Microsoft Office 2003 Web Components, including product

DeclaringandUsingEventProceduresinVBScript

YoudeclareeventproceduresinVisualBasicbyusingthePrivateandByValkeywordsandargumentswithexplicittypedeclarations,asshowninthefollowingexample.

PrivateSubSpreadsheet1_MouseOver(ByValButtonAsLong,ByValShiftAsLong,ByValTargetAsRange)

ThisproceduredeclarationwillnotworkinVBScriptbecauseVBScriptdoesnotusethesekeywordsandbecauseallargumentsarepassedasVariant.Instead,youdeclareeventproceduresinVBScriptsimplybyusingtheeventnameandargumentnames,asshowninthefollowingexample.

SubSpreadsheet1_MouseOver(Button,Shift,Target)

Theargumentnamesthemselvesaresimplyaconventioninanycontainer(youcoulduseanyargumentnames).

CautionSomescripteditors(includingMicrosoftScriptEditor)donotfillintheargumentlistwhentheycreateaneventprocedure.Toensurethatyoureventprocedurerunscorrectly,consulttheObjectBrowserortheappropriateeventtopicinHelp,andfillintheargumentlistyourself.