documentation.help · BasicList ListFields Web Lists NavigationNode WebFile NavigationNodes...

Post on 29-Mar-2020

14 views 0 download

Transcript of documentation.help · BasicList ListFields Web Lists NavigationNode WebFile NavigationNodes...

FrontPageWebObjectModelApplicationSystem ThemesTheme

WebsWebListsNavigationNodeWebFileMetaTags

NavigationNodesPropertiesWebFilesWebFileMetaTags

WebFolderListListFields

WebFolders

WebWindowsWebWindowPageWindowsPageWindowWebFile

WebListsNavigationNodeNavigationNodesPropertiesWebFilesWebFolderWebFolders

Legend

ObjectandcollectionObjectonly

OthernotablemembersoftheFrontPageobjectmodel.

BasicListListFieldsWebListsNavigationNodeWebFile

NavigationNodesPropertiesThemesTheme

WebFilesWebFile

WebFoldersWebWindowsWebWindow

WebFolderListPropertiesWebFilesWebFile

WebFolders

DocumentLibraryListFieldsWebListsNavigationNodeWebFile

NavigationNodesPropertiesThemesTheme

WebFilesWebFile

WebFoldersWebWindowsWebWindow

WebFolderListPropertiesWebFilesWebFile

WebFolders

PageWindowExWebListsNavigationNodeNavigationNodesPropertiesThemes

WebFilesWebFolder

WebFoldersWebWindows

WebFileMetaTagsNavigationNode

Properties

NewWebObjectModelObjectsVisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithMicrosoftOfficeFrontPage2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistsobjectsaddedtotheOfficeFrontPage2003objectmodel.

Object Description

Discussion ContainsinformationaboutaDiscussionlistinaMicrosoftFrontPageWebsite.

ListFieldAttachmentsContainsinformationabouttheattachmentsfieldwhenattachmentsareenabledforalistinaFrontPageWebsite.

ListFieldRatingScale ContainsinformationabouttheratingscalelistfieldforasurveylistinaFrontPageWebsite.

WebPackage RepresentsaWebpackagethathasbeencreatedinMicrosoftVisualBasicforApplications.

NewWebObjectModelProperties(AlphabeticalList)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithMicrosoftOfficeFrontPage2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistspropertiesaddedtotheOfficeFrontPage2003objectmodel(sortedalphabetically).

NewProperty Object(s)

AllowAttachments BasicList,DocumentLibrary,List,Survey,Discussion

AllowFillInChoices ListFieldChoice

AllowModerate BasicList,DocumentLibrary,List,Survey,Discussion

AllowRichHTML ListFieldMultiLineAuthor WebPackageCompany WebPackageComputationFormula ListFieldComputedDynamicTemplate WebFileEndNumber ListFieldRatingScale

IsHidden BasicList,DocumentLibrary,List,Survey,Discussion

IsModified BasicList,DocumentLibrary,List,Survey,Discussion

OptimizeHTMLFlags ApplicationOptimizeHTMLPublishFlagsWeb,WebExReturnType ListFieldComputedStartNumber ListFieldRatingScaleSubject WebPackage

NewWebObjectModelProperties(byObject)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithMicrosoftOfficeFrontPage2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistspropertiesaddedtotheOfficeFrontPage2003objectmodel(sortedbyobjectname).

Object NewPropertiesOptimizeHTMLFlags

BasicList AllowAttachments,AllowModerate,IsHidden,IsModified

Discussion AllowAttachments,AllowModerate,IsHidden,IsModified

DocumentLibrary AllowAttachments,AllowModerate,IsHidden,IsModified

List AllowAttachments,AllowModerateListFieldChoice AllowFillInChoicesListFieldComputed ComputationFormula,ReturnTypeListFieldMultiLine AllowRichHTMLListFieldRatingScale EndNumber,StartNumberList IsHidden,IsModified

Survey AllowAttachments,AllowModerate,IsHidden,IsModified

WebEx OptimizeHTMLPublishFlagsWebFile DynamicTemplateWeb OptimizeHTMLPublishFlagsWebPackage Author,Company,Subject

NewWebObjectModelMethods(AlphabeticalList)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithMicrosoftOfficeFrontPage2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistsmethodsaddedtotheOfficeFrontPage2003objectmodel(sortedalphabetically).

NewMethod ObjectApplyDynamicTemplate WebFile

ConvertToField

ListField,ListFieldChoice,ListFieldComputed,ListFieldCounter,ListFieldCurrency,ListFieldDateTime,ListFieldFile,ListFieldInteger,ListFieldLookup,ListFieldMultiLine,ListFieldNumber,ListFieldSingleLine,ListFieldTrueFalse,ListFieldURL,ListFieldAttachments,ListFieldRatingScale

CreateDynamicTemplateState ApplicationCreatePackage Web,WebExCreateSearchInfo ApplicationDecodeURL ApplicationEncodeURL ApplicationImportWebPackage Web,WebExRemove WebPackageShowBordersShadingDialog ApplicationShowFontDialog ApplicationShowHTMLDialog ApplicationShowHyperlinkParameters Application

ShowImportWebPackageDialog ApplicationShowPickURLDialog ApplicationShowPositionDialog ApplicationSplitArgs ApplicationUpdateDynamicTemplate Web,WebEx,WebFile

NewWebObjectModelMethods(byObject)VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetworkWebsiteforthelatestinformationaboutprogrammingwithMicrosoftOfficeFrontPage2003,includingproductnews,technicalarticles,downloads,andsamples.

ThefollowingtablelistsmethodsaddedtotheOfficeFrontPage2003objectmodel(sortedbyobjectname).

NewMethod ObjectDecodeURL

Application

CreateDynamicTemplateState,CreateSearchInfo,EncodeURL,ShowBordersShadingDialog,ShowFontDialog,ShowHTMLDialog,ShowHyperlinkParameters,ShowImportWebPackageDialog,ShowPickURLDialog,ShowPositionDialog,SplitArgs

ListFieldAttachments ConvertToFieldListFieldChoice ConvertToFieldListFieldComputed ConvertToFieldListField ConvertToFieldListFieldCounter ConvertToFieldListFieldCurrency ConvertToFieldListFieldDateTime ConvertToFieldListFieldFile ConvertToFieldListFieldInteger ConvertToFieldListFieldLookup ConvertToFieldListFieldMultiLine ConvertToFieldListFieldNumber ConvertToFieldListFieldRatingScale ConvertToField

ListFieldSingleLine ConvertToFieldListFieldTrueFalse ConvertToFieldListFieldURL ConvertToFieldWeb CreatePackage

WebEx CreatePackage,ImportWebPackage,UpdateDynamicTemplate

WebFile ApplyDynamicTemplate,UpdateDynamicTemplateWeb ImportWebPackageWebPackage RemoveWeb UpdateDynamicTemplate

CreatingWebSitesSomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

MicrosoftFrontPagemakesFrontPage-basedWebsitecreationaseasyascreatinganewfolderonyourharddrive.ThekeytosuccessfulWebsitemanagementinFrontPageisplanningthestructureanddesignofyourWebsites.WithmostWebservers,youhaveoneWebsite,butwithFrontPage,youcancreateasmanyWebsitesasyouwant,includingnestedWebsites,calledsubsites.AFrontPage-basedWebsitecomprisesthreelayers—Websitestructure,folderstructure,andnavigationstructure.Clickoneofthelinksbelowtoselectaspecifictopic.

UnderstandingFrontPageWebstructure

UnderstandingFrontPagefolderstructure

Understandingnavigationstructure

CreatingWebsitesprogramatically

CreatingaWebsitewiththeAddmethod

CreatingaWebsitewiththeMakeWebmethod

UnderstandingFrontPageWebstructure

AnyfolderonyourWebservercanbeaWebsitewithitsownfolderhierarchythatcanincludesubsitesbelowtheoriginalWebsite.WhenyouinstallFrontPage,theprogramautomaticallyprovidesadefaultnameforyourmainWebsite.Onadisk-basedsystem,thedefaultnameisC:\DocumentsandSettings\username\MyDocuments\MyWebSitesforMicrosoftWindowsXP.Youmaywanttonametheindividualsubsitesforthevariouscompanynamesthemselves,suchasAdventureWorks,AmericanSocietyofScience,MightyflightToys,orCohoWinery.

FrontPageprovidesavarietyofWebsitetemplates—corporate,discussion,customersupport,andsoon.ThesetemplatesprovidethefoundationofthestructureforeachWebsite.Forexample,AdventureWorksmaywantyoutoestablishafull-blowncorporatepresencefortheirWebsite;andsoon.TheWebsitehierarchyforadisk-basedWebsiteisshowninthefollowingdiagram.

ThefollowingfigureshowstheWebsitestructureinFoldersview.Thesubsitesdisplayasmallglobewithinthefoldericon.

UnderstandingFrontPagefolderstructure

ThefolderstructureinFrontPagebehavesinthesamemannerasthefolderstructureinWindowsExplorer.However,toaccessthesefilesfromWindowsExplorer,youhavetoexportthemtoanotherlocation—eitheryourharddriveorserver.Duringtheexportprocess,thefilesareconvertedtoHTMLpages.Inthatsense,openingFrontPageissimilartoopeningawindowtoyourWebsites.Thefolderhierarchyforadisk-basedWebsiteisshowninthefollowingdiagram.

ThefollowingdiagramshowsthefolderstructureinFoldersview.

NoteThisdiagramdisplaysthesameinformationasthepreviousonebecausebothfoldersandWebsitesaredisplayedinthesameview,butyoucanseefromtheWebsiteandfolderdiagramsthattheyeachhavetheirownstructure.AWebsiteorsubsiteisafolder.However,afolderthatisalsoaWebsitecontainsmetadataaboutthatWebsite.Forexample,ifyouapplyathemetooneofyourWebsites,allfolderswithinthatWebsitewillhavethesametheme.However,youcanapplydifferentthemestotheWebsitesonyourWebserver.WhenyouchangeaWebsitetoafolder,youremovespecialsettingsthatmakethatfolderaWebsite,andsettingssuchasthethemechangetomatchthe"global"themeforthedisk-basedorserver-basedWebsitethatprovidesthecontainerforyour

FrontPage-basedsubsites.

Understandingnavigationstructure

YoucancreatefileswithinyourWebsite,butthenavigationstructurethatlinksthesefilestoyourWebsiteisn'tautomaticallycreatedwhenthefilesarecreated.However,eachsubsitecanhaveitsownhomepage.AhomepageisusuallythestartingpageforanyWebsiteinthenavigationstructure;butinFrontPageyoucancreatealternatepagesthatexistatthesamenavigationlevelasthehomepage.Youmaywanttoaddlinkstoahomepagethatnavigatetothehomepagesofothersubsitesthatyou'remaintaining.

Thenavigationstructurecontainsnodesthatlinkeachofthepagesinyoursubsitesandprovidepointerstothelocationsofeachpageinthenavigationstructure.Thenavigationstructureforadisk-basedWebsiteisshowninthefollowingdiagram.

ThefollowingdiagramshowsthenavigationstructureinNavigationview.

CreatingWebsitesprogrammatically

Here'saverysimpledesignforaWebsite.TheCohoWinerycompanywantstoaddasubsitecalledWinesAroundtheWorldthatwillstartwithpagesfortworegions,SpainandFrance.ThefolderstructurewillcontaintheCohoWineryWebsiteandthefolderforthesubsite,WinesAroundtheWorld,plusthehiddenfolder_private,andanImagesfolder.ThenavigationstructurewillcontaintheWinesAroundtheWorldhomepage(index.htm)andthetwochildpages(Spain.htmandFrance.htm—theleftandrightnodesinthenavigationstructure).

TherearetwowaystocreateFrontPage-basedWebsitesinMicrosoftVisualBasicforApplications.YoucanusetheAddmethodwiththeWebscollection,oryoucanusetheMakeWebmethodwithaWebFolderobjecttochangeanexistingfolderintoaWebsite.

CreatingaWebsitewiththeAddmethod

Onceyou'vedesignedhowyourWebsiteisgoingtolookandfunction,youcanusetheSetstatementasshownintheprocedurebelowtocreateanewWebsite.

NoteToruntheexamplesinthistopic,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\CohoWinery",oryoumaysubstituteaWebsiteandfilesofyourchoice.

PrivateSubAdd()

DimmyNewWebAsWebEx

SetmyNewWeb=_

Webs.Add("C:\MyWebSites\CohoWinery\WinesAroundtheWorld")

EndSub

WhenyoucreateaWebsitewiththismethod,youonlycreatetheWebsiteanditsfolder;youdon'tcreateacompleteWebsitewithallofthefolders,pages,andnavigationinplace.Thenextstepisaddingahomepage.Thefollowingexampleaddsahomepage.

PrivateSubAdd()

DimmyNewWebAsWebEx

DimmyFilesAsWebFilesDimmyUrlAsString

SetmyNewWeb=_

Webs.Add("C:\MyWebSites\CohoWinery\WinesAroundtheWorld")

SetmyFiles=myNewWeb.RootFolder.FilesmyFileUrl=_

"C:\MyWebSites\CohoWinery\WinesAroundtheWorld\index.htm"

myFiles.Add(myFileUrl)

EndSub

Becauseindex.htmordefault.htmarefilenamesassociatedwithnamescommonlyusedashomepages,FrontPagecreatestheappropriatenavigationstructureforahomepagewheneveryouuseoneofthesenames.However,ifyouaddfurtherpagesusingtheAddmethodwiththeWebFileobject,youwilladdpages,butFrontPagewillnotautomaticallycreatethenavigationstructureforyou—youwillhavetoaddthenavigationstructuremanuallyasisillustratedinthefollowingexample.

NoteThefollowingexamplecreatesanewsubsiteintheCohoWineryWebsite

andcreatestwopagesinthenewsubsite:index.htmandSpain.htm.

PrivateSubAddCompleteWeb()

DimmyNewWebAsWebEx

DimmyFilesAsWebFiles

DimmyUrlAsString

DimmyFileOneAsString

SetmyNewWeb=_

Webs.Add("C:\MyWebSites\CohoWinery\WinesAroundtheWorld")

SetmyFiles=myNewWeb.RootFolder.Files

myFileUrl=_

"C:\MyWebSites\CohoWinery\WinesAroundtheWorld\index.htm"

myFiles.Add(myFileUrl)

myFileOne="C:\MyWebSites\CohoWinery\WinesAroundtheWorld\"

myFileOne=myFileOne&"Spain.htm"

myFiles.AddmyFileOne

CallmyNewWeb.HomeNavigationNode.Children.Add(myFileOne,"Spain",_

fpStructLeftmostChild)

myNewWeb.ApplyNavigationStructure

EndSub

Noticethelaststatement—theApplyNavigationStructuremethodappliesthechangesthatyou'vemadetothenavigationstructure.

ThereareseveralconstantsyoucanuseintheAddmethodfortheChildrenproperty:fpStructBaseOnSibling,fpStructLeftmostChild,andfpStructRightmostChild.Verysimply,theseconstantsinformFrontPagewhichpositionyouwanttoapplytothefileinthenavigationstructure—left,right,orbasethepositionononeofthesiblings.Here,myFileOnebecomestheleftmostchildofthehomepage.Thenextstepistoaddthenextpage,sothatyoucanviewthenavigationstructureinNavigationview.ThefollowingaddsanotherpageandnavigationnodetothepreviousWebsite.

PrivateSubAdd()

DimmyNewWebAsWebEx

DimmyFilesAsWebFiles

DimmyFileUrlAsString

DimmyFileOneAsString

DimmyFileTwoAsString

SetmyNewWeb=_

Webs.Add("C:\MyWebSites\CohoWinery\WinesAroundtheWorld")

SetmyFiles=myNewWeb.RootFolder.Files

myFileUrl=_

"C:\MyWebSites\CohoWinery\WinesAroundtheWorld\index.htm"

myFiles.Add(myFileUrl)

myFileOne="C:\MyWebSites\CohoWinery\WinesAroundtheWorld\"

myFileOne=myFileOne&"Spain.htm"

myFileTwo="C:\MyWebSites\CohoWinery\WinesAroundtheWorld\"

myFileTwo=myFileTwo&"France.htm"

myFiles.AddmyFileOne

myFiles.AddmyFileTwo

CallmyNewWeb.HomeNavigationNode.Children.Add(myFileOne,"Spain",_

fpStructLeftmostChild)

CallmyNewWeb.HomeNavigationNode.Children.Add(myFileOne,"Spain",_

fpStructRightmostChild)

myNewWeb.ApplyNavigationStructure

EndSub

YoucancontinuetoaddpagesandnavigationnodestoyourWebsiteinthiswayuntilyourWebsiteiscomplete.Or,youcancreateaForloopwhereyouiteratethroughtheWebsiteaddingthenumberofpagesandnavigationnodesyouneedtocompletetheWebsite.ThefollowingexampleaddsfivepagesandnavigationnodestoanewsubsiteintheCohoWineryWebsite.

NoteCreating,moving,ordeletingfilesandfolderswhileattemptingtomodifythenavigationstructuremaycausesomechangestobelost.First,makethechangestothefolderstructureoftheWebsite,thenmakethenavigationstructurechanges,andthenapplythenavigationstructuretotheWebsite.

PrivateSubAddDesignerCrystalWeb()

DimmyWebAsWebEx

DimmyParentWebAsWebEx

DimmyFoldersAsWebFolders

DimmyFolderAsWebFolder

DimmyFilesAsWebFiles

DimmyNewFiles(4)AsWebFiles

DimmyChildNodeAsNavigationNode

DimmyNewFilenameAsString

DimmyFileURLAsString

DimmyCountAsInteger

DimmyBaseURLAsString

DimmyWebURLAsString

DimmyInputMsgAsString

DimmyExistAsBoolean

SetmyParentWeb=_

Webs.Open("C:/MyDocuments/MyWebSites/CohoWinery/")

myParentWeb.Activate

myBaseURL="C:/MyDocuments/MyWebSites/CohoWinery/"

myWebURL=myBaseURL&"CohoWineryDesignerCrystal"

myExist=False

myInputMsg=_

"Allfileswillhave"".htm""appended.Typeafilename:"

SetmyFolders=Webs(0).RootFolder.Folders

ForEachmyFolderInmyFolders

'ChecktoseeifmyWebURLalreadyexists.

IfmyFolder.IsWebAndmyFolder.Url=myWebURLThen

myExist=True

EndIf

Next

'CreatemyWebURLifitdoesn'texist.

IfmyExist=FalseThenWebs.Add(myWebURL).Activate

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

'Createfiles.

FormyCount=0ToUBound(myNewFiles)

myNewFilename=InputBox(myInputMsg)

myFileURL=myWeb.Url&"/"&myNewFilename&".htm"

myFiles.AddmyFileURL

myFiles(myFileURL).Edit

Next

'Addtonavigationstructure.

FormyCount=0ToUBound(myNewFiles)

'Checkifthecurrentpageisindex.htm,ifso,skipit.

IfmyFiles(myCount).Title="index.htm"Then

myCount=myCount+1

EndIf

SetmyChildNode=_

myWeb.RootNavigationNode.Children(0)

'Addnavigationnodetothecurrentpage.

myChildNode.Children.AddmyFiles(myCount).Url,_

myFiles(myCount).Title,fpStructLeftmostChild

Next

myWeb.ApplyNavigationStructure

EndSub

CreatingaWebsitewiththeMakeWebmethod

Ifyoualreadyhaveanexistingfolderthatyou'dliketoconverttoaWebsite,youcanusetheMakeWebmethodwithaWebFolderobjectasshowninthefollowingexample.

NoteThefollowingexampleassumesthatWebs(0)istheCohoWineryWebsiteandthatitcontainsafoldercalledFolderOne.

PrivateSubMakeAWeb()

DimmyWebAsWebEx

DimmyFolderAsWebFolder

SetmyWeb=Webs(0)

myWeb.Activate

SetmyFolder=ActiveWeb.RootFolder.Folders("FolderOne")

myFolder.MakeWeb

EndSub

YouwillneedtocreateanavigationstructureoncePageOneisasubsiteofCohoWinery.

ExploringProceduresThistopicisdesignedtogiveuserswhomaybefamiliarwithMicrosoftFrontPage,butunfamiliarwithMicrosoftVisualBasicforApplications(VBA),abackgroundonsomeofthebasicconceptsinaFrontPage-basedprogrammingenvironment.ProgramminginFrontPageVisualBasicforApplicationsprovidesyouwithHTMLtoolsinanMicrosoftOfficeprogrammingenvironmentwhereyoucancreateproceduresthatperformataskoraseriesoftasks.Forexample,youcould:

CreateaprocedurethatretrievesdatafromaMicrosoftAccessdatabaseanddisplaysthedataonyourWebpage.PublishaMicrosoftPowerPointpresentationforautomaticupdatesovertheInternet.AutomaticallyupdateaMicrosoftExcelspreadsheetwithinputfromusersrespondingtoyourWebsite.

ThistopicprovidesinformationonthefollowingVBAprogrammingconcepts.

Organizecodeformodularuse

Typesofprocedures

Publicandprivateprocedures

Typesofprocedurecalls

Eventproceduresandarguments

CreateatableinFrontPagefromanAccessdatabase

Organizecodeformodularuse

VisualBasicproceduresprovideawayfordeveloperstoorganizecodeformodularuse.Insteadofwritingthesamecalculatorfunctionoverandoverforeachprogram,youcantakethatsegmentofcode(thecalculatorfunction)andcompileitintoageneralprogram,thatcanthenbeaccessedbymanyotherprograms.InVisualBasic,ablockofcodeisenclosedbetweenaprocedureheadingandaclosurestatement—theSubandEndSubstatements.

ThebasicsyntaxofaprocedurewithinVisualBasicisshowninthefollowingcodesample.

[Private|Public|Static]Subprocedurename(arguments)

statements

EndSub

TorunanyofthecompletecodeexamplesincludedintheFrontPageVisualBasicforApplicationsonlinehelp,followthesesteps:

1. OpenFrontPage,selectMacrofromtheToolsmenu,andthenclickVisualBasicEditor.

2. Double-clickMicrosoft_FrontPage(orthecurrentproject)intheProjectwindowandexpandtheModulesfolder.

3. Double-clickModule1toopentheCodewindow.4. Copythecodeblockfromthedocumentation,andthenpasteitintothe

Codewindow.5. ClickRunSub/UserFormonthetoolbar.

YourcodewillautomaticallybesavedwhenyouclosetheVisualBasicEditor.

Typesofprocedures

FrontPageVBAprovidestwotypesofprocedures,SubandFunctionprocedures.Subproceduresperformtasksbutdonotreturnanyvalues.Theymaybecalledfromothersubroutinesorexecutedinresponsetoanevent,suchasamouseclickorakeystroke.

NoteASubprocedurecanbeaneventprocedure,butitcanalsoperformataskwithoutnecessarilyrespondingtoanevent.

ThefollowingprocedureretrievestheversionnumberofFrontPagefromtheactiveWebsitebutdoesn'treturntheversionnumbertoanyotherprocedure.

SubDisplayVersion()

DimmyWebAsWebEx

DimmyVersionAsString

myVersion="FrontPageversionnumber:"&ActiveWeb.Application.Version

EndSub

AFunctionprocedurealsoperformstasks,butitcaninadditionreturnoneormorevaluesasarguments.ThefollowingcodesamplereturnstheversionnumberofFrontPagetoacallingprocedure.

FunctionReturnVersion()AsVariant

DimvarAppVersionAsVariant

varAppVersion=Application.Version

ReturnVersion=varAppVersion

EndFunction

ThevariableReturnVersionnowcontainstheversionnumberofFrontPage.Toaccessthisvalueinthecallingprocedure,youcouldwritecodesimilartothefollowingsample.

SubGetAppVersion()

DimmyAppVersionAsVariant

MsgBox"ThisversionofFrontPageisversion"_

&ReturnVersion

EndSub

Alternatively,youcouldassigntheexpressionReturnVersiontoavariableand

appendthevariabletothemessageboxstatementinsteadofthefunctioncall.

BothSubandFunctionprocedurescanbecalledtoperformtheirtasks,dependingonwhethertheproceduresaredeclaredPublicorPrivate.

AmacroisathirdtermusedtodescribecodeinVBA.AsapublicSubprocedurethatdoesn'ttakearguments,amacromayormaynotcallotherSuborFunctionproceduresandcanbeassignedtocommandbarsandshortcutkeysorrunfromtheMacrodialogbox.

Publicandprivateprocedures

VisualBasicprovidestwowaystoaccessaprocedure.Bydefault,proceduresarepublic—theycanbecalledfromanyotherprocedureinanymodulewithinyourapplication.Forexample,ifyou'vewrittenaprocedurethatlistsimagesbyfilenameonaWebpage,youwouldwanttodeclarethatprocedurepublicsothatyoucoulduseitacrossallofyourWebsites.However,ifyou'vewrittenaprocedurethateditsaspecificdatabase,youwouldwantthatproceduretobeavailableonlytothemodulethathandleseditingthedatabase—inthatcase,youcandeclaretheprocedureprivate.Proceduresthathavebeendeclaredprivatecanonlybereferencedbyotherprocedureswithinthesamemodule.Thefunctionshownpreviouslyhasbeendeclaredapublicfunctioninthefollowingcodesampleandcanbecalledacrossmodulesandprojects.

PublicFunctionReturnVersion()AsVariant

statements

EndFunction

Incontrast,aprocedurethatisusedtoeditadatabaseshouldbedeclaredprivate.

PrivateFunctionEditCustomerName(strFirstNameAsString)

statements

EndFunction

Typesofprocedurecalls

Howdoyouprogrammaticallyrunaprocedure?Youdeclareitthesamewaythatyouwoulduseakeyword,suchasOpen.ThefollowingprocedurecallstheReturnVersionfunctionandassignsthereturnedvaluetoalocalvariable,MyVersion,forthevaluethatispassedtotheprocedure.

SubTestCall()

DimMyVersionAsVariant

MyVersion=ReturnVersion

EndSub

Ifyoudidn'thaveanyinformationtopassfromoneproceduretoanother,youwouldsimplydeclaretheprocedurename,asshowninthefollowingcodesample.

SubTestCall2()

DisplayCompanySplashScreen

EndSub

TheTestCall2procedurecallsanotherprocedure,DisplayCompanySplashScreen,whichdoesn'ttakeanyargumentsorreturnanyvalues.

Eventproceduresandarguments

Ifyouwantanevent,suchasclickingacommandbutton,totriggertheexecutionofcodeincaseswhereyouwouldusuallypassavalueintothecallingprocedure,youcanexecutetheresultsfromthefunctionratherthanreturntheresults.InthiscasetheReturnVersionfunctionbecomesasubroutineandinitiatesthedisplayoftheversionnumberfortheapplication.

SubReturnVersion()

DimvarAppVersionAsVariant

varAppVersion=Application.System.Version

DisplayMsgBoxvarAppVersion

EndSub

TheDisplayMsgBoxsubroutineshowninthefollowingcodesampledisplaysthecontentsofthevariablevarGotAppVersionthatwaspassedfromtheReturnVersionsubroutine.

SubDisplayMsgBox(varGotAppVersionAsVariant)

DimvarDisplayAppVersionAsVariant

varDisplayAppVersion=varGotAppVersion

MsgBox"Thisapplicationisversion"_

&varDisplayAppVersion

EndSub

AneventprocedurecannowinitiatethedisplayofthevaluethatispassedfromtheReturnVersionsubroutine.

PrivateSubCommandButton1_Click()

ReturnVersion

EndSub

CreateatableinFrontPagefromanAccessdatabase

ThefollowingprocedurecombinesobjectsfromthePageobjectmodelandtheWebobjectmodeltoretrievedatafromanopenMicrosoftAccessdatabaseandinsertitintoatableonaFrontPage-basedWebpage.TheParseDBTableprocedureprovidestheparametersfortheParseAccessTablefunctionwhichcallsthefollowingfunctionstocreateandpopulatethetable:

AddDBTableToPage—createsanewtableAddDBRow—insertsarowontotheWebpageAddMemo—retrievesthememosfromtheAccessdatabase,returnsthemasbookmarksatthebottomofthepagebelowthenewtable,andreturnstheURLtothebookmark

NoteTheAccessdatabase,Northwind.mdb,wasusedforthisexample.Toruntheexample,youmusthavereferencesintheVisualBasicEditortotheMicrosoftDAO3.6ObjectLibraryandtheMicrosoftAccessObjectLibrary.YoumustalsoopenanAccessdatabasebeforerunningtheexample,andyoumustaddablanktemporaryfilecalledtmp.htmintheactiveWebsite.IfyouuseadatabaseotherthanNorthwind.mdb,youmustspecifythedatabasenameandtableintheParseDBTableprocedure.

FunctionAddDBTableToPage(myPageAsPageWindowEx,_

myTableNameAsString,myFieldsAsInteger)

DimmyTableAsFPHTMLTable

DimmyHTMLStringAsString

DimmyCountAsInteger

myHTMLString="<tableborder=""2""id=""myRecordSet_"&_

myTableName&""">"&vbCrLf

myHTMLString=myHTMLString&"<tr>"&vbCrLf

FormyCount=1TomyFields

myHTMLString=myHTMLString&"<tdid=""myDBField_"&_

myCount&"""></td>"&vbCrLf

NextmyCount

myHTMLString=myHTMLString&"</tr>"&vbCrLf

myHTMLString=myHTMLString&"</table>"&vbCrLf

CallmyPage.Document.body.insertAdjacentHTML("BeforeEnd",_

myHTMLString)

EndFunction

FunctionAddDBRow(myDBTableAsFPHTMLTable)

DimmyHTMLStringAsString

DimmyTableRowAsFPHTMLTableRow

SetmyTableRow=myDBTable.rows(0)

myHTMLString=myTableRow.outerHTML

CallmyDBTable.insertAdjacentHTML("BeforeEnd",myHTMLString)

EndFunction

FunctionAddMemo(myCurrentPageAsPageWindowEx,myDBMemoAsString,_

myBkMarkFieldAsString,myIndex)AsString

DimmyHTMLStringAsString

DimmyMemoBkMarkAsString

DimmyBookMarkAsFPHTMLAnchorElement

myMemoBkMark=myBkMarkField&"_"&myIndex

myHTMLString="<aname="""&myMemoBkMark&""">Memo#"&_

myIndex&"</a>"&vbCrLf

'Addthebookmarktothepage.

CallmyCurrentPage.Document.body.insertAdjacentHTML("BeforeEnd",_

myHTMLString)

SetmyBookMark=myCurrentPage.Document.all(myMemoBkMark)

'Addthememotexttothepage.

CallmyCurrentPage.Document.body.insertAdjacentHTML("BeforeEnd",_

myDBMemo)

AddMemo="<ahref=""#"&myBookMark.Name&""">"

EndFunction

FunctionParseAccessTable(myDBNameAsString,myTableNameAsString)

'Access/DAODeclarations.

DimmyDBAppAsAccess.Application

DimmyRecordSetAsDAO.recordset

DimmyDBFieldAsDAO.Field

'FrontPagePageobjectmodeldeclarations.

DimmyPageAsPageWindowEx

DimmyTableAsFPHTMLTable

DimmyTableRowAsFPHTMLTableRow

DimmyTableCellAsFPHTMLTableCell

'Functiondeclarations.

DimmyCountAsInteger

DimmyFieldValueAsString

DimmyRecordCountAsInteger

myRecordCount=0

'Functionconstants.

ConstmyTempPage="tmp.htm"

'GetthecurrentAccessdatabase.

OnErrorGoToAccessNotThereYet

SetmyDBApp=GetObject(,"Access.Application")

'Getthedatabasetable.

OnErrorResumeNext

SetmyRecordSet=myDBApp.CurrentDb.OpenRecordset(myTableName)

'AddanewpagetothecurrentWebsite.

SetmyPage=ActiveWeb.LocatePage(myTempPage)

myPage.SaveAsmyTableName&".htm"

'DeletethetemporaryfilefromWebsite.

ActiveWeb.LocatePage(myTempPage).File.Delete

'Addadatabase-readytabletothepagewiththepropernumberoffields.

AddDBTableToPagemyPage,myTableName,myRecordSet.Fields.Count

'Getareferencetothetable.

SetmyTable=myPage.Document.all.tags("table").Item(0)

'Populatethefirstrow.

FormyCount=0TomyRecordSet.Fields.Count-1

myTable.rows(0).cells(myCount).innerHTML="<b>"&_

Trim(myRecordSet.Fields(myCount).Name)&"</b>"

Next

'Populatetherestofthetable.

WhileNot(myRecordSet.EOF)

AddDBRowmyTable

SetmyTableRow=myTable.rows(myTable.rows.Length-1)

FormyCount=0TomyRecordSet.Fields.Count-1

SetmyTableCell=myTableRow.cells(myCount)

IfIsNull(myRecordSet.Fields(myCount))Then

myFieldValue="None"

Else

myFieldValue=Trim(myRecordSet.Fields(myCount).Value)

EndIf

IfmyRecordSet.Fields(myCount).Type=DAO.dbMemoThen

myFieldValue=AddMemo(myPage,_

myRecordSet.Fields(myCount).Value,_

myRecordSet.Fields(myCount).Name,myRecordCount)

EndIf

myTableCell.innerHTML=myFieldValue

NextmyCount

myRecordSet.MoveNext

myRecordCount=myRecordCount+1

Wend

myPage.Save

myDBApp.Quit

ExitFunction

AccessNotThereYet:

Debug.PrintErr.Number&":"&Err.Description

Resume

EndFunction

PrivateSubParseDBTable()

CallParseAccessTable("Northwind.mdb","Products")

EndSub

SharingProgrammingProjectsMicrosoftFrontPagedoesn'tprovidetheabilitytocreatemultipleprojects,sosharingaprojectmaybealittleconfusingatfirstglance.YoucanshareyourMicrosoftFrontPageprojectsusingoneofthefollowingtwomethods:

AsaComAddIn.Byexportingthe.bas,.cls,and.frmmodulestoadirectoryonyourharddrive(oraserverlocation)sothattheusercanimportthemodulestotheirprojectinFrontPage.

SharingasaCOMAddIn

ForadetaileddescriptionofhowtodevelopaCOMadd-inforFrontPage,seetheFrontPageSoftwareDeveloperKit,whichyoucanviewonlineordownloadfromtheMicrosoftDeveloperNetworkWebsite.

Sharingbyexportingtheproject

YoucanexportyourmodulesfromtheVisualBasicEditorbyselectingthemoduleintheProjectwindowandthenpointingtoExportFileontheFilemenu.IntheExportFiledialogbox,selectthedirectoryyouwantthefiletoresideinandFrontPagetakescareoftherest.

NoteWhenexportingUserFormfiles,youmustalsoincludethe.frxfile.Thisfileisusedduringtheimportprocessanddoesnotneedtobeimported,butdoesneedtobeavailableinthesamedirectoryastheothermodules.

UnderstandingAbsoluteandRelativeURLAddressinginMicrosoftFrontPageMicrosoftFrontPageusesabsoluteURLaddressing.However,FrontPagedoesprovideawaytochangetheaddressingofURLsbetweenabsoluteandrelativeaddressingthroughtheMakeRelandMakeAbsmethods.

WhatisanabsoluteURL?

AURLdefinesthelocationofanobject.WhenaURLisabsolute,itdefinesunambiguouslywheretheobjectislocated.Forexample,http://www.microsoft.com/FrontPage/default.htmistheexactlocationofthewelcomepageforMicrosoftFrontPage.Theobject,default.htm,isstoredintheFrontPagefolderorWebsubsiteontheWebserver,www.microsoft.com.

Adisk-basedWebsitethatcontainsyourWebsitesonyourharddrivemighthaveabaseabsoluteURLsuchasfile:///C:/MyDocuments/MyWebSites,file:///C:/WINNT/Profiles/yourlogonalias/Personal/MyWebSites/index.htm,orfile:///C:/DocumentsandSettings/yourlogonalias/MyDocuments/MyWebSites.

AsWebsitesareupdatedandthestructureofaWebsiteevolves,documentscanoftenbemovedfromonelocationtoanotherinaWebsite.Ifyou'reusingarelativeaddress,youmaybreaksomelinks.Forexample,ifyouhaveadocumentthathasahyperlinktoanobject,youcanuseanabsoluteURLtoensurethatthehyperlinkalwaysreferstothatobject.Forexample,adocumentsuchasfile:///C:/MyDocuments/MyWebs/mydocument.htm,maycontainanabsoluteURLthatreferstothewelcomepage,http://www.microsoft.com/FrontPage/default.htm.Ifthedocument,default.htm,ismovedtoanotherlocation,theabsoluteURLforthedocumentwillalwaysrefertotheobjectontheWebserveratwww.microsoft.cominthesubsitenamedFrontPage.IftheURLforthehyperlinktodefault.htmisarelativeaddress,thelinkcouldbebrokenifmydocument.htmismovedtoadifferentsubsiteormainWebsite.

WhatisarelativeURL?

InsteadofspecifyingeverypieceofaURLthatfullydefineshowtofindanobject,youcanabbreviateaURLtomakeit"relative"toacurrentlocation.RelativeURLsaretypicallyusedwhencreatingaWebsiteinwhichthepagesinitrefertootherpagesonthesite.Apagesuchasfile:///C:/MyDocuments/MyWebSites/mydocument.htmcanhavearelativeURLto"newdocument.htm"orto"../MyWebSites2/default.htm".Inthesetwocases,thereferredaddressesforthesefilesarefile:///C:/MyDocuments/MyWebSites/newdocument.htmandfile:///C:/MyDocuments/MyWebSites2/default.htm.NoticethatthefullWeb

serverorexplicitdirectoryisn'tspecified;thelocationisbasedonwherethedocumentislocated.

RelativeURLsareveryuseful,particularlywhenconstructingasiteinoneplaceandthenpublishingittoanotherplace.Forexample,youmightnotwanttospecifyaservernamewhileauthoringaWebpage,becausetheservernamewillchangewhentheWebsiteispublished.

HowcananabsoluteURLbemaderelative?

URLscanbemaderelativeeithertoaserverortoapage.InordertomakeaURLrelativetoafolderortoaWebsite,youneedtomaketheURLrelativeeithertoaserverortoapage,becauseFrontPagewilltreattheURLasifitwerebeingmaderelativetoapageinthatfolderorWebsite.EachrelativeURL,combinedwithitsbaseURLfullyspecifieswheretheobjectislocated.

Whenyouhaveanabsoluteaddresssuchashttp://www.microsoft.com/mywebsitewithanimagefilecalledMyPicture.gifresidingintheimagesfolderontheWebsite,youcancreatearelativeURLforthataddressbydecidingwhethertherelativeaddresswillrefertoaserverorapage.Foraserver-relativeURL,you'duse"mywebsite/images/MyPicture.gif"withtheservernameasthebasefortherelativeURL,whichfullydefinesthelocationoftheobject.Forapage-relativeURL,you'duse"images/MyPicture,gif"withtheservernameandtheWebsitenameasthebasefortherelativeURL,whichfullydefinesthelocationoftheobject.Forafolder-relativeURL,you'duse"MyPicture.gif"withtheservername,Websitename,andfoldernameasthebasefortherelativeURL;thisrelativeaddressfullydefinesthelocationoftheobject.

Afolder-relativeURLcanalsobespecifiedfromadifferentfolder,forexample,"../images/MyPicture.gif"couldbeusedifthereferringdocumentwereinanothertop-levelfolderonthesameWebsiteandserver.The".."isthenotationusedtoindicateuponefolderlevelfromthecurrentURLaddress.

ProgrammaticAccesstoRelativeURLs

Onceyou'vedecidedwhethertouseserver,Website,orfolder-relativeURLs,youcandeterminewhichobjectstouse.ForserverorWebsite-relativeURLs,youwouldbeworkingwithmethodsrelatedtotheWebExobject.Forfolder-relativeURLs,youwouldbeworkingwithmethodsrelatedtotheWebFolder

object.

ConvertingrelativeandabsoluteURLs

RecommendeduseforFrontPageisabsoluteaddressing.However,onceyouhavespecifiedarelativeURLwithinFrontPage,youcanusetheMakeAbsmethodtoconvertitintoanabsoluteURL.Similarly,ifyouhaveanabsoluteURLandyouwanttoinsertareferenceintoadocumentasarelativeURL,youcanusetheMakeRelmethodtoconverttheaddresstoarelativeaddress.YoucanalsousetheMakeAbsandMakeRelmethodstoconvertahyperlinkforaWebEx,WebFolder,WebFileEx,NavigationNode,orIHTMLDocument2object.

ExploringtheObjectModelinFrontPageTheMicrosoftFrontPageobjectmodelconsistsofthreeseparateobjectmodels—theApplicationobjectmodel,theWebobjectmodel,andthePageobjectmodelthatisbasedontheMicrosoftInternetExplorer4.0Documentobjectmodel.

TheseobjectmodelsaredesignedtoprovideWebdesignerswitharichsetofprogramminginterfacestomanageindividualHTMLdocumentsandFrontPage-basedWebsites.TheobjectmodelsparallelotherMicrosoftOfficeapplicationobjectmodelsascloselyaspossibleinordertoleveragetheexperienceandknowledgeuserscurrentlyhavewithotherprogrammableOfficeapplications.Inaddition,thePageobjectmodeliscompatiblewiththeDocumentobjectmodelofMicrosoftInternetExplorer4.0andlater.ThePageobjectmodelalsoleveragestheexperienceandknowledgeofWebdeveloperswhoprogramdynamicHTML(DHTML)usingscript.

Differencesintheprogramminginterfaces

FrontPageprovidesadesign-timeuserexperienceversusarun-timeuserexperience,becauseHTMLpagesareusuallyviewedinabrowserratherthaninFrontPage.OtherOfficeapplicationsprovidearun-timeuserexperiencethatcontainsanenvironmentwherethedevelopercancreatesolutionsfortheuserthatrunwithintheapplication.WithFrontPage,youcancreateutilitiesforuseduringthedesignphaseoftheHTMLdocumentorWebsiteand,onceyouhavedesignedandbuiltyourWebsite,youcanuseMicrosoftVisualBasicScriptingEdition(VBScript),MicrosoftJScript,andDHTMLtocreateinteractiveeffectsforuseduringrun-timewhenthepageisviewedinabrowser.

VisittheOfficeDeveloperCenterontheMicrosoftDeveloperNetwork(MSDN)WebsiteforthelatestMicrosoftFrontPagedevelopmentinformation,includingnewtechnicalarticles,downloads,samples,productnews,andmore.

Applicationobjectmodelfunctionality

TheApplicationobjectisthetop-levelobjectintheWebobjectmodelhierarchyandprovidesaccesstoalloftheobjectsinFrontPage,suchastheactiveWebsite,activepage,add-ins,commandbars,system,andacollectionofWebsites.

FrontPagePageobjectmodelfunctionalityandrestrictions

ThePageobjectmodelprovidesaccesstotheHTMLinapageandhasmostofthefunctionalityoftheInternetExplorerDocumentobjectmodel,withsomeexceptions.SomeobjectsandmembersoftheInternetExplorerDocumentobjectmodelprovidefunctionalitythatisonlyusefulinanInternetExplorerenvironment.ThoseobjectsandmembersarenotimplementedforuseinthePageobjectmodel.

Webobjectmodelfunctionality

TheWebobjectmodelprovidesprogrammaticmanagementofmultipleFrontPage-basedWebsitesandtheircontents.ThisobjectmodelisbasedonconventionsusedbytheapplicationsintheMicrosoftOfficeSystemandMicrosoftVisualBasicforApplications(VBA).TheWebobjectmodelalsoprovidessupportforMicrosoftVisualSourceSafewhenaccessedthroughFrontPage.

Objectmodelinteraction

MostoftheprogrammingforFrontPage-basedWebsiteswillcontainacombinationofWebandPageobjectmodelprogrammingelements.Foradditionalinformationandexamplesofthis,seeoneofthefollowingtopics.

AccessingFramesetswithMicrosoftVisualBasic

ModifyingPagesProgrammatically

ProgrammingDynamicElements

AccessingFramesetswithMicrosoftVisualBasicFramesareanimportantpartofthedesignofaWebsite.MicrosoftFrontPageprovidessupportforprogrammingthecontentofframes.Clickoneofthefollowinglinksformoreinformationonaparticulartopic.

Exploringframes

Roleofaframeset

AccessingHTMLtags

Dynamicframesources

Iteratingallframesinapagewindow

ChangingMetatagcontenttoanothercharacterset

Exploringframes

AccessingframeswithinaframesetinFrontPageisrelativelystraightforwardaslongasyoukeepinmindthateachframeaccessesitsownpageandthatyouaccessthecontentsofeachpagethroughthePageobjectmodel.ThetwowindowsinvolvedindisplayingtheframesarethePageWindowExobjectandFPHTMLWindow2objects.TheequivalentexpressionforaccessingthecontentsinthewindowassociatedwiththeactiveframeisSetmyActiveFrameInFrameset=ActivePageWindow.Document.TheActivePageWindowobjectaccessesthepagewindowfortheframe,andtheDocumentobjectaccessestheFPHTMLWindow2object.

NoteYoumaygetpermissiondeniederrorsifyoutrytoaccessobjectswhileinHTMLview.Whenyouwanttoaddcodeortexttoadocumentobject,youmustsettheFpPageViewModeconstantfortheViewModepropertytofpPageViewNormal.ThevaluefortheviewmodecannotbesettofpPageViewHtmlorfpPageViewPreview.Alternatively,intheFrontPageuserinterface(UI),youcannothavetheHTMLtaborthePreviewtabopeninPageview.

Roleofaframeset

AframesetisthecontainerforalloftheframesinaWebwindow.Eachframeiscontainedinanindividualpagewindowandhasanindividualpageassociatedwithit.ByaccessingtheFrameWindowobjectfromtheWebobjectmodel,youaccessanFPHTMLWindow2objectthatcontainstheframepagedocument.Fromtheseobjectsyoucanaccessthewindows,documents,andframesoftheframeset.Inthefollowingstatement,myFramesetisanFPHTMLWindow2objectthatreturnstheframespagedocument.Fromthisobject,youcanaccessthe<FRAME>and<FRAMESET>tags,orthewindowordocumentobjects.

SetmyFrameset=ActivePageWindow.FrameWindow

ThisstatementreturnsanFPHTMLWindow2objectthroughthePageobjectmodel.TheDocumentpropertyofmyFramesetaccessesthePageobjectmodelforthepagethatisequivalenttoaccessingtheframespageHTMLtabinPageviewinFrontPage.

NoteTheFramesPageHTMLandNoFramestabsareonlyavailablewhenframesexistonthecurrentpage.

AccessingHTMLtags

YoucanaccessthesameinformationthataframestagaccessesbydeclaringanobjectasanFPHTMLFrameElement.Someofthepropertiesandmethodsavailableforthisobjectincludeborder,borderColor,click,frameBorder,frameSpacing,innerHTML,innerText,insertAdjacentHTML,andinsertAdjacentText.

DimmyFramesElements()AsFPHTMLFrameElement

YoucanaccesstheinformationforaframesettagbydeclaringanFPHTMLFramesetSiteobject.

DimmyFramesetSiteAsFPHTMLFramesetSite

Dynamicframesources

YoucandynamicallychangetheframesourceintheHTMLcodebyusingthefollowingstatements.ThiscodesetstheframesourcetoanewURL,Inventory_1stQuarter.htm.

DimmyDocAsObject

SetmyDoc=ActivePageWindow.FrameWindow.Document

myDoc.all.tags("frame").Item(0).src=_

"Inventory_1stQuarter.htm"

Iteratingallframesinapagewindow

Toaccessthepropertiesoftheframesetelementsthatresideinaparticularframespage,youmustaccesstheFPHTMLDocumentobjectthroughtheDocumentproperty.ThefollowingexampleiteratesthroughtheframesetandframeelementsfortheactiveframesetinMicrosoftFrontPage.Theframesetarray(myFSElements)compriseseach<FRAMESET>tagontheframespage.Theframesarray(myFramesElements)compriseseach<FRAME>tagontheframespage.Theframewindowsarray(myFramesWindows)compriseseachFPHTMLWindow2objectthatpointstoeachframe.Youpopulateeachofthearraysbyiteratingthroughtheirrespectivetagsorobjects.Oncethearraysarepopulated,youchangetheframeSpacingpropertyintheframesetelementto"10",theborderColorpropertyto"red",andchangevariousotherpropertiesinthedocument.

PrivateSubAccessFramesPage()

DimmyFPWindowAsFPHTMLWindow2

DimmyFSElements()AsIHTMLFrameSetElement

DimmyFramesWindows()AsFPHTMLWindow2

DimmyFramesElements()AsFPHTMLFrameElement

DimmyStyleAsFPHTMLStyle

DimiAsInteger

SetmyFPWindow=ActivePageWindow.FrameWindow

ReDimmyFSElements(myFPWindow.Document.all.tags("FRAMESET").length)

ReDimmyFramesElements(myFPWindow.Document.all.tags("FRAME").length)

ReDimmyFramesWindows(myFPWindow.frames.length)

Fori=0ToUBound(myFSElements)

SetmyFSElements(i)=_

myFPWindow.Document.all.tags("FRAMESET").Item(i)

Nexti

i=0

Fori=0ToUBound(myFramesWindows)

SetmyFramesWindows(i)=myFPWindow.frames(i)

Nexti

i=0

Fori=0ToUBound(myFramesElements)

SetmyFramesElements(i)=_

myFPWindow.Document.all.tags("FRAME").Item(i)

Nexti

myFSElements(0).frameSpacing="10"

myFramesElements(0).borderColor="red"

WithmyFramesWindows(2).Document

.bgColor="green"

.body.innerHTML="<pid=""cool"">AddedbyFPProgrammability"

SetmyStyle=.all.cool.style

myStyle.backgroundColor="white"

myStyle.display=False

myStyle.textDecorationUnderline=True

myStyle.Font="Tahoma,24"

myStyle.fontStyle="italic"

EndWith

EndSub

ChangingMetatagcontenttoanothercharacterset

Youcanchangeallofthecontent-typeMETAtagstoadifferentcharacterset(CentralEuropean)asshowninthefollowingcodesample.ThecurrentcharactersetisshownintheLanguageSettingsdialogbox(availableforpageproperties).

NoteTheentirecontent-typeMETAtagcontainsastringsimilartothefollowing:

content="text/html;charset=windows-1252"

Thecharactersetis"windows-1252"andisthedefaultcharactersetforU.S.English.

Eachtimetheprogramiteratesthroughtheloop,youaccessthenextframeintheframeWindowobject,whichisthesameasaccessingeachHTMLframestaginsuccession.However,theFramescollectiondoesnotsupporttheFor...eachconstruct.YoucannotaccessHTTP-EQUIVtypeMETAtagsviatheirname;youmustinsteaduseanindexasshowninthefollowingexample.TheexpressionbeginningwithmyContentType.ContentsetsthecharactersettoCentralEuropean.

NoteFrontPageplacesthecontenttypein<META>tagzero(0).

PrivateSubChangeCharSet()

DimmyFramesAsIHTMLFramesCollection2

DimmyFrameAsFPHTMLWindow2

DimmyHTTPEquivAsString

DimmyContentTypeAsObject

DimmyCountAsInteger

SetmyFrames=ActivePageWindow.FrameWindow.frames

SetmyFrame=ActivePageWindow.FrameWindow.frames(0)

myHTTPEquiv=0

FormyCount=0TomyFrames.Length-1

SetmyFrame=myFrames(myCount)

SetmyContentType=_

myFrame.Document.all.tags("meta").Item(myHTTPEquiv)

myContentType.content=_

"text/html;charset=iso-8859-2"

NextmyCount

EndSub

AccessingtheObjectModelinFrontPagefromDesign-TimeControlsSomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

Adesign-timecontrol(DTC)isoneofaclassofMicrosoftActiveXcontrolsthatisexclusivelyusedatdesign-timeasanaidtoauthoringWebsitecontent.DTCsfunctionjustlikeembeddedwizards—theycanbeeditedtomodifytheoutputthattheDTCgeneratesontheWebpage.Oncethefileisclosed,theDTCbecomesinactive—thetextthattheDTCgeneratedhasbeenembeddedintothefile.

Howaredesign-timecontrolsdifferentfromActiveXcontrols?

Design-timecontrolsdonotcontainabinaryrun-timecomponent,butdohaveaspecialinterfacethatprovidestheabilityforthedesign-timecontroltopersistandgeneratetext.Design-timecontrolsandActiveXcontrolscanco-existonthesamewebpage.FormoreinformationonDTCs,seethedocumentationontheMicrosoftworkshopWebsitefordesign-timecontrols.

Howdodesign-timecontrolsdifferfromVisualInterDev?

FrontPageandMicrosoftVisualInterDevarecompatibleinmostareas.Fordesign-timecontrols,FrontPageprovidesfullaccesstotheDocumentobjectmodelthat'savailableinMicrosoftInternetExplorer.TheWebobjectmodelisalsoavailablefordesign-timecontrolsandprovidesaricharrayofobjects,events,methods,andproperties.FrontPagealsoprovidessupportforremovingtags(ortext)thatisinsertedintoadocumentbydesign-timecontrols.

PropertiessupportedbyFrontPagethatarenotsupportedbyMicrosoftVisualInterDev:

Preview—returnsastringcontainingthecontrolspreviewtext.Tag—returnsthetagcontextforthepreviewstring.

Built-inoptionsinVisualInterDevthatFrontPagedoesn'tsupport:

QueryBuilderDataconnectionsVisualInterDevobjectmodelfor.asppages

HowtoaccesstheFrontPageobjectmodelfromadesign-timecontrol

Adesign-timecontrolisatypeofActiveXcontrol,andthusaccessesitshost'sobjectmodelsimilarlytoothercontrols(seeFPHTMLObjectElementobject).Thedesign-timecontrolhasaUserControlpropertythatreturnstheUserControlobject.ThisobjectinturnhasanExtenderpropertythatreturnstheenvironmentwheretheActiveXcontrolresides.Theexpression,UserControl.extenderreturnstheenvironmentforthespecifiedDTC.

TheExtenderpropertyreturnsFPHTMLObjectElementobjectandprovidesaccesstoallofthepropertiesandmethodsintheFPHTMLObjectElementobject.OneofthesepropertiesistheDocumentpropertythataccessestheFrontPagePageobjectmodelforthedocumentwherethedesign-timecontrolresides.ThefollowingstatementsillustratehowtoaccesstheDocumentpropertyfromaDTC.

DimmyDTCAsFPHTMLObjectElement

DimmyDocAsFPHTMLDocument

DimmyPageWindowAsPageWindowEx

SetmyDTC=UserControl.Extender

SetmyDocument=myDTC.document

SetmyPageWindow=myDoc.parentWindow.external

ThelastSetstatementillustrateshowtoaccesstheWebobjectmodelfromthePageobjectmodel.

CodinginaWindowlessEnvironmentInMicrosoftFrontPage,itispossibletocreateawindowlessenvironmenttocutdownonUserInterface(UI)overhead,buttherearesomedrawbackstoworkinginsuchanenvironment.Forexample,openingapagewiththeViewModepropertysettofpPageViewNoWindow,createsawindowlessenvironmentwherewindowelementsthatrequiretheUIwon'tworkcorrectly.IfyouopenapagewithoutawindowandtrytoaccessitusingcodesuchasPageWindow.Document.ParentWindow,theresultingcodereturnsnothinginsteadofreturninganFPHTMLWindow2object.Thefollowingstatementsprovideaccesstowindowlesspages.

Application.LocatePage(DocumentUrlAsString,_

ViewModeAsFpPageViewMode)AsPageWindowEx

Web.LocatePage(DocumentUrlAsString,ViewModeAsFPPageViewMode)_

AsPageWindowEx

File.Edit(ViewModeAsFpPageViewMode)AsPageWindowEx

ThefollowingtabledescribesthePageWindowExmethodsandpropertiesandtheobjectsorerrormessagestheyreturn.SomemethodsandpropertiesofthePageWindowExobjectaredisabledinawindowlessenvironmentandwillreturntheresultsshowninthefollowingtable.

DisabledMethodorPropertyofthePageWindowObject ReturnedObjectorErrorMessage

ActiveDocument Returns"objectorwithvariablenotset"errormessage.

ActiveFrameWindow Returns"objectorwithvariablenotset"errormessage.

Caption ReturnstheURLforthePageWindowobject.

Document ReturnsaDocumentobject.File ReturnsaFileobject.

ViewMode Thispropertycannotbeset.ItreturnstheconstantfpPageViewNoWindow.

Visible ReturnsFalse.

Web

ReturnstheWebobjectiftheobjectwaslocatedusingthefollowingstatements.

Web.LocatePage

File.Edit

ApplyTheme Returnsarun-timeerror.Close(ForceSave) Closesthepagewindow.Refresh(ForceSave) Refreshesthepagewindow.Save(ForceOverwrite) Savesthepagewindow.SaveAs(ForceOverwrite) SavesthepagewindowtoanewURL.

ShowAll

ModifyingPagesProgrammaticallyThistopicillustrateshowtoworkwiththeFPHTMLDocumentobjectelementswithinthePageobjectmodeleithertochangethecontentsofapageorsimplytoaccessthecontentsofapageforverification.

MicrosoftVisualBasicisapowerfultoolthatyoucanusetomodifycontentinyourWebpages.AsyoubrowsethroughtheObjectBrowser,you'llseemanyofthesametypesofcomponentsthatyou'refamiliarwithinMicrosoftInternetExplorer.

Tip

ToonlyviewtheprogrammingelementsthatarecompatiblewiththeFrontPagePageobjectmodel,select"FrontPageEditor"astheobjectlibraryintheObjectBrowser.

YoucanaccesstheHTMLelementsofapageusingtheActiveDocumentorDocumentpropertiesthatreturnthedocumentobjectviathePageWindowExobject.Forexample,thefollowingstatementchangesthebackgroundcolorforthepageintheactivepagewindow.

ActivePageWindow.Document.bgColor="DarkBlue"

Thefollowingexamplechecksforaspecifichyperlink(index.htm)withintheactivedocument.Ifthehyperlinkisfound,theprocedureexits,butifthehyperlinkisn'tfound,theprocedurefirstchecksiftheactivedocumentisindex.htmand,ifnot,thehyperlinkisaddedattheendofthedocument.

PrivateSubVerifyIndexLink()

DimmyDocAsFPHTMLDocument

DimmyLinksAsVariant

DimmyLinkAsVariant

DimmyNumberOfLinksAsInteger

DimmyAddLinkAsBoolean

DimmyLinkNameAsString

DimmyLinkName2AsString

SetmyDoc=ActivePageWindow.Document

SetmyLinks=myDoc.Links

myNumberOfLinks=myLinks.length

myLinkName="index.htm"

myLinkName2=""""&myLinkName&""""

ForEachmyLinkInmyLinks

IfmyLink=myLinkNameThen

myAddLink=True

ExitFor

EndIf

Next

IfmyAddLink=FalseAndmyDoc.nameProp<>"index"Then

CallmyDoc.body.insertAdjacentHTML("BeforeEnd","<ahref="_

&myLinkName2&">"&myLinkName&"</a>")

ActivePageWindow.Save

EndIf

EndSub

NoteNoticethatinthelastIfstatementtheactivepagewindowissavedbeforeexitingtheprocedure.ThiswouldbeagoodstatementtoaddtotheOnPageCloseevent.

UnderstandingWebWindowsandPageWindowsInMicrosoftInternetExplorer,thewindowobjectistherootoftheobjecthierarchy.InMicrosoftFrontPage,theApplicationobjectistherootoftheobjecthierarchyandtheWebWindowExobjectisanobjectinthethirdtieroftheobjecthierarchybelongingtothecollectionofWebWindows(secondtier).TheDocumentpropertyisaccessedviathePageWindowExobject(belongingtothecollectionofPageWindows),whoseparentistheWebWindowExobject.TheobjecthierarchyfortheWebWindowscollectionisshowninthefollowingdiagram.

WebWindows WebWindowExPageWindowsPageWindowEx

WhatisaWebWindowExobject?

TheWebWindowExobjectisthewindowcontainerfortheWebsite.WhenyouopenaWebsiteinFrontPage,youseetheWebsiteinits"web"window.FrontPageopensanewwindowforeachWebsiteyouopen.

WhatisaPageWindowExobject?

ThePageWindowExobjectisthecontainerforthewebpage.Whenyouopenapageinawebwindow,thatpageiscontainedinapagewindow(visibleintherightpane).FrontPageopensanewpagewindowforeachpageyouopen;howevereachPageWindowExobjectiscontainedwithintheWebWindowExobjectfortheindividualWebsite.Eachpagethatyou'veopenedisvisibleontheWindowsmenuinFrontPage.

WheredoestheDispFPHTMLDocumentobjectfitin?

TheFPHTMLDocumentobjectcontainstheHTMLelementsforapage.Theelementsforthedocumentareavailableusinganexpressionsuchas

ActivePageWindow.Document.elementwhereelementisoneoftheHTMLelementsavailableinFrontPage.NotethatnotallHTMLelementshavecorrespondingpropertiesthatyoucanusetoaccesstheelement.Forexample,thereisnoheadpropertytoaccesstheHEADelement.Inthesecases,useactivepagewindow.Document.all.tags.item("element")toreturntheobjectthatcorrespondstothespecifiedelement.

ReturninganObjectfromaCollectionTheItempropertyreturnsasingleobjectfromacollection.ThefollowingstatementssetthefileOnevariabletoaWebFileobjectthatrepresentsthefirstfileintheFilescollection.

NoteAllcollectionsintheMicrosoftFrontPageWebandPageobjectmodelsarezero-based,soyouaccessthefirstiteminthecollectionbyusingazero.

DimfileOneAsWebFile

SetfileOne=ActiveWeb.RootFolder.Files.Item(0)

TheItempropertyisthedefaultpropertyformostcollections,soyoucanomittheItemkeywordasshowninthefollowingstatement.

SetfileOne=ActiveWeb.RootFolder.Files(0)

Namedobjects

AlthoughyoucanusuallyspecifyanintegervaluewiththeItemproperty,itmaybemoreconvenienttoreturnanobjectbyname.ThefollowingexampleeditsafilenamedWebSales.htmintheactiveWebpage.

ActiveWeb.RootFolder.Files("WebSales.htm").Edit

UsingEventstoControlActionsTherearetwotypesofeventsinMicrosoftFrontPage—eventsthatareraisefromtheApplicationandWebobjectmodelsandeventsthatareraisedfromthePageobjectmodel.

Applicationevents

TheeventsfortheApplicationobjectmodelcanbeusedtocontrolunderwhatconditionsaWebsiteispublished,whetheryouwanttosaveapagewhenevertheOnPageCloseeventisfired,orwhetheryouwanttosetstyles,fonts,orbackgroundswheneveranewpageiscreated.

Pageevents

IntheMicrosoftInternetExplorerDHTMLobjectmodel,eventhandlersarecreatedusingscriptsforuseatrun-time.

However,intheFrontPagePageobjectmodel,you'reprogrammingwitheventsandobjectsthatarecompatiblewithInternetExplorer,butforuseatdesigntime.Toprogrameventsforruntime,youcanusethestandardMicrosoftVisualBasic5.0(orhigher)keywordstoaccessthePageobjectmodeleventsjustasyouwouldtoaccesstheWebobjectmodelevents.Thismethodcombinesthetwotechniquesdescribedpreviously.ThefollowingexamplecatchestheonclickeventforahyperlinkinFrontPage.

IntheVisualBasicEditor,insertaclassmoduleandnameitCatchOnClick.Addthefollowingcodetotheclassmodule.

DimWithEventseAnchorAsFPHTMLAnchorElement

DimWithEventseDocAsFPHTMLDocument

DimeAsIHTMLEventObj

PrivateSubClass_Initialize()

SeteDoc=ActiveDocument

SeteAnchor=eDoc.links(0)

EndSub

PrivateFunctioneAnchor_onclick()AsBoolean

Sete=eAnchor.Document.parentWindow.event

If(MsgBox("OnClickEventfor"&e.srcElement.tagName&_

"wouldyouliketocanceltheeventbubbling?",_

vbYesNo)=vbYes)Then

e.cancelBubble=True

e.returnValue=False

Else

e.cancelBubble=False

e.returnValue=True

EndIf

EndFunction

PrivateFunctioneDoc_onclick()AsBoolean

MsgBox"OnClickeventfortheDocumentobject"

EndFunction

Nextaddastandardmoduleandaddthefollowingcode.

PubliceAsCatchOnClick

SubGetClick()

Sete=NewCatchOnClick

EndSub

NoteToruntheexample,performthefollowingsteps:

AddahyperlinktoapageinFrontPage.RuntheGetClickproceduretocreateaglobalinstanceoftheCatchOnClickeventhandlerclass.Clickthehyperlink.

Apromptisdisplayedstatingthattheonclickeventfired.Thepromptalsoqueriestheusertofindoutwhethertheprogramshouldpasstheeventonuptheeventchain.IfYesischosen,theonclickeventispasseduptothedocumentobjecttobehandled.

Tocontrolwhichdocumentobjecttheeventispassedto,youmustsetboththecancelBubbleandreturnValueproperties.ThecancelBubbleeventworkstocanceltheeventfromgoinganyfartheruptheeventchain.SetthecancelBubblepropertyoftheIHTMLEventObjecttoTruewhenyoudon'twanttheonclickeventtobepasseduptothenextlevelofonclickevents,otherwise,setthecancelBubblepropertytoFalse.Forexample,ifyouhaveanimagethathasanonclickeventplacedonadocument,whichalsohasanonclickevent,youwouldsetthecancelBubblepropertyfortheIHTMLEventObjobjecttoTruefortheimage,ifyoudon'twanttheonclickeventtobepassedonuptothedocumentonclickevent.

ThereturnValuepropertyisusedtocontrolthedefaultactiontakenbyFrontPagewhenaneventfires.Usingthepreviousexampleofanimageplacedonadocument,ifthereturnValuepropertyfortheIHTMLEventObjectfortheimageissettoFalseintheonclickevent,thentheshortcutmenuwouldbedisabled(becausetheright-clickcontextmenuisthedefaultactionfortheonclickevent).

ManagingPublishingwithMetaTagsAutomatepublishingyourWebsitebyusingacombinationofeventssuchasOnBeforeWebPublishandmetadatathatcanbeobtainedbyaccessingthedatainthePropertiescollection.Forexample,beforepublishingaWebsite,youmightwanttocheckthemetadataforallofthepagesintheWebsite.TocheckifMicrosoftFrontPagegeneratedallofthepagesinyourWebsite,usethefollowingcodeintheOnBeforeWebPublishingevent,alongwithaneventhandler.

PrivateSubCheckIfFP()

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyMetaTagsAsMetaTags

DimmyMetaTagAsVariant

SetmyFiles=ActiveWeb.RootFolder.Files

ForEachmyFileInmyFiles

SetmyMetaTags=myFile.MetaTags

'Checkforanytextfiles.

IfmyMetaTags.Count=0And_

myFile.Extension<>".asa"Then

MsgBoxmyFile.Name&"wasnotgeneratedbyFrontPage."

EndIf

'Checkallwebpages.

ForEachmyMetaTagInmyMetaTags

IfmyMetaTag="generator"Then

IfmyFile.Properties("vti_generator")=_

"MicrosoftFrontPage4.0"Then

ExitFor

Else

MsgBoxmyFile.Name&"wasnotgeneratedbyFrontPage."

EndIf

EndIf

Next

Next

EndSub

Youcanalsocheckthevalueofthevti_donotpublishpropertykeybeforepublishing.Ifthedocumentisadraftoradocumentthatisn'ttobepublished,thevti_donotpublishpropertykeywillbesettoTrue.Thefollowingexamplechecksthevalueofthevti_donotpublishpropertykey.

DimmyFilesAsWebFiles

DimmyFileAsWebFile

ForEachmyFileInmyFiles

IfmyFile.Properties("vti_donotpublish")=TrueThen

MsgBox"Donotpublish"&myFile.Name

EndIf

Next

Thevti_donotpublishpropertykeycanbeusedtodisablepublishing.Whenpublishingiscomplete,thefilewillnotbepublishedtotheserver.ThefollowingexampledisablespublishingforthefirstfileintheFilescollection.

SubPublishThisFile(myFileNameAsString,myStatusAsBoolean)

DimmyFileAsWebFile

SetmyFile=ActiveWeb.LocateFile(myFileName)

CallmyFile.Properties.Add("vti_donotpublish",Not(myStatus))

myFile.Properties.ApplyChanges

EndSub

PrivateSubPublishFile()

PublishThisFileActiveweb.RootFolder.Files(0),False

EndSub

ProgrammingDynamicElementsinMicrosoftFrontPageTheobjects,methods,andpropertiesinMicrosoftInternetExplorerareusuallydesignedforrun-timeuse.InMicrosoftFrontPage,mostoftheelementsaredesignedfordesign-timeonly.Youcanprogrammaticallyaddcontenttoanexistingdocument,accessselectionsonapage,createascriptingelement,ormodifyanexistingtable.

AddingcontenttoadocumentusingaTextRange

AccessinguserselectionsusingaTextRange

Addingscripttoapage

Accessingtables

AddingcontenttoadocumentusingaTextRange

YoucanprogrammaticallyaddHTMLcontenttoaWebpagebycreatingatextrangeandaddingthenewcontenttothepageasshowninthefollowingexample.ThetextrangeiscreatedfromtheBODYelementofthemyDocumentvariable.IfthevalueinthemyClearPageparameterisTrue,thentheentirecontentbetweentheopeningandclosingBODYelementisreplacedwiththenewHTMLcontent,otherwisethenewcontentisappendedtotheoriginalcontent.

PublicFunctionAddHTMLToPage(myDocumentAsObject,_

myHTMLTextAsString,myClearPageAsBoolean)AsBoolean

DimmyRangeAsIHTMLTxtRange

DimmyBodyTextAsFPHTMLBody

OnErrorGoToCannotAddHTML

'CreateaTextRangeobject

IfmyClearPageThen

SetmyRange=_

myDocument.all.tags("BODY").Item(0).createTextRange

'Clearthecurrentdocument

CallmyRange.pasteHTML("")

myRange.collapseFalse

SetmyRange=Nothing

EndIf

SetmyBodyText=myDocument.all.tags("BODY").Item(0)

myBodyText.innerHTML=myBodyText.innerHTML&myHTMLText&vbCrLf

AddHTMLToPage=True

ExitFunction

CannotAddHTML:

AddHTMLToPage=False

EndFunction

SubAddNewHTML()

DimmyHTMLStringAsString

DimmyBodyElementAsFPHTMLBody

myHTMLString="<B><I>NewSaleonVintageWines!</I></B>"&vbCr

IfAddHTMLToPage(ActivePageWindow.Document,myHTMLString,True)Then

SetmyBodyElement=_

ActivePageWindow.Document.all.tags("BODY").Item(0)

EndIf

EndSub

AccessinguserselectionsusingaTextRange

YoucanusetheIHTMLTxtRangeobjecttoselectHTMLobjectsormanipulateauserselectiononaspecifieddocument.Thefollowingexampleappliesabackgroundcolortothecurrentselection.

PrivateSubApplyStyleToSelection()

DimmyRangeAsIHTMLTxtRange

SetmyRange=ActiveDocument.selection.createRange

myRange.parentElement.style.backgroundColor="SkyBlue"

EndSub

Addingscripttoapage

ScriptinginMicrosoftFrontPageVisualBasicforApplicationsiseasy.JustloadthescriptintoaStringvariableandinserttheStringtotheHEADelementforthepage.(TheHEADelementisaccessedusinganIHTMLElementobject.)OncetheStringhasbeenaddedtothepage,itisavalidscriptingelementandcanbeaccessedthroughtheFPHTMLScriptElementobjectandmodified.Thefollowingcodeaddsascriptelementtothecurrentpage,verifiesthatthescriptwasadded,addsaquerytotheuserwithOKandCancelbuttons,andthenprintssomeofthescriptelementpropertiesintheImmediatewindowoftheVisualBasicEditor.

PrivateSubCreateAScript()

DimmyScriptElementAsFPHTMLScriptElement

DimmyHTagAsIHTMLElement

DimmyBodyTagAsIHTMLElement

DimmyBodyStringAsString

DimmyHTMLStringAsString

DimmyTextAsString

'Buildascripttagconstruct.

myHTMLString=myHTMLString&"<scriptlanguage=""VBScript"">"_

&vbCrLf

myHTMLString=myHTMLString&"FunctiondoOK"&vbCrLf

myHTMLString=myHTMLString&_

"msgbox""Pleasewait,anorderformisbeinggenerated..."""&_

vbCrLf

myHTMLString=myHTMLString&"EndFunction"&vbCrLf&vbCrLf

myHTMLString=myHTMLString&"FunctiondoCancel"&vbCrLf

myHTMLString=myHTMLString&_

"msgbox""Exitingorderingprocess."""&vbCrLf

myHTMLString=myHTMLString&"EndFunction"&vbCrLf

myHTMLString=myHTMLString&"</script>"&vbCrLf

'Buildacalltagconstruct.

myBodyString="<CENTER>"&vbCrLf

myBodyString=myBodyString&_

"<BUTTONonclick=""doOK()"">OK</BUTTON>"&vbTab

myBodyString=myBodyString&_

"<BUTTONonclick=""doCancel()"">Cancel</BUTTON>"&vbCrLf

myBodyString=myBodyString&"</CENTER>"

'Addtexttothedocument

myText="I'dliketoordersomevintagewines."

'AccesstheHEADelement.

SetmyHTag=ActivePageWindow.Document.all.tags("HEAD").Item(0)

'AppendthescriptelementtotheHEADelement(myHTag).

myHTag.innerHTML=myHTag.innerHTML&myHTMLString

'Verifythatthescriptelementwasadded.

IfActivePageWindow.Document.scripts.length=1Then

'Accessthescriptelementjustadded.

SetmyScriptElement=ActivePageWindow.Document.scripts(0)

'PrintscriptelementpropertiestotheImmediatewindow.

'JScriptonly:thenextstatementgetstheFOR=attributefrom

'theJScript,otherwiseanemptystringprintsintheImmediate

'window.

Debug.PrintmyScriptElement.htmlFor

'Retrievethecontentofthescript.

Debug.PrintmyScriptElement.outerHTML

'Checkscriptinglanguage.

Debug.PrintmyScriptElement.language

EndIf

'Addaquerytotheuserandcallthescriptelement.

ActiveDocument.body.insertAdjacentHTML"BeforeEnd",_

"<B><I>"&myText&"</B></I><P>"&myBodyString

EndSub

Accessingtables

AnyonewhohascreatedtablesandworkedwiththeircontentsinHTMLwillfinditeasytouseMicrosoftVisualBasictoaccesstables.Thefollowingprogramaccessesatableonthecurrentpageandinsertsacell.

SubAccessTables()

DimmyTableAsFPHTMLTable

DimmyRowAsFPHTMLTableRow

DimmyCellAsFPHTMLTableCell

'Getthetable.

SetmyTable=ActiveDocument.all.tags("TABLE").Item(0)

'Getthefirstrow.

SetmyRow=myTable.rows(0)

MsgBoxmyRow.cells.Length

'Getthefirstcell.

SetmyCell=myRow.cells(0)

MsgBoxmyCell.Width

'Addanewcelltothefirstrow.

SetmyCell=myTable.rows(0).insertCell(myRow.cells.Length)

EndSub

ManagingSourceControlProjectsinMicrosoftFrontPageMicrosoftFrontPageprovidestwomethodsofversioning,FrontPageLightWeightsourcecontrol(alsoknownasMicrosoftOffice-stylelockingorFrontPage-basedlocking)andMicrosoftVisualSourceSafe.FrontPageLightWeightsourcecontrolisthedefaultversioningmethodforsourcecontrolprojectsinFrontPage.

VersioningprovidesameasureofcontroloveruserswhomaintainpagesonyourWebsites.Bothsourcecontrolmethodsprovidecheckin,checkout,undocheckout.VisualSourceSafeprovidesotherversioningcapabilities,suchasversiontrackingandrollbackfeatures.

Creatingasourcecontrolproject

Tocreateanewsourcecontrolproject,yousettheRevisionControlProjectpropertytothepathoftheproject(forVisualSourceSafe)orto<FrontPage-basedLocking>asshowninthefollowingstatement.

ActiveWeb.RevisionControlProject="<FrontPage-basedLocking>"

AssumingthattheString"$/CohoWinery"isavalidVisualSourceSafeproject,thefollowingstatementassignstheactiveWebsitetoaVisualSourceSafeproject.

ActiveWeb.RevisionControlProject="$/CohoWinery/Inventory"

Thefollowingexamplecreatesasourcecontrolprojectandchecksouttwofiles.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\CohoWinery".Youmaycreatetwofilescalled"index.htm"and"footnote.htm"orsubstitutefilenamesofyourchoice.

PrivateSubCreateSourceControl()

DimmyWebAsWebEx

DimmyProjectAsString

DimmyFile1AsWebFile

DimmyFile2AsWebFile

SetmyWeb=Webs.Open("C:\MyDocuments\MyWebSites\CohoWinery")

SetmyFile1=myWeb.RootFolder.Files("index.htm")

SetmyFile2=myWeb.RootFolder.Files("footnote.htm")

myProject="<FrontPage-basedLocking>"

myWeb.RevisionControlProject=myProject

myFile1.Checkout

myFile2.Checkout

EndSub

TheCheckoutmethodprovidesaBooleanforcecheckoutargumentforadministrators.

Removingasourcecontrolproject

Onceaprojectiscompleted,youmaydecidetoremoveversioning.Todothis,settheRevisionControlProjectpropertytoanemptyString("")asshowninthefollowingstatement.

myWeb.RevisionControlProject=""

SwitchingbetweenFrontPageLightWeightandVisualSourceSafeprojects

Toswitchbetweenthesetwotypesofversioning,youmustfirstsettheRevisionControlProjectpropertytoanemptyString("")asshowninthefollowingstatement.

myWeb.RevisionControlProject=""

ListsCollectionMultipleobjects Lists

ListMultipleobjects

RepresentsthecollectionofallListobjectsinthecurrentWebsite.ListsallowinformationtobesharedandexchangedbetweendifferentusersanddifferentWebsites.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListscollection

UsetheListspropertyoftheWebExobjecttoreturnthecollectionofalllistsintheWebsite.UseLists.item(index),whereindexiseitherthenameofthelistoritsnumericpositionwithinthecollection,toreturnasingleListobject.

ThefollowingexampledisplaysthenamesofalllistsintheactiveWebsite.IftheactiveWebsitedoesnotcontainanylists,amessageisdisplayedtotheuser.

SubListAllLists()

'Displaysthenamesofalllistsinthecollection

DimlstWebListAsList

DimstrNameAsString

'Checkifanylistsexist

IfNotActiveWeb.ListsIsNothingThen

'Cyclethroughlists

ForEachlstWebListInActiveWeb.Lists

'addlistnamestostring

IfstrName=""Then

strName=lstWebList.Name&vbCr

Else

strName=strName&lstWebList.Name&vbCr

EndIf

Next

'Displaynamesofalllists

MsgBox"ThenamesofalllistsinthecurrentWebsiteare:"_

&vbCr&strName

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

UsetheLists.AddmethodtoaddanewlisttotheListscollection.ThefollowingexampleaddsanewlistoftypefpBasicListcalledNewSharetotheactiveWebsite.

SubNewList()

'AddsanewlisttothecurrentWebsite

DimobjAppAsFrontPage.Application

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Addnewlist

objLists.AddName:="NewShare",_

ListType:=fpListTypeBasicList,_

Description:="ListofSharedfiles"

'Displaymessagetouser

MsgBox"AnewlistwasaddedtotheListscollection."

EndSub

MetaTagsCollectionWebFile MetaTags

Anarrayofpropertykey/valuepairs.EachitemintheMetaTagscollectionrepresentsaMETAtagcontainedonanHTMLpageinMicrosoftFrontPage.ThereisnoMetaTagobject.

NoteMETAtagsgeneratedbyFrontPage,suchasMETAtagsforathemeorborder,won'tshowupintheMetaTagscollection.TheMetaTagscollectionisonlypropagatedafterthefileissaved.Forexample,ifyouaddanewMETAtagtoapagebyusingtheCodevieworbyprogrammaticallyusingthePageobjectmodelinMicrosoftVisualBasicforApplications,youwon'tbeabletoviewthepropertykey/valuepairsuntilafteryousavethepage.TosavespaceintheMETAdictionary,youcanusethefollowingmethodstodisabletheMETAtagstore:

SettheDisableMetaTagStorekeyonaper-servicebasisSettheDisableMetaTagStorekeyasaglobalsettingunderHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SharedTools\WebServerExtensions\AllPortsSetthevti_disablemetatagstoreproperty

TheDisableMetaTagStorekeyfunctionsinthesamewayasotherserversettings;seetheServerExtensionsResourceKitformoreinformationaboutserversettings.

UsingtheMetaTagsCollection

UsetheMetaTagspropertytoreturntheMetaTagscollection.

NoteInthemetadataforFrontPage,thehttp-equivattributecanbeusedinplaceofthenameattribute.FrontPagedoesn'tusethevalueofthehttp-equivattributeinresponsemessageheaders.ThesyntaxforMETAdataisasfollows:

<META

CONTENT=description

HTTP-EQUIV=text

NAME=text

TITLE=text

URL=url

>

YoucanalsoreturnalistoftheMETAtagsthatexistintheactiveWebsitebyaccessingthefilestructurethroughtherootfolderoftheActiveWebobject,asshowninthefollowingexample.

NoteTorunthisexample,createaformwithatextboxcalledtxtMetaTags(settomultiplelines)andacommandbuttoncalledcmdGetMetaTagInfo,andthencopytheexampleintothecodewindow.

PrivateSubcmdGetMetaTagInfo_Click()

DimmyWebAsWebEx

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyMetaTagsAsMetaTags

DimmyMetaTagAsVariant

DimmyFileNameAsString

DimmyMetaTagNameAsString

DimmyReturnInfoAsString

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyWeb

ForEachmyFileInmyFiles

SetmyMetaTags=myFile.MetaTags

ForEachmyMetaTagInmyMetaTags

myFileName=myFile.Name

myMetaTagName=myMetaTag

myReturnInfo=myFileName&":"&myMetaTagName

txtMetaTags.Text=txtMetaTags.Text&myReturnInfo

Next

Next

txtMetaTags.SetFocus

txtMetaTags.CurLine=0

EndWith

EndSub

UsetheApplicationpropertytoreturntheApplicationobject.ThefollowingstatementreturnstheApplicationobject.

myApplication=ActiveWeb.RootFolder.Files(0).MetaTags._

Application

UsetheCountpropertytoreturnthenumberofMETAelementsinthecollection.ThefollowingstatementreturnsthenumberofMETAelementsinthetenthfileoftheActiveWebobject.

myMetaTagCount=ActiveWeb.RootFolder.Files(9).MetaTags.Count

UseItems(index),whereindexisthepropertykeyvalueasastring,ofanitemintheMetaTagscollectiontoreturnthepropertykey/valuepair.ThefollowingexamplereturnstheprogramidentificationtagfromtheMETAtagsinthefirstfileoftheActiveWebobject.

myMetaTagOne=ActiveWeb.RootFolder.Files(0).MetaTags("ProgId")

Commonpropertykeyvaluesare"generator"and"progid."Formoreinformationaboutpropertykeyvalues,seethetableinthePropertiesobject.

UsetheParentpropertywhenyouwanttoreturnthefilecontainerfortheMetaTagscollection.Forexample,thefollowingexamplereturnstheUrlpropertyoftheWebFilecontainerobjectthatisassociatedwiththeMETAtagsforthefirstfileoftheActiveWebobject.

myMetaTagParent=_

ActiveWeb.RootFolder.Files(0).MetaTags.Parent.Url

NavigationNodesCollectionMultipleobjects NavigationNodes

NavigationNodeMultipleobjects

AcollectionofNavigationNodeobjectswithinthenavigationalstructureofaMicrosoftFrontPage-basedWebsite.EachNavigationNodeobjectrepresentsapointertoapageonaWebsite.TheNavigationNodeobjectisamemberoftheNavigationNodescollection.

UsingtheNavigationNodesobject

UsetheNavigationNodepropertytoreturntheNavigationNodeobjectforaWebFileobject.FormoreinformationonreturningthecollectionofchildnodeswithinthenavigationalstructureofaWebsite,seetheChildrenproperty.ThefollowingexamplebuildsalistofthelabelsthatareassociatedwitheachNavigationNodeobjectintheNavigationNodescollection.Theprocedureexitswhenitreachestheendofthenavigationalstructure.

PrivateSubGetNavigationNode()

DimmyWebAsWebEx

DimmyWebFilesAsWebFiles

DimmyWebFileAsWebFile

DimmyNavNodeLabelAsString

DimmyLabelAsString

OnErrorResumeNext

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyFiles

ForEachmyFileInmyFiles

myLabel=myFile.NavigationNode.Label

IfErr<>0ThenExitSub

myNavNodeLabel=myNavNodeLabel&myLabel&vbCRLF

Next

EndWith

EndSub

UseChildren(index),whereindexistheindexnumberofaniteminthecollectionofchildnodes,toreturnasingleNavigationNodeobject.ThefollowingexamplereturnsthefirstNavigationNodeobjectinthecollection—whichisthehomepage.

SetmyNavNodeOne=ActiveWeb.RootNavigationNode.Children(0)

UsetheAddmethodtoaddaNavigationNodeobjecttotheNavigationNodescollection.Thefollowingexampleaddsanodetotherightmostpositioninthecurrentnavigationalstructure.

PrivateSubAddNewNavNode()

DimmyWebAsWebEx

DimmyNewNavNodeAsNavigationNode

DimmyNavChildrenAsNavigationNodes

SetmyWeb=ActiveWeb

SetmyNavChildren=_

myWeb.rootfolder.Files(1).NavigationNode.Children

myNewNavNode=_

myNavChildren.Add("C:\MyWebs\Sale.htm","Sale",fpStructRightmostChild)

myWeb.ApplyNavigationStructure

EndSub

NoteAfteryoufinishmodifyingyournavigationalstructure,youmustapplythechangesusingtheApplyNavigationStructuremethodbeforethenavigationalstructureisupdatedinFrontPage.

PageWindowsCollectionMultipleobjects PageWindows

PageWindowMultipleobjects

AcollectionofPageWindowExobjects.EachPageWindowExobjectrepresentsanopenWebpageinaMicrosoftFrontPageapplicationwindow.ThePageWindowExobjectisamemberofthePageWindowscollection.

UsingthePageWindowsobject

UsethePageWindowspropertytoreturnthePageWindowscollection.ThefollowingstatementreturnsthePageWindowsobjecttothemyPagesvariable.

myPages=WebWindows(0).PageWindows

UsePageWindows(index),whereindexistheindexnumberofaniteminthePageWindowscollection,toreturnasinglePageWindowExobject.ThefollowingstatementreturnsthefirstPageWindowExobjectinthecollection.

SetmyPageWindow=WebWindows(0).PageWindows(0)

UsetheAddmethodtoaddapagewindowtothePageWindowscollection.ThefollowingexampleopensthespecifiedpageinmyWebOneandaddsthepagetothePageWindowscollection.

DimmyPageWindowsAsPageWindows

SetmyPageWindows=ActiveWeb.WebWindows(0).PageWindows

myPageWindows.Add("C:\MyWebSites\myWebOne\bugrep.htm")

UsetheApplicationpropertytoreturntheApplicationobjectfromthePageWindowscollection.ThefollowingexamplereturnstheApplicationobjectfromthePageWindowscollection.

myAppName=WebWindows.PageWindows.Application.Name

UsetheClosemethodtocloseaPageWindowExobjectorthecollectionofopenPageWindows.ThefollowingstatementclosesthefourthPageWindowExobjectforthefirstWebWindowExobject.

WebWindows(0).PageWindows(3).Close

UseClose(index),whereindexistheindexnumberofaniteminthePageWindowscollection,tocloseasinglePageWindowExobjectasshowninthefollowingstatements.Bothstatementsclosethesamepagewindow.Inthefirststatement,youclosethepagewindowusingtheindexnumberfortheClosemethod,whileinthesecondstatement,youclosethepagewindowbyspecifyingtheindexnumberforthepageyouwanttoclose.

WebWindows(0).PageWindows.Close(2)

WebWindows(0).PageWindows(2).Close

UseClose()toclosealloftheopenPageWindowExobjectsinthePageWindowscollection.ThefollowingstatementclosesalloftheopenpagesinthePageWindowscollection.

WebWindows(0).PageWindows.Close()

UsetheCountpropertytoreturnthetotalnumberofpagewindowsinthePageWindowscollection.ThefollowingexamplereturnsthenumberofpagewindowsinthecollectionofPageWindows.

myPageCount=WebWindows(0).PageWindows.Count

UsetheParentpropertywhenyouwanttoreturnthecontainerforthePageWindowscollection.ThefollowingstatementreturnstheWebWindowExcontainerobjectforthefirstPageWindowExobjectusingtheParentproperty.

SetmyParent=ActiveWeb.WebWindows(0).PageWindows.Parent

PropertiesCollection

Multipleobjects Properties

AcollectionofmetadataasPropertyobjects.EachiteminthePropertiescollectionrepresentsanitemassociatedwithanindividualWebEx,WebFile,orWebFolderobject.Formoreinformation,seethetableofPropertyKeysinUsingthePropertyKeys.Chooseatopicfromthefollowinglisttogodirectlytothattopic.

UsingthePropertiesobject

UsingthePropertiescollectionwithinaWebsite

Usingthepropertykeys

UsingthePropertiesobject

UsetheAddmethodtoaddapropertytothePropertiescollection.ThefollowingstatementaddsacopyrightstatementtothePropertiescollection.

ActiveWeb.Properties.Add"Copyright",_

"Copyright1999byCohoWinery")

Youcanalsoaddandremovecategoriesandapprovallevels.

UsetheApplyChangesmethodtoapplyaPropertyobjectthathasbeenaddedtothecollectionofProperties.ThefollowingstatementsaddandapplyacopyrightpropertytothePropertiescollection.

ActiveWeb.Properties.Add"Copyright",_

"Copyright1999byCohoWinery")

ActiveWeb.Properties.ApplyChanges

UsetheCountpropertytoreturnthetotalnumberofpropertiesinthePropertiescollection.ThefollowingexamplechecksthatthenumberofpropertiesinthePropertiescollectionhasincreasedsincetheCopyrightpropertywasaddedandappliedtothecollection,andthengoesontoaddthecopyrighttoaWebsitepage.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\CohoWinery",oryoumaysubstituteanalternativeWebsiteURL.

PrivateSubcopyrightAdd()

DimmyWebAsWebEx

DimmyCopyrightAsString

DimmyCountAsInteger

DimmyMessageAsString

myCopyright="Copyright1999byCohoWinery"

myCount=ActiveWeb.Properties.Count

myMessage="Nonewpropertieshavebeenadded."

SetmyWeb=Webs.Open("C:\MyWebSites\CohoWinery")

myWeb.Activate

ActiveWeb.Properties.Add"Copyright",myCopyright

IfmyCount<>ActiveWeb.Properties.Count–1Then

MsgBoxmyMessage

ExitSub

EndIf

ActiveWeb.RootFolder.Files("Zinfandel.htm").Open

ActiveDocument.body.insertAdjacentText"BeforeEnd",_

ActiveWeb.Properties("Copyright")

ActivePageWindow.Save

ActiveWeb.Close

EndSub

UsetheDeletemethodtodeleteasingleproperty.ThefollowingstatementdeletestheCopyrightpropertyfromthePropertiescollection.

ActiveWeb.Properties.Delete("Copyright")

UsetheParentpropertywhenyouwanttoreturnthecontainerforthePropertiescollection.Forexample,thefollowingstatementreturnstheURLoftheparentWebsite.

myParentURL=ActiveWeb.Properties.Parent.Url

UsingthePropertiescollectionwithinaWebsite

UseProperties(index),whereindexisthePropertyKeyoftheiteminthePropertiescollection,toreturnasingleproperty.ThefollowingexamplereturnsthevalueofthePropertyKeyvti_hassearchbot.

PrivateSubCheckForSearchBot()

DimmyPropertiesAsProperties

DimmyFoundSearchBotAsBoolean

SetmyProperties=ActiveWeb.Properties

WithmyProperties

myFoundSearchBot=.Item("vti_hassearchbot")

EndWith

EndSub

ImportantThevaluesforpropertiesarevariant—thatis,eachvaluecanbeastring,aBoolean,oranarray.YoucanusetheTypename()functiontodeterminethetypeofthepropertyvalue.

NoteTorunthefollowingexampleyoumustcreateaformthatcontainsatextboxcalledtxtCategories.Also,noticethatmyCategoriesisdeclaredasavarianttypeinthisexample.Inapreviousexample,myFoundSearchBotwasdeclaredBoolean—butcouldalsohavebeendeclaredasastring.

PrivateSubGetWebPropertyCategories()

DimmyPropertiesAsProperties

DimmyCategoriesAsVariant

DimmyCategoryAsVariant

DimtxtCategoriesAsString

SetmyProperties=ActiveWeb.Properties

WithmyProperties

myCategories=.Item("vti_categories")

ForEachmyCategoryInmyCategories

txtCategories=txtCategories&"|"&myCategory

Next

EndWith

EndSub

Usingthepropertykeys

ThepropertykeyscanbeavaluabletoolfororganizinginformationaboutyourWebsites.Forexample,youcanaddcategoriestothemasterlistofcategoriesonyourWebsite.

ImportantThecategorynamescanbeaddedtothecategorieslistusingcasesensitivity,butwillnotdisplaywithcasesensitivityintheUserInterface(UI).Becauseofthis,asituationmayoccurwhereausercreatesacategoryontheclient,suchas"WebAdministrators",andaduplicatecategoryexistsontheserver,suchas"webadministrators".Inthiscase,intheUI,MicrosoftFrontPagewillassignbothcategoriestothe"webadministrators"categoryandneitherofthesecanbedeletedfromtheWebsite(intheUI).Programmatically,thecasesensitivitywillcorrectlydisplayintheImmediateandLocalwindowsoftheVisualBasicEditor.

ThefollowingexamplefirstaddsacategorytothepropertiesfortheactiveWebsite,deletestheWaitingcategoryfromthesamelist(vti_categories),andthenaddsthenewcategorytoeachofthefilesintheactiveWebsite.

NoteWhencreatinganewcategory,youmustfirstaddthenewcategorytotheWebsitebeforeyouaddittoanyofthefiles.Theprocedure,AddCategories,addsanewcategorytotheWebsiteandthenextprocedure,AddCategoryToFiles,addsthesamecategorytoallofthefilesintheWebsite.

PrivateSubAddCategories()

DimmyWebAsWebEx

DimmyCategory(2)AsString

DimmyItemAsVariant

SetmyWeb=ActiveWeb

myCategory(0)="+webadministrators"

myCategory(1)="-waiting"

ActiveWeb.Properties("vti_categories")=myCategory

ActiveWeb.Properties.ApplyChanges

'Listalloftheitemsinvti_categoriesintheImmediatewindow

ForEachmyItemInmyWeb.Properties("vti_categories")

Debug.PrintmyItem

Next

EndSub

PrivateSubAddCategoryToFiles()

DimmyWebAsWebEx

DimmyCategories(1)AsString

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyItemAsVariant

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

myCategories(0)="+webadministrators"

ForEachmyFileInmyFiles

myFile.Properties("vti_categories")=myCategories

myFile.Properties.ApplyChanges

'Listalltheitemsinvti_categoriesintheImmediatewindow

ForEachmyItemInmyFile.Properties("vti_categories")

Debug.PrintmyItem

Next

Next

EndSub

NoteAlthoughyoucancreatenewcategories,suchas"webadministrators",thataren'tincludedinthecategoriesthatareautomaticallyinstalledwithFrontPage,thesenewcategorieswon'tbevisibleintheUserInterface(UI)untiltheyareaddedtotheWebsite.Noticethatinthepreviousexample,thenewcategorywasaddedtotheWebsitefirstandwillbevisibleintheUI.

ThefollowingtableprovidesdetailedinformationaboutthepropertykeysavailableinFrontPage.NoticethatallpropertykeysinFrontPagestartwith“vti_”.Itissuggestedthatyouprefixthepropertykeysyouwanttoaddwithashortname,suchasanabbreviationforthenameofyourcompany,toreducethechancesofnamingconflictswithotherproperties.

PropertyKey Description Permission

vti_approvallevel

Theapprovallevelsetforapage.TheavailablelevelsareAssignedTo,ReviewStatus,andCategories.

Read/write

ListofavailableapprovallevelsthatcanbeappliedtodocumentsinaWebsite.Thispropertykeyisastringvector(oranarrayof

vti_approvallevelsstrings).UsedtopopulatetheWeb-widelistofknown"reviewstatuses"(alsoknownas"approvallevels")thataresetforadocument.TheapprovallevelsyoucansetareAssignedTo,ReviewStatus,andCategories.

Read-only

vti_approvedby Theauthenticatednameofthepersonwhoapprovedthepage. Read-only

vti_assignedbyTheauthenticatednameofthepersonwhoassignedthepagetoauser.

Read-only

vti_assigneddate Thisisthedatethatthepagewaslastassignedtoauser. Read-only

vti_assignedtoTheauthenticatednameofthepersontowhomthepageisassigned.

Read-only

vti_author

Returnstheauthor'snameinstringformat.Theidentificationoftheauthenticatedauthorwhohas,oris,makingchangestothedocument.

NoteThisisdifferentfromtheAuthorpropertystoredaspartofMicrosoftOfficedocumentproperties,whichcanbesetbytheusertoanyarbitraryvalue.

Read-only

vti_casesensitiveurls

TrueiftheWebsiteisrunningonaserverwhereURLsarecasesensitive,suchasaserverrunningUNIX.Forexample,ifthispropertyissettoTrue,thenafilenamedMyFile.htmandafilenamedmyFile.htmaretreatedastwoseparatefiles.

Read-only

Themasterlistofcategories.Thispropertykeyisastringvector(or

vti_categories

anarrayofstrings)thatisusedforbothWeb-levelanddocument-levelmetadata.AttheWeb-sitelevel,thepropertykeycontainsalistofallknowncategoriesthatexistintheWebsite.Atthedocumentlevel,itcontainsalistofallthecategoriestowhichthespecifieddocumentbelongs.

NoteThesecategoriesareautomaticallyupdatedwheneveracategoryisaddedormodifiedinanyway.

Read/write

vti_clientvercutoff

Youcanusethispropertykeytosetaversioncutoffstring.Thisismostcommonlyusedinamulti-versionenvironmenttopreventolderversionsoftheapplicationfromrunningonaspecificserver.Formoreinformation,seetheFrontPageServerExtensionsResourceKit.

Read/write

vti_dataconns ListofdataconnectionsusedbydatabasefeaturesinFrontPage. Read-only

vti_defaultcharset ThedefaultcharactersetfortheWebsiteorpage. Read-only

vti_defaultlanguage ThedefaultlanguagefortheWebsiteorpage. Read-only

vti_description Providesamulti-linetextboxfortheusertowritecommentsin. Read/write

vti_donotpublish SettoTrueifthepageismarkedas"draft"or"nottobepublished." Read/write

vti_filesize Thesizeofthefileinbytes. Read-onlyThispropertykeycorrespondstothegeneratortagwithinanHTML

vti_generator

document.Thevalueofthevti_generatorpropertykeycontainsthenameoftheapplicationthat"generated"thedocument,whichmaybedifferentfromtheapplicationthatwasinvokedtohandlethepage.Forexample,ifyoucreatedoreditedapagewithMicrosoftWord,andthenretrievedthevalueofthevti_generatorpropertykeyinMicrosoftFrontPageVisualBasicforApplicationsforthatdocument,thevalueofthevti_generatorpropertykeywouldbeMicrosoftWord--eventhoughtheprocedurecallwasgeneratedbyFrontPage.Validvaluesare"MicrosoftWord","MicrosoftAccess","MicrosoftFrontPage",andsoon.

NoteFrontPagedeferstoWordwhenthere'sathemeconflictifthevti_generatorpropertykeycontains"MicrosoftWord".

Read-only

vti_globalpage

Marksapageasglobal,thatis,atop-levelpageinthenavigationstructure,onthesamelevelas,butnotequalto,thehomepage.

Read/write

vti_hasframeset

Trueifthepagecontainsframesets.Thispropertykeyisusedwhenconstructinglinkbarlinks.Whenthepagethatisbeinglinkedisaframeset,thelink'stargetattributeisforcedto"_top".Thiscausesthenewpagetoreplacethecurrentframesettopreventrecursive

Read-only

framesetsatbrowsetime.

vti_hasruntimebots Trueifthepagehasrun-timebotsonit. Read-only

vti_htmlextensionsAconcatenatedstringofextensionsusedtospecifyaWebfile,suchashtm.html.asp.

Read-only

vti_httpdversion TheversionofFrontPagethatisrunningonthehttpdserver. Read-only

vti_imagemapformat

ThispropertykeysetstheURLformatusedbytheserver-sideimagemapprocessor.ValidvaluesareNCSAandCERN.ThispropertykeyisonlyusefulforpriorversionsofFrontPage.FrontPagenowusesclient-sideimagemaps.

Read/write

vti_imagemapurlprefix

Setstheserver-relativeURLoftheserver-sideimage-mapprocessorfortheselectedimage-mapformat.Ifthevalueofthevti_imagemapurlprefixpropertykeyissettoanemptystring(""),server-sideimagemapsarehandledautomaticallybytheFrontPageServerExtensions.Forotherformats,providethenameandlocationoftheimage-mapprocessor.Tospecifyclient-sideimagemaps,setthisvariabletoanemptystring.Formoredetailedinformation,seetheFrontPageServerExtensionsResourceKit.

Read/write

vti_insecureserverurl

Retrievesthehttp://URL(unsecuredURL)foraWebsite.Providescompatibilitywitholderbrowsersthatmaynothavesecurebrowsingcapability.Formoreinformation,seetheFrontPage

Read-only

ServerExtensionsResourceKit.

vti_isbrowsable

Trueifthepagefolderisbrowsable.UseFolder.IsBrowsabletosetthisvalue..

Read-only

vti_ischildweb

Trueifthespecifiedfolderistherootofasubsite.UseFolder.MakeWebandFolder.RemoveWebtomodify.

Read-only

vti_isexecutable

SetthispropertytoTruetoenableifthisfolderismarkedforexecutablecontentontheserver.UseFolder.IsExecutabletosetthisvalue.

Read/write

vti_isscriptable

SetthispropertytoTrueifscriptingisenabledforthisfolder.UseFolder.IsScriptabletosetthisvalue.

Read-write

vti_longfilenames

Trueiftheserversupportsfilenamesthatarelongerthanthestandard8.3fileformat.(The8.3fileformatonlysupportsfilenameswitheightcharactersandextensionswiththreecharacters,suchas"filename.txt".)

Read-only

vti_metatags

ThispropertykeycorrespondstothecontentswithintheMETAtagsinanHTMLdocument.AlloftheinformationcontainedinthispropertykeyisaddedtotheMETAtagscollection.

Read-only

vti_modifiedby Authenticatednameoftheauthorwholastmodifiedthepage. Read-only

vti_navbuttonhomelabel

Theimagefileassociatedwiththebuttonthatlinkstothehomepage.

NoteThisimageisretrievedfrom Read/write

thethemeassociatedwiththefileandisnotcustomizable.

vti_navbuttonhomelabeltext

Thetextthatoverlaysthevti_navbuttonhomelabel.

NoteThistextiscustomizablebytheuser.

Read/write

vti_navbuttonlabeltext

Thetextthatoverlaysthevti_nvabuttonuplabel.

NoteThistextiscustomizablebytheuser.

Read/write

vti_navbuttonnextlabel

Theimagefileassociatedwiththebuttonthatlinkstothenextpageinthenavigationstructure.

NoteThisimageisretrievedfromthethemeassociatedwiththefileandisnotcustomizable.

Read/write

vti_navbuttonnextlabeltext

Thetextthatoverlaysthevti_navbuttonnextlabel.

NoteThistextiscustomizablebytheuser.

Read/write

vti_navbuttonprevlabel

Theimagefileassociatedwiththebuttonthatlinkstothepreviouspageinthenavigationstructure.

NoteThisimageisretrievedfromthethemeassociatedwiththefileandisnotcustomizable.

Read/write

Thetextthatoverlaysthevti_navbuttonprevlabel.

vti_navbuttonprevlabeltext NoteThistextiscustomizablebytheuser.

Read/write

vti_navbuttonuplabel

Theimagefileassociatedwiththebuttonthatlinkstothepageonelevelupinthenavigationstructure.

NoteThisimageisretrievedfromthethemeassociatedwiththefileandisnotcustomizable.

Read/write

vti_noclientimagemaps Trueifclientimagemapsareprohibited. Read-only

vti_nonnavpageTrueifthepageisn'tassociatedwithanavigationnodewithinthenavigationstructure.

Read/write

vti_nosourcecontrol

TrueiftheWebsiteisnotbeingstoredundersourcecontrol.PreventsaddingafiletosourcecontrolifthispropertyissettoTrue.

NoteIfafilehaspreviouslybeenaddedtoasourcecontrolprojectwiththevti_nosourcecontrolpropertysettoFalse,andthepropertyissubsequentlysettoTrue,thefilewillnotberemovedfromthesourcecontrolproject.

Read/write

Thispropertykeycorrespondstothe"originator"METAtaginanHTMLdocument.Thevalueofthispropertykeycontainsthenameoftheapplicationthatcreatedthedocument.Youshouldneveroverwritethispropertykeywiththenameofanotherapplication.The

vti_originator

vti_generatorpropertykeyshouldbeusedtotracktheapplicationthatlast"generated"theHTMLpage.SimplyeditingadocumentinFrontPagewillchangethevalueofthevti_generatorpropertykeyto"MicrosoftFrontPage".Validvaluesare"MicrosoftWord","MicrosoftAccess","MicrosoftFrontPage",andsoon.

NoteFrontPagedeferstoWordwhenthere'sathemeconflictifthevti_generatorpropertykeycontains"MicrosoftWord".

Read-only

vti_privatetext

Thevalueofthispropertykeymustbeaninteger.Zeroornotpresentisthedefault.Anon-zerovaluemeansthatthepagewon'tbeaddedtoanytextindexes.Thispropertykeyonlyworkswiththebuilt-intextindexinginFrontPageandisnotrecognizedbyMicrosoftInternetInformationServices(IIS).

Read/write

vti_progid

Thiscorrespondstothe"progid"METAtaginanHTMLdocument.Thevalueofthispropertykeydetermineswhichapplicationopensthedocumentwhenauserclicks(ordouble-clicks)thedocument'sfilenameinWindowsExplorer.Validvaluesare"FrontPage.Editor.Document","Word.Document","Excel.Sheet","PowerPoint.Slide","Access.Application".

NoteFrontPagedeferstoWord

Read-only

whenthere'sathemeconflictifthevti_generatorpropertykeycontains"MicrosoftWord".

vti_scriptlanguage Indicateswhichscriptinglanguageisenabledontheserver. Read-only

vti_secureserverurl

Retrievesthehttps://URL(securedURL)foraWebsite.ProvidesasecureenvironmentforconfidentialtransactionsovertheInternet.FormoreinformationseetheFrontPageServerExtensionsResourceKit.

Read-only

vti_serveripaddress

TheIPaddressoftheserver.

NoteAnIPaddressbeginningwith127representsalocalserver.

Read-only

vti_serverlanguageThelanguageoftheoperatingsystem.Usedforlocalizationpurposes.

Read-only

vti_showhiddenpages Trueifhiddenpagesaredisplayed. Read-only

vti_sourcecontrolcheckedoutby Authenticatednameoftheauthorwholastcheckedoutapage. Read-only

vti_sourcecontrolerror

Theerrorlastreturnedbythesourcecontrolsystem.ThiserrorisaddedtotheMETAtaginformationifanerroroccurswhilethefileisbeingaddedtoasourcecontrolproject.

Read-only

vti_sourcecontrolproject

Thenameofthesourcecontrolproject.ForaMicrosoftVisualSourceSafeproject,thestringwouldincludethe"$"symbol,asin"$/myProject"

Read-only

Thevalueofthispropertykeyisthetypeofsourcecontrolinuseonthat

vti_sourcecontrolsystem

Website.CanbeMicrosoftVisualSourceSafeorMicrosoftFrontpageLightWeightsourcecontrol.Validvaluesforthesetwotypesofsourcecontrolare"VSS"and"LW",respectively.Thispropertykeyissetwhenasourcecontrolprojectisstarted.Formoreinformationonsourcecontrolprojects,seeManagingSourceControlProjects.

Read-only

vti_sourcecontrolversionAnumberedstringthatcontainstheversionofthesourcecontrolsystemthatisinuse.

Read-only

vti_textextensions

Aconcatenatedstringofextensionsthatarecommonlyusedtodenotetextfiles.Forexample,theconcatenatedstringmightcontain".txt.rpt..."

Read-only

vti_themedefault ThedefaultthemeoftheWebsite. Read-only

vti_themesusecss TrueifCSSisusedtopresentthetheme. Read/write

vti_timecreated

Thetimestampwhenthepagewascreated.ThetimestampisinUniversalTimeCoordinate(UTC)orGreenwichtime.

Read-only

vti_timelastmodified

Thetimethatthepagewaslastmodified.ThetimestampisinUTCtime.Thisisonlysetwhentheauthoreditsthepagedirectly.

Read-only

vti_timelastwrittenThetimethatthepagewaslastrewritten.ThetimestampisinUTCtime.

Read-only

vti_-title Thevalueofthetextbetweenthe<TITLE>tagsonthepage. Read-only

vti_usernames ThelistofknownusernamesforaspecifiedWebsite. Read-only

ThetypeofWebsiteserver.Valid

vti_webservertypevaluesinclude,"MSIIS"forMicrosoftInternetInformationServicesand"PWS"forPersonalWebServer.

Read-only

vti_welcomenames

Aconcatenatedlistoffilenamesthatcanbeusedasthefilenameforthehomepage,suchas"index.htmindex.htmldefault.htm".

Read-only

ThemesCollectionMultipleobjects Themes

Theme

AcollectionofThemeobjects.EachThemeobjectrepresentsathemeassociatedwithanHTMLpageoraWebsiteinMicrosoftFrontPage.TheThemeobjectisamemberoftheThemescollection.

UsingtheThemescollection

UsetheThemespropertytoreturntheThemescollection.TheThemespropertycanbeusedwitheithertheApplicationortheWebExobject.TheThemespropertyfortheApplicationobjectisthecollectionofthemesavailableinFrontPage.TheThemespropertyfortheWebExobjectisthecollectionofthemesappliedtothefileswithinaWebsite,orthecollectionofthemesappliedtoaWebsite.ThefollowingstatementillustratesboththeThemesandCountpropertiesandreturnsthenumberofitemsintheThemescollectionthatareavailableinFrontPage.

myTotalThemeCount=Application.Themes.Count

ThefollowingstatementreturnsthenumberofthemeswithintheactiveWebsite.

myWebThemeCount=ActiveWeb.Themes.Count

UseThemes(index),whereindexistheindexnumberofathemeitem,toreturnasingleThemeobject.ThefollowingstatementreturnsthefirstthemeintheThemescollection.

myThemeOne=Application.Themes(0)

UsetheApplicationpropertytoreturntheApplicationobject.ThefollowingexamplereturnstheversionandbuildnumberofFrontPagefromwithintheThemescollection.

NoteTorunthisprocedureyoumusthaveatleastoneopenWebsite.

PrivateSubGetBuildNumber()

DimmyThemesAsThemes

DimmyBuildAsString

SetmyThemes=ActiveWeb.Themes

myBuild=myThemes.Application.Build

EndSub

UsetheParentpropertywhenyouwanttoreturnthecontainerfortheThemescollection.Forexample,thefollowingstatementreturnstheURLassociatedwiththeparentcontaineroftheThemescollection.

myParentUrl=ActiveWeb.Themes.Parent.Url

WebFilesCollectionMultipleobjects WebFiles

WebFileMultipleobjects

AcollectionofWebFileobjects.EachWebFileobjectrepresentsalloftheopenfilesinaWebsite.TheWebFileobjectisamemberoftheWebFilescollection.

UsingtheWebFilesobject

UsetheFilespropertytoreturntheWebFilescollection.ThefollowingstatementreturnstheWebFileobjectsintheWebFilescollection.

SetmyWebFiles=Application.Webs(0).RootFolder.Files

UseWebFiles(index),whereindexistheordinalnumberofanitemintheWebFilescollection,toreturnasingleWebFileobject.ThefollowingstatementreturnsthefirstWebFileobjectinthecollection.

SetmyWebFile=ActiveWeb.RootFolder.Files(0)

UsetheAddmethodtoaddaWebFileobjecttotheWebFilescollection.ThefollowingstatementaddsanewWebFileobjecttothecollectionofWebFiles.

myWebFiles.Add("C:\NewWebWebFiles\SalesStatistics.htm")

UsetheApplicationpropertytoreturntheApplicationobjectfromwithintheWebFilescollection.ThefollowingstatementreturnstheApplicationobjectfromtheWebFilescollection.

myApp=ActiveWeb.RootFolder.Files.Application

UsetheCountpropertytoreturnthenumberofopenfilesintheWebFilescollection.ThefollowingstatementreturnsthenumberoffilesinthecollectionofWebFiles.

myCount=Webs(0).RootFolder.WebFiles.Count

UsetheDeletemethodtodeleteaWebFileobject.ThefollowingstatementdeletesthethirdfileintheWebFilescollection.

Webs(0).RootFolder.Files(2).Delete

UsetheParentpropertywhenyouwanttoreturnthecontainerfortheWebFilescollection.ThefollowingstatementreturnstheURLofthefolderforthesecondfileintheactiveWebsite.

myWebFileParent=ActiveWeb.RootFolder.Files(1).Parent.Url

WebFoldersCollectionMultipleobjects WebFolders

WebFolderMultipleobjects

AcollectionofWebFolderobjects.EachWebFolderobjectwithintheWebFolderscollectionrepresentsafolderinaWebsite.TheWebFolderobjectisamemberoftheWebFolderscollection.

NoteAllofthemethodsthatinvolvechangingthelocationofafolder,suchasCopyorMove,onlychangethelocationwithinthecurrentWebsite;youcannotmoveafolderfromoneWebsitetoaanotherWebsite.

UsingtheWebFoldersobject

UseWebFolders(index),whereindexistheindexnumberofanitemintheWebFolderscollection,toreturnasingleWebFolderobject.ThefollowingexamplereturnsthefirstWebFolderobjectinthecollection.

SetmyFolder=ActiveWeb.RootFolder.Folders(0)

UsetheAddmethodtoaddanewWebFolderobjecttotheWebFolderscollectioninaWebsite.BothofthefollowingstatementsaddaWebFoldertothecollectionofWebFoldersintheactiveWebsite—parenthesesarenotrequiredforthefoldername,asshowninthesecondstatement.

NoteTheFolderUrlargumentwithinthequotes("CohoWinery")shouldonlyincludethenewfoldername,nottheentireURL,unlessyouareaddinganewURLtothelocationdesignatedastheFolderUrl.TheprogramwillfailiftheentireURLisincludedforexistingURLs.

ActiveWeb.RootFolder.Folders.Add("CohoWinery")

ActiveWeb.RootFolder.Folders.Add"CohoWinery"

UsetheCountpropertytoreturnthenumberoftotalnavigationnodesintheWebFolderscollection.ThefollowingstatementreturnsthenumberofWebfoldersintheCohoWineryWebsite.

Webs("C:\WebServerOne\CohoWinery").Folders.Count

UsetheDeletemethodtodeleteafolderfromaWebsite.ThefollowingstatementsdeletethetenthWebFolderobject.Thesecondstatementusesthenameofthefolderinsteadoftheindexnumbertodesignatethefoldertodelete.

ActiveWeb.RootFolder.Folders(9).Delete

ActiveWeb.RootFolder.Folders("TempFolder").Delete

UsetheCopymethodtocopyaWebFolderobject.Thefollowingexamplecopiesafolder(WebFolders(4))toanotherfolderontheactiveWebsite

(ChardonnayInventory).Forpurposesofthisexample,WebFolders(4)isafoldernamedInventoryintheCohoWineryWebsite.Thisfoldercontainstheentirewineinventory—buttheWebdesignerwantedtofeaturethesaleonChardonnaywinesandcreatedatemporaryfolderthatwillbeeditedtocontainonlyChardonnaywine.

PrivateSubCopyInventory()

DimmyFolderAsWebFolder

SetmyFolder=ActiveWeb.RootFolder.Folders(4)

myFolder.Copy("C:\CohoWinery\ChardonnayInventory,False,True)

EndSub

UsetheParentpropertywhenyouwanttoreturnthecontainerfortheWebFolderscollection.Thefollowingstatementreturnsthecontainerforthefourthfolder.

myParent=Webs.RootFolder.Folders(3).Parent

WebsCollectionApplication Webs

WebMultipleobjects

AcollectionofWebExobjects.EachWebExobjectrepresentsaWebsite,whichcaneitherbedisk-based(onalocalharddrive)orserver-based(onaWebserver).TheWebExobjectisamemberoftheWebscollection.

UsingtheWebscollection

UsetheWebspropertytoreturntheWebscollection.YoucanalsousetheApplicationpropertytoreturntheApplicationobject.ThefollowingstatementusestheApplicationobjecttoreturnthefirstitemintheWebscollectionorusethesecondstatementtoreturntheentirecollectionofWebsites.

SetmyWebOne=Application.Webs(0)

SetmyWebs=Application.Webs

UseWebs(index),whereindexistheindexnumberofanitemintheWebscollection,toreturnasingleWebExobject.ThefollowingstatementreturnsthethirdWebsiteinthecollectionofopenWebExobjects.

SetmyGetWebThree=Webs(2)

UsetheAddmethodtoaddanitemtothelistofavailableitemsintheWebscollection.ThefollowingstatementaddstheCohoWineryWebsitetotheWebscollection.Ifitdoesn'texist,FrontPagewillcreateanewWebsiteatthespecifiedpathandopenit.

Webs.Add("C:\MyDocuments\MyWebSites\CohoWinery")

UsetheApplicationpropertytoreturninformationabouttheapplicationfromwithintheWebscollection.ThefollowingstatementreturnstheversionnumberoftheApplicationobject.

ActiveWeb.Webs.Application.Version

UsetheCountpropertytoreturnthenumberofopenWebsitesintheWebscollection.ThefollowingstatementreturnsthenumberofopenWebsites.

Webs.Count

UsetheDeletemethodtopermanentlydeleteaWebsitefromtheWebscollection.ThefollowingstatementdeletestheCohoWineryWebsite.

Webs.Delete("C:\MyDocuments\MyWebSites\CohoWinery")

UsetheOpenmethodtoopenaWebsite.ThefollowingstatementopensaWebsiteandaddsittothecollectionofitemsintheWebscollection.

Webs.Open("C:\MyDocuments\MyWebSites\CohoWinery")

UsetheParentmethodwhenyouwanttoreturnthecontaineroftheWebscollection,whichistheapplication.ThefollowingstatementreturnstheApplicationobject.

SetmyParent=Webs.Parent

WebWindowsCollection

Multipleobjects WebWindowsWebWindowMultipleobjects

AcollectionofWebWindowExobjects.EachWebWindowobjectrepresentsanopenWebsiteinMicrosoftFrontPage.TheWebWindowExobjectisamemberoftheWebWindowscollection.

UsingtheWebWindowsCollection

UseItems(index),whereindexistheindexnumberofanitemintheWebWindowscollection,toreturnasingleWebWindowExobject.ThefollowingexamplereturnstheCaptionpropertyforthefourthitemintheWebWindowscollection.

FunctionReturnWebWindowCaption()AsString

DimmyCaptionAsString

DimmyWebWindowAsWebWindowEx

SetmyWebWindow=Application.WebWindows(3)

myCaption=myWebWindow.Caption

ReturnWebWindowCaption=myCaption

EndSub

UsetheWebWindowspropertytoreturntheWebWindowscollection.ThefollowingexampleclosesalloftheopenWebWindowExobjectsintheWebWindowscollectionexcepttheActiveWebWindowobject.

PrivateSubCloseWebWindows

DimmyWebWindowsAsWebWindows

DimmyWebWindowAsWebWindowEx

DimmyActiveWebWindowAsWebWindowEx

SetmyWebWindows=Application.WebWindows

SetmyActiveWebWindow=ActiveWebWindow

ForEachmyWebWindowInmyWebWindows

IfmyWebWindow.Caption<>myActiveWebWindow.CaptionThen_

myWebWindow.Close

Next

EndSub

UsetheApplicationpropertytoreturntheApplicationobject.Ifyou'realreadyworkingwiththeWebWindowscollectionandyou'dliketochecktheversionnumberoftheapplication,youcaneasilyaccessitthroughyourWithmyWebWindowsstatementasshowninthefollowingexample.

WithmyWebWindows

myWebWindowCount=myWebWindows.Count

myAppVersion=.Application.Version

IfmyAppVersion<"4.0"Then

MsgBox"PleaseupgradeyourFrontPagesoftware."

Else

ForEachmyWebWindowInmyWebWindows

myCaption=myWebWindow.Caption

WithmyPageWindows

myPageCount=PageWindows.Count

EndWith

Next

EndIf

EndWith

YoucanusetheClosemethodtocloseanindividualWebWindowExobject,multipleWebWindowExobjects,orallWebWindowExobjectsinFrontPage.FormoredetailsontheClosemethod,seetheusagedescribedinthefollowingtable.

ImportantFrontPagewillclosetheapplicationifyouusetheClosemethodtocloseallWebWindowExobjectsinFrontPage.

CloseMethodUsage Code

CloseanindividualWebWindowExobjectintheapplication

Application.WebWindows(index).Close

or

Application.WebWindows.Close(index)

ClosemultipleWebWindowExobjectsintheapplication(asshowninthepreviousexample)

ForEachmyWebWindowInmyWebWindows

IfmyWebWindow.Caption<>_

myActiveWebWindow.CaptionThen_

myWebWindow.Close

Next

CloseallWebWindowExobjectsintheapplication

Application.WebWindows.Close

Closeanindividual Webs(index).WebWindows(index).Close

WebWindowExobjectinaWebsite

ClosemultipleWebWindowExobjectsinaWebsite

SetmyWeb=Web(index).WebWindows

ForEachmyWebWindowInmyWebWindows

IfmyWebWindow.Caption_

<>myActiveWebWindow.CaptionThen_

myWebWindow.Close

Next

CloseacollectioninaWebsite

Webs(index).WebWindows.Close

ClosingallWebWindowExobjectsinFrontPagefunctionsthesameastheQuitmethod

Theexpression,Application.WebWindows.Closeisthesameas,Application.Quit.

UsetheCountpropertytoreturnthenumberofWebWindowExobjectsinthecollection.ThefollowingexamplereturnsthenumberofWebWindowExobjects.

Web.WebWindows.Count

UsetheParentpropertywhenyouwanttoreturnthecontainerfortheWebWindowscollection.ThefollowingstatementreturnstheApplicationobject.

Application.WebWindows.Parent.Name

ApplicationObjectApplication Multipleobjects

RepresentstheMicrosoftFrontPageapplication.TheApplicationobjectincludespropertiesandmethodsthatreturntop-levelobjects.Forexample,theActiveDocumentpropertyreturnsadocumentobjectthatreferencestheFrontPagePageobjectmodelthatiscompatiblewithMicrosoftInternetExplorer4.0andlater.

UsingtheApplicationObject

UsetheApplicationpropertytoreturntheApplicationobject.YoucanusetheApplicationpropertyfromanyoftheobjectsinFrontPage.ThefollowingexampleaccessestheApplicationobject,andthendisplaystheOpendialogbox.

Application.FileDialog(msoFileDialogOpen).Show

Manyofthepropertiesandmethodsthatreturnthemostcommonuser-interfaceobjects,suchastheActiveDocumentproperty,canbeusedwithouttheApplicationobjectqualifier.Forexample,insteadofwritingApplication.ActiveDocument.Title,youcanwriteActiveDocument.Title.PropertiesandmethodsthatcanbeusedwithouttheApplicationobjectqualifierareconsidered"global."ToviewglobalpropertiesandmethodsintheObjectBrowser,click<globals>atthetopofthelistintheClassesboxoftheObjectBrowser.

Remarks

TouseAutomationtocontrolFrontPagefromanotherapplication,usetheCreateObjectorGetObjectfunctiontoreturnaFrontPageApplicationobject.ThefollowingMicrosoftWordVisualBasicforApplications(VBA)examplestartsFrontPage,opensanexistingWebsite,andclosestheWebsite.

PrivateSubStartFrontPage()

DimmyNewFPAsVariant

SetmyNewFP=CreateObject("FrontPage.Application")

myNewFP.Webs.Open("C:\MyWebs\AdventureWorks")

myNewFP.Webs.Close"(C:\MyWebs\AdventureWorks")

SetmyNewFP=Nothing

EndSub

BasicListObjectBasicList Multipleobjects

ContainsinformationaboutthebasiclisttypeusedwithinMicrosoftFrontPage.TheBasicListobjectallowsuserstoshareandcategorizeinformationbetweenWebsites.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheBasicListobject

UseLists.item(index),whereindexiseitherthenameofthebasiclistoritsnumericpositionwithinthecollection,toreturnasingleBasicListobject.ThefollowingexampledisplaysthenamesofallbasiclistsintheactiveWebsite.IftheWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubListAllLists()

'Displaysthenamesofallbasiclistsinthecollection

DimlstWebListAsList

DimstrNameAsString

DimblnFoundAsBoolean

'Setfoundflagtofalse

blnFound=False

'Checkifanylistsexistand,ifsocyclethroughthem

IfNotActiveWeb.ListsIsNothingThen

ForEachlstWebListInActiveWeb.Lists

IflstWebList.Type=fpListTypeBasicListThen

'Setbooleanflagtofoundandnamestostring

blnFound=True

IfstrName=""Then

strName=lstWebList.Name&vbCr

Else

strName=strName&lstWebList.Name&vbCr

EndIf

EndIf

Next

IfblnFound=TrueThen

'Displaynamesofallbasiclists

MsgBox"ThenamesofallbasiclistsinthecurrentWebare:"_

&vbCr&strName

Else

MsgBox"TherearenobasiclistsinthecurrentWeb."

EndIf

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebcontainsnolists."

EndIf

EndSub

UsetheListscollection'sAddmethodtocreateanewlistoftypefpListTypeBasicList.ThefollowingexamplecreatesanewlistcalledNewShare.

SubNewList()

'AddsanewlisttothecurrentWebsite

DimobjAppAsFrontPage.Application

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Addnewlistanddisplaysamessagetotheuser.

objLists.AddName:="NewShare",_

ListType:=fpListTypeBasicList,_

Description:="ListofSharedfiles"

MsgBox"AnewlistwasaddedtotheListscollection."

EndSub

DiscussionObjectDiscussion Multipleobjects

ContainsinformationaboutaDiscussionlistinaMicrosoftFrontPageWebsite.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftWindowsSharePointServices.

UsingtheDiscussionobject

UsetheItempropertyfortheListscollectiontoreturnasingleDiscussionobject.ThefollowingexampleassumesthefirstlistintheactiveWebsiteisaDiscussionobject,andthenreturnsit.

DimobjDiscussionAsDiscussion

SetobjDiscussion=ActiveWeb.Lists(0)

DocumentLibraryObjectDocumentLibrary Multipleobjects

RepresentsthecollectionofdocumentsinthecurrentWebsite.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheDocumentLibraryobject

UseLists.Item(index),whereindexiseitherthenameofthedocumentlibraryoritsnumericpositionwithinthecollection,toreturnasingleDocumentLibraryobject.ThefollowingexampledisplaysthenamesofalldocumentlibrariesintheactiveWebsite.IftheWebsitecontainsnodocumentlibraries,amessageisdisplayedtotheuser.

SubListAllLibraries()

'Displaysthenamesofalldocumentlibraries

'inthecollection.

DimlstWebListAsList

DimstrNameAsString

DimblnFoundAsBoolean

'Setfoundflagtofalse

blnFound=False

'Checkifanylistsexistandisso,cyclethroughthem

IfNotActiveWeb.ListsIsNothingThen

ForEachlstWebListInActiveWeb.Lists

IflstWebList.Type=fpListTypeDocumentLibraryThen

'Setbooleanflagtofoundandaddnametostring

blnFound=True

IfstrName=""Then

strName=lstWebList.Name&vbCr

Else

strName=strName&lstWebList.Name&vbCr

EndIf

EndIf

Next

IfblnFound=TrueThen

'Displaynamesofalldocumentlibraries

MsgBox"Thenamesofalldocumentlibrariesinthecurrentwebsiteare:"_

&vbCr&strName

Else

MsgBox"Therearenodocumentlibrariesinthecurrentwebsite."

EndIf

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebcontainsnolists."

EndIf

EndSub

UsetheListobject'sAddmethodtocreateanewlistoftypefpListTypeDocumentLibrary.ThefollowingexamplecreatesanewdocumentlibrarycalledNewlibrary.

SubNewLibrary()

'Addsanewlisttothecurrentwebsite

DimobjAppAsFrontPage.Application

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Addnewlist

objLists.AddName:="NewLibrary",_

ListType:=fpListTypeDocumentLibrary,_

Description:="ListofSharedfiles"

'Displaymessagetouser

MsgBox"AnewlibrarywasaddedtotheListscollection."

EndSub

ListObjectMultipleobjects Lists

ListMultipleobjects

ContainsinformationabouttheListobjectandtheMicrosoftFrontPagecollaborationobjects.TheListobjectisabaseclassthatdefinesthecommonmembersusedbythedifferenttypesoflistsinFrontPage.Forexample,thecollaborationobjects,—theBasicList,Discussion,DocumentLibrary,andSurveyobjects—allowinformationtobesharedandexchangedbetweendifferentusersanddifferentwebsites.TheListobjectisamemberoftheListscollection.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListobject

UseLists.Item(index),whereindexiseitherthenameofthelistoritsnumericpositionwithinthecollection,toreturnasingleListobject.ThefollowingexampledisplaysthenamesofalllistsintheactiveWebsite.IftheWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubListAllLists()

'Displaysthenamesofalllistsinthecollection

DimlstWebListAsList

DimstrNameAsString

'Checkifanylistsexist

IfNotActiveWeb.ListsIsNothingThen

'Cyclethroughlists

ForEachlstWebListInActiveWeb.Lists

'addlistnamestostring

IfstrName=""Then

strName=lstWebList.Name&vbCr

Else

strName=strName&lstWebList.Name&vbCr

EndIf

Next

'Displaynamesofalllists

MsgBox"Thenamesofalllistsinthecurrentwebare:"_

&vbCr&strName

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebcontainsnolists."

EndIf

EndSub

Similarly,usetheWebFolderobject'sListpropertytoreturntheListobjectassociatedwiththefolder.

UsetheListobject'sFieldspropertytoreturnacollectionofListFieldobjectsthatdefinethefieldsinthecurrentlist.

ListFieldObjectMultipleobjects ListFields

ListFieldWeb

ContainsinformationaboutthefieldsthatmakeupaListobject.Thefieldsofalistdefinethecolumnsthatappearinthelistandpresentinformationabouttheitemsinthelist.TheListFieldobjectisabaseclassthatdefinesthecommonmembersusedbythedifferenttypesoffieldsinMicrosoftFrontPagelists.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldobject

UseListFields.Item(index),whereindexistheeithernameofthefieldorit'spositionwithinthecollectiontoreturnasingleListFieldobject.Thefollowingexampledisplaysthenamesofallfieldsinthecurrentlist.IftheWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubListAllFields()

'Displaysthenameoffieldsinthecurrentlist

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

IfstrType=""Then

'Createnewstring

strType=objField.Name&vbCr

Else

'Addnextfieldnametostring

strType=strType&objField.Name&vbCr

EndIf

NextobjField

MsgBox"Thenamesofthefieldsinthislistare:"&_

vbCr&strType

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebsitecontainsnolists."

EndIf

EndSub

ListFieldAttachmentsObjectListFieldAttachments Web

ContainsinformationabouttheattachmentsfieldwhenattachmentsareenabledforalistinaMicrosoftFrontPageWebsite.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftWindowsSharePointServices.

UsingtheListFieldAttachmentsobject

UsetheItempropertyfortheListFieldscollectiontoreturnasingleListFieldAttachmentsobject.ThefollowingexamplereturnsthefirstfieldinthethefirstlistintheListscollection.

DimobjListAsBasicList

DimobjFieldAsListFieldAttachments

SetobjList=ActiveWeb.Lists(0)

SetobjField=objList.Fields(0)

ListFieldChoiceObjectListFieldChoice Web

Containsinformationaboutthechoicefield.Thechoicefieldallowstheusertoselectfromaspecifiednumberofoptionsbyprovidingadrop-downlistorradiobuttonsinthelist.

UsingtheListFieldChoiceobject

UseListFields.Item(index),whereindexisthenameorordinalpositionofafieldoftypefpFieldChoicetoreturnasingleListFieldChoiceobject.

UsetheListFields.AddmethodtoaddafieldoftypefpFieldChoicetotheListFieldscollection.ThefollowingexampleaddsanewfieldnamedNewChoiceFieldoftypefpFieldChoice,totheListFieldscollection.UsetheAddChoicemethodtoaddchoicestothelist.Usetheclearmethodtoclearthechoicesfromthelist.

SubDisplayChoice()

'Displaychoice

DimobjAppAsFrontPage.Application

DimobjLstFldsAslistFields

DimobjFldChoiceAsListFieldChoice

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="NewChoiceField"

'AddnewfieldoftypefpFieldChoicetolist

objLstFlds.AddName:=strName,Description:="NewChoicevalueField",_

Fieldtype:=fpFieldChoice,Required:=True

MsgBox"AnewFieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

ListFieldComputedObjectListFieldComputed Web

Containsinformationaboutfieldscreatedautomaticallybythecomputer.TheListFieldComputedobjectcannotbecreatedbytheuserandinsteadisusedbyMicrosoftFrontPagetocreateareferencefromthelisttoapageintheWebsite.Forexample,inmanylists,theTitlefieldiscreatedbythecomputerandisusedtoreferencethepagecorrespondingtothelistfield.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldComputedobject

UseListFields.Item(index)toreturnaListFieldComputedobject,whereindexiseitherthenameofthefieldoritsnumericpositionwithinthecollection.Thefollowingexampledisplaysthenamesofallcomputedfieldsinthecurrentlist.

SubListComputedFields()

'Displaythenamesofcomputedfieldsinthecurrentlist

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

'Checkifitisacomputedfield

IfobjField.Type=fpFieldComputedThen

IfstrType=""Then

'Createnewstring

strType=objField.Name&vbCr

Else

'Addnextfieldnametostring

strType=strType&objField.Name&vbCr

EndIf

EndIf

NextobjField

MsgBox"Thenamesofthefieldsinthislistare:"&_

vbCr&strType

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebsitecontainsnolists."

EndIf

EndSub

ListFieldCounterObjectListFieldCounter Web

Containsinformationaboutthekeycounterusedwithinthelist.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

Remarks

ThisfieldiscreatedautomaticallybyMicrosoftFrontPageandcannotbemodifiedbytheuser.

UsingtheListFieldCounterobject

Thefollowingexampledisplaysthenameassociatedwiththecounterfieldinthecurrentlist.

SubListCounterFields()

'Displaysthenameofcounterfieldsinthecurrentlist

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

DimblnFoundAsBoolean

blnFound=False

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

'CheckifitisacomputedfieldoftypefpFieldFile

IfobjField.Type=fpFieldCounterThen

blnFound=True

IfstrType=""Then

'Createnewstring

strType=objField.Name&vbCr

Else

'Addnextfieldnametostring

strType=strType&objField.Name&vbCr

EndIf

EndIf

NextobjField

IfblnFound=TrueThen

MsgBox"Thenamesofthefieldsinthislistare:"&_

vbCr&strType

Else

MsgBox"Therearenocounterfieldsinthelist."

EndIf

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebsitecontainsnolists."

EndIf

EndSub

ListFieldCurrencyObjectListFieldCurrency Web

Containsinformationaboutthefieldtypeusedtoviewcurrencyinformationwithinthelist.TheListFieldCurrencyobjectallowsyoutoviewinformationaboutdifferentcurrencytypeswithinthecurrencyfieldofthelist.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldCurrencyobject

UseListFields.Item(index),whereindexisthenameorordinalpositionofafieldoftypefpListFieldCurrency,toreturnasingleListFieldCurrencyobject.

UsetheListFields.AddmethodtoaddafieldoftypefpFieldCurrencytotheListFieldscollection.ThefollowingexampleaddsanewfieldnamedNewCurrencyFieldoftypefpFieldCurrencytotheListFieldscollectionandchangesthecurrencytypetodisplayCanadiandollars.

SubCreateCurrencyField()

'AddnewCurrencyfield

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimobjFldChoiceAsListFieldCurrency

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="NewCurrencyField"

'AddnewFieldoftypefpFieldCurrencytolist

objLstFlds.AddName:=strName,Description:="NewCurrencyField",_

Fieldtype:=fpFieldCurrency,Required:=True

SetobjFldChoice=objLstFlds.Item("NewCurrencyField")

'ChangecurrencytypetoCanadian

objFldChoice.Currency=fpCurrencyFieldCanada

MsgBox"AnewFieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

ListFieldDateTimeObjectListFieldDateTime Web

ContainsinformationaboutthefieldusedtodisplaydatesandtimeswithinaMicrosoftFrontPagelist.TheListFieldDateTimeobjectallowsyoutoviewdateandtimeinformationinavarietyofdifferentconfigurationsdependingonthetypeofdatainthelist.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldDateTimeobject

UseListFields.Item(index),whereindexisthenameorordinalpositionofafieldoftypefpListFieldDateTime,toreturnasingleListFieldDateTimeobject.

UsetheListFields.AddmethodtoaddafieldoftypefpListFieldDateTimetotheListFieldscollection.ThefollowingexampleaddsanewfieldnamedNewDateTimeFieldoftypefpListFieldDateTimetotheListFieldscollection.

SubCreateDateTimeField()

'AddnewDate/Timefield

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="NewDateTimeField"

'AddnewFieldoftypefpFieldDateTimetolist

objLstFlds.AddName:=strName,Description:="NewDateTimeField",_

Fieldtype:=fpFieldDateTime,Required:=True

MsgBox"AnewFieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

ListFieldFileObjectListFieldFile Web

Containsinformationaboutanyfilescontainedinthelist.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

Remarks

ThisfieldiscreatedautomaticallybyMicrosoftFrontPageandcannotbemodifiedbytheuser.

UsingtheListFieldFileobject

ThefollowingexampledisplaysthenamesofallfieldsoftypefpFieldFileintheactivelist.Ifnofieldsofthistypeexist,oriftheWebcontainsnolists,amessageisdisplayedtotheuser.

SubListFileFields()

'Displaysthenameoffilefieldsinthecurrentlist

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

DimblnFoundAsBoolean

blnFound=False

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

'CheckifitisacomputedfieldoftypefpFieldFile

IfobjField.Type=fpFieldFileThen

blnFound=True

IfstrType=""Then

'Createnewstring

strType=objField.Name&vbCr

Else

'Addnextfieldnametostring

strType=strType&objField.Name&vbCr

EndIf

EndIf

NextobjField

IfblnFound=TrueThen

MsgBox"Thenamesofthefieldsinthislistare:"&_

vbCr&strType

Else

MsgBox"Therearenofilefieldsinthelist."

EndIf

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebcontainsnolists."

EndIf

EndSub

ListFieldIntegerObjectListFieldInteger Web

Containsinformationaboutfieldscreatedautomaticallybythecomputer.TheListFieldintegerobjectcannotbecreatedbytheuserandinsteadisusedbyMicrosoftFrontPagetocreateanIDforeachiteminthelist.Forexample,inatypicallist,theIDfieldiscreatedbythecomputerasauniqueidentifierforeachiteminthelist.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldIntegerobject

UseListFields.Item(index)toreturnaListFieldIntegerobject,whereindexiseitherthenameofthefieldoritsnumericpositionwithinthecollection.ThefollowingexampledisplaysthenamesofallIntegerfieldsinthecurrentlist.IftheWebsitecontainsnolists,orifthelistcontainsnoIntegerfields,amessageisdisplayedtotheuser.

SubListIntegerFields()

'DisplaysthenameofIntegerfieldsinthecurrentlist

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

DimblnFoundAsBoolean

blnFound=False

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

'CheckifitisacomputedfieldoftypefpFieldInteger

IfobjField.Type=fpFieldIntegerThen

blnFound=True

IfstrType=""Then

'Createnewstring

strType=objField.Name&vbCr

Else

'Addnextfieldnametostring

strType=strType&objField.Name&vbCr

EndIf

EndIf

NextobjField

IfblnFound=TrueThen

MsgBox"Thenamesofthefieldsinthislistare:"&_

vbCr&strType

Else

MsgBox"TherearenoIntegerfieldsinthelist."

EndIf

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

ListFieldLookupObjectListFieldLookup Multipleobjects

ContainsinformationabouttheLookupfield.TheListFieldLookupobjectallowsyoutosearchforinformationwithinthegivenWebsitebasedonaspecifiedfield.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldLookupobject

UseListFields.Item(index),whereindexisthenameorordinalpositionofafieldoftypefpFieldLookup,toreturnasingleListFieldLookupobject.

UsetheListFields.AddmethodtoaddafieldoftypeListFieldLookuptotheListFieldscollection.

ThefollowingexampleaddsanewfieldnamedNewFileLookupFieldoftypefpFieldLookuptotheListFieldscollection.

SubCreateLookup()

'AddnewLookupfield

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimobjFldLookupAsListFieldLookup

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="NewFileLookupField"

'AddnewFieldoftypefpFieldLookuptolist

objLstFlds.AddName:=strName,Description:="NewLookupField",_

Fieldtype:=fpFieldLookup

SetobjFldLookup=objLstFlds.Item("NewFileLookupField")

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

ListFieldMultiLineObjectListFieldMultiLine Web

Containsinformationaboutthefieldusedtodisplayinformationcontainingmorethanonelineoftext.Forexample,theListFieldMultiLineobjectcanbeusedtodisplaydescriptionsandsummaries,whichoftenrequiremorethanasingleline.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldMultiLineobject

UseListFields.Item(index),whereindexisthenameorordinalpositionofafieldoftypefpFieldMultiLine,toreturnasingleListFieldMultiLineobject.

UsetheListFields.AddmethodtoaddafieldoftypefpFieldMultiLinetotheListFieldscollection.

ThefollowingexampleaddsanewfieldnamedDescriptionoftypefpFieldMultiLinetotheListFieldscollection.Thesubroutinedisplaysthenameofthenewfieldaswellasthenumberoflinesitwillcontain.

SubCreateMultiLine()

'AddnewMultiLineField

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimobjLstFldMultiAsListFieldMultiLine

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="Description"

'AddnewFieldoftypefpFieldMultiLinetolist

objLstFlds.AddName:=strName,Description:="DescriptionField",_

Fieldtype:=fpFieldMultiLine

SetobjLstFldMulti=objLstFlds.Item(strName)

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&".Itcontains"&_

objLstFldMulti.NumberOfLines&"lines."

EndSub

ListFieldNumberObjectListFieldNumber Web

ContainsinformationabouthownumbersaredisplayedinMicrosoftFrontPagelistfields.TheListFieldNumberobjectallowsyoutoconfigurethewayinwhichyouviewnumbersinFrontPagelists.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldNumberobject

UseListFields.Item(index),whereindexisthenameorordinalpositionofafieldoftypefpFieldNumber,toreturnasingleListFieldNumberobject.

UsetheListFields.AddmethodtoaddafieldoftypefpFieldNumbertotheListFieldscollection.ThefollowingexampleaddsanewfieldnamedTotaloftypefpFieldNumbertotheListFieldscollection.Thesubroutinedisplaysthenameofthenewfieldandthenameofthelisttowhichitwasadded.

UsetheListFieldNumberobject'sDisplayFormatpropertytochangethewayinwhichthedatawillbedisplayedinthefield.

SubCreateNumberField()

'AddnewMultiLineField

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="Total"

'AddnewFieldoftypefpFieldNumbertolist

objLstFlds.AddName:=strName,Description:="NumericTotalField",_

Fieldtype:=fpFieldNumber

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

ListFieldRatingScaleObjectListFieldRatingScale Web

ContainsinformationabouttheratingscalelistfieldforalistinaMicrosoftFrontPageWebsite.TheListFeldRatingScaleobjectisonlyavailableforsurveylists.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftWindowsSharePointServices.

UsingtheListFieldRatingScaleObject

UsetheItempropertyfortheListFieldscollectiontoreturnasingleListFieldRatingScaleobject.ThefollowingexamplereturnsthefirstfieldinthefirstlistintheListscollection.ThisexampleassumesthatthefirstlistintheactiveWebisaWebsurveylist.

DimobjListAsBasicList

DimobjFieldAsListFieldRatingScale

SetobjList=ActiveWeb.Lists(0)

SetobjField=objList.Fields(0)

ListFieldsCollectionMultipleobjects ListFields

RepresentsacollectionofListFieldobjectsthatdefinethetextfieldsusedwithinMicrosoftFrontPagelists.TheListFieldobjectisabaseclassthatdefinesthecommonmembersusedbythedifferenttypesoffieldsinFrontPage.Forexample,theListFieldCurrencyandListFieldNumberobjectsallowyoutocustomizethewayinwhichcurrencyandnumericinformationisdisplayed.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldscollection

UseFields.Item(index),whereindexiseitherthenameofthelistoritspositionwithinthecollection,toreturnasingleListFieldobject.ThefollowingexampledisplaysthenamesofallfieldsinthefirstlistoftheactiveWebsite.IftheWebsitecontainsnolists,amessageisdisplayedtotheuser.

UsetheAddmethodtoaddanewListFieldobjecttotheListFieldscollection.

SubListFields()

'Displaythenamesoffieldsinthecurrentlist

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

IfstrType=""Then

'Createnewstring

strType=objField.Name&vbCr

Else

'Addnextfieldnametostring

strType=strType&objField.Name&vbCr

EndIf

NextobjField

MsgBox"Thenamesofthefieldsinthislistare:"&_

vbCr&strType

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebcontainsnolists."

EndIf

EndSub

ListFieldSingleLineObjectListFieldSingleLine Web

Containsinformationaboutthesinglelinefield.ThefpFieldSingleLineobjectisusedtodisplayinformationthattypicallyrequiresnomorethanasinglelineoftext.Forexample,theNameandTitlefieldstypicallyusetheListFieldSingleLineobjecttodisplayinformation.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldSingleLineobject

ThefollowingexamplecreatesanewfieldoftypeListFieldSingleLinenamedAlternativeName.Thesubroutinedisplaysthenameofthenewfieldandthenameofthelisttowhichitwasadded.

SubCreateSingleLineField()

'AddnewSingleLineField

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="AlternativeName"

'AddnewFieldoftypefpFieldSingleLinetolist

objLstFlds.AddName:=strName,Description:="NumericTotalField",_

Fieldtype:=fpFieldSingleLine

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

ListFieldTrueFalseObjectListFieldTrueFalse Web

ContainsinformationabouttheBooleanfieldinaMicrosoftFrontPagelist.TheListFieldTrueFalseobjectallowsyoutoprovidetheuserwithasimple,binaryuser-interfaceoption.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldTrueFalseobject

ThefollowingexamplecreatesanewfieldoftypefpFieldTrueFalsenamedDefaultPage.Thesubroutinedisplaysthenameofthenewfieldandthenameofthelisttowhichitwasadded.

SubCreateTrueFalseField()

'AddnewTrueFalsefield

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="DefaultPage"

'AddnewFieldoftypefpFieldTrueFalsetolist

objLstFlds.AddName:=strName,Description:="Determinesifthisis"&_

"defaultpage",Fieldtype:=fpFieldTrueFalse

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

ListFieldURLObjectListFieldURL Web

ContainsinformationabouttheMicrosoftFrontPagefieldusedtodisplayURLs.TheListFieldURLobjectallowsyoutocustomizethewayURLsappearinthelistfields.TheURLcanbedisplayedasanimageorasalink.UsetheDisplayFormatpropertytochangetheviewsettings.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheListFieldURLobject

UseListFields.Item(index),whereindexisthenameorordinalpositionofafieldoftypefpFieldURL,toreturnasingleListFieldURLobject.

ThefollowingexamplecreatesanewfieldoftypefpFieldURLanddisplaysthenameofthenewfieldandthenameofthelistintowhichitwasinserted.

SubCreateURLField()

'AddnewURLfield

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="Location"

'AddnewFieldoftypefpFieldURLtolist

objLstFlds.AddName:=strName,Description:="Displaysfilelocations",_

Fieldtype:=fpFieldURL

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

NavigationNodeObjectMultipleobjects NavigationNode

Multipleobjects

RepresentsanodeinthenavigationalstructureofaWebsite.TheNavigationNodeobjectisamemberoftheNavigationNodescollection.WithintheNavigationNodescollection,individualNavigationNodeobjectsareindexedbeginningwithzero.

ImportantFromtheNavigationNodeobject,youcanaccessallothernavigationnodesinaWebsite.TheRootNavigationNodeobject,createdbydefaulteachtimeyoucreateanewWebsite,providesthebasisforthenavigationstructure,whichisaccessedthroughtheChildrenproperty.ThefirstchildnodeofthenavigationstructureisusuallythehomepageoftheWebsite,whichcanbeaccessedthroughtheHomeNavigationNodeproperty.However,thefirstchildnodeoftherootnavigationnodecanbeanypage,andmaynotcontainaHomeNavigationNodeobjectatall.

UsingtheNavigationNodeobject

YoucanusetheNavigationNodepropertytoreturntheNavigationNodeobject.ThefollowingexamplebuildsalistofnavigationnodelabelsfortheWebFileobjectoftheWebFilescollection.

PrivateSubGetNavigationNode()

DimmyWebAsWebEx

DimmyWebFilesAsWebFiles

DimmyWebFileAsWebFile

DimmyNavNodeLabelAsString

DimmyLabelAsString

OnErrorResumeNext

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyFiles

ForEachmyFileInmyFiles

myLabel=myFile.NavigationNode.Label

IfErr<>0ThenExitSub

myNavNodeLabel=myNavNodeLabel&myLabel&vbCRLF

Next

EndWith

EndSub

TheChildrenpropertyreturnsthecollectionofchildnodeswithinthenavigationstructureofaWebsite.ThefollowingstatementreturnsthenumberofchildnodeswithinthenavigationstructureoftheactiveWebsite.

myNavChildrenCount_

=ActiveWeb.RootFolder.Files(0).NavigationNode.Children.Count

UseChildren(index),whereindexistheindexnumberofanavigationnodeitem,toreturnasingleNavigationNodeobject.ThefollowingstatementreturnsthefilenameofthefirstnavigationnodeintheNavigationNodescollection.

myNavNodeName_

=ActiveWeb.RootFolder.Files(0).NavigationNode.Children(0).File.Name

TheFilepropertyreturnstheFileobjectthatisassociatedwiththeNavigationNodeobject.ThefollowingstatementreturnsTrueifthefileisopen.

myNavFile=ActiveWeb.RootFolder.Files(3).NavigationNode.File.IsOpen

TheHomepropertyreturnstheHomeobjectassociatedwiththecurrentnavigationnodeandreferencesinformationsuchastheChildren,File,Label,Next,Prev,andotherpropertiesforthehomepage.ThefollowingstatementreturnstheURLoftheHomepropertyfortheNavigationNodeobject.

myHomePageUrl_

=ActiveWeb.RootFolder.Files(5).NavigationNode.Home.Url

YoucanreturntheLabelpropertytosetorreturntextthatcanbeusedasbuttonswithinthenavigationstructure,orusedfortextinalinkbar.Thefollowingexamplereturnsthelabelforthehomepage.

myLabel=ActiveWeb.RootFolder.Files(0).NavigationNode.Label

UsetheNext,Parent,Prev,orUrlpropertiestoreturnnavigationnodesassociatedwiththespecifiedproperty.ThefollowingexamplereturnstheURLthatisassociatedwiththepreviousNavigationNodeobject.

myPrevNode=ActiveWeb.RootFolder.Files(1).NavigationNode.Prev.Url

UsetheWebpropertytoreturntheWebExobjectassociatedwiththecurrentnavigationnode.ThefollowingexamplereturnstheWebExobjectforthecurrentnavigationnode.

myNavNodeWeb=_

ActiveWeb.RootFolder.Files(2).NavigationNode.Web.Url

UsetheMovemethodtomoveanavigationnodefromonechildnodetoanother.ThefollowingexamplemovesanavigationnodetoachildlocationonasiblingnodeinthesameWebsite.

PrivateSubMoveNavNode()

DimmyNodesAsNavigationNodes

DimmyNodeAsNavigationNode

SetmyNodes=ActiveWeb.RootNavigationNode.Children

SetmyNode=myNodes(4)

myNode.MovemyNodes,myNodes(2)

ActiveWeb.ApplyNavigationStructure

EndSub

PageWindowExObjectPageWindowEx Multipleobjects

RepresentsanopeneditorsessionandencapsulatestheMicrosoftFrontPagePageobjectmodelthatiscompatiblewiththeDocumentobjectmodelforMicrosoftInternetExplorer4.0andlater.ThePageWindowExobjectisamemberofthePageWindowscollectionandrepresentsalloftheopenpagewindowsinthespecifiedWebsite.WithinthePageWindowscollection,individualPageWindowExobjectsareindexedbeginningwithzero.

NoteYoucanalsosubstitutetheCaptionpropertyofthePageWindowobjectinsteadoftheindexnumberwhenaccessingaPageWindowExobject.ThisonlyworkswhenthePageWindowExobjecthasalreadybeensaved.ThefollowingstatementsreturnthePageWindowExobjectforanopenpagewindowthathasacaptionof"C:\MyWebSites\CohoWinery\Zinfandel.htm").

SetobjPageWindow=ActiveWebWindow.PageWindow("Zinfandel.htm")

SetobjPageWindow=WebWindows(0).PageWindow("Zinfandel.htm")

UsingthePageWindowobject

UsePageWindows(index),whereindexistheindexnumberofapagewindowitem,toreturnasinglePageWindowExobject.ThefollowingstatementreturnsthefileURLofthefirstpagewindowiteminthePageWindowscollection.

PgePageOne=WebWindows(0).PageWindows(0).Document.Url

UsetheActiveFrameWindowpropertytoreturntheactiveframeofaPageWindowExobject.ThefollowingstatementreturnstheActiveFrameWindowobject.

NoteTheactiveframeistheframethatcurrentlyhasthefocus;itisshowninFrontPagewithabluebordersurroundingit.

SetobjActiveFrame_

=WebWindows(1).ActivePageWindow.ActiveFrameWindow

UsetheFrameWindowpropertytoreturnanFPHTMLWindow2object,whichcanthenbeusedtoreturntheframescollectionandthecontentofeachoftheframescollectionpages.

objFrameWindow=WebWindows(0).ActivePageWindow.FrameWindow

UsetheDocumentpropertytoreturnthedocumentassociatedwiththePageWindowExobject.ThefollowingstatementreturnsthedocumentassociatedwiththefirstPageWindowExobjectofthefirstWebWindowExobject.

SetobjDoc=WebWindows(0).PageWindows(0).Document

YoucanusetheIsDirtypropertytodetermineifthePageWindowExobjectisdirty—thatis,ifithasbeenmodifiedsincethelastrefreshorsave.TheisDirtypropertyreturnsTrueifthePageWindowExobjectisdirty.ThefollowingexamplesavesthePageWindowExobjectifthefirstiteminthePageWindowscollectionisdirty.

PrivateSubCheckPageWindowIsDirty()

DimobjPageWinAsPageWindowEx

SetobjPageWin=WebWindows(0).PageWindows(0)

IfobjPageWin.IsDirty=TrueThen

objPageWin.Save

EndIf

EndSub

YoucanusetheViewModepropertytosettheviewforthepageasshowninthefollowingstatement.Formoreinformationontheenumeratedconstantsavailableforthisproperty,seethetableundertheViewModeproperty.

WebWindows(1).PageWindows(1).ViewMode=fpPageViewHtml

SurveyObjectSurvey Multipleobjects

ContainsinformationabouttheMicrosoftFrontPageSurveyobjectthatallowsuserstovoteonissuesandshareinformation.

ThisobjectissupportedonlybyWebpagesorsitesthatarebasedonMicrosoftSharePointServices.

UsingtheSurveyobject

UseLists.Item(index),whereindexisisthenameorordinalpositionofaListobjectoftypefpListTypeSurvey,toreturnasingleSurveyobject.

ThefollowingexampleliststhenamesofallsurveysintheactiveWebsite.IftheWebsitecontainsnosurveysortheWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubListAllSurveys()

'Displaysthenamesofallsurveyobjectsinthecollection

DimlstWebListAsList

DimstrNameAsString

DimblnFoundAsBoolean

'Setfoundflagtofalse

blnFound=False

'Checkifanylistsexist

IfNotActiveWeb.ListsIsNothingThen

'Cyclethroughlists

ForEachlstWebListInActiveWeb.Lists

IflstWebList.Type=fpListTypeSurveyThen

'Setboolenflagtofound

blnFound=True

'addlistnamestostring

IfstrName=""Then

strName=lstWebList.Name&vbCr

Else

strName=strName&lstWebList.Name&vbCr

EndIf

EndIf

Next

IfblnFound=TrueThen

'Displaynamesofallsurveyobjects

MsgBox"ThenamesofallsurveyobjectsinthecurrentWebsiteare:"_

&vbCr&strName

Else

MsgBox"TherearenosurveyobjectsinthecurrentWebsite."

EndIf

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

UsetheListscollection'sAddmethodtocreateanewlistoftypefpListTypeSurvey.ThefollowingexamplecreatesanewsurveycalledNewSurvey.

SubNewSurvey()

'AddsanewSurveytothecurrentWebsite

DimobjAppAsFrontPage.Application

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Addnewsurvey

objLists.AddName:="NewSurvey",_

ListType:=fpListTypeSurvey,_

Description:="NewSurvey"

'Displaymessagetouser

MsgBox"AnewsurveywasaddedtotheListscollection."

EndSub

SystemObjectApplication System

Providesaccesstosysteminformationsuchastheoperatingsystem,screenresolution,orregistry.

UsingtheSystemObject

UsetheSystempropertytoreturntheSystemobject.Thefollowingstatementreturnsthenameofthecallingapplication.

mySysApp=System.Application.Name

UsetheBuildandVersionpropertiestoreturnbuildandversioninformationabouttheoperatingsystem.

myVer=System.Version

myBld=System.Build

Thehorizontalandverticalresolutioncanbeusedtodetermineifagraphiccanbedisplayedonaclient’smachine.Thefollowingstatementsreturntheresolutionsettings.

currHorizRes=System.HorizontalResolution

currVertRes=System.Vertical.Resolution

UsetheOperatingSystempropertytoreturnthenameofthecurrentoperatingsystem,asshowninthefollowingstatement.

thisOps=System.OperatingSystem

UsetheParentpropertytoreturntheparentofthespecifiedobject.ThefollowingstatementreturnsparentinformationfortheSystemobject.

PrivateSubGetSystemParentInfo()

DimmySysAsSystem

DimmySysUserNameAsString

SetmySys=System

WithmySys

mySysUserName=.Parent.UserName

EndWith

EndSub

UsetheLanguageDesignationpropertytoreturnathree-letterabbreviationforthelanguageusedfortheoperatingsystem.Thefollowingstatementreturns"enu"asthelanguagedesignationabbreviationfortheEnglish(US)language.

currSystemLanguage=System.LanguageDesignation

UsetheProfileStringpropertytoreturnorsetanentryintheWindowsregistry.Ifusedwithoutparameters,theProfileStringpropertydefaultstothefollowingkey:

HKEY_CURRENT_USERS\Software\Microsoft\FrontPage

TheparametersfortheProfileStringpropertyare:

RegistrySection,whereRegistrySectionisaregistrysubtreesuchasHKEY_CURRENT_USERorHKEY_LOCAL_MACHINE.RegistryKey,whereRegistryKeyisthenextlevelbelowthesectionorsubtreewithsuchkeynamesasSoftwareorNetwork.

ThefollowingexamplereturnstheIdentifierfortheCentralProcessorsubkey.

PrivateSubGetProfileString()

DimmySysAsSystem

DimmyRegSecAsString

DimmyRegKeyInfoAsString

SetmySys=System

myRegSec=_

"HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0"

myRegKeyInfo=mySys.ProfileString(myRegSec,"Identifier")

EndSub

ThemeObjectMultipleobjects Themes

Theme

RepresentsathemeinMicrosoftFrontPage.TheThemeobjectisamemberoftheThemescollection.TheThemescollectionrepresentsallthethemesonthelocalmachineorallthemesappliedtoaspecificWebsite.WithintheThemescollection,individualThemeobjectsareindexedbeginningwithzero.

UsingtheThemeobject

UsetheFormatpropertytoreturnformatinformationforatheme.ThefollowingstatementreturnstheformatforthefirstthemeappliedtotheactiveWebsite.

myThemeFormat=ActiveWeb.Themes(1).Format

UsetheLabelpropertytoreturnthenamethatisdisplayedintheThemelistbox.Thisisthefullnameofthetheme.Thefollowingstatementreturnsthelabelforthetheme.

myThemeLbl=ActiveWeb.Themes(1).Label

UsetheNamepropertytoreturnorapplyathemetoaWebpage.TheNamepropertycontainsthedirectorynameforthetheme,whichisanabbreviatedversionofthenameofthethemeasdisplayedintheThemelistbox.Thefollowingexampleliststhenamesofallthemesinthethemescollectioninthebodyoftheactivedocument.

NoteTorunthisexample,youmusthaveaWebsiteopenthathasathemeappliedtotheactivepage,theentireWebsite,oraspecificfileintheWebsite.

SubListThemes()

DimobjThemeAsTheme

ForEachobjThemeInApplication.Themes

ActiveDocument.body.insertAdjacentText"beforeend",objTheme.Name

Next

EndSub

UsetheVersionpropertytoreturntheversionnumberofthetheme.Thefollowingexamplereturnstheversionforatheme.

myThemeVersion=Theme.Version

WebExObjectMultipleobjects Web

Multipleobjects

RepresentsaMicrosoftFrontPageWebsite.TheWebExobjectisamemberoftheWebscollection,whichrepresentsalloftheopenWebsitesinFrontPage.FrontPageprovidestheabilitytocreatemultipleWebExobjectsonaWebserver.WithintheWebscollection,individualWebExobjectsareindexedbeginningwithzero.ThedirectoryhierarchyofaWebsiteinFrontPageissimilartoafolderhierarchy.AnyWebFoldercanrepresentaWebsite,buteveryWebFolderdoesnotnecessarilyrepresentaWebsite.TheWebfolderhierarchyprovidesthelinktofoldersandfilesonaWebserverdirectory.

UsingtheWebobjectproperties

UsetheWebpropertytoreturntheWebExobject.ThefollowingexamplecheckstheWebsite’soperatingsystemforthecapabilityofprocessinglongfilenames.

NoteTorunthisexample,createaformwithacommandbuttoncalledcmdCheckLongFilenames,atextboxcalledtxtLongFilenames,andcopytheexampleintothecodewindow.

PrivateSubcmdCheckLongFilenames()

DimobjPageWinAsPageWindow

SetobjPageWin=ActivePageWindow

WithobjPageWin

If.Web.AllowsLongFilenames=TrueThen

txtlongFilenames=_

"Thisoperatingsystemuseslongfilenames."

ExitSub

Else

txtlongFilenames=_

"Thisoperatingsystemonlyusesshortfilenames."

EndIf

EndWith

EndSub

UseWebs(index),whereindexistheordinalpositionofaWebsiteintheWebscollection,toreturnasingleWebExobject.ThefollowingexamplereturnstheURLofthefirstWebsiteintheWebscollection.

Application.Webs(0).Url

UsetheActiveWebWindowpropertytoreturntheselectedWebWindowExobject.FromtheWebWindowExobject,youcanaccesstheActiveDocument,ActivePageWindow,orApplicationproperties,alongwithpropertiessuchasCaption,PageWindows,Parent,ViewMode,Visible,andWeb.Thefollowingexamplereturnsthecreationdateandfilesizeoftheactivedocument.

NoteAlthoughDateisanavailabletypeinMicrosoftVisualBasicforApplications(VBA),theWebWindowExobjectreturnsthedateinstringformatanddoesnotautomaticallyconvertthestringtoadateformat.

PrivateSubActiveDocDateSize()

DimobjWebWindowAsWebWindowEx

DimstrFileSizeAsString

DimstrCreateDateAsString

SetobjWebWindow=ActiveWebWindow

WithobjWebWindow

strFileSize=.ActiveDocument.fileSize

strCreateDate=.ActiveDocument.fileCreatedDate

EndWith

EndSub

TheRevisionControlProjectandIsUnderRevisionControlpropertiesreturnthestatusoftheWebExobject’srevisionstate.YoucancontrolversioninginMicrosoftFrontPagethroughMicrosoftVisualSourceSafeorthroughMicrosoftOffice-stylelocking.FormoreinformationonsourcecontrolprojectsandOffice-stylelocking,seeManagingSourceControl.

IfarevisioncontrolprojectdoesnotcorrespondtoavalidVisualSourceSafeproject,FrontPagedefaultstoOffice-stylelocking.ThefollowingexamplereturnstheRevisionControlProjectandIsUnderRevisionControlproperties,andincludesasourcecontrolprojectexample.

NoteTorunthisexample,createamoduleandcopytheexampleintothecodewindow.YoumusthaveaWebsiteopen.

PrivateSubSourceControl()

DimobjWebAsWebEx

SetobjWeb=ActiveWeb

IfNot(objWeb.IsUnderRevisionControl)Then

objWeb.RevisionControlProject="<FrontPage-basedLocking>"

EndIf

EndSub

PrivateSubReturnRevisionState()

DimobjWebAsWebEx

DimstrRevCtrlProjAsString

DimblnIsUnderRevCtrlAsBoolean

SetobjWeb=ActiveWeb

WithobjWeb

RevCtrlProj=.RevisionControlProject

blnIsUnderRevCtrl=.IsUnderRevisionControl

EndWith

EndSub

UsetheRootFolderandRootNavigationNodepropertiestodeterminetherootfolderorrootnavigationnode.TheRootFolderpropertyreturnsapointertotherootfolderofaWebsite.TheRootNavigationNodepropertyreturnstheNavigationNodeobjectfromwhichyoucanaccessallothernavigationnodesinaWebsite.TheRootNavigationNodeobjectiscreatedbydefaultwhenyoucreateaWebsite,andprovidesthebasisforthenavigationstructure,whichisaccessedthroughtheChildrenproperty.ThefirstchildnodeofthenavigationstructureisthehomepageoftheWebsite.ThefollowingexamplereturnsthenameoftherootfolderandtheURLoftheRootNavigationNodeobject.

PrivateSubGetRootInfo()

DimobjWebAsWebEx

DimstrRootFolderAsString

DimstrHomeNavNodeAsString

SetobjWeb=ActiveWeb

WithobjWeb

strRootFolder=.RootFolder.Name

strHomeNavNode=.RootNavigationNode.Children(0).Url

EndWith

EndSub

UsetheSharedBorderspropertytosetthesharedbordersforaWebsiteeitheronoroff.ThefollowingstatementsetstheSharedBorderspropertytoTrueandturnssharedbordersonforthespecifiedWebsite.

ActiveWeb.SharedBorders(fpBorderTop)=True

UsetheWebWindowspropertytoreturnthecollectionofWebWindowobjectsthatarecontainedwithinthecurrentWebExobject.ThefollowingstatementreturnsacountoftheWebWindowscollection.

Application.WebWindows.Count

UsingtheWebobjectmethods

UsetheActivatemethodtoplacethefocusonthecurrentobject.ThefollowingstatementscheckifmyAdventureWorksWebistheactiveWebsite;ifitisnot,thenmyAdventureWorksWebisactivated.

IfActiveWeb<>myAdventureWorksWebThen

objAdventureWorksWeb.Activate

EndIf

UsetheApplyNavigationStructuremethodtoapplyanewlycreatedormodifiednavigationstructuretoaWebsite.ThefollowingstatementappliesanavigationstructuretoaWebsite,wherethevariablefortheAdventureWorksWebsiteiswebAdventureWorksWeb.

myAdventureWorksWeb.ApplyNavigationStructure

UsetheCancelRequestsmethodtocancelallserverrequests.ThefollowingstatementcancelsallserverrequestsfortheAdventureWorksWebsite,withwebAdventureWorksWebastheWebobjectvariable.

NoteTheclientwillstopallrequeststotheserver;however,theservermayhavealreadystartedatransaction,inwhichcaseitwillcontinueuntilthetransactionisfinishedandthentheremainingrequests(ifany)willbecancelled.

myAdventureWorksWeb.CancelRequests

UsetheLocateFileorLocateFoldermethodstoreturnaWebFileoraWebFolderobjectwithinaWebsite.Thefollowingexamplelocatesafolderforadisk-basedWebsite.

Application.Web.LocateFolder("C:\MyWebSites\AdventureWorks\images")

UsethePublishmethodtopublishaWebsitetoaWebserver.ThefollowingstatementpublishestheAdventureWorksWebsitetoaPersonalWebServersite.

DimobjWebAsWebEx

SetobjWeb=Application.Web

WithobjWeb

.Publish_

"http://myServer/wwwroot",fpPublishAddToExistingWeb

TheFpWebPublishFlagsenumeratedtypescanbeconcatenatedasshowninthefollowingstatement.

myWeb.Publish_

"http://myServer/wwwroot",fpPublishAddToExistingWeb+_

fpPublishCopySubwebs

WebFileObjectMultipleobjects WebFile

Multipleobjects

RepresentsafileinaMicrosoftFrontPage-basedWebsite.TheWebFileobjectisamemberoftheWebFilescollection.TheWebFilescollectionrepresentsallofthefilesinaspecifiedWebFolderobject.WithintheWebFilescollection,individualWebFileobjectsareindexedbeginningwithzero.TheWebFileobjectissimilartoafileinadirectory-basedhierarchy.FrontPageprovidestheabilitytocreatemultipleWebobjectsonaWebserver.AnyWebFoldercanrepresentaWebsite,buteveryWebFolderdoesnotnecessarilyrepresentaWebsite.

UsingtheFileobject

UseWebFiles(index),whereindexistheordinalnumberofaWebpage,toreturnasingleWebFileobject.ThefollowingexamplereturnsthefilenameofthefirstWebpageintheWebFilescollection.

ActiveWeb.RootFolder.Files(0).Name

UsetheFileobjecttoreturninformationaboutafileonaWebsite.ThefollowingexamplereturnstheName,Title,andUrlpropertiesofeachFileobjectontheactiveWebsite.

NoteTorunthisprogram,youmusthavealeastoneWebsiteopen.

PrivateSubGetWebFileInfo()

DimmyWebAsWebEx

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyFileNameAsString

DimmyTitleAsString

DimmyUrlAsString

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyWeb

ForEachmyFileInmyFiles

myFileName=myFile.Name

myTitle=myFile.Title

myUrl=myFile.Url

Next

EndWith

EndSub

UsetheIsOpenpropertytocheckifafileiscurrentlyopeninPageview.ThefollowingexamplereturnstheIsOpenpropertyforaspecifiedFileobject.NoticethattheEditmethodisusedtoopenthefileinthisexample.Formoreinformationonusingthesemethods,seetheEditmethod.

NoteYoumusthaveaWebsiteopentorunthisprogram.

PrivateSubCheckForOpenFile()

DimmyWebAsWebEx

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyFileToOpenAsString

DimmyMessageAsString

DimmyFileNameAsString

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

myFileToOpen="index.htm"

myMessage="Thisfileiscurrentlyopen."

WithmyWeb

ForEachmyFileInmyFiles

myFileName=myFile.Name

IfmyFileName=myFileToOpenThen

IfmyFile.IsOpen=TrueThen

MsgBox(myMessage)

ExitSub

Else

myFile.EditfpPageViewNormal

ExitSub

EndIf

EndIf

Next

EndWith

EndSub

UsetheCheckin,Checkout,andUndoCheckoutmethodstomanagefileresourcesthroughsourcecontrolonaWebsite.ThefollowingstatementchecksoutthefirstfileintheactiveWebsite.

NoteYoumusthaveasourcecontrolprojectsetupinorderforthistowork.

myFileCheckedOut=ActiveWeb.RootFolder.Files(1).Checkout

SimilartofilemanagementfeaturesinMicrosoftVisualSourceSafe,FrontPagealsoprovidesanUndoCheckoutmethodthatyoucanusetoreturnafiletoitsoriginalstate.Thefollowingstatementreturnsthefiletoitsoriginalstate.

myFileCheckedOut=ActiveWeb.RootFolder.Files(1).UndoCheckout

YoucanusetheCheckedoutBypropertybeforeattemptingtocheckoutafiletoseeifthefileiscurrentlycheckedoutandbywhom.Thefollowingstatementreturnsthelogonaliasofthepersonwhocheckedoutafileorisnullifthefileisn'tcurrentlycheckedout.

myWhoCheckedOutFile=ActiveWeb.RootFolder.Files(0).CheckedoutBy

UsethePropertiespropertytoreturninformationaboutaWebsite,suchasthetypeofWebserver(vti_webservertype)oriftheWebsitehasasearchbot(vti_hassearchbot).ThePropertiespropertyreturnsacollectionofkey-valuepairsusedtomaintainthemetainformation.ThefollowingstatementreturnsTrueforthevariablemySearchBotiftheWebsitehasasearchbot.

mySearchBot=ActiveWeb.Properties.Item("vti_hassearchbot")

UsetheMetaTagspropertytoreturninformationaboutthemetatagscontainedintheHTMLcodingofafile.TheMetaTagspropertyreturnsacollectionofmetatagsforaFileobject,suchasthegeneratorofthefile.ThefollowingexamplereturnsthefilenameandmetatagsforeachfileinaWebsite.

NoteTorunthisprogram,youmusthavealeastoneWebsiteopen.

PrivateSubGetMetaTags()

DimmyWebAsWebEx

DimmyMetaTagAsVariant

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyMetaTagsAsMetaTags

DimmyFileNameAsString

DimmyMetaTagNameAsString

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyWeb

ForEachmyFileInmyFiles

SetmyMetaTags=myFile.MetaTags

ForEachmyMetaTagInmyMetaTags

myFileName=myFile.Name

myMetaTagName=myMetaTag

Next

Next

EndWith

EndSub

UsetheSharedBorderspropertytoreturnthesharedbordersonthecurrentWebpageortosetnewsharedborders.ThefollowingstatementreturnsthetopsharedborderofthefirstfileintheFilescollectionoftheactiveWebsite.

myTopBorder_

=ActiveWeb.RootFolder.Files(0).SharedBorders(fpBorderTop)

YoucanalsosetsharedbordersonaWebpage,asshowninthefollowingstatement.

ActiveWeb.RootFolder.Files(0).SharedBorders(fpBorderTop)=True

UsetheThemePropertiespropertytoreturninformationaboutwhetherthethemeusesvividcolorsoractivegraphics.Thefollowingexamplereturnsthepropertiesofanappliedthemeandaddsvividcolorstothecurrentthemepropertiesifvividcolorshaven'tbeenappliedtothespecifiedobject.

PrivateSubCheckThemeProperties()

DimmyFileAsWebFile

SetmyFile=ActiveWeb.RootFolder.Files(0)

IfmyFile.ThemeProperties(fpThemeActiveGraphics)Then

myFile.ApplyThememyFile.ThemeProperties(fpThemeName),myFile.ThemeProperties(fpThemePropertiesAll)

Else

myFile.ApplyThememyFile.ThemeProperties(fpThemeName),myFile.ThemeProperties(fpThemePropertiesAll)+fpThemeActiveGraphics+fpThemeVividColors

EndIf

EndSub

UsingFilemethods

UsetheCopy,Delete,Edit,Move,orOpenmethodstomanageyourWebpages.There'sasubtledistinctionbetweentheEditandOpenmethods.WiththeEditmethod,youcanopenandmodifyaFrontPage-compatiblefileintoaPageWindowobject.WiththeOpenmethod,youcanopenbothFrontPage-compatiblefilesandanyothertypeoffilesuchasimageortextfiles,intothefile'sassociatededitor.WhenyouusetheOpenmethodtoopenafiletypethatisnotFrontPage-compatible,FrontPagedoesnotreturnafileobject.Thefollowingexampleopensafile,deletesafile,andmovesafile.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebsSites\CohoWinery".

PrivateSubOpenFile()

DimmyWebAsWebEx

DimmyFileAsWebFile

SetmyWeb=Webs.Open("C:\MyDocuments\MyWebsSites\CohoWinery")

myWeb.Activate

SetmyFile=myWeb.RootFolder.Files("index.htm")

myFile.Open

EndSub

PrivateSubDeleteFile()

DimmyWebAsWebEx

DimmyFileAsWebFile

SetmyWeb=ActiveWeb

SetmyFile=myWeb.RootFolder.Files(0)

myFile.Delete

EndSub

SubMoveFile()

DimmyWebAsWebEx

DimmyFileAsWebFile

SetmyWeb=ActiveWeb

SetmyFile=myWeb.RootFolder.Files(0)

myFile.Move"NewFilename",True,True

EndSub

WebFolderObjectMultipleobjects WebFolder

Multipleobjects

RepresentsafolderinaMicrosoftFrontPage-basedWebsite.TheWebFolderobjectisamemberoftheWebFolderscollection.

NoteTheFolderobjectisapointertotheWebFolderobject.

TheWebFolderscollectionrepresentsallofthefoldersinaspecifiedWebsite.WithintheWebFolderscollection,individualWebFolderobjectsareindexedbeginningwithzero.TheWebFolderobjectissimilartoafolderinadirectory-basedhierarchy;however,therelationshipbetweenWebFolderobjectsandWebobjectsisunique.FrontPageprovidestheabilitytocreatemultipleWebExobjectsonaWebserver.AnyWebFoldercanrepresentaWebsite,buteveryWebFolderdoesnotnecessarilyrepresentaWebsite.ThefolderhierarchyprovidesthelinktofoldersandfilesonaWebserverdirectory.ThenavigationstructureprovidestheunderlyingstructurefortheWebobjectswithinindividualFrontPage-basedWebsites.

UsingtheWebFolderobject

UseWebFolders(index),whereindexisthepropertykeyofafolder,toreturnasingleWebFolderobject.ThefollowingexamplereturnsthefilenameofthefirstfolderitemintheWebFolderscollection.

ActiveDocument.WebFolders(0).Name

UsethecollectionpropertiessuchasFiles,Folders,orProperties,toreturnthecollectionobjectforthespecifieditem.ThefollowingstatementsreturnthefirstspecifiediteminthecollectionfortheactiveWebsite.

myFileOne=ActiveWeb.RootFolder.Files(0)

myFolderOne=ActiveWeb.RootFolder.Folders(0)

myPropertyOne=ActiveWeb.Properties("vti_author")

UsesuchpropertiesasIsExecutable,IsReadable,IsRoot,andsoon,tocheckforthespecifiedstateofthefolder.IfyouhaveCGIscriptsthatyou'dliketoexecute,youcanaddthescriptstoafolderandsettheIsExecutablepropertyofthatfoldertoTrue.Whenyouhavecontentinafolderthatyou'dlikeotherstobrowse,youcansettheIsReadablepropertytoTrue.Ifyouwanttocheckwhetherthecurrentfolderistherootfolder,youcanusetheIsRootproperty.ThefollowingexamplechecksiffilesinthecurrentWebFolderobjectareexecutable,read-only,orlocatedinarootfolder.

PrivateSubGetFolderInfo()

DimmyWebAsWebEx

DimmyFolderAsWebFolder

DimmyIsExeAsBoolean

DimmyIsReadableAsBoolean

DimmyIsRootAsBoolean

SetmyWeb=ActiveWeb

SetmyFolder=myWeb.RootFolder.Folders(1)

WithmyFolder

myIsExe=.IsExecutable

myIsReadable=.IsReadable

myIsRoot=.IsRoot

EndWith

EndSub

TheIsExecutable,IsReadable,andIsWriteablepropertiesreturninformationaboutthestateofthefolder.ThefollowingexamplesshowhowtosettheIsExecutableandIsReadablepropertiesandreadtheIsWriteableproperty.

NoteYoucannotsettheIsWriteableproperty,howeveryoucansettheIsExecutableandIsReadablepropertiesforaWebFolderobject.

SubFolderProperties()

DimmyFolderAsWebFolder

SetmyFolder=ActiveWeb.RootFolder.Folders(0)

IfmyFolder.IsWritableThen

MsgBox"Folder,"&myFolder.Url&"iswritable"

EndIf

IfNot(myFolder.IsReadable)Then

MyFolder.IsReadable=True

EndIf

IfmyFolder.IsExecutableThen

MyFolder.IsExecutable=False

EndIf

EndSub

Folders(orWebFolderscollection)inFrontPageservetwopurposes.TheycanbefoldersthathelpmanagethecontentsofaWebsiteortheycanbeentireWebsites.AWebsitecanhavemultiplesubWebsitesbelowit.TheIsWebpropertyreturnsTrueifthefolderinquestionisaWebsubsite.ThefollowingexampleusestheIsWebpropertytodetermineifafolderisaWebsubsiteand,ifso,openstheWebsite.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\CohoWinery",oryoumaysubstituteanalternativeWebsiteURL.

PrivateSubCheckFolder()

DimmyFolderAsWebFolder

SetmyFolder=ActiveWeb.RootFolder.Folders("CohoWinery")

IfmyFolder.IsWeb=TrueThen

Webs.OpenmyFolder.Url

EndIf

EndSub

UsetheUrlpropertytoreturntheURLofthecurrentWebFolderobject.ThefollowingstatementreturnstheabsoluteURLfortheeighthfolderintheactiveWebsite.

myUrl=ActiveWeb.RootFolder.Folders(7).Url

UsetheCopy,Delete,andMovemethodstomaintainyourWebsitestructure.ThefollowingstatementcopiesaWebFolderobjectfromonefoldertoanotherfolder,updatesthelinksduringthecopyprocess,andforcesanoverwriteifthefilealreadyexists.

myFolder.Copy("C:\MyWebSites\NewAdventureProducts",True,True)

WebPackageObjectWebPackage

RepresentsaWebpackagethathasbeencreatedinMicrosoftFrontPageVisualBasicforApplications.TheWebPackageobjectisanin-memoryobjectonlyanddoesnotcorrespondtoanyFrontPageUserInterfaceelement.Instead,usetheWebPackageobjecttoworkwithaWebpackageonceyou'vecreateditincode.

UsingtheWebPackageobject

UsetheCreatePackagemethodtocreateaWebPackageobject.ThefollowingexamplecreatesanewWebpackage.

DimobjPackageAsWebPackage

SetobjPackage=ActiveWeb.CreatePackage("NewWebPackage")

UsetheAddmethodtoaddfilestotheWebpackage.ThefollowingexampleaddsthreefilestotheWebPackageobjectcreatedinthepreviouscode.

objPackage.AddobjWeb.Url&"/test.htm",fpDepsDefault

objPackage.AddobjWeb.Url&"/test2.htm",fpDepsNone

objPackage.AddobjWeb.Url&"/test3.htm",fpDepsImages

UsetheSubject,Author,Comany,andTitlepropertiestoaddinformationaboutaWebpackage.Thefollowingexamplespecifiesthesubject,author,andcompanyfortheWebPackageobjectcreatedabove.(WhenyoucreateaWebpackage,theTitleparameterfortheCreatePackagemethodbecomesthevalueoftheTitleproperty.YoucanchangethetitleofaWebpackagebysettingtheTitlepropertytoanewvalue.)

objPackage.Author="JohnSmith"

objPackage.Company="FourthCoffee"

objPackage.Subject="ThisisanewWebpackageforFourthCoffee."

UsetheRemovemethodtoremovefilesthatwereaddedbyusingtheAddmethod.Thefollowingexampleremovesoneofthefilesaddedabove.

objPackage.RemoveobjWeb.Url&"/test3.htm",fpDepsImages

UsetheSavemethodtosave,orexport,aWebpackage.ThefollowingexamplesavestheWebPackageobjectcreatedabove.

objPackage.Save"c:\NewWebPackage.fwp",True

WebWindowExObject

WebWindowEx Multipleobjects

RepresentsaMicrosoftFrontPageapplicationwindowinwhichaWebsiteisopened.TheWebWindowExobjectisamemberoftheWebWindowscollection.TheWebWindowscollectionrepresentsalloftheopenapplicationwindowsinaspecifiedWebsiteorwithinFrontPage.WithintheWebWindowscollection,individualWebWindowExobjectsareindexedbeginningwithzero.EachWebsitethatisopenedinFrontPageiscontainedinanewWebWindowExobject,unlessitisopenedinawindowlessenvironmentbysettingtheVisiblepropertyoftheWebWindowExobjecttoFalse.Formoreinformationonwindowlessenvironments,seeCodinginaWindowlessEnvironment.

UsingtheWebWindowobject

UsetheWebWindowpropertytoreturninformationaboutanopenWebWindowExobject.YoucanalsousethePageWindowspropertytoreturninformationaboutthecollectionofopenpagesinaWebWindowExobject.UseWebWindows(index),whereindexistheindexnumberofanapplicationwindowitem,toreturnasingleWebWindowobject.ThefollowingstatementreturnstheViewModepropertyofthefirstWebsiteintheWebWindowscollection.

myViewMode=WebWindows(0).ViewMode

YoucanalsousetheViewModepropertytoswitchbetweenviewmodesbysettingtheviewmodeasshowninthefollowingstatement,whichswitchesthecurrentviewmodetoNavigationview.

ActiveWebWindow.ViewMode=fpWebViewStructure

TheActivatemethodputsthefocusonthespecifiedWebWindowExobject.ThefollowingstatementsactivatesthefirstWebsitesinthecollectionofopenwindows.

myWebWindow=WebWindows(0)

myWebWindow.Activate

TheActivePageWindowpropertyreturnstheactivePageWindowExobject.ThefollowingstatementsreturntheURLandthecaptionoftheactivePageWindowExobject.Thevaluereturnedforthecaptioninthiscaseisafilename,suchas"Index.htm".

urlThisDoc=WebWindow.ActivePageWindow.Document.Url

fileName=WebWindow.ActivePageWindow.Caption

YoucanalsoreturntheCaptionpropertyfromtheWebWindowExobject.Inthiscase,thetextthatisreturnedreflectsthetextinthetitlebaroftheFrontPageapplicationwindow,whichconsistsoftheapplicationnameandtheURLofthe

specifiedWebWindowExobject,suchas"MicrosoftFrontPage–C:\MyDocuments\MyWebSites\AdventureWorks".ThefollowingstatementreturnsthevalueoftheCaptionpropertyoftheWebWindowExobject.

thisCaption=WebWindow.Caption

UsetheClosemethodtocloseaWebWindowExobject.ThefollowingstatementclosesthespecifiedWebWindow.

SetmyWebWindowOne=WebWindows(0)

myWebWindowOne.Close

UsetheViewModepropertytoreturnorsetoneofthevaluesshowninthefollowingtable.YoucanalsousetheseenumeratedvaluestoswitchviewsinFrontPage.

EnumermatedConstant Value CorrespondingViewinFrontPageFpWebViewLinks 0 HyperlinksviewFpWebViewFolders 1 FoldersviewFpWebViewStructure 2 NavigationviewFpWebViewPage 3 PageviewfpWebViewAllFiles 4 ViewalistofeveryfileinReportsviewFpWebViewTodo 5 ViewaToDolistinTasksview

FpWebViewBrokenLinks 6 ViewalistofbrokenhyperlinksinReportsview

FpWebFiewSiteSummary 7 SiteSummaryviewinReportsview

ThefollowingstatementsetstheViewModepropertytofpWebViewPage.

WebWindows(0).ViewMode=fpWebViewPage

UsetheVisiblepropertytoreturnorsetaBooleanvalueforthestateofaWebWindowExobject.TheVisiblepropertyreturnsTrueifaWebWindowExobjectisvisible.ThefollowingstatementsetsaWebWindowExobjecttoaninvisiblestate.

WebWindow.Visible=False

UsetheWebpropertytoreturninformationabouttheWebExobject.ThefollowingstatementreturnsthenumberofpropertiesforthespecifiedWebsites.

myProperties=ActiveWeb.WebWindows(0).Web.Properties.Count

ActivateMethodActivatesthespecifiedPageWindowEx,WebEx,orWebWindowExobject.Whenyouhavemultipleobjectsopen,youcanusetheActivatemethodtoworkwithaspecificPageWindowEx,WebEx,orWebWindowExobject.

expression.Activate

expressionAnexpressionthatreturnsaPageWindowEx,WebEx,orWebWindowExobject.

Remarks

TheActivatemethodhasnoeffectonawindowlessPageWindowExobject.

Example

ThisstatementactivatesthehomepagefortheAdventureWorksWebsite.

IfmyWeb.Url="C:\MyWebSites\AdventureWorks"ThenmyWeb.Activate

ShowAll

AddMethodAddmethodasitappliestotheListFieldsobject.

AddsanewListFieldobjecttotheListFieldscollection.

expression.Add(Name,Description,FieldType,Required,DefaultValue)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

NameRequired.AStringthatrepresentsthenameofthefield.

DescriptionOptional.AStringthatrepresentsadescriptionofthefield.

DefaultValueOptional.AVariantthatdefinesthedefaultvalue.

FieldTypeOptional.AnFpFieldTypeconstantthatrepresentsthetypeofthenewfield.

FpFieldTypecanbeoneoftheseFpFieldTypeconstants.fpFieldAttachmentsfpFieldChoicefpFieldComputedfpFieldCounterfpFieldCurrencyfpFieldDateTimefpFieldFilefpFieldIntegerfpFieldLookupfpFieldMultiLinefpFieldNumberfpFieldRatingScalefpFieldSingleLinedefaultfpFieldTrueFalse

fpFieldURL

RequiredOptional.ABooleanthatdeterminesifthisisarequiredfield.Trueifthefieldisrequired.

AddmethodasitappliestotheListsobject.

AddsanewListobjecttotheListscollection.

expression.Add(Name,ParentFolder,ListType,Description)

expressionRequired.AnexpressionthatreturnsaListsobject.

NameRequired.AStringthatrepresentsthenameofthenewlist.

ParentFolderOptional.AStringthatrepresentstheparentfolderassociatedwiththeList.

ListTypeOptional.AnFpListTypeconstantthatrepresentsthetypeoflist.

FpListTypecanbeoneoftheseFpListTypeconstants.fpListTypeBasicListdefaultfpListTypeDiscussionfpListTypeDocumentLibraryfpListTypeSurvey

DescriptionOptional.AStringthatrepresentsadescriptionoftheListobject.

AddmethodasitappliestotheNavigationNodesobject.

AddsanewfiletothelistofavailableitemsintheNavigationNodescollection.Usethismethodtoaddanewfiletothenavigationstructure.Formoreinformationonusingnavigationnodes,seetheRootNavigationNodepropertyfortheWebobject,ortheChildrenpropertyfortheNavigationNodeobject.

expression.Add(Url,NodeLabel,ModificationType,LeftSibling)

expressionRequired.AnexpressionthatreturnsaNavigationNodescollection.

UrlRequiredString.AstringthatcontainsthepathfortheWebserverwherethefilewillbestored.ThiscanbeanyabsoluteURL,suchashttp://webserverorfile://filesystemfordisk-basedWebs.

NodeLabelRequiredString.AstringoftextusedtoidentifytheNavigationNodeobjectwhenviewingthenavigationstructureinNavigationview.TheNodeLabelargumentisusedonlyasanaidtoidentification.

ModificationTypeRequiredFpStructModType.Thenodemodificationtype.

FpStructModTypecanbeoneoftheseFpStructModTypeconstants.fpStructBaseOnSiblingUsethissettingifyouwanttoaddanewnodetotherightofthenodedesignatedintheleftsiblingargument.fpStructLeftmostChildTheleftmostnodeinthecurrentnavigationstructure.fpStructRightmostChildTherightmostnodeinthecurrentnavigationstructure.

LeftSiblingOptionalVariant.AnindexintotheNavigationNodescollection.ItcanbeeitherastringthatrepresentsaURL,oranumberthatrepresentsanodeinthecollection.

Remarks

AddinganewfileontotheWebserver(usingtheWebFiles.Addmethod)doesn'timplythatyouareautomaticallyintroducingthefileintothenavigationstructure.ANavigationNodeobjectmustbecreatedseparatelyforthefile.TocreateanewNavigationNodeobject,usetheAddmethodfortheNavigationNodescollection.

NoteWhenatemplateisusedtocreateanewWeb,navigationnodesareautomaticallycreatedforthefilesthathavebeenaddedtotheWebbythetemplate.

AddmethodasitappliestothePageWindowsobject.

AddsanewPageWindowExobjecttothelistofavailableopenitemsinthePageWindowscollection.

NoteOpeninganeworexistingfileobjectbyusingtheAddmethodforthePageWindowExobjectalsoaddsthePageWindowExobjectthatisassociatedwiththeopenedfiletothePageWindowscollection.

expression.Add(FileUrl)

expressionRequired.AnexpressionthatreturnsaPageWindowscollectionobject.

FileUrlOptionalString.AstringthatcontainsthepathfortheWebserverwherethepagewillbestored.ThiscanbeanyabsoluteURLforafile,suchashttp://webserver/fileorfile://filesystem/filefordisk-basedWebs.

Remarks

YoucanuseoneofthreemethodswhenyouwanttoopenHTMLpagesinMicrosoftFrontPagePageview—theAdd,EditorOpenmethod.Whenyouwanttoopen,edit,thensaveafileinPageviewthatexistseitheronafileserveroronafilesystemonyourharddisk,usetheAddmethodforthePageWindowsobject,asshowninthefollowingstatements.

NoteItdoesn'tmatterwherethefilesexist;theycouldresideonaharddisk,server,oraFrontPageWeb.

DimmyFileAsString

myFile="C:\AdventureWorksHTMLFiles\Hiking.htm"

ActiveWeb.ActiveWebWindow.PageWindows.Add(myFile)

Withthismethod,youhaven'taddedthefiletoaFrontPage-basedWeb—you'vejustopenedit.IfmyFileispartofaWeb,andtheWebiscurrentlynotopen,FrontPagewillalsoopentheWeb.

WhenyouwanttoopenandeditanHTMLfilethatexistsonaWeb,usetheEditmethodfortheFilescollectionintherootfolder,asshowninthefollowingstatement.

ActiveWeb.RootFolder.Files("Hiking.htm").Edit

YoucanusetheOpenmethodinthesameway.However,youshouldreservetheOpenmethodforopeningfilesthatarenotHTMLfiles,suchasMicrosoftWorddocuments,imagefiles,andsoon.

YoucanalsousetheAddmethodtoopenanewunsavedPageWindowobject.Youcanuseeitherofthefollowingstatementstoopenanunsavedpagewindow.

SetmyUnsavedPageWindow=ActiveWebWindow.PageWindows.Add()

SetmyUnsavedPageWindow=ActiveWebWindow.PageWindows.Add("")

NoteYoucanusetheexpressionActiveWebWindow.PageWindows.Add("C:\My

Documents\MyWebs\index.htm")asavalidexpressionaslongasindex.htmisavalidFrontPage-basedfilethatresidesinMyWebs.However,ifindex.htmdoesnotresideinMyWebs,yourcodewillfail.Toaddanewpage,youmustfollowtheproceduredescribedearlierinthissection.

AddmethodasitappliestothePropertiesobject.

AddsanewpropertytothelistofavailableitemsinthePropertiescollection.

expression.Add(PropertyKey,PropertyValue)

expressionRequired.AnexpressionthatreturnsthePropertiescollection.

PropertyKeyRequiredString.Astringthatcontainsthenameofthepropertythatyouwanttoadd.Formoreinformation,seethetableofpropertiesinthePropertiescollectiontopic.

PropertyValueRequiredVariant.Thevalueoftheproperty.

Remarks

YoucanprogrammaticallyaddandremovecategoriesandapprovalratingsforthePropertiescollection.

AddmethodasitappliestotheWebFilesobject.

AddsanewWebFileobjecttothelistofavailableitemsintheWebFilescollection.AWebFileobjectisnotrestrictiveandcanbeanytypeoffile;itisnotrestrictedtoanHTMLfiletype—itcouldbeanimagefile,amovie,oranexecutablefile.

NoteUsethismethodtoaddanewfiletoaFrontPage-basedWeb.

expression.Add(FileUrl,ForceOverwrite)

expressionRequired.AnexpressionthatreturnsaWebFilescollection.

FileUrlRequiredString.AstringthatcontainstheURLforthefilesuchas"Inventory.htm".ThiscanbeanyabsoluteURLforafile,suchashttp://webserver/fileorfile://filesystem/filefordisk-basedWebs.

ForceOverwriteOptionalBoolean.

Remarks

AccessingasingleWebFileobjectthroughtheWebFilescollectionprovidesreferencetoaWebFileobjectthatdoesn'thaveaccesstothePageobjectmodeluntiltheWebfileisopened.Oncethefileisopen,thePageWindowobjectassociatedwiththefileprovidesaccesstothePageobjectmodelthatiscompatiblewithMicrosoftInternetExplorer4.0andlater.ForfurtherinformationonusingthePageobjectmodelinyourWebpages,seeExploringtheObjectModelinFrontPage.

AddmethodasitappliestotheWebFoldersobject.

AddsanewWebFolderobjecttothelistofavailableitemsintheWebFolderscollection.

expression.Add(FolderUrl)

expressionRequired.AnexpressionthatreturnsaWebFolderscollection.

FolderUrlRequiredString.AstringthatcontainstheURLforthefolder,suchastheImagesfolderinC:\MyWebs.ThiscanbeanyabsoluteURLforafolder,suchashttp://webserver/folderorfile://filesystem/folderfordisk-basedwebs.

AddmethodasitappliestotheWebPackageobject.

ReturnsaBooleanthatrepresentswhetherthespecifiedfilewassuccessfullyaddedtotheWebpackage.

expression.Add(Url,flags)

expressionRequired.AnexpressionthatreturnsaWebPackageobject.

UrlRequiredString.Thepathandfilenameofthefiletobeadded.

flagsOptionalFpDependencyFlags.Specifieshowtohandledependenciesforthespecifiedfile.DependenciesareincludedonlyiftheyexistwithinthecurrentWebsite.

FpDependencyFlagscanbeacombinationofoneormoreofthefollowingFpDependencyFlagsconstants.

fpDepsDefault Includesallimages,linkbars,hyperlinks,lists,sharedborders,andthemes.

fpDepsImages Includesallimages.fpDepsLinkbars Includesalllinkbars.fpDepsLinks Includesallpagestowhichtherearehyperlinks.

fpDepsLists Includesliststhatmaybeneededinorderforthepagetorendercorrectly.

fpDepsNone Includesnodependencies.fpDepsRecurse Includesallfilesthatareinaspecifiedfolder.fpDepsSharedBorders Includesallsharedborders.fpDepsThemes Includesallthemes.

Remarks

UsetheCreatePackagemethodtocreateanewWebpackage.ThenusetheAddmethodtoaddpagesandtheirspecifieddependenciestotheWebpackage.YoucancreateWebpackagesfromfilesinWebsitesbasedonMicrosoftWindowsSharePointServicesandindisk-basedWebsites.

AddmethodasitappliestotheWebsobject.

AddsanewWebtothelistofavailableitemsintheWebscollection.

SecurityAvoidusinghard-codedpasswordsinyourapplications.Ifapasswordisrequiredinaprocedure,requestthepasswordfromtheuser,storeitinavariable,andthenusethevariableinyourcode.Forrecommendedbestpracticesonhowtodothis,seeSecurityNotesforMicrosoftOfficeSolutionDevelopers.

expression.Add(WebUrl,UserName,Password,WebOpenFlags)

expressionRequired.AnexpressionthatreturnsaWebscollectionobject.

WebUrlRequiredString.AstringthatcontainsthepathfortheWebserverwheretheWebwillbestored.ThiscanbeanyabsoluteURLforaWeb,suchashttp://webserverorfile://filesystemfordisk-basedWebs.

UserNameOptionalString.Theuser'slogonnamefortheWebserver.

PasswordOptionalString.Theuser'spasswordfortheWebserver.

WebOpenFlagsOptional.AnFpWebOpenFlagsconstantthatrepresentsthebehaviorofthenewWeb.

FpWebOpenFlagscanbeoneoftheseFpWebOpenFlagsconstants.fpOpenInWindowdefaultfpOpenNoWindow

AddmethodasitappliestotheWebWindowsobject.

AddsanewWebWindowExobjecttotheWebWindowscollection.

expression.Add(ViewModeEx)

expressionRequired.AnexpressionthatreturnsaWebWindowscollection.

ViewModeExRequired.AnFpWebViewModeExenumeratedconstantthatrepresentstheinformationdisplayedinthenewwindow.

FpWebViewModeExcanbeoneoftheseFpWebViewModeExconstants.fpWebViewExAccessibilityfpWebViewExAllFilesfpWebViewExAssignedTofpWebViewExBrokenLinksfpWebViewExBrowserTypesfpWebViewExCategoriesfpWebViewExCheckoutStatusfpWebViewExComponentErrorsfpWebViewExCSSLinksfpWebViewExDailyPageHitsfpWebViewExDailySummaryfpWebViewExFoldersfpWebViewExLinksfpWebViewExMasterPagesfpWebViewExMonthlyPageHitsfpWebViewExMonthlySummaryfpWebViewExNavigationfpWebViewExOlderFilesfpWebViewExOsTypesfpWebViewExPagefpWebViewExPublishStatusfpWebViewExRecentlyAddedFilesfpWebViewExRecentlyChangedFilesfpWebViewExReferringDomainsfpWebViewExReferringURLs

fpWebViewExRemoteSitefpWebViewExReviewStatusfpWebViewExSearchStringsfpWebViewExSharedBordersfpWebViewExSiteSummaryfpWebViewExSlowPagesfpWebViewExThemesfpWebViewExTodofpWebViewExUnlinkedFilesfpWebViewExUsageSummaryfpWebViewExVisitingUsersfpWebViewExWeeklyPageHitsfpWebViewExWeeklySummary

Example

AsitappliestotheNavigationNodesobject.

Thisexampleaddsanewnodecalledfootnote.htmtothelistofitemsintheNavigationNodescollection.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebs\CohoWinery"thatcontainsafilecalledfootnote.htm.Or,youmaysubstituteanalternativeWebsiteURLorfilename.

PrivateSubAddNewNavNode()

DimmyHomeAsNavigationNode

DimmyNewNodeAsNavigationNode

DimmyFileUrlAsString

myFileUrl="C:\MyDocuments\MyWebs\CohoWinery\footnote.htm"

SetmyHome=ActiveWeb.HomeNavigationNode

SetmyNewNode=_

myHome.Children.Add(myFileUrl,_

"Footnote",fpStructLeftmostChild)

ActiveWeb.ApplyNavigationStructure

EndSub

AsitappliestothePageWindowsobject.

ThisexampleaddstheInventorypageforCohoWinerytothelistofitemsinthePageWindowscollection.WhenyouaddapageusingtheFileUrlargument,thepagethatyouwanttoaddmustexistasafile—youcannotcreateanewpageusingthisargument.Tocreateanunsavednewpage,seethedescriptionintheAddmethod.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebs\CohoWinery"thatcontainsafilecalledInventory.htm.Or,youmaysubstituteanalternativeWebsiteURLorfilename.

PrivateSubAddPage()

DimmyPageWindowsAsPageWindows

DimmyPageAsString

SetmyPageWindows=ActiveWeb.ActiveWebWindow.PageWindows

myPage="C:\MyDocuments\MyWebs\CohoWinery\Inventory.htm"

myPageWindows.Add(myPage)

EndSub

AsitappliestothePropertiesobject.

ThisexampleaddsanewfiletothelistofitemsinthePropertiescollection.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebs\CohoWinery\Zinfandel.htm"thatcontainsafilecalledfootnote.htm.Or,youmaysubstituteanalternativeWebsiteURLorfilename.

PrivateSubCopyrightAdd()

DimmyWebAsWebEx

DimmyCopyrightAsString

DimmyCopyrightPropertyAsVariant

myCopyright="Copyright1999byCohoWinery"

SetmyWeb=Webs.Open("C:\MyWebs\CohoWinery")

myWeb.Activate

ActiveWeb.Properties.Add"Copyright",myCopyright

ActiveWeb.RootFolder.Files("Zinfandel.htm").Open

ActiveDocument.body.insertAdjacentText"BeforeEnd",_

ActiveWeb.Properties("Copyright")

ActivePageWindow.Save

ActiveWeb.Close

EndSub

AsitappliestotheWebsobject.

ThisexampleaddsanewitemtothelistoffilesintheWebscollection.

Webs.Add("C:\MyDocuments\MyWebs\CohoWinery")

AsitappliestotheWebFilesobject.

ThisexampleaddsanewWebFileobjecttothelistofitemsintheFilescollection.

ActiveWeb.RootFolder.Files.Add("C:\NewWebFiles\SalesStatistics.htm")

AsitappliestotheWebFoldersobject.

ThisexampleaddsafoldertothelistofitemsintheWebFolderscollection.

ActiveWeb.RootFolder.Folders.Add("DistributionCenters")

AsitappliestotheWebPackageobject

ThefollowingexamplecreatesanewWebpackageandaddsthepage"test.htm"tothepackage,includingalldependenciesforthepage,andthensavesthenewWebpackage.

DimobjWebAsWebEx

DimobjPackageAsWebPackage

SetobjWeb=ActiveWeb

SetobjPackage=objWeb.CreatePackage("NewWebPackage")

WithobjPackage

.Author="JohnSmith"

.Company="FourthCoffee"

.Subject="ThisisanewWebpackageforFourthCoffee."

.AddobjWeb.Url&"/test.htm",fpDepsDefault

.Save"c:\NewWebPackage.fwp",True

EndWith

AddChoiceMethodAddsanewchoicetothelistofavailablechoicesforthecurrentfield.ThefieldmustbeoftypeListFieldChoice.

expression.AddChoice(text,Index)

expressionRequired.AnexpressionthatreturnsaListFieldChoiceobject.

textRequired.AStringthatrepresentsthetextthatwillappearinthedrop-downlistorbesidearadiobutton.

IndexOptional.ALongthatrepresentsthepositionofthechoicewithinthelistofchoices.

Example

ThefollowingexampleaddstwochoicestoachoicefieldnamedNewChoiceFieldinthefirstlistoftheactiveWebsite.ThenewchoicesareSaleOption1,whichwillappearfirstinthelist,andSaleOption2,whichwillappearsecondinthelist.TherelativepositionsofthechoicesaredeterminedbytheoptionalIndexargument.

SubAddChoice()

DimobjAppAsFrontPage.Application

DimobjLstFldsAslistFields

DimobjFldChoiceAsListFieldChoice

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

'Setareferencetothenewfieldand

'addtwonewchoicestothelist.

SetobjFldChoice=objLstFlds.Item("NewChoiceField")

objFldChoice.AddChoicetext:="SaleOption1",Index:=1

objFldChoice.AddChoicetext:="SaleOption2",Index:=2

EndSub

ShowAll

AddLinkBarMethodReturnsaNavigationNodeobjectthatrepresentsalinkbar.

expression.AddLinkBar(NodeLabel,ModificationType,LeftSibling)

expressionRequired.AnexpressionthatreturnsaNavigationNodescollection.

NodeLabelRequired.AStringthatrepresentsthelabelornameofthelinkbar.

ModificationTypeRequired.AnFpStructModTypeconstantthatrepresentsthestructureofthelinkbar.

FpStructModTypecanbeoneoftheseFpStructModTypeconstants.fpStructBaseOnSiblingBasethelinkbaronitsclosestsiblingnode.fpStructLeftmostChildBasethelinkbaronitsleftmostchildnode.fpStructRightmostChildBasethelinkbaronitsrightmostchildnode.

LeftSiblingOptional.AVariantthatrepresentstheleftsiblingofthenode.Thisvalueisusedtolocatethenewlinkbarinthehierarchy.

Remark

Thenewnodewillnotappearinthelinkbar.Onlythenode'schildrenwillappearinthelinkbar.

NoteThenewlinkbarmustbeaddedtothestructurebeforechildnodescanbeaddedtoit.

Example

Thefollowingexamplecreatesanewlinkbarthatisbasedonitssiblinginthehierarchyofnavigationnodes.

SubNewLinkBar()

DimobjAppAsFrontPage.Application

DimobjNavNodesAsNavigationNodes

DimobjNavNodeAsNavigationNode

SetobjApp=FrontPage.Application

SetobjNavNodes=objApp.ActiveWeb.AllNavigationNodes

'Referenceanodetouseinthemethod.

SetobjNavNode=objNavNodes.Item(1)

'Createnewlinkbarbasedonsibling.

objNavNodes.AddLinkBarNodeLabel:="Newlinkbar",_

ModificationType:=fpStructBaseOnSibling,_

LeftSibling:=objNavNode

'Applynavigationstructuresonodewillappear.

objApp.ActiveWeb.ApplyNavigationStructure

EndSub

ApplyChangesMethodApplychangestothespecifiedobject.ChangestoapropertyofaWebEx,WebFile,orWebFolderobjectarenotapplieduntilyouusetheApplyChangesmethodforthespecifiedobject.

expression.ApplyChanges

expressionAnexpressionthatreturnsaPropertiescollectionobject.

Example

Thisexamplechangesthevalueofthevti_titlepropertyforafilecalledZinfandel.htmandappliesthechange.

PrivateSubChangeProperties()

DimmyPropertiesAsProperties

SetmyProperties=_

ActiveWeb.RootFolder.Files("Zinfandel.htm").Properties

myProperties("vti_title")="RogueCellarsWineList"

myProperties.ApplyChanges

EndSub

ApplyDynamicTemplateMethodAppliesaDynamicWebTemplatetoadocument.

expression.ApplyDynamicTemplate(bzMaster,pState,)

expressionRequired.AnexpressionthatreturnsaWebFileobject.

bzMasterRequiredString.ThepathandfilenamefortheDynamicWebTemplate.

pStateRequiredDynamicTemplateState.SpecifiestheregionmappingfortheDynamicWebTemplate.UsetheSetHeadMappingandSetBodyMappingmethodsoftheDynamicTemplateStateobjecttocustomizeregionmapping.

Remarks

TodetachaDynamicWebTemplateusetheApplyDynamicTemplatemethodwiththebzMasterparametersettoanemptystring.

Example

ThefollowingexampleappliesthespecifiedDynamicWebTemplatefiletothespecifiedfile.

DimobjStateAsDynamicTemplateState

DimobjFileAsWebFile

SetobjState=Application.CreateDynamicTemplateState

SetobjFile=ActiveWeb.LocateFile("home.htm")

objFile.ApplyDynamicTemplate"template.dwt",objState

ApplyNavigationStructureMethodAppliesthenavigationstructuretothespecifiedobject.

expression.ApplyNavigationStructure

expressionAnexpressionthatreturnsaWebExobject.

Remarks

Therearetwodetailstokeepinmindwhenprogrammaticallycreatingfilesandnavigationnodes:

Navigationlabelscannotbeempty.Changestothenavigationstructurecanbelostifyoudon'tapplythenavigationstructurebeforestartingoperationsthataffectthecontentoftheWebsitesuchasmovingoraddingfilesorfolders.

Example

Thisexampleaddsanavigationnodeastherightmostchildnodeandthenappliesthechangestothenavigationstructure.

PrivateSubAddNewNavNode()

DimmyWebAsWebEx

DimmyChildNodesAsNavigationNodes

DimmyNewNavNodeAsNavigationNode

SetmyWeb=ActiveWeb

SetmyChildNodes=_

myWeb.RootFolder.Files(1).NavigationNode.Children

myNewNavNode=_

myChildNodes.Add(myWeb.Url&"Sale.htm","Sale",_

fpStructRightmostChild)

myWeb.ApplyNavigationStructure

EndSub

ApplyTemplateMethodSomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

AppliesanexistingHTMLtemplatetothecurrentWebsite.

expression.ApplyTemplate(TemplateDir,fOverWrite)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TemplateDirRequiredString.Thepathofthetemplate.

fOverWriteOptional.ABooleanthatdeterminesifthecurrenttemplatewillbeoverwritten.IfTrue,thecurrenttemplatewillbeoverwritten.IfFalse,thecurrenttemplatewillnotbeoverwritten.ThedefaultvalueisFalse.

Example

ThefollowingexampleaddsaspecifiedtemplatetothecurrentWebsiteusingtheApplyTemplatemethod.ThemethodiscalledwiththefApplyThemesandthefOverWriteargumentssettoFalse.ThethemeswillnotbeappliedtothenewWebsiteandanyexistingtemplatewillnotbeoverwritten.

SubUseTemplate()

'AppliesatemplatetothecurrentWebsitewithoutoverwritingtheoriginaltemplate

'orapplyingthemes.

DimobjAppAsFrontPage.Application

DimobjWebAsWebEx

DimstrPathAsString

DimstrnameAsString

SetobjApp=FrontPage.Application

SetobjWeb=objApp.ActiveWeb

'Setvariabletotemplatedirectory.

strPath="C:\ProgramFiles\MicrosoftOffice\Templates\"

'Prompttheuserforthefilenameofthetemplate.

strname=InputBox("Enterthefilenameofthetemplateyouwishtoapply")

'Addthetemplatenametothepathinorderto

'createafullpathname.

strPath=strPath&strname

'ApplythetemplatetothenewWebsite.

objWeb.ApplyTemplateTemplateDir:=strPath,_

fOverWrite:=False

EndSub

ShowAll

ApplyThemeMethodAppliesthevaluecontainedintheThemeNameargumenttothepropertynamedintheThemePropertiesargument.Forexample,athemecanbeappliedtoaWebFile,WebFiles,PageWindowEx,orWebExobjectinaMicrosoftFrontPage-basedWebsite.

expression.ApplyTheme(ThemeName,ThemeProperties)

expressionAnexpressionthatreturnsanobjectintheAppliesTolist.

ThemeNameRequiredString.Astringthatcontainsthenameofthethemethatyouwanttoapplytoafile.TheThemeNameparametercanbeoneofthefollowing:

aftrnoon concrete modular strtedge

arcs corporat nature studio

arctic cypress network sumipntg

artsy deepblue papyrus sunflowr

axis echo passport tabs

balance eclipse piechart technolo

bars edge pixel topo

blank evergreen poetic travel

blends expeditn profile water

blitz folio quad watermar

blocks glacier radial waves

bluecalm global refined willow

blueprnt highway ricepapr zero

boldstri ice ripple

breeze indust rmnsque

canyon inmotion sandston

capsules iris satin

cascade journal sky

checkers layers slate

citrus level sonora

classic loosegst spiral

compass mdshapes spring

ThemePropertiesOptionalFpThemeProperties.Thepropertiesassociatedwiththetheme.

FpThemePropertiescanbeoneoftheseFpThemePropertiesconstants.fpThemeActiveGraphicsfpThemeBackgroundImagefpThemeCSSfpThemeDefaultSettingsfpThemeNamefpThemeNoBackgroundImagefpThemeNoCSSfpThemeNormalColorsdefaultfpThemeNormalGraphicsfpThemePropertiesAllfpThemePropertiesNonefpThemeVividColors

Remarks

ThefollowingcodeappliestheSumiPaintingthemetoafilewithactivegraphics.

DimstrThemeAsString

strTheme="sumipntg"

CallWebFile.ApplyTheme(strTheme,fpThemeActiveGraphics)

Tochangemorethanonethemepropertywhenapplyingthetheme,usetheplussign(+),asshowninthefollowingexample.

strTheme="sumipntg"

WebFile.ApplyTheme(strTheme,_

fpThemeVividColors+fpThemeActiveGraphics)

Thismethodisessentiallythesameoneyou'duseforapplyingathemetoaPageWindowExorWebExobject.

Example

Thisexamplecontainsafunction,ApplyThemeToFilesInFolder,andaprocedurethatyoucanmodifytoapplyanyoftheavailablethemes.ThisexampleappliestheArtsythemetoallfilesinaspecifiedfolder.

NoteTorunthisexample,copythecodeintoamoduleintheMicrosoftVisualBasicEditorandruntheChangeToArtsyprocedure.

FunctionApplyThemeToFilesInFolder(myThemeNameAsString,_

myFolderObjectAsWebFolder)AsBoolean

DimmyFileAsWebFile

DimmyThemeAsTheme

OnErrorGoToERR

ForEachmyFileInmyFolderObject.Files

CallmyFile.ApplyTheme(myThemeName,fpThemePropertiesAll)

NextmyFile

ApplyThemeToFilesInFolder=True

ExitFunction

ERR:

MsgBox"Anerroroccurred:"&ERR.Description,vbCritical,"Error!"

ApplyThemeToFilesInFolder=False

ExitFunction

EndFunction

PrivateSubChangeToArtsy()

ApplyThemeToFilesInFolder"artsy",ActiveWeb.RootFolder

EndSub

CancelRequestsMethodImmediatelycancelsallrequeststotheWebExobjectwithoutsaving.

expression.CancelRequests

expressionAnexpressionthatreturnsaWebExobject.

Example

TheCancelRequestsmethodcanbeusedtostopaprocessthatmaybetakingtoolong,mayappeartobeinaninfiniteloop,orthatmaybecomingfromaquestionablesource.

PrivateSubCancelRequestsToWeb_Click()

DimmyWebAsWebEx

SetmyWeb=ActiveWeb

myWeb.CancelRequests

EndSub

CheckinMethodChecksthespecifiedWebFileobjectintothesourcecontrolproject.

NoteYoumusthaveasourcecontrolprojectinplacebeforeusingthismethod.Forinformationaboutsourcecontrolprojects,refertoManagingSourceControlProjects.

expression.Checkin(Comment,KeepCheckedout)

expressionAnexpressionthatreturnsaWebFileobject.

CommentOptionalString.Adescriptionstring.

KeepCheckedoutOptionalBoolean.Truekeepsthefilecheckedout.DefaultvalueisFalse.

Remarks

TheKeepCheckedoutargumentprovidestheabilitytohavethefileremaininacheckedoutstatewhiletheuserchecksthefileintoMicrosoftVisualSourceSafetorecordthechanges.ThisdoesnotapplytoMicrosoftFrontPageLightWeightsourcecontrol.

Example

Theprograminthisexampleperformsthefollowingitems:

Checksoutafileandputsthepageineditmode.Addsawelcomemessagetothepage.Checksiftheopenpagehasbeenmodified.Savesthepageifithasbeenmodified.Closesthefileandchecksitintotheexistingsourcecontrolproject.

NoteTorunthisexample,youmusthaveasourcecontrolprojectinplaceonaWebsitewithafilecalled"C:\MyDocuments\MyWebSites\RogueCellars\Zinfandel.htm."Or,youmaysubstituteaWebsiteandfileofyourchoice.

PrivateSubCheckinFile()

DimmyWebAsWebEx

DimmyFileAsWebFile

DimmyPageWindowAsPageWindowEx

DimmyWelcomeAsString

SetmyWeb=Webs("C:/MyWebSites/RogueCellars")

myWelcome="WelcometomyWebSite!"

SetmyFile=myWeb.RootFolder.Files("Zinfandel.htm")

myFile.Checkout

SetmyPageWindow=myFile.Edit(fpPageViewNormal)

WithmyPageWindow

myPageWindow.Document.body.insertAdjacentText("BeforeEnd",_

myWelcome)

IfmyPageWindow.IsDirty=TrueThenmyPageWindow.Save

.Close

EndWith

myFile.Checkin

EndSub

CheckoutMethodChecksthespecifiedWebFileobjectouttothesourcecontrolproject.

NoteYoumusthaveasourcecontrolprojectinplacebeforeusingthismethod.Forinformationaboutsourcecontrolprojects,refertoManagingSourceControlProjects.

expression.Checkout(ForceCheckout)

expressionAnexpressionthatreturnsaWebFileobject.

ForceCheckoutOptionalBoolean.Forcesacheckout,evenifthefileisalreadycheckedout.Trueforcesacheckoutofthefile.DefaultvalueisFalse.

Remarks

TheForceCheckoutargumentprovidestheadministratorwiththeabilitytoforceacheckoutincaseswhereafilehasbeencheckedoutbyauserwhoisunavailabletocheckthefilebackin.

Example

Theprograminthisexampleperformsthefollowing:

Checksoutafilefromanexistingsourcecontrolprojectandputsthefileineditmode.Addsawelcomemessagetothedocument.Checksiftheopenpagehasbeenmodified.Savesthepage,ifithasbeenmodified.Closesthefileandchecksitintotheexistingsourcecontrolproject.

NoteTorunthisexample,youmusthaveasourcecontrolprojectinplaceonaWebsitewithafilecalled"C:\MyDocuments\MyWebSites\RogueCellars\Zinfandel.htm".Or,youmaysubstituteanalternativeWebsiteandfilename.

PrivateSubCheckoutFile()

DimmyWebAsWebEx

DimmyFileAsWebFile

DimmyPageWindowAsPageWindowEx

DimmyWelcomeAsString

SetmyWeb=Webs("C:/MyWebSites/RogueCellars")

myWelcome="WelcometomyWebSite!"

SetmyFile=myWeb.RootFolder.Files("Zinfandel.htm")

myFile.Checkout

SetmyPageWindow=myFile.Edit(fpPageViewNormal)

WithmyPageWindow

myPageWindow.Document.body.insertAdjacentText("BeforeEnd",_

myWelcome)

IfmyPageWindow.IsDirty=TrueThenmyPageWindow.Save

.Close

EndWith

myFile.Checkin

EndSub

ClearChoicesMethodRemovestheavailablechoicesforachoicefield.

expression.ClearChoices

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ShowAll

CloseMethodClosemethodasitappliestothePageWindowExobject.

ClosesthespecifiedPageWindowExobject.

expression.Close(ForceSave,PromptUser)

expressionRequired.Anexpressionthatreturnstheaboveobject.

ForceSaveOptionalBoolean.TrueforcesthespecifiedfiletobesavedbeforetheClosemethodiscompleted.DefaultisFalse.

PromptUserOptionalBoolean.Truepromptstheuserbeforeclosingthepage.DefaultisFalse.

ClosemethodasitappliestothePageWindowsobject.

ClosesthespecifiedpagesinthePageWindowscollection,or,ifNull,closesallopenpagesinthePageWindowscollection.

expression.Close(Index,ForceSave,PromptUser)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

IndexOptionalVariant.ReferstoanindividualiteminthePageWindowscollection.Canbeanynumbercorrespondingtoaniteminthecollection,withtheindexstartingatzero.

ForceSaveOptionalBoolean.TrueforcesthespecifiedfiletobesavedbeforetheClosemethodiscompleted.DefaultisFalse.

PromptUserOptionalBoolean.Truepromptstheuserbeforeclosingthepages.DefaultisFalse.

ClosemethodasitappliestotheWebWindowsobject.

ClosesthespecifiedWebWindowExobject.

expression.Close(Index)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

IndexOptionalVariant.ReferstoanitemintheWebWindowscollection.Canbeanynumbercorrespondingtoaniteminthecollection,withtheindexstartingatzero.

ClosemethodasitappliestotheWebExandWebWindowExobjects.

Closesthespecifiedobject.

expression.Close

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Example

AsitappliestothePageWindowExobject.

Thefollowingexampleclosestheactivepagewindow.

SubCloseWindow()

'Closestheactivepagewindow

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

IfNotobjApp.ActivePageWindowIsNothingThen

objApp.ActivePageWindow.CloseForceSave:=True

EndIf

EndSub

AsitappliestothePageWindowscollection.

ThefollowingexampleclosesthefirstpagewindowofthefirstWebsiteintheWebWindowscollection.

SubCloseWindow()

'Closesapagewindow

DimobjAppAsFrontPage.Application

DimobjPgeWindowsAsPageWindows

SetobjApp=FrontPage.Application

SetobjPgeWindows=objApp.ActiveWeb.WebWindows(0).PageWindows

objPgeWindows.CloseIndex:=0,ForceSave:=True

EndSub

AsitappliestotheWebWindowsobject.

ThefollowingexampleclosesallopenWebwindows.

SubCloseWindow()

'ClosesallWebpagewindows.

DimobjAppAsFrontPage.Application

DimobjPgeWindowsAsWebWindows

SetobjApp=FrontPage.Application

SetobjWebWindows=objApp.ActiveWeb.WebWindows

objWebWindows.Close

EndSub

AsitappliestotheWebExandWebWindowExobjects.

ThefollowingexampleclosestheactiveWebsite(ifoneexists).

SubCloseWindow()

'Closestheactivedocument

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

IfNotobjApp.ActiveWebIsNothingThen

objApp.ActiveDocument.Close

EndIf

EndSub

ShowAll

ConvertToFieldMethodChangesafieldfromonetypetoanotherandreturnstheobjectspecifiedintheTypeparameter.

expression.ConvertToField(Type)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

TypeRequiredFpFieldType.Specifiesthetypeoffieldtowhichtoconvertthespecifiedfield.

FpFieldTypecanbeoneofthefollowingFpFieldTypeconstants.

fpFieldAttachments ReturnsaListFieldAttachmentsobject.fpFieldChoice ReturnsaListFieldChoiceobject.fpFieldComputed ReturnsaListFieldComputedobject.fpFieldCounter ReturnsaListFieldCounterobject.fpFieldCurrency ReturnsaListFieldCurrencyobject.fpFieldDateTime ReturnsaListFieldDateTimeobject.fpFieldFile ReturnsaListFieldFileobject.fpFieldInteger ReturnsaListFieldIntegerobject.fpFieldLookup ReturnsaListFieldLookupobject.fpFieldMultiLine ReturnsaListFieldMultilineobject.fpFieldNumber ReturnsaListFieldNumberobject.fpFieldRatingScale ReturnsaListFieldRatingScaleobject.fpFieldSingleLine ReturnsaListFieldSingleLineobject.fpFieldTrueFalse ReturnsaListFieldTrueFalseobject.fpFieldURL ReturnsaListFieldURLobject.

Remarks

Thefollowingchartspecifieswhetheronefieldtypecanbeconvertedtoanotherfieldtypeandhowtheconversionworksifspecialconversionisnecessary.

FromField/ToField

Text Choice NoteNote(Rich

TextEnabled)

Number

Text N/A Yes Yes Yes

Yes;convertsnumbersandsetsothervaluestoNULL

Choice Yes N/A Yes Yes

Yes;convertsnumbersandsetsothervaluestoNULL

Note

Yes;convertsandtruncatestexttolessthan255characters.

Yes;convertsandtruncatestextto255characters.

N/A Yes

Yes;convertsnumbersandsetsothervaluestoNULL

Note(RichText

Enabled)

No No Yes N/A No

Number Yes Yes Yes Yes N/A

Currency Yes Yes Yes Yes Yes

DateTime Yes Yes Yes Yes No

Boolean Yes;convertsto0or1.

Yes;convertsto0or1.

Yes;convertsto0or1.

Yes;convertsto0or1.

Yes;convertsto0or1.

Multi-valuechoice

Yes Yes Yes Yes Yes

CopyMethodCopiesthespecifiedobjecttoadesignatedURL.Duringthecopyprocessyoucanchoosetoupdatehyperlinksorforceafileoverwriteifthespecifiedobjecthasthesamenameasthedesignatedobject.

expression.Copy(DestinationUrl,Unused,ForceOverwrite)

expressionAnexpressionthatreturnsaWebFileorWebFolderobject.

DestinationUrlRequiredString.ThetargetURL.

UnusedOptionalBoolean.Thisparameterisunused.SettingitornotsettingitwillhavenoeffectonthefunctionalityoftheCopymethod.

ForceOverwriteOptionalBoolean.Specifieswhethertoforceafileoverwritewhenafileorfolderisfoundwiththesamename.SettheargumenttoTruetoforceafileoverwrite.DefaultvalueisFalse.

Remarks

TheCopymethodonlycopiesfilesorfolderswithinthesameWebsite.YoucannotcopyacrossWebsites.However,youcanusetheSaveAsmethodforthePageWindowExobjecttosaveapagethathasitsfilecurrentlylocatedinoneWebsitetosavethepagetoafileinanotherWebsite.Or,youcanusetheAddmethodfortheWebFileobjecttoaddafilethatiscurrentlylocatedinoneWebsitetoanotherWebsite.

Example

ThisexamplecopiesafilefromtheCohoWineryfoldertoanInventoryfolderwithinthesameWebsite.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\CohoWinery."Or,youmaysubstituteanalternativeWebsiteandfilename.

PrivateSubFileCopy()

DimmyFileAsWebFile

SetmyFile=ActiveWeb.RootFolder.Files("Zinfandel.htm")

myFile.Copy"C:\MyWebSites\CohoWinery\Inventory\Zinfandel.htm"

EndSub

CreateDynamicTemplateStateMethodReturnsaDynamicTemplateStateobjectthatrepresentsasetofregionmappingstousewhenapplyingorupdatingaDynamicWebTemplate.

expression.CreateDynamicTemplateState

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThefollowingexamplecreatesareferencetoaDynamicWebTemplate.

DimobjStateAsDynamicTemplateState

SetobjState=Application.CreateDynamicTemplateState

CreatePackageMethodReturnsaWebPackageobjectthatrepresentsacollectionofpages,files,andfoldersandtheirrelateddependencies,suchasimages,cascadingstylesheets,andJavaScriptfiles.

expression.CreatePackage(Title)

expressionRequired.AnexpressionthatreturnsaWebExobject.

TitleRequiredString.ThenameoftheWebpackage.ThisvaluebecomesthevalueoftheTitlepropertyfortheWebPackageobject.

Remarks

UsetheCreatePackagemethodtocreatetheWebPackageobject.UsetheAddmethodtoaddpagestotheWebpackage.ThenusetheSavemethodtosavethenewWebpackagetodisk.UsetheRemovemethodtoremovefilesthatwereaddedbyusingtheAddmethod.

YoucancreateWebpackagesfromfilesinWebsitesbasedonMicrosoftWindowsSharePointServicesandindisk-basedWebsites.

Example

ThefollowingexamplecreatesanewWebpackageandaddsthepage"test.htm"tothepackage,includingalldependenciesforthepage,andthensavesthenewWebpackage.

DimobjWebAsWebEx

DimobjPackageAsWebPackage

SetobjWeb=ActiveWeb

SetobjPackage=objWeb.CreatePackage("NewWebPackage")

WithobjPackage

.Author="JohnSmith"

.Company="FourthCoffee"

.Subject="ThisisanewWebpackageforFourthCoffee."

.AddobjWeb.Url&"/test.htm",fpDepsDefault

.Save"c:\NewWebPackage.fwp",True

EndWith

CreateSearchInfoMethodReturnsaSearchInfoobjectthatrepresentsacustomfindorfindandreplaceoperation.

expression.CreateSearchInfo

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThefollowingexamplefindsthenextoccurrenceofthePelementintheactivedocument.

DimobjSearchAsSearchInfo

DimblnFoundAsBoolean

DimobjRangeAsIHTMLTxtRange

SetobjSearch=Application.CreateSearchInfo

objSearch.Find="p"

objSearch.Action=fpSearchFindTag

SetobjRange=Application.ActiveDocument.selection.createRange

blnFound=Application.ActiveDocument.Find(objSearch,Nothing,objRange)

IfblnFound=TrueThenobjRange.Select

DecodeURLMethodReturnsaStringthatrepresentsadecodedWebaddressforthespecifiedencodedWebaddress.

expression.DecodeURL(bstrEncodedURL)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

bstrEncodedURLRequiredString.TheencodedWebaddresstodecode.

Remarks

DecodingaURLincludesreplacing"%20"withspaces.UsetheEncodeURLmethodtoencodeaWebaddress.

Example

ThefollowingexampledecodesthespecifiedWebaddress.

DimstrDecodedURLAsString

strDecodedURL=Application.DecodeURL_

("http://www.fourthcoffee.com/our%20best%20coffee.htm")

ShowAll

DeleteMethodDeletemethodasitappliestotheNavigationNodesobject.

DeletesanindividualnavigationnodefromthelistofavailablenodesintheNavigationNodescollection.

expression.Delete(Index)

expressionRequired.AnexpressionthatreturnsaNavigationNodesobject.

IndexOptionalVariant.Referstoaniteminthenavigationstructure.Canbeanynumbercorrespondingtoaniteminthenavigationstructure,withtheindexstartingatzero.

DeletemethodasitappliestothePropertiesobject.

DeletesapropertyfromthelistofavailablepropertiesinthePropertiescollection.

expression.Delete(PropertyKey)

expressionRequired.AnexpressionthatreturnsaPropertiesobject.

PropertyKeyRequiredString.Astringthatrepresentsthepropertyname.

DeletemethodasitappliestotheWebExobject.

DeletesaWebsitefromthelistofavailableWebsitesintheWebscollection.

expression.Delete(WebDeleteFlags)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

WebDeleteFlagsOptionalFpWebDeleteFlags.DetermineswhatisdeletedfromthecurrentWebsite.DefaultisfpDeleteEntireWeb.

FpWebDeleteFlagscanbeoneoftheseFpWebDeleteFlagsconstants.fpDeleteEntireWebdefaultfpDeleteFrontPageInfoFromWeb

DeletemethodasitappliestotheWebFilesandWebFoldersobjects.

DeletesataskfromthelistofavailabletasksintheWebFilescollection,orafolderorfoldersfromthelistofavailablefoldersintheWebFolderscollection.

expression.Delete(Index)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

IndexRequiredVariant.ReferstoanitemintheWebFilesorWebFolderscollection.Canbeanynumbercorrespondingtoaniteminthecollection,withtheindexstartingatzero.

DeletemethodasitappliestotheWebsobject.

DeletesaWebsitefromthelistofavailableWebsitesintheWebscollection.

expression.Delete(Index,WebDeleteFlags)

expressionRequired.AnexpressionthatreturnsaWebsobject.

IndexRequiredVariant.ReferstoanitemintheWebscollection.Canbeanynumbercorrespondingtoaniteminthecollection,withtheindexstartingatzero.

WebDeleteFlagsOptionalFpWebDeleteFlags.DetermineswhatisdeletedfromthecurrentWebsite.DefaultisfpDeleteEntireWeb.

FpWebDeleteFlagscanbeoneoftheseFpWebDeleteFlagsconstants.fpDeleteEntireWebdefaultfpDeleteFrontPageInfoFromWeb

DeletemethodasitappliestoallotherobjectsintheAppliesTolist.

DeletesthespecifiedobjectfromaWebsite.

expression.Delete

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Example

AsitappliestotheNavigationNodesobject.

ThisexampledeletesthefourthnavigationnodeofthesecondfileintheactiveWebsite.

NoteYoumustapplythenavigationstructuretotheWebsiteinorderforthechangestobeappliedtotheWebsite.

PrivateSubDeleteNavNode()

DimmyWebAsWebEx

DimmyChildNodesAsNavigationNodes

DimintResponseAsInteger

SetmyWeb=ActiveWeb

SetmyChildNodes=_

myWeb.RootFolder.WebFiles(1).NavigationNode.Children

intResponse=MsgBox("Areyousureyouwantto"&_

"deletethisnavigationnode?",vbYesNo)

IfintResponse=vbYesThen

CallmyChildNodes.Delete(3)

myWeb.ApplyNavigationStructure

EndIf

EndSub

AsitappliestothePropertiesobject.

ThisexampledeletestheSaleTextpropertyfromtheSales.htmfile.

PrivateSubDeleteProperty()

DimmyFileAsWebFile

DimmyPropAsString

DimintResponseAsInteger

myProp="SaleText"

SetmyFile=ActiveWeb.RootFolder.Files("Sales.htm")

intResponse=MsgBox("Areyousureyouwanttodeletethe"&_

myProp&"property?",vbYesNo)

Ifintrespons=vbYesThen

myFile.Properties.DeletemyProp

EndIf

EndSub

AsitappliestotheWebExobject.

ThisexampledeletesatemporaryWebsitecalledTempWeb.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\TempWeb".Or,youmaysubstituteanalternativeWebsiteURL.

PrivateSubDeleteWeb()

DimmyWebAsWebEx

DimmyTempWebAsWebEx

DimmyFoldersAsWebFolders

DimmyFolderAsWebFolder

DimmyWebToDeleteAsString

DimintResponseAsString

SetmyWeb=Webs.Open("C:\MyDocuments\MyWebs")

SetmyFolders=myWeb.RootFolder.Folders

myWebToDelete="TempWeb"

ForEachmyFolderInmyFolders

IfmyFolder.IsWeb=TrueThen

IfmyFolder.Name=myWebToDeleteThen

intResponse=MsgBox("Areyousureyouwanttodelete"&_

"the"&myFolder.Name&"subWebsite?",vbYesNo)

IfintResponse=vbYesThen

SetmyTempWeb=Webs.Open(myFolder.Name)

myTempWeb.Delete

EndIf

EndIf

EndIf

Next

ActiveWebWindow.Close

EndSub

AsitappliestotheWebFilescollection.

ThisstatementdeletesafileintheactiveWebsite.

NoteTorunthisexample,youmusthaveafilecalled"C:\MyDocuments\MyWebSites\TempFile.htm".Or,youmaysubstituteanalternativefilename.

PrivateSubDeleteWebFile()

DimintResponseAsInteger

intResponse=MsgBox("Areyousureyouwant"&_

"todeletethisfile?",vbYesNo)

IfintResponse=vbYesThen

ActiveWeb.RootFolder.Files.Delete"TempFile"

EndIf

EndSub

ShowAll

EditMethodTheEditmethodisusedtoopenMicrosoftFrontPagecompatiblefilesinapagewindow.ThesefilesincludefileformatssuchasHTML,CSS,andASP.Toopenfilesofothertypes,usetheOpenmethod.

NoteHTMLfileswithoutextensionswillnotopenwiththeEditmethod.

expression.Edit(ViewMode)

expressionAnexpressionthatreturnsaWebFileobject.

ViewModeOptionalFpPageViewMode.

FpPageViewModecanbeoneoftheseFpPageViewModeconstants.fpPageViewDefaultdefaultfpPageViewHtmlfpPageViewNoFramesfpPageViewNormalfpPageViewNoWindowfpPageViewPreview

Example

ThisexampleshowshowtousetheEditmethodtoopenafileforediting.

NoteTorunthisprogram,youmusthaveaWebsiteopenthatcontainsafilecalled"RedWines.htm."Or,youmaysubstituteafileofyourchoice.

PrivateSubModifyFile()

DimmyFileAsWebFile

SetmyFile=ActiveWeb.RootFolder.Files("RedWines.htm")

myFile.Edit

EndSub

EncodeURLMethodReturnsaStringthatrepresentstheencodedWebaddressforthespecifiedWebaddress.

expression.EncodeURL(bstrDecodedURL)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

bstrDecodedURLRequiredString.TheWebaddresstoencode.

Remarks

EncodingaURLincludesreplacingspaceswith"%20".UsetheDecodeURLmethodtodecodeaWebaddress.

Example

thefollowingexampleencodesthespecifiedWebaddress.

DimstrEncodedURLAsString

strEncodedURL=Application.EncodeURL_

("http://www.fourthcoffee.com/ourbestcoffee.htm")

ShowAll

ImportWebPackageMethodReturnsanFpPkgImportResultthatrepresentswhetherthespecifiedpackagewasimportedorwhethertherewereproblemswiththeimport.

FpPkgImportResultcanbeoneofthefollowingFpPkgImportResultconstants.

fpPkgImportCancelled Importwascancelledbytheuser.fpPkgImportComplete Importwascompletedsuccessfully.

fpPkgImportErrorInPackageImportwascancelledbecauseanerrorinthepackagewasfound(forexample,aninvalidmanifestordamagedfiles).

fpPkgImportFailed Importfailedforanunknownreason.

fpPkgImportNotTrusted

ImportwascancelledbecausethepackagewasnotsignedbyatrustedcertificateortheFpPkgTrustLevelparameterwasnotsettofpPkgTrustAll.

fpPkgImportServerNotSupportedImportwascancelledbecausetheserveronwhichtheWebsiteislocateddoesnotsupportWebpackages.

fpPkgImportStopped

Importwascancelledbecauseafile,folder,orlistconflictcausedtheimportprocesstostopasaresultofthevalueofthefpConflictOptsparameter

expression.ImportWebPackage(packageFileName,urlDeployTo,FpPkgTrustLevel,fpConflictOpts)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

packageFileNameRequiredString.Thepathandfilenameofthepackagetobeimported.

urlDeployToRequiredString.Thepathtowhichtoimportthefilesincluded

intheWebpackage.

FpPkgTrustLevelRequiredFpPkgTrustLevel.SpecifieswhethertotrustallWebpackagesoronlythosethataredigitallysignedbyatrustedsource.

FpPkgTrustLevelcanbeoneofthefollowingFpPkgTrustLevelconstants.

fpPkgTrustAllfpPkgTrustCertificateStore

fpConflictOptsRequiredFpPkgImportConflictOpts.Specifieshowtohandleconflicts.

FpPkgImportConflictOptscanbeoneofthefollowingFpPkgImportConflictOptsconstants.

fpPkgFileConflictMaskfpPkgListConflictMask

fpPkgOnConflictSkipSkipsimportinganyfilesifaconflictariseswhenimportingaWebpackage,andcontinuestheimportprocess.

fpPkgOnConflictStop

StopstheimportprocessifanyconflictariseswhenimportingaWebpackage,andcontinuestheimportprocess.

fpPkgOnFileConflictOverwrite Ifafileconflictexists,overwritesthatfile.

fpPkgOnFileConflictSkip

SkipsimportingafileintheWebpackagethatconflictswithafileintheWebsite,andcontinuestheimportprocess.

fpPkgOnFileConflictStopStopstheimportprocessifafileiftheWebpackageconflictswithanexistingfileintheWebsite.

fpPkgOnListConflictMergeOrRename

Mergeslistsiftheyarecompatible;otherwise,theWeblistsarebackedupandimported,andtheimportprocesscontinues.

fpPkgOnListConflictMergeOrSkipMergeslistsifcompatible;otherwise,theimportprocessskipstheconflictinglistsandcontinues.

fpPkgOnListConflictMergeOrStop Mergeslistsifcompatible;otherwise,theimportprocessstops.

fpPkgOnListConflictRename Backsupallconflictinglistsandcontinuestheimportprocess.

fpPkgOnListConflictSkip Skipsdeploymentofalistifalistconflictexists.

fpPkgOnListConflictStop StopstheimportprocessofaWebpackageifalistconflictexists.

Remarks

YoucanimportWebpackagesonlyintoWebsitesbasedonMicrosoftWindowsSharePointServices.

Example

ThefollowingexampleimportsthespecifiedWebpackageintoanewfolderintheactiveWebsite.

DimobjWebAsWebEx

DimobjFolderAsWebFolder

SetobjWeb=ActiveWeb

SetobjFolder=objWeb.AllFolders.Add("NewWebPackageFolder")

objWeb.ImportWebPackage"c:\NewWebPackage.fwp",objFolder.Url,_

fpPkgTrustCertificateStore,fpPkgOnListConflictSkip

LocateFileMethodReturnsthespecifiedWebFileobject.

expression.LocateFile(FileUrl)

expressionAnexpressionthatreturnsaWebExobject.

FileUrlRequiredString.DefaultvalueisthefileportionoftheURL.

Example

ThisexamplelocatesafileintherootdirectoryoftheWebsiteandputsthefileineditmode.

NoteYoumusthaveaWebsiteopenandafilecalled"Zinfandel.htm,"oryoumaysubstituteafileofyourchoice.

PrivateSubLocateAFile()

DimmyFileAsWebFile

SetmyFile=Webs(0).LocateFile("Zinfandel.htm")

myFile.Edit

EndSub

Inmostcases,youwouldprobablyusetheentireURLfortheStringargumentoftheLocateFilemethod—forexample,ifyouwantedtolocatethefileFirst_Qtr.htminC:/MyDocuments/MyWebSites/RogueCellars/Inventory/First_Qtr.htm.AnytimeafolderexistsinaleveldeeperthantherootdirectoryoftheWebsite,usetheentireURLasshowninthefollowingexample.

PrivateSubGetFile()

DimmyFileAsString

DimmyFileFoundAsWebFile

myFile=_

"C:/MyDocuments/MyWebSites/RogueCellars/Inventory/First_Qtr.htm"

SetmyFileFound=Webs(0).LocateFile(myFile)

EndSub

However,thereisashortcut.Forexample,ifyouwanttolocateafileinanimagesfolderthatresidesintherootdirectoryoftheWebsite,youcanusearelativeaddressbyusingaforwardslashfollowedbythesubfolderandfilenameasshowninthefollowingstatement.

SetmyFileFound=Webs(0).LocateFile("images/JPG/myJPGFileList.htm")

NoteYoucannotsubstituteabackslashinarelativeaddress.

LocateFolderMethodReturnsthespecifiedWebFolderobject.

expression.LocateFolder(FolderUrl)

expressionAnexpressionthatreturnsaWebFolderobject.

FolderUrlRequiredString.ThedefaultvalueisthefolderportionoftheURL.

Example

ThisexamplelocatesafolderintherootdirectoryofaWebsite.

NoteYoumusthaveaWebsiteopenforalloftheseexamples.

PrivateSubLocateAFolder()

DimmyFolderFoundAsWebFolder

SetmyFolderFound=Webs(0).LocateFolder("images")

EndSub

Inmostcases,youwouldprobablyusetheentireURLfortheStringargumentoftheLocateFoldermethod.Forexample,afoldermaybeseverallevelsdeepinthefolderhierarchy,suchasC:/MyDocuments/MyWebSites/RogueCellars/Inventory/First_Quarter—andyouwanttolocateFirst_Quarter.AnytimeafolderexistsinaleveldeeperthantherootdirectoryoftheWebsite,usetheentireURLasshowninthefollowingexample.

PrivateSubGetFolder()

DimmyFolderAsString

DimmyFolderFoundAsWebFolder

myFolder=_

"C:/MyDocuments/MyWebSites/RogueCellars/Inventory/First_Quarter"

SetmyFolderFound=_

Webs(0).LocateFolder(myFolder)

EndSub

However,thereisashortcut.Forexample,ifyouwanttolocateanimagesfolderthatresidesintherootdirectoryoftheWebsite,youcanusearelativeURLbyusingaforwardslashfollowedbythesubfoldernameasshowninthefollowingstatement.

SetmyFolderFound=Webs(0).LocateFolder("images/JPG")

NoteYoucannotsubstituteabackslashinarelativeURL.

ShowAll

LocatePageMethodLocatePagemethodasitappliestotheApplicationobject.

ReturnsaPageWindowExobjectforthespecifiedobject.

expression.LocatePage(DocumentUrl,ViewMode)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

DocumentUrlRequired.AStringthatrepresentsthedocumentorfileportionoftheentireURL.ThiscanbeanyabsoluteURL,suchas"http://webserver/file"or"file://filesystem/file"fordisk-basedWebsites.ThedefaultvalueisthefileportionoftheURL.

ViewModeOptional.AnFpPageViewModeconstantthatrepresentstheviewmode.

FpPageViewModecanbeoneoftheseFpPageViewModeconstants.fpPageViewDefaultdefaultfpPageViewHtmlfpPageViewNoFramesfpPageViewNormalfpPageViewNoWindowfpPageViewPreview

LocatePagemethodasitappliestotheWebExobject.

ReturnsthePageWindowExobjectassociatedwiththecurrentWebsite.

expression.LocatePage(FileUrl,ViewMode)

expressionRequired.AnexpressionthatreturnsaWebExobject.

FileUrlRequired.AStringthatrepresentsthedocumentorfileportionoftheentireURL.

ViewModeOptional.AnFpPageViewModeconstantthatrepresentstheviewmode.

FpPageViewModecanbeoneoftheseFpPageViewModeconstants.fpPageViewDefaultdefaultfpPageViewHtmlfpPageViewNoFramesfpPageViewNormalfpPageViewNoWindowfpPageViewPreview

Example

ThisexamplelocatesapageintherootWebsiteandasubsite.

PrivateSubLocatePages()

DimmyRootPageAsPageWindowEx

DimmyWebPageAsPageWindowEx

SetmyRootPage=_

Application.LocatePage("Zinfandel.htm",fpPageViewNormal)

SetmyWebPage=_

Webs(1).LocatePage("Zinfandel.htm",fpPageViewNormal)

EndSub

MakeAbsMethodReturnsaStringthatrepresentsanabsoluteURLfortheStringspecifiedintheURLparameter,usingtheURLBaseparameterasthestartingpoint.IftheURLisalreadyabsolute,theURLisreturnedunchanged.FormoreinformationaboutabsoluteandrelativeURLs,refertoUnderstandingAbsoluteandRelativeURLAddressing.

expression.MakeAbs(UrlBase,Url)

expressionAnexpressionthatreturnsaApplicationobject.

UrlBaseRequiredVariant.AbaseURL.CanbeastringoraWebEx,WebFolder,WebFile,NavigationNode,orIHTMLDocument2object.

UrlRequiredString.AstringthatcontainstheentireURLfortheWebsite.ThiscanbeanyURLforaWebsite,suchas"http://webserver/folder"or"file://filesystem/folder"fordisk-basedWebsites.

Example

ThisexamplechangesarelativeURLtoanabsoluteURL.

NoteTorunthisexample,youmusthaveaWebsiteandafilecalled"C:\MyDocuments\MyWebSites\RogueCellars\Zinfandel.htm."Or,youmaysubstituteanalternativeWebsiteURLorfilename.

PrivateSubMakeURLAbsolute()

DimmyBaseURLAsWebEx

DimmyAbsAddressAsString

DimmyLocalUrlAsString

myBaseURL=Webs.Open("C:\MyWebSites")

myLocalUrl="Zinfandel.htm"

myAbsAddress=MakeAbs(myBaseURL,myLocalUrl)

EndSub

MakeRelMethodReturnsaStringthatrepresentsarelativeURLfortheStringspecifiedintheURLparameter,usingtheURLBaseparameterasthestartingpoint.IftheURLisalreadyrelativetotheURLBaseparameter,theURLisreturnedunchanged.FormoreinformationaboutabsoluteandrelativeURLs,refertoUnderstandingAbsoluteandRelativeURLAddressing.

expression.MakeRel(UrlBase,Url)

expressionAnexpressionthatreturnsanApplicationobject.

UrlBaseRequiredVariant.AbaseURL.CanbeastringoraWebEx,WebFolder,WebFile,NavigationNode,orIHTMLDocument2object.

UrlRequiredString.AstringthatcontainstheentireURL.ThiscanbeanyURLforaWebsite,suchas"http://webserver/folder"or"file://filesystem/folder"fordisk-basedWebsites.

Example

ThisexamplechangesanabsoluteURLtoarelativeURL,addsahyperlinktotheactivedocumentusingtherelativeURL,andthensavesthechangestothedocument.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\RogueCellars."Youmustalsohavetwofiles,onecalled"Zinfandel.htm"andtheothercalled"index.htm,"whichhasanabsoluteURL(thedefaultstate).Or,youmaysubstituteanalternativeWebsiteURLandfilenames.

PrivateSubMakeURLRelative()

DimmyFileAsWebFile

DimmyFile2AsWebFile

DimmyBaseURLAsWebEx

DimmyDocAsFPHTMLDocument

DimmyRelAddressAsString

DimmyRelAddress2AsString

SetmyBaseURL=Webs.Open("C:\MyDocuments\MyWebSites\RogueCellars")

SetmyFile=myBaseURL.RootFolder.Files("Zinfandel.htm")

SetmyFile2=myBaseURL.RootFolder.Files("index.htm")

SetmyDoc=myFile.Edit(fpPageViewNormal).Document

myRelAddress=MakeRel(myBaseURL,myFile2.Url)

myRelAddress2=""""&myRelAddress&""""

CallmyDoc.body.insertAdjacentHTML("BeforeEnd","<ahref="_

&myRelAddress2&">"&myRelAddress&"</a>")

ActivePageWindow.Save

EndSub

MakeWebMethodCreatesanewWebsitefromanexistingfolder.TocreateanewWebsitewithoutfirstcreatingafolder,seetheAddmethod.

SecurityAvoidusinghard-codedpasswordsinyourapplications.Ifapasswordisrequiredinaprocedure,requestthepasswordfromtheuser,storeitinavariable,andthenusethevariableinyourcode.Forrecommendedbestpracticesonhowtodothis,seeSecurityNotesforMicrosoftOfficeSolutionDevelopers.

expression.MakeWeb(UserName,Password)

expressionAnexpressionthatreturnsaWebFolderobject.

UserNameOptionalString.Thelogonnameoftheuser.YoucanusethisoptiontocreateadefaultusernamefortheWebsite.

PasswordOptionalString.Thepasswordoftheuser.YoucanusethisoptiontocreateadefaultpasswordfortheWebsite.

Example

ThisexamplecreatesanewWebsitefromanexistingfoldernamed"Distributors,"whichisafolderintheRogueCellarsWebsite.ThisexampleassumesthatthereisaWebsiteonyourlocalcomputernamedRogueCellarsthatcontainsafoldernamedDistributors.Alternatively,youcansubstituteadifferentWebsiteandfoldername.

PrivateSubMakeWeb()

DimmyWebAsWebEx

DimmyFolderAsWebFolder

SetmyWeb=Webs("C:\MyWebSites\RogueCellars")

myWeb.Activate

SetmyFolder=Active.RootFolder.Folders("Distributors")

myFolder.MakeWeb

EndSub

ShowAll

MoveMethod(WebObjectModel)MovemethodasitappliestotheWebFileandWebFolderobjects.

MovesthespecifiedobjectfromitscurrentlocationtoadesignatedURL.

expression.Move(DestinationUrl,UpdateLinks,ForceOverwrite)

expressionAnexpressionthatreturnsoneoftheaboveobjects.

DestinationUrlRequiredString.ThetargetURL,suchas"C:\MyDocuments\MyWebSites\AdventureWorks".

UpdateLinksRequiredBoolean.Truetoupdatelinksduringthemoveprocess.

ForceOverwriteRequiredBoolean.Truetooverwriteduplicatefilesorfolders.

MovemethodasitappliestotheNavigationNodeobject.

Movesanavigationnodefromonelocationtoanotherinthenavigationstructure.ReturnsaNavigationNodeobjectthatrepresentsthenodeafterithasbeenmoved.

expression.Move(NodeCollection,NewLeftSibling)

expressionAnexpressionthatreturnsaNavigationNodeobject.

NodeCollectionRequiredNavigationNodes.Thetargetnavigationcollection.

NewLeftSiblingOptionalVariant.Thenavigationnodethatwillprecedethenewnodeinthenavigationstructure.Ifitisnotspecified,thenodewillbecomethelastnodeinthetargetnodecollectionspecifiedintheNodeCollectionparameter.

Example

AsitappliestotheWebFileobject.

Thefollowingstatementmovesafilefromonepositioninthefilestructuretoanother.

myFile.Move("C:\MyDocuments\MyWebSites\AdventureWorks\Images",_

True,False)

AsitappliestotheNavigationNodeobject.

Thefollowingexamplemovesanodefromthefifthpositioninthenavigationstructuretothefourthpositioninthenavigationstructurebydesignatingthethirdnodeasthenewleftsibling.

PrivateSubMoveNavNode()

DimmyNodesAsNavigationNodes

DimmyNodeAsNavigationNode

SetmyNodes=ActiveWeb.RootNavigationNode.Children

SetmyNode=myNodes(4)

myNode.Move(myNodes,2)

ActiveWeb.ApplyNavigationStructure

EndSub

OnTimeMethodStartsabackgroundtimerthatrunsamacroonthespecifieddateatthespecifiedtime.

expression.OnTime(When,Name,Tolerance)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

WhenRequiredVariant.Thetimeatwhichthemacroistoberun.Canbeastringthatspecifiesatime(forexample,"4:30pm"or"16:30"),oritcanbeaserialnumberreturnedbyafunctionsuchasTimeValueorTimeSerial(forexample,TimeValue("2:30pm")orTimeSerial(14,30,00)).Youcanalsoincludethedate(forexample,"6/304:15pm"orTimeValue("6/304:15pm")).

UsethesumofthereturnvaluesoftheNowfunctionandeithertheTimeValueorTimeSerialfunctiontosetatimertorunamacroaspecifiedamountoftimeafterthestatementisrun.Forexample,useNow+TimeValue("00:05:30")torunamacro5minutesand30secondsafterthestatementisrun.

NameRequiredString.Thenameofthemacrotoberun.Usethecompletemacropathtoensurethatthecorrectmacroisrun(forexample,"Project.Module1.Macro1").Forthemacrotorun,thedocumentortemplatemustbeavailablebothwhentheOnTimemethodisrunandwhenthetimespecifiedbyWhenarrives.

ToleranceOptionalVariant.Themaximumtime(inseconds)thatcanelapsebeforeamacrothatwasn'trunatthetimespecifiedbyWheniscanceled.Macrosmaynotalwaysrunatthespecifiedtime.Forexample,ifadialogboxisbeingdisplayed,themacrowillbedelayeduntilMicrosoftFrontPagehascompletedthetask.Ifthisargumentis0(zero)oromitted,themacroisrunregardlessofhowmuchtimehaselapsedsincethetimespecifiedbyWhen.

Remarks

MicrosoftFrontPagecanmaintainonlyonebackgroundtimersetbytheOnTimemethod.Ifyoustartanothertimerbeforeanexistingtimerruns,theexistingtimeriscanceled.

Example

Thisexamplerunsthemacronamed"Macro1"inthecurrentmoduleat3:55P.M.

Application.OnTimeWhen:=Timevalue("15:55:00"),Name:="Macro1"

Thisexamplerunsthemacronamed"Macro1"15secondsfromthetimetheexampleisrun.Themacronameincludestheprojectandmodulename.

Application.OnTimeWhen:=Now+TimeValue("00:00:15"),_

Name:="Project1.Module1.Macro1"

Thisexamplerunsthemacronamed"Start"at1:30P.M.Themacronameincludestheprojectandmodulename.

ShowAll

OpenMethodOpenmethodasitappliestotheWebFileobject.

OpensafileinaWebsite.

expression.Open

expressionRequired.AnexpressionthatreturnsaWebFileobject.

OpenmethodasitappliestotheWebsobject.

OpensaWebsite.ReturnsaWebExobject.

expression.Open(szWebUrl,UserName,Password,WebOpenFlags)

expressionRequired.AnexpressionthatreturnsaWebsobject.

szWebUrlRequiredString.ThebaseURLoftheWebsite,suchas"C:\MyWebSites".ThiscanbeanyabsoluteURL,suchas"http://webserver"or"file://filesystem"fordisk-basedWebsites.

UserNameOptionalString.Thelogonnameoftheuser.

PasswordOptionalString.AdesignatedstringofcharacterstovalidateaccesstothespecifiedWebsite.

WebOpenFlagsOptionalFpWebOpenFlags.

NoteAvoidusinghard-codedpasswordsinyourapplications.Ifapasswordisrequiredinaprocedure,requestthepasswordfromtheuser,storeitinavariable,andthenusethevariableinyourcode.Forrecommendedbestpracticesonhowtodothis,seeSecurityNotesforMicrosoftOfficeSolutionDevelopers.

FpWebOpenFlagscanbeoneoftheseFpWebOpenFlagsconstants.fpOpenInWindowdefaultfpOpenNoWindow

Example

ThefollowingexampleopenstheRogueCellarsWebsiteandtheOktoberfestSalefile,andperformsthefollowingtasks:

Addstexttothefilebycreatingapropertytoholdthetext.AccessesthePageobjectmodelusingtheActiveDocumentpropertyandtheinsertAdjacentTextmethod.AddstexttothepagebysubstitutingmySalePropforthetextparameterintheinsertAdjacentTextmethod.ClosesMicrosoftFrontPage.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\RogueCellars",oryoumaysubstituteanalternativeWebsiteURLandfilename.

PrivateSubAddSaleText()

DimobjWebAsWeb

DimobjFileAsWebFile

DimstrSalePropAsString

DimstrSaleTextAsString

strSaleText="VintageWinesforOktoberfestSale!!!"

SetobjWeb=Webs.Open("C:\MyDocuments\MyWebSites\RogueCellars")

SetobjFile=ActiveWeb.RootFolder.Files("Sale.htm")

objFile.Properties.Add"SaleText",mySaleText

strSaleProp=objFile.Properties("SaleText")

objFile.Open

ActiveDocument.body.insertAdjacentText"BeforeEnd",strSaleProp

WebWindows.Close

EndSub

ShowAll

PublishMethodPublishesaWebsitetoaWebserver.

expression.Publish(DestinationUrl,PublishFlags,UserName,Password)

expressionAnexpressionthatreturnsaWebExobject.

DestinationUrlRequiredString.AstringthatcontainstheentiretargetURLfortheWebsite,suchas“http://wwwroot/AdventureWorks”.ThiscanbeanyURLforaWebsite,suchashttp://webserver/folderorfile://filesystem/folderfordisk-basedWebsites.

PublishFlagsOptionalFpWebPublishFlags.

FpWebPublishFlagscanbeoneoftheseFpWebPublishFlagsconstants.fpPublishAddToExistingWebfpPublishCopyAllFilesfpPublishCopySubwebsfpPublishIncrementalfpPublishLogInTempDirfpPublishNoDeleteUnmatchedfpPublishUseLastPublishTimefpPublishNonedefault

UserNameOptionalString.ThenameoftheuserwhoispublishingtheWebsite.

PasswordOptionalString.Thepasswordoftheuser.

NoteAvoidusinghard-codedpasswordsinyourapplications.Ifapasswordisrequiredinaprocedure,requestthepasswordfromtheuser,storeitinavariable,andthenusethevariableinyourcode.Forrecommendedbestpracticesonhowtodothis,seeSecurityNotesforMicrosoftOfficeSolutionDevelopers.

Example

ThefollowingexamplepublishestheactiveWebsite.

NoteIftheWebsiteyouarepublishingtoisanexistingWebsite,youmustusetheargumentfpPublishAddToExistingWeb,otherwiseyourWebsitewon'tbepublished.IftheWebsiteyouarepublishingtodoesn'texist,don'tusethefpPublishAddToExistingWebargumentbecauseyourWebsitewon'tbepublished.

PrivateSubPublishMyWeb()

DimmyWebAsWebEx

DimmyBaseURLAsString

DimmyPublishParamAsFpWebPublishFlags

SetmyWeb=Application.ActiveWeb

myBaseURL="http://www.Adventure-Works.com"

myPublishParam=fpPublishAddToExistingWeb

myWeb.PublishmyBaseURL,myPublishParam

EndSub

QuitMethodQuitstheapplication.ThismethoddoesnotsaveanychangesthathavenotbeenpreviouslysavedusingtheSaveorSaveAscommand,butimmediatelyexitstheactiveapplication.

expression.Quit

expressionAnexpressionthatreturnsanApplicationobject.

Example

ThisexamplequitstheapplicationwithoutsavinganychangesthatweremadesincethepreviousSaveorSaveAscommandwasexecuted.

PrivateSubQuitApp()

Application.Quit

EndSub

RecalcHyperlinksMethodRecalculatesallmetadataontheserverforthespecifiedWebsite.Thisoperationwillrebuildallhyperlinks,titlesforWebpages,themesonpages,andsooninaMicrosoftFrontPageWebsite.

NoteThisoperationmaytakealongtimetocompletedependingontheamountofmetadataontheserver.

expression.RecalcHyperlinks

expressionAnexpressionthatreturnsaWebExobject.

Example

ThefollowingexamplerecalculatesthehyperlinksfortheactiveWebsite.

PrivateSubRecalcLinks()

DimmyWebAsWebEx

SetmyWeb=Application.ActiveWeb

myWeb.RecalcHyperlinks

EndSub

ShowAll

RefreshMethod(WebObjectModel)RefreshmethodasitappliestotheWebExobject.

RefreshesthespecifiedWebExobject.

expression.Refresh(FetchAll)

expressionRequired.AnexpressionthatreturnsaWebExobject.

FetchAllOptionalBoolean.Truetoretrieveallinformationforalldocumentsregardlessofview.WhensettoFalsethisargumentretrievesonlytheinformationnecessarytosupportthecurrentview.However,iftheReportsorHyperlinkviewisopen,Falserefreshesalldocuments.DefaultisFalse.

RefreshmethodasitappliestothePageWindowExobject.

Refreshesthespecifiedpagewithanoptiontosavechanges.

expression.Refresh(SaveChanges)

expressionRequired.AnexpressionthatreturnsaPageWindowExobject.

SaveChangesOptionalBoolean.Truetosavechanges.

Example

ThefollowingstatementsrefreshtheactivepageandthefirstpageofthefirstWebsiteopened.

ActivePageWindow.Refresh

WebWindows(0).PageWindows(0).Refresh

Youcanusethefollowingstatementtosaveanychangesyoumayhavemadetotheactivepage.

ActivePageWindow.Refresh(True)

YoucanusethefollowingstatementstorefreshtheactiveWebsiteandthefirstWebsiteopened.

ActiveWeb.Refresh

Webs(0).Refresh

ShowAll

RemoveMethod(WebObjectModel)ReturnsaBooleanthatrepresentswhetheraspecifiedfilewassuccessfullyremovedfromaWebpackage.

expression.Remove(Url,flags)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

UrlRequiredString.ThepathandfilenameofthefiletoremovefromtheWebpackage.

flagsRequiredFpDependencyFlags.SpecifieswhichdependenciestoincludewhenremovingtheWebpackage.

FpDependencyFlagscanbeacombinationofoneormoreofthefollowingFpDependencyFlagsconstants.

fpDepsDefault Removesallimages,linkbars,hyperlinks,lists,sharedborders,andthemes.

fpDepsImages Removesallimages.fpDepsLinkbars Removesalllinkbars.fpDepsLinks Removesallpagestowhichtherearehyperlinks.

fpDepsLists Removesliststhatmaybeneededinorderforthepagetorendercorrectly.

fpDepsNone Removesnodependencies.fpDepsRecurse Removesallfilesthatareinaspecifiedfolder.fpDepsSharedBorders Removesallsharedborders.fpDepsThemes Removesallthemes.

Example

ThefollowingexamplecreatesaWebpackageandaddsthreefilestoit,removesthelastfileaddedtothepackage,andthensavesthepackagetothelocaldrive.

SetobjWeb=ActiveWeb

SetobjPackage=objWeb.CreatePackage("NewWebPackage")

WithobjPackage

.AddobjWeb.Url&"/test.htm",fpDepsDefault

.AddobjWeb.Url&"/test2.htm",fpDepsNone

.AddobjWeb.Url&"/test3.htm",fpDepsImages

.RemoveobjWeb.Url&"/test3.htm",fpDepsImages

.Author="JohnSmith"

.Company="FourthCoffee"

.Subject="ThisisanewWebpackageforFourthCoffee."

.Save"c:\NewWebPackage.fwp",True

EndWith

RemoveChoiceMethodRemovesthespecifiedchoicefromthespecifiedfield.

expression.RemoveChoice(Index)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

IndexRequired.ALongthatrepresentsthepositionofthechoicewithinthearray.

Example

ThefollowingexampleremovesthefirstchoicefromtheNewChoiceFieldfieldinthefirstlistoftheactiveWebsite.

SubRemoveChoice()

'Removesfirstchoicefromarray

DimobjAppAsFrontPage.Application

DimobjListFieldsAslistFields

DimobjListFieldAsListFieldChoice

SetobjApp=FrontPage.Application

SetobjListFields=objApp.ActiveWeb.Lists.Item(0).Fields

SetobjListField=objListFields.Item("NewChoiceField")

'Removefirstchoiceinlist

objListField.RemoveChoiceIndex:=0

EndSub

RemoveWebMethodRemovesaWebsite.

expression.RemoveWeb(UserName,Password)

expressionAnexpressionthatreturnsaWebFolderobject.

UserNameOptionalString.Thelogonnameoftheuser.

PasswordOptionalString.Thepasswordoftheuser.

NoteAvoidusinghard-codedpasswordsinyourapplications.Ifapasswordisrequiredinaprocedure,requestthepasswordfromtheuser,storeitinavariable,andthenusethevariableinyourcode.Forrecommendedbestpracticesonhowtodothis,seeSecurityNotesforMicrosoftOfficeSolutionDevelopers.

Remarks

TheRemoveWebmethodisthecomplementoftheMakeWebmethod.JustastheMakeWebmethodcreatesthemetadatafortheWebsitefromafolder,theRemoveWebmethodremovesthemetadatafortheWebsitefromafolder,butthefolderremainsintact.ThisisdifferentfromtheDeletemethodfortheWebExobject,wheretheentirecontentsofthespecifiedWebsiteareremoved.

Example

ThefollowingexampleremovesaWebsitefromafolder.Thefolderanditscontentsremainintact,butthefolderisnolongeraWebsite.

NoteYoumusthavetheWebsitethatcontainsthefolderopen.

PrivateSubWebRemove()

DimmyFoldersAsWebFolders

DimmyFolderAsWebFolder

SetmyWebFolders=Webs(0).RootFolder.Folders

ForEachmyFolderInmyFolders

IfmyFolder.Name="TempWeb"Then

myFolder.RemoveWeb

ExitFor

EndIf

Next

EndSub

RunMethodRunsthedesignatedMicrosoftVisualBasicmacro.YoucanusetheRunmethodtoexecuteaspecifiedprocedureinMicrosoftFrontPage.YoucanalsousetheRunmethodfromwithintheprocedureofanActiveXcontrolthatcarriesoutinstructionstoqueryormodifyaFrontPage-basedWebsite.

NoteYoucannotpassparameterstoaprocedureusingtheRunmethod.UsetheCallstatementtopassparameterstoaprocedure.

expression.Run(MacroName,safeArrayOfParams)

expressionAnexpressionthatreturnsanApplicationobject.

MacroNameRequiredString.Thenameofthemacro,add-in,orscript.

safeArrayOfParamsRequired.AParamArrayoftypeVariant.

Example

Thefollowingexamplerunsamacrofromanotherprocedure.

NoteTorunthisexample,youmusthaveaWebsitenamedRogueCellarsoryoucansubstituteadifferentWebsiteinplaceoftheRogueCellarsWebsite.CopythefollowingproceduresintoacodemoduleandrunStartMacro.

PrivateSubStartMacro()

DimmyMacroAsString

myMacro="OpenRogueCellars"

Run(myMacro)

EndSub

SubOpenRogueCellars()

DimmyWebAsWeb

SetmyWeb=Webs.Open("C:\MyWebSites\RogueCellars")

EndSub

ShowAll

SaveMethodAsitappliestotheWebPackageobject.

SavesaWebpackagewiththespecifiedfilename.

expression.Save(strFileName,fOverWrite)

expressionRequired.AnexpressionthatreturnsaWebPackageobject.

strFileNameRequiredString.ThepathandfilenameoftheWebpackage.Webpackageshavean.fwpfilenameextension.TheSavemethoddoesnotautomaticallyincludethisfilenameextension,soyoushouldspecifyitaspartofthefilename.

fOverWriteRequiredLong.Falsetonotoverwriteanexistingfilewiththesamefilename.

AsitappliestothePageWindowExobject.

Savesaspecifiedpage.

expression.Save(ForceOverwrite)

expressionAnexpressionthatreturnsaPageWindowExobject.

ForceOverwriteOptionalBoolean.Falsetonotsaveoveranexistingfile.ThedefaultvalueisTrue.

Example

AsitappliestotheWebPackageobject.

ThefollowingexamplecreatesanewWebpackageandaddsthepage"test.htm"tothepackage,includingalldependenciesforthepage,andthensavesthenewWebpackage.

DimobjWebAsWebEx

DimobjPackageAsWebPackage

SetobjWeb=ActiveWeb

SetobjPackage=objWeb.CreatePackage("NewWebPackage")

WithobjPackage

.Author="JohnSmith"

.Company="FourthCoffee"

.Subject="ThisisanewWebpackageforFourthCoffee."

.AddobjWeb.Url&"/test.htm",fpDepsDefault

.Save"C:\MyDocuments\NewWebPackage.fwp",True

EndWith

AsitappliestothePageWindowExobject.

Thefollowingexamplecreatesaproperty,addsittoafile,andthensavesthepage.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\RogueCellars",oryoumaysubstituteanalternativeWebsiteURLandfilename.

PrivateSubAddSaleText()

DimmyWebAsWebEx

DimmyFileAsWebFile

DimmySalePropAsString

DimmySaleTextAsString

mySaleText="VintageWinesforOktoberfestSale!!!"

SetmyWeb=Webs.Open("C:\MyDocuments\MyWebSites\RogueCellars")

SetmyFile=ActiveWeb.RootFolder.Files("Sale.htm")

myFile.Properties.Add"SaleText",mySaleText

mySaleProp=myFile.Properties("SaleText")

myFile.Open

ActiveDocument.body.insertAdjacentText"BeforeEnd",mySaleProp

ActivePageWindow.Save

WebWindows.Close

EndSub

SaveAsMethodWritesthespecifiedpageobjecttothedestinationURL.

expression.SaveAs(DestinationUrl,ForceOverwrite)

expressionAnexpressionthatreturnsaPageWindowExobject.

DestinationUrlRequiredString.AstringthatcontainstheentireURLfortheWebsite,suchas“C:\MyDocuments\MyWebSites\AdventureWorks\index.htm”.ThiscanbeanyURLforaWebsite,suchashttp://webserver/folder/fileorfile://filesystem/folder/filefordisk-basedWebsites.

ForceOverwriteOptionalBoolean.Falsetonotsaveoveranexistingfile.ThedefaultvalueisTrue.

Example

ThefollowingexamplesavesanexistingfiletoanotherWebsiteunderanewname.(Itisn'tnecessarytochangethenameofthefile.)TheprogramfirstactivatesthecontainerWebsite,andthenitopensthefileandsavesittoadifferentWebsitewithanewname.

NoteYoumusthaveafilenamedZinfandel.htmintheC:\MyWebSitesfolder,orchangethenameofthefileintheprogramtomatchanexistingfileinyourWebsite.

PrivateSubSaveAsNewFile()

DimmyFileAsWebFile

DimmyPageWindowAsPageWindowEx

Webs("C:\MyWebSites").Activate

SetmyFile=ActiveWeb.RootFolder.Files("Zinfandel.htm")

myFile.Open

SetmyPageWindow=ActivePageWindow

myPageWindow.SaveAs("C:\MyWebSites\RogueCellars\ZinfandelSale.htm")

myPageWindow.Close

EndSub

ShowAll

SaveReportMethodSavesaspecifiedreporttoanHTMLfileontheuser'scomputer.

expression.SaveReport(reportviewModeEx,DestinationUrl,Title,ForceOverwrite)

expressionRequired.AnexpressionthatreturnsaWebWindowExobject.

reportviewModeExRequired.AnFpWebViewModeExconstantthatrepresentsthetypeofreportyouwanttosave.

FpWebViewModeExcanbeoneoftheseFpWebViewModeExconstants.fpWebViewExAllFilesfpWebViewExAssignedTofpWebViewExBrokenLinksfpWebViewExBrowserTypesfpWebViewExCategoriesfpWebViewExCheckoutStatusfpWebViewExComponentErrorsfpWebViewExDailyPageHitsfpWebViewExDailySummaryfpWebViewExFoldersfpWebViewExLinksfpWebViewExMonthlyPageHitsfpWebViewExMonthlySummaryfpWebViewExNavigationfpWebViewExOlderFilesfpWebViewExOsTypesfpWebViewExPagefpWebViewExPublishStatusfpWebViewExRecentlyAddedFilesfpWebViewExRecentlyChangedFiles

fpWebViewExReferringDomainsfpWebViewExReferringURLsfpWebViewExReviewStatusfpWebViewExSearchStringsfpWebViewExSiteSummaryfpWebViewExSlowPagesfpWebViewExTodofpWebViewExUnlinkedFilesfpWebViewExUsageSummaryfpWebViewExVisitingUsersfpWebViewExWeeklyPageHitsfpWebViewExWeeklySummary

DestinationUrlRequired.AStringthatrepresentsthetargetfilenameforthereport.

TitleRequired.AStringthatrepresentsthetitleofthenewreport.

ForceOverwriteOptional.ABooleanthatindicatesifanypreviouslycreatedreportwiththesamefilenamewillbeoverwrittenbythenewreport.IfTrue,anexistingfilewillbeoverwritten.ThedefaultvalueisTrue.

Example

ThefollowingexamplesavesareportofallfilesinthecurrentWebsitetoafilenamedReport1.htmonthelocaluser'scomputer.Thereportwilloverwriteanyexistingreportinthe\Reportsdirectorywiththename"Report1.htm".

SubReportSave()

'Savesaspecifiedreporttoaspecifiedlocation.

DimobjAppAsFrontPage.Application

DimobjWebwdwAsWebWindowEx

SetobjApp=FrontPage.Application

SetobjWebwdw=objApp.ActiveWebWindow

'Savethereport

objWebwdw.SaveReportreportviewModeEx:=fpWebViewExAllFiles,_

Title:="CurrentProjectProgress",_

DestinationURL:="C:\NewProject\Reports\Report1.htm",_

ForceOverwrite:=True

EndSub

SetChoicesMethodSetthechoicesforafieldoftypechoicetotheitemsindicatedintheppsaChoicesargument.

expression.SetChoices(ppsaChoices)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

ppsaChoicesRequiredString.Anarrayofitemsthatrepresentthechoicesinthelistfield.

ShowBordersShadingDialogMethodDisplaystheBordersandShadingdialogboxandreturnsaStringthatrepresentstheCascadingStyleSheetpropertysettingsforthebordersandshadingpropertiesselectedintheBordersandShadingdialogbox.AvalueisreturnedwhentheusersclicksOK.IftheuserclicksCancel,anemptyStringisreturned.

expression.ShowBordersShadingDialog(strCSSIn)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

strCSSInOptionalVariant.AStringthatrepresentstheinitialcustomsettingsforthedialogbox.

Example

ThefollowingexampledisplaystheBordersandShadingdialogbox,andthensetstheborderstylefortheactiveelementtothebordersettingsreturned.

DimstrCSSAsString

DimstrCSSInAsString

strCSSIn="border:3double#00FFFF"

strCSS=Application.ShowBordersShadingDialog(strCSSIn)

IfstrCSS<>""ThenActiveDocument.activeElement_

.Style.Border=strCSS

ShowFontDialogMethodDisplaystheFontdialogboxandreturnsaStringthatrepresentstheCascadingStyleSheetpropertiesforthefontpropertiesselectedintheFontdialogbox.AvalueisreturnedwhentheusersclicksOK.IftheuserclicksCancel,anemptyStringisreturned.

expression.ShowFontDialog(strCSSIn)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

strCSSInOptionalVariant.AStringthatrepresentstheinitialcustomsettingsforthedialogbox.

Example

ThefollowingexampledisplaystheFontdialogbox,andthensetsthefontstylefortheactiveelementtothefontsettingsreturned.

DimstrCSSAsString

DimstrCSSInAsString

strCSSIn="font-size:14pt;color:#FF0000"

strCSS=Application.ShowFontDialog(strCSSIn)

IfstrCSS<>""ThenActiveDocument_

.activeElement.Style.Font=strCSS

ShowHTMLDialogMethodDisplaysacustomdialogboxbyusingthecontentsofanHTMLpage.ReturnsaVariant.

expression.ShowHTMLDialog(Url,pVarArgIn)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

UrlRequiredString.Thepathandfilenameofthepagetorenderasadialogbox.

pVarArgInOptionalVariant.Datausedtosettheinitialsettingsofthecustomdialogbox.

Example

ThefollowingexampledisplaysthespecifiedWebpageinaMicrosoftWindowsdialogbox.

Application.ShowHTMLDialog("c:\test.htm")

ShowHyperlinkParametersMethodDisplaystheHyperlinkParameterdialogboxandreturnsaStringthatrepresentsthehyperlinkplustheparameters,separatedbyaquestionmark.

expression.ShowHyperlinkParameters(bstrPath,bstrQuery,bstrColumns,bstrColTypes)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

bstrPathRequiredString.SpecifiestheWebaddressforthehyperlink.

bstrQueryRequiredString.Specifiesthequerystringtopassinwhenopeningthelinkedpage.

bstrColumnsRequiredString.Specifiesacomma-delimitedStringthatcontainsthenamesofthedatabasecolumnsthatareavailableforuseintheURL.

bstrColTypesRequiredString.Specifiesacomma-delimitedStringthatrepresentsthedatatypevaluesofthedatabasecolumns.

Remarks

ThevaluesforthebstrColTypesparameterincludethefollowing.

Datatype Value Description

adArray 819 Whencombinedwithanotherdatatype,indicatesanarrayoftheotherdatatype.

adBigInt 20 Indicatesan8-bytesignedinteger.adBinary 128 Indicatesabinaryvalue.adBoolean 11 IndicatesaBooleanvalue.adBSTR 8 Indicatesanull-terminatedcharacterstring.

adChapter 136 Indicatesa4-bytechaptervaluethatidentifiesrowsinachildrowset.

adChar 129 Indicatesastringvalue.

adCurrency 6Indicatesacurrencyvalue.Currencyisafixed-pointnumberwithfourdigitstotherightofthedecimalpointandisstoredinaneight-bytesignedinteger.

adDate 7

Indicatesadatevalue.Adatevalueisstoredasadouble,thewholepartofwhichisthenumberofdayssinceDecember30,1899,andthefractionalpartofwhichisthefractionofaday.

adDBDate 133 Indicatesadatevalue(yyyymmdd).adDBTime 134 Indicatesatimevalue(hhmmss).

adDBTimeStamp 135 Indicatesadate/timestamp(yyyymmddhhmmssplusafractioninbillionths).

adDecimal 14 Indicatesanexactnumericvaluewithafixedprecisionandscale.

adDouble 5 Indicatesadouble-precisionfloating-pointvalue.adEmpty 0 Indicatesnovalue.adError 10 Indicatesa32-biterrorcode.

adFileTime 64 Indicatesa64-bitvaluerepresentingthenumberof100-nanosecondintervalssinceJanuary1,1601.

adGUID 72 Indicatesagloballyuniqueidentifier(GUID).

adIDispatch 9 IndicatesapointertoanIDispatchinterfaceonaCOMobject.(ADOdoesnotcurrentlysupportthisdatatype.Usagemaycauseunpredictableresults.)

adInteger 3 Indicatesa4-bytesignedinteger.

adIUnknown 13IndicatesapointertoanIUknowninterfaceonaCOMobject.(ADOdoesnotcurrentlysupportthisdatatype.Usagemaycauseunpredictableresults.)

adLongVarBinary 205 Indicatesalongbinaryvalue.adLongVarChar 201 Indicatesalongstringvalue.adLongVarWChar 203 Indicatesalongnull-terminatedUnicodevalue.

adNumeric 131 Indicatesanexactnumericvaluewithafixedprecisionandscale.

adPropVariant 138 IndicatesanAutomationPROPVARIANT.adSingle 4 Indicatesasingle-precisionfloatingpoint.adSmallInt 2 Indicatesa2-bytesignedinteger.adTinyInt 16 Indicatesa1-bytesignedinteger.adUnsignedBigInt 21 Indicatesan8-byteunsignedinteger.adUnsignedInt 19 Indicatesa4-byteunsignedinteger.adUnsignedSmallInt 18 Indicatesa2-byteunsignedinteger.adUnsignedTinyInt 17 Indicatesa1-byteunsignedinteger.adUserDefined 132 Indicatesauser-definedvariable.adVarBinary 204 Indicatesabinaryvalue.adVarChar 200 Indicatesastringvalue.

adVariant 12IndicatesanAutomationVariant.(ADOdoesnotcurrentlysupportthisdatatype.Usagemaycauseunpredictableresults.)

adVarNumeric 139 Indicatesanumericvalue.adVarWChar 202 Indicatesanull-terminatedUnicodecharacterstring.adWChar 130 Indicatesanull-terminatedUnicodecharacterstring.

FormoreinformationonActiveXdatatypes,seeActiveXDataObject(ADO)ontheMicrosoftDeveloperNetwork(MSDN)Website.

Example

ThefollowingexampledisplaystheHyperlinkParameterdialogboxwiththefollowingURLandsettings.

Application.ShowHyperlinkParameters"http://www.fourthcoffee.com/coffee.asp",_

"type=black","CategoryID,CategoryName,Description","3,202,202"

ShowImportWebPackageDialogMethodReturnsaBooleanthatindicateswhetherthemethodsuccessfullyaddedthespecifiedWebpackage.

expression.ShowImportWebPackageDialog(packageFileName,urlImportedTo)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

packageFileNameRequiredString.ThepathandfilenameoftheWebpackagetoimport.

urlImportedToRequiredString.ThepathandfilenameofwheretoimporttheWebpackage.

Remarks

YoucanimportWebpackagesonlyintoWebsitesbasedonMicrosoftWindowsSharePointServices.

Example

ThefollowingexampledisplaystheImportWebPackagedialogbox,andthenindicateswhetherthespecifiedWebpackagewasaddedsuccessfullytothespecifiedWebsite.

DimblnResponseAsBoolean

blnResponse=Application.ShowImportWebPackageDialog_

("c:\NewWebPackage.fwp",ActiveWeb.Url)

IfblnResponse=TrueThen

MsgBox"TheWebpackagewasaddedsuccessfully."

Else

MsgBox"UnabletoaddtheWebpackagetothespecifiedsite."_

&vbCrLf&"Contactyouradministratorforassistance."

EndIf

ShowPickURLDialogMethodDisplaysthetheEditHyperlinkdialogboxandreturnsaStringthatrepresentstheURLtothefilethattheuserhasselectedintheEditHyperlinkdialogbox.

expression.ShowPickURLDialog(strBaseURL,strFileURL)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

strBaseURLOptionalVariant.ThebaseURLfortheresultinghyperlink.

strFileURLOptionalVariant.Theselectedpageforanewhyperlink.TheusermaychangethisbyselectingadifferentpageintheEditHyperlinkdialogbox.

Example

ThefollowingexampledisplaysthetheEditHyperlinkdialogbox.

DimstrURLAsString

DimobjSelectionAsIHTMLTxtRange

DimstrHyperlinkAsString

strURL=Application.ShowPickURLDialog_

(ActiveWeb.Url,"c:\test.htm")

SetobjSelection=ActiveDocument.selection.createRange

WithobjSelection

strHyperlink="<ahref="""&strURL&""">"&.Text&"</a>"

.pasteHTMLstrHyperlink

EndWith

ShowPositionDialogMethodReturnsaStringthatrepresentsthevalueofthepositionattributeforacascadingstylesheet.

expression.ShowPositionDialog(strCSSIn)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

strCSSInOptionalVariant.AStringthatrepresentstheinitialcustomsettingsforthedialogbox.

Example

Thefollowingexamplesetsthepositionattributefortheactiveelementintheactivedocument.NotethatusingthesetAttributemethodoverwritesanyotherstyleattributesettingsfortheactiveelement.

DimstrCSSAsString

DimstrCSSInAsString

strCSSIn="position:absolute;left:750"

strCSS=Application.ShowPositionDialog(strCSSIn)

IfstrCSS<>""ThenActiveDocument.activeElement_

.setAttribute"style",strCSS

SplitArgsMethodReturnsaVariantthatrepresentsanarrayoftheindividualitemsinthespecifiedstringseparatedbythespecifiedcharacterstring.

expression.SplitArgs(String,Tokens)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

StringRequiredString.Thestringcontainingthedata.

TokensRequiredString.ThecharacterstringthatseparatestheitemsintheStringparameter.

Remarks

TheSplitArgsmethodissimilartotheSplitfunctioninMicrosoftVisualBasic;however,theSplitArgsmethodwillnotbreakquote-delimitedstrings.

Example

Thefollowingexamplesplitsthespecifiedstringintoanarrayoftheitemsinthespecifiedstringthatareseparatedbyacomma.

DimvarArray()AsVariant

varArray=Application.SplitArgs("this,isa,test",",")

UndoCheckoutMethodReturnsthespecifiedfiletoitspriorstateinthesourcecontrolprojectwithoutsavinganychangesthatmayhavebeenmade.

NoteYoumusthaveasourcecontrolprojectinplacebeforeusingthismethod.Forinformationaboutsourcecontrolprojects,refertoManagingSourceControlProjects.

expression.UndoCheckout

expressionAnexpressionthatreturnsaWebFileobject.

Example

Thefollowingexamplechecksafileintoitspriorstate(itsstatebeforecheckout).Thefilemustbepartofasourcecontrolproject.

NoteTorunthisprocedure,youmusthaveasourcecontrolprojectinplacewithaWebsiteopenandapagecalledZinfandel.htmcontainedintheWebsite.Or,substituteanalternateWebsiteandfilename.

PrivateSubUndoCheckout()

DimmyWebAsWebEx

SetmyWeb=("C:/MyWebSites/RogueCellars")

myWeb.RootFolder.Files("Zinfandel.htm").UndoCheckout

EndSub

UpdateDynamicTemplateMethodUpdatesthepagesthatareattachedtoaDynamicWebTemplatesothatanychangestotheDynamicWebTemplateareappliedtopagesthatreferencetheDynamicWebTemplate.

expression.UpdateDynamicTemplate(type,pbzLog)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

pStateRequiredDynamicTemplateState.SpecifiestheregionmappingtousewhenupdatingtheDynamicWebTemplate.UsetheSetHeadMappingandSetBodyMappingmethodsoftheDynamicTemplateStateobjecttocustomizeregionmapping.

pbzLogRequiredString.AByRefparameterthatreturnsaStringcontainingthelogentryabouttheupdateprocessforafile.Inthecaseofanerror,itreturnsinformationthatindicateswhichfileshavefailed.

Remarks

Ifanerroroccurs,theupdateprocesswillterminateunlesstheSkipOnQuerypropertyissettoTrue.

Example

ThefollowingexampleupdatestheDynamicWebTemplatereferencesinthespecifiedfile.

DimobjStateAsDynamicTemplateState

DimobjFileAsWebFile

DimstrLogAsString

SetobjState=Application.CreateDynamicTemplateState

SetobjFile=ActiveWeb.LocateFile("home.htm")

objFile.UpdateDynamicTemplateobjState,strLog

VerifyAllLinksMethodVerifiesallhyperlinksinthespecifiedWebsite.

NoteTheBrokenHyperlinksreportusestheVerifyAllLinksmethodtodisplayanypageswithbrokenhyperlinks.

expression.VerifyAllLinks

expressionRequired.AnexpressionthatreturnsaWebWindowExobject

Example

ThefollowingexampleusestheVerifyAllLinksmethodtocheckforbrokenlinksintheactiveWebsite,andthenswitchestotheBrokenHyperlinksreportview.

SubVerifyLinks()

'Verifiesbrokenlinksinthecurrentview

DimobjAppAsFrontPage.Application

DimobjWebwdwAsWebWindowEx

SetobjApp=FrontPage.Application

SetobjWebwdw=objApp.ActiveWebWindow

'Verifyalllinksinthecurrentweb.

objWebwdw.VerifyAllLinks

EndSub

ActiveDocumentPropertyReturnsanFPHTMLDocumentobjectthatrepresentstheWebpagecurrentlydisplayedintheMicrosoftFrontPageapplicationwindow.

expression.ActiveDocument

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

ThisobjectprovidesaccesstotheMicrosoftFrontPagePageObjectModelelementsthatarecompatiblewithMicrosoftInternetExplorer4.0andlater.ThisobjectmodelprovidesprogrammaticaccesstotheHTMLinthespecifiedpage.

Example

ThefollowingstatementreturnstheactivedocumentinFrontPage.

myDoc=Application.ActiveDocument

Thefollowingstatementreturnstheactivedocumentforthespecifiedpagewindow.

myDoc=Application.WebWindows(0).PageWindows(0).ActiveDocument

ActiveFrameWindowPropertyReturnsanFPHTMLWindow2objectthatrepresentsthedocumentdisplayedintheactivepagewindow.

NoteIftheactivepagecontainsframes,theActiveFrameWindowpropertyreturnsthecurrentlyselectedframe,ifoneisselected,ortheframespageitself,ifnoneoftheframesisselected.Ifapagedoesnotcontainframes,theActiveFrameWindowpropertyreturnsthewindowcontainingthespecifiedpage.

expression.ActiveFrameWindow

expressionRequired.AnexpressionthatreturnsaPageWindowExobject.

NoteAccessingtheActiveFrameWindowpropertyisthesameasaccessingtheparentwindowthroughtheactivepagewindowasfollows:

ActivePageWindow.Document.parentWindow

Example

ThefollowingexampleretrievestheActiveFrameWindowobject.

PrivateSubGetActiveFrame()

DimmyPageWindowAsPageWindowEx

DimmyFrameAsFPHTMLWindow2

SetmyPageWindow=_

ActiveWeb.ActiveWebWindow.ActivePageWindow

SetmyFrame=myPageWindow.ActiveFrameWindow

EndSub

ActivePageWindowPropertyReturnsaPageWindowExobjectthatrepresentsthewindowinwhichthecurrentpageisdisplayed.

expression.ActivePageWindow

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplereturnsthePageWindowExobjectfortheApplicationobject.

PrivateSubGetActivePageWindow()

DimmyPageWindowAsPageWindowEx

SetmyPageWindow=ActivePageWindow

EndSub

ThefollowingexamplereturnsthePageWindowExobjectfromtheWebWindowExobject.

PrivateSubGetActivePageWindow()

DimmyPageAsPageWindowEx

SetmyPage=ActiveWebWindow.ActivePageWindow

EndSub

ActiveWebPropertyReturnsaWebExobjectthatrepresentstheWebsitecurrentlyopeninMicrosoftFrontPage.

expression.ActiveWeb

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

TheMicrosoftFrontPageVisualBasicforApplicationsobjectmodelprovidesaccesstotheWebobjectmodelthroughtheActiveWebproperty.FormoreinformationabouttheFrontPageobjectmodels,seeExploringtheObjectModelinFrontPage.

Example

ThisexampleusestheActiveWebpropertytolocatetheWebpageindex.htmandchangesthebackgroundcolorofthepage.

NoteTorunthisexample,createaformwithonecommandbuttoncalledcmdActiveWebColorChangeandpastethefollowingcodeinthecodewindow.YoumusthaveaWebpagecalledindex.htmforthisproceduretochangethebackgroundcolor.

PrivateSubcmdActiveWebBKGRDColorChange_Click()

DimmyPageWinAsPageWindowEx

SetmyPageWin=Application.ActiveWeb.LocatePage("index.htm")

myPageWin.Document.bgColor="PapayaWhip"

EndSub

NoteMicrosoftVisualBasicprovidescolorconstantswitha"vb"prefix,suchasvbCyan.FrontPagebuildsWebpagesinHTML,whichusesdifferentcolorconstantsthanVisualBasic.IfyouusethecolorconstantsprovidedwithVisualBasicinyourexistingprograms,youmayneedtochangethesetotheequivalenthexadecimalcolorvalueswhenyouportyourprogramstoaFrontPage-basedWebsite,orwhenyouusecolorsacrossMicrosoftOfficeapplicationsthatincludeaFrontPage-basedWebsite.

ActiveWebWindowPropertyReturnsaWebWindowExobjectthatrepresentsthewindowinwhichthecurrentlyopenWebsiteisdisplayed.

expression.ActiveWebWindow

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThisexampleprintsthevalueoftheActiveDocument.nameProppropertyfortheWebExobject.

NoteTorunthisexample,createaformwithacommandbuttoncalled"cmdActiveWebWindowDisplay"andalabelcalled"lblWebWindowDisplay".Pastethefollowingcodeinthecodewindow.YoumusthaveaMicrosoftFrontPage-basedWebpageopenforthisproceduretoreturnadocumentname.

PrivateSubcmdActiveWebWindowDisplay_Click()

OnErrorResumeNext

DimmyCurrentWebWindowAsWebWindowEx

SetmyCurrentWebWindow=Application.ActiveWebWindow

WithmyCurrentWebWindow

lblWebWindowDisplay.Caption=.ActiveDocument.nameProp

EndWith

EndSub

AllFilesPropertyReturnsaWebFilescollectionthatrepresentsallfilesinthespecifiedWebsite.

expression.AllFiles

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

TheWebFilescollectionreturnsallfilesinthecollectionregardlessoftheirpositionintheWebsitehierarchy.

Example

ThefollowingexamplesearchesthroughthefilesintheactiveWebsiteforapagewiththetitle"MainPage."Ifthepageisfound,itisopenedinMicrosoftFrontPage.

SubFindFileTitle()

'ReturnsacollectionofallfilesinthecurrentWebsite.

DimobjAppAsFrontPage.Application

DimobjWebFileAsWebFile

DimobjWebFilesAsWebFiles

SetobjApp=FrontPage.Application

'CreateareferencetotheWebFilescollection.

SetobjWebFiles=objApp.ActiveWeb.AllFiles

'CheckeachfileinthecollectionforthetitleMainPage.

ForEachobjWebFileInobjWebFiles

'Ifthetitleisfoundopenthepageintheeditor.

IfobjWebFile.Title="MainPage"Then

objWebFile.Open

EndIf

'Ifnotfound,checknextfile.

NextobjWebFile

EndSub

AllFoldersPropertyReturnsaWebFolderscollectionthatrepresentsallfoldersinthecurrentWebsite.

expression.AllFolders

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

TheWebFolderscollectionreturnsallfoldersinthecollectionregardlessoftheirpositionintheWebsitehierarchy.

Example

ThefollowingexamplesearchesthroughtheWebFolderscollectionforafoldernamed"Folder1."Ifthefolderisfound,theexamplesearchesforafilewiththetitle"MainPage."Ifthetitleisfound,thefileisopenedinMicrosoftFrontPage.

SubWebFoldersFind()

DimobjAppAsFrontPage.Application

DimobjWebFolderAsWebFolder

DimobjWebFoldersAsWebFolders

SetobjApp=FrontPage.Application

'CreateareferencetotheWebFolderscollection.

SetobjWebFolders=objApp.ActiveWeb.AllFolders

'Checkeachfolderinthecollectionforthename"Folder1".

ForEachobjWebFolderInobjWebFolders

'Ifthefolderisfoundthensearchthrougheach

'fileinthefolderforafilewiththetitle

'MainPageandopenthefileifitexists.

IfobjWebFolder.Name="Folder1"Then

Fori=1ToobjWebFolder.Files.Count

IfobjWebFolder.Files.Item(i).Title="MainPage"Then

objWebFolder.Files.Item(i).Open

ExitFor

EndIf

Nexti

EndIf

'Ifnotfoundchecknextfile.

NextobjWebFolder

EndSub

AllNavigationNodesPropertyReturnsaNavigationNodescollectionobjectthatrepresentsallofthenavigationnodesinthespecifiedWebsite.

NoteNavigationnodesareusedtodisplayagraphicrepresentationofthecurrentWebsiteinNavigationview.

expression.AllNavigationNodes

expressionRequired.AnexpressionthatreturnsaWebExobject.

Example

ThefollowingexamplereturnsareferencetotheNavigationNodescollectionanddisplaysthefilenameofthefirstobjectinthecollectionandthetitleoftheWebsiteinwhichitexists.

SubAllNavigationNodes()

DimobjAppAsFrontPage.Application

DimobjNavNodeAsNavigationNode

DimobjNavNodesAsNavigationNodes

SetobjApp=FrontPage.Application

'CreateareferencetotheNavigationNodescollection.

SetobjNavNodes=objApp.ActiveWeb.AllNavigationNodes

'Returnareferencetothefirstnodeinthecollection.

SetobjNavNode=objNavNodes.Item(0)

'DisplaythefilenameandtheWebofthefirst

'navigationnodeinthecollection

MsgBox"TheURLofthisfileis"&objNavNode.Url&_

vbCr&".Itisfoundinthe"_

&objNavNode.Web.Title&"Website."

EndSub

AllowAttachmentsPropertySetsorreturnsaBooleanthatrepresentswhetheralistallowsallowsattachments.

expression.AllowAttachments

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

AllowFillInChoicesPropertySetsorreturnsaBooleanthatrepresentswhetherachoicefieldallowsuserstoenteracustomchoice.

expression.AllowFillInChoices

expressionRequired.AnexpressionthatreturnsaListFieldChoiceobject.

AllowModeratePropertySetsorreturnsaBooleanthatrepresentswhethertoallowusingthemoderationsettinginalist.

expression.AllowModerate

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

AllowMultipleResponsesPropertyReturnsorsetsaBooleanthatdetermineswhetheruserscanrespondmorethanoncetoagivensurvey.IfFalse,ausercanonlyrespondoncetoasurvey.

expression.AllowMultipleResponses

expressionRequired.AnexpressionthatreturnsaSurveyobject.

Example

ThefollowingexamplesetstheAllowMultipleResponsespropertyofallSurveyobjectsintheactiveWebsitetoFalsesothatuserscanonlyrespondoncetoagivensurvey.

SubChangeResponses()

'Setsnumberofresponsestooneperuser.

DimobjAppAsFrontPage.Application

DimobjListAsObject

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Cyclethrougheachlistandcheckforlisttype.

ForEachobjListInobjLists

'Ifit'saSurveythenchangeresponsestosingle.

IfobjList.Type=fpListTypeSurveyThen

objList.AllowMultipleResponses=False

EndIf

Next

EndSub

AllowRichHTMLPropertySetsorreturnsaBooleanthatrepresentswhethertodisplaytheRichTextFormat(RTF)editcontrolinthebrowser.

expression.AllowRichHTML

expressionRequired.AnexpressionthatreturnsaListFieldMultiLineobject.

AllowsLongFilenamesPropertyReturnsTrueiftheoperatingsystemonthemachinewheretheWebsiteresidesacceptslongfilenames.Read-onlyBoolean.

expression.AllowsLongFilenames

expressionRequired.AnexpressionthatreturnsaWebExobject.

Example

ThefollowingexamplecheckswhethertheactiveWebsiteallowslongfilenames.TheexampleassumestheexistenceofaprocedurenamedConvertLongFilenames.

IfActiveWeb.AllowsLongFilenames=TrueThen

ExitSub

Else

CallConvertLongFilenames()

EndIf

AnswerWizardPropertySomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

ReturnsanAnswerWizardobjectthatcontainsthefilesusedbytheHelpsearchengine.

expression.AnswerWizard

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThisexampleaddsanAnswerWizardfileandretrievestheCreatorandCountproperties.

NoteTheCreatorpropertyforMicrosoftFrontPageisdifferentfromtheCreatorpropertyusedbyotherMicrosoftOfficeobjects,suchastheAnswerWizardobject.TheCreatorpropertyforFrontPageusesastringformat,whileOfficeobjectsusea32-bitintegertoidentifytheapplicationthatcreatedthefile.Inthisexample,you'llnotethattheCreatorpropertyreturnsa32-bitintegerratherthantheFrontPagestringformatbecausetheAnswerWizardobjectisanOfficesharedobject.Formoreinformation,usetheObjectBrowserforalllibrariesorMicrosoftVisualBasicHelptoviewmoredetailedinformationabouttheCreatorpropertyforMicrosoftOfficeobjects.

PrivateSubGetAnswerWizardInfo()

DimmyAWAsAnswerWizard

DimmyAWFilesAsAnswerWizardFiles

DimmyAWCountAsInteger

DimmyAWCreatorAsString

SetmyAW=ActiveWeb.Application.AnswerWizard

SetmyAW=myAW.Files

WithmyAWFiles

myAWCreator=.Creator

.Add("myAWFile")

myAWCount=.Count

EndWith

EndSub

ApplicationPropertyReturnsanApplicationobjectthatrepresentstheMicrosoftFrontPageapplication.

expression.Application

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

TheapplicationnamecanbedirectlyaccessedfromtheobjectsandcollectionsintheFrontPageobjectmodel.ThisstatementshowstheFrontPageapplicationaccessedfromtheFilescollection.

SetcurrApp=ActiveWeb.RootFolder.Files.Application

AssistantPropertySomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

ReturnsanAssistantobjectthatrepresentstheMicrosoftOfficeAssistant.Read-only.

expression.Assistant

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThefollowingexamplereturnsareferencetotheMicrosoftOfficeAssistantandmodifiesitsproperties.ThesubroutinedisplaystheAssistantonthescreen,turnsanimationsoundson,andsetstheMoveWhenInTheWaypropertytoTrue.TheAssistantwillnowmovetoanotherlocationonthescreenifitisintheuser'sway.

SubfpAsst()

'CreatesareferencetotheOfficeAssistantandmodifiesitsproperties

DimobjAppAsFrontPage.Application

DimobjAsstAsAssistant

SetobjApp=FrontPage.Application

'ReturnareferencetotheOfficeAssistant

SetobjAsst=objApp.Assistant

WithobjAsst

'Makeassistantvisible

.Visible=True

'Allowsoundsduringanimations

.Sounds=True

'MovetheAssistantoutofthewaywhenneeded

.MoveWhenInTheWay=True

EndWith

EndSub

AuthorPropertySetsorreturnsaStringthatrepresentsthenameoftheauthorwhocreatedaWebpackage.

expression.Author

expressionRequired.AnexpressionthatreturnsaWebPackageobject.

Example

ThefollowingexamplecreatesanewWebpackageandaddsthepage"test.htm"tothepackage,includingalldependenciesforthepage,andthensavesthenewWebpackage.

DimobjWebAsWebEx

DimobjPackageAsWebPackage

SetobjWeb=ActiveWeb

SetobjPackage=objWeb.CreatePackage("NewWebPackage")

WithobjPackage

.Author="JohnSmith"

.Company="FourthCoffee"

.Subject="ThisisanewWebpackageforFourthCoffee."

.AddobjWeb.Url&"/test.htm",fpDepsDefault

.Save"c:\NewWebPackage.fwp",True

EndWith

BuildPropertyReturnsthebuildnumberforthespecifiedobject.Read-onlyString.

expression.Build()

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

IftheApplicationobjectisspecified,theBuildpropertyreturnsthebuildnumberoftheapplication.WhentheSystemobjectisspecified,thispropertyreturnsthebuildnumberoftheoperatingsystem.Forexample,theformatusedontheAboutdialogboxforanapplicationmightlooklikethis:“Version:4.0.0.xxxx,”wherexxxxisthebuildnumberoftheapplication.WhentheBuildpropertyfortheSystemobjectisaccessed,itreturnsthecurrentbuildoftheoperatingsystemasyoumightseeusedonthePropertiespageoftheSystemdialogbox.

Example

Thefollowingstatementreturnsthebuildnumberoftheapplication.

myAppBuild=Application.Build

Youcanaccessthesystembuildasshowninthefollowingstatement.

mySysbuild=System.Build

CaptionPropertyReturnsaStringthatrepresentseitherthecaptiontextinthetitlebarortheURLofapage.

expression.Caption

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

TheCaptionpropertyreturnsdifferentvaluesdependingontheobject.Forexample,theCaptionpropertyforthePageWindowExobjectreturnsthefileURLoftheopenpage,whiletheCaptionpropertyfortheWebWindowExobjectreturnsthetextofthetitlebarfortheMicrosoftFrontPageapplicationwindow.

Example

Thisstatementreturnsthecaptionoftheactivepage.

myCaption=ActivePageWindow.Caption

ThefollowingexampledemonstratesaccessingboththeactiveWebWindowExandPageWindowExobjectsusingtheWithandForstatements.

PrivateSubGetPageWindowCaption()

DimmyWebWindowAsWebWindowEx

DimmyPageWindowsAsPageWindows

DimmyPageWindowCaptionsAsString

DimmyWebWindowCaptionAsString

SetmyWebWindow=Application.ActiveWebWindow

SetmyPageWindows=myWebWindow.PageWindows

WithmyWebWindow

myWebWindowCaption=.Caption

EndWith

ForEachmyPageWindowInmyPageWindows

myPageWindowCaptions=myPageWindowCaptions&myPageWindow.Caption

Next

EndSub

CheckedoutByPropertyReturnsaStringthatrepresentsthelogonnameofthepersontowhomthespecifiedfileischeckedout.

NoteYoumusthaveasourcecontrolprojectinplacebeforeusingthismethod.

expression.CheckedoutBy

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Example

Thisexampleretrievesthelogonaliasofthepersonwhocheckedoutthefile.

NoteYoumusthaveasourcecontrolprojecttorunthisexample.

PrivateSubGetCheckedOutBy()

DimmyCheckedOutAliasAsString

myCheckedOutAlias=_

ActiveWeb.RootFolder.Files(0).CheckedoutBy

EndSub

ChildrenPropertyReturnsaNavigationNodescollectionthatrepresentsthecollectionofchildnodesforanavigationnode.

expression.Children

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Example

Thefollowingexamplereturnsthenumberofchildnodesthatexistdirectlybelowthehomepagenavigationnode.

PrivateSubGetChildrenCount()

DimmyCountAsInteger

myCount=ActiveWeb.HomeNavigationNode.Children.Count

EndSub

ChoicesPropertyReturnsorsetsaStringthatrepresentsanarrayofallchoicesinthecurrentfield.

expression.Choices

expressionRequired.AnexpressionthatreturnsaListFieldChoiceobject.

Example

Thefollowingexampledisplaysthetextforallchoicesinthefield"NewChoiceField."Ifthefieldcontainsnochoices,amessageisdisplayedtotheuser.Thefield"NewChoiceField"isanobjectoftypeListFieldChoice.

SubViewChoices()

'Displaysthechoicesinthecurrentfield

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimobjFldChoiceAsListFieldChoice

DimVarChoicesAsVariant

DimstrChoiceAsString

DimblnFoundAsBoolean

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

'Referencechoicefield

SetobjFldChoice=objLstFlds.Item("NewChoiceField")

blnFound=False

ForEachVarChoiceInobjFldChoice.Choices

IfstrChoice=""Then

'iffirstvalueinstring

strChoice=VarChoice&vbCr

'Thelistcontainsatleastonechoice

blnFound=True

Else

'addvaluetostring

strChoice=strChoice&VarChoice&vbCr

EndIf

NextVarChoice

IfblnFound=TrueThen

'Displaychoices

MsgBox"Thecurrentlistcontainsthefollowingchoices:"&_

vbCr&strChoice

Else

'Displaymessagetouser

MsgBox"Thecurrentfieldcontainsnochoices."

EndIf

EndSub

COMAddInsPropertyReturnsaCOMAddInscollectionthatrepresentsalltheComponentObjectModel(COM)add-inscurrentlyloadedinMicrosoftFrontPage.ThesearelistedintheCOMAdd-Insdialogbox(Add-InscommandontheToolsmenu).

expression.COMAddIns

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

AlloftheFrontPageadd-insthatareregisteredintheMicrosoftWindowsRegistryarelocatedunderthefollowingkey:

HKEY_CURRENT_USER\Software\Microsoft\Office\version\FrontPage\AddIns

Add-insdesignedforadministratorsareregisteredunder:

HKey_Local_Machine\Software\Microsoft\Office\version\FrontPage\Addins

Example

Thefollowingexamplereturnsthenumberofadd-insavailabletoFrontPage.

PrivateSubGetCOMAddIns()

DimmyWebAsWebEx

DimmyAddinCountAsInteger

SetmyWeb=ActiveWeb

myAddinCount=Application.COMAddIns.Count

EndSub

CommandBarsPropertyReturnsaCommandBarscollectionthatrepresentsthemenuandtoolbarsdisplayedinMicrosoftFrontPage.

expression.CommandBars

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

Youcan'taccessFrontPage-specificpop-upshortcutmenususingtheCommandBarscollection.Forexample,youcan'taccesstheshortcutmenuthatappearswhenyouright-clickapageinPageview.However,youcancreateyourownpop-upshortcutmenususingtheShowPopupmethodfortheCommandBarobject.

Example

Thefollowingthreeproceduressetupanewmenuitemonatoolbar.

Procedure1

SubAddMenuItem()

DimnewMenuAsCommandBarControl

DimtoolsMenuAsCommandBar

SettoolsMenu=Application.CommandBars("Tools")

SetnewMenu=_

toolsMenu.Controls.Add(msoControlButton,,,,True)

newMenu.Caption="New&MenuItem"

EndSub

Thefollowingprocedureconnectstheclickeventtothecustombuttonandmustbeaddedtoaclassorformmodule.Themoduleshownisaformmodule.ThisprocedureaddsanewitemtotheToolsmenuandconnectstheeventsofthecustombuttonbyassigningthevariablee_NewMenu(usedintheWithEventsstatement)tothecustombuttonvariablenewMenu.

Procedure2

PrivateSubAddButton_Click()

DimnewMenuAsCommandBarControl

DimWithEventse_NewMenuAsCommandBarButton

SubAddMenuItemWithEventHook()

DimtoolsMenuAsCommandBar

SettoolsMenu=Application.CommandBars("Tools")

SetnewMenu=_

toolsMenu.Controls.Add(msoControlButton,,,,True)

Sete_NewMenu=newMenu

newMenu.Caption="New&MenuItem"

EndSub

PrivateSube_NewMenu_Click(ByValCtrlAs_

Office.CommandBarButton,CancelDefaultAsBoolean)

MsgBox"MenuItemClicked"

Ctrl.Caption="Clicked"

EndSub

ToexecuteFrontPagecustommenuitemsusingtheCommandBarscollection,indexthemenuitemandcalltheexecutemethodforthatitem.ThefollowingexampleinsertsaMicrosoftOfficespreadsheetcontrolattheinsertionpoint.

Procedure3

SubExecuteMenu()

DimIAsString

DimCAsString

DimOAsString

I="Insert"

C="C&omponent"

O="OfficeSp&readsheet"

CommandBars(I).Controls(C).Controls(O).Execute

EndSub

ThefollowingexamplereturnsthestatusofvariouspropertiesofthecommandbarsintheactiveWebsite.

PrivateSubGetCommandBars()

DimmyWebAsWebEx

DimmyCBAsObject

DimmyCBCountAsInteger

DimmyDisplayFontsAsBoolean

DimmyDisplayKeysInToolTipsAsBoolean

DimmyLargeButtonsAsBoolean

DimmyMenuAnimationStyleAsString

SetmyWeb=ActiveWeb

SetmyCB=Application.CommandBars

WithmyCB

myCBCount=.Count

myDisplayFonts=.DisplayFonts

myDisplayKeysInToolTips=.DisplayKeysInTooltips

myLargeButtons=.LargeButtons

myMenuAnimationStyle=.MenuAnimationStyle

EndWith

EndSub

Thefollowingexampleisatoolthatiteratesthroughthecommandbarsandreturnsseveralpropertiesfromeachmenu.

NoteTorunthisexample,createaformthathasatextboxcalledtxtComBarandacommandbuttoncalledcmdComBar,andcopythefollowingcodetothecodewindow.

PrivateSubcmdComBar_Click()

DimmyWebAsWebEx

DimmyComBarsAsObject

DimmyComBarAsObject

DimmyTextAsString

DimmyNameAsString

DimmyAdaptMenuAsString

DimmyEnabledMenuAsString

DimmyMenuHeightAsString

DimmyMenuWidthAsString

SetmyWeb=ActiveWeb

SetmyComBars=Application.CommandBars

myName="Name:"

myAdaptMenu="MenuAdaptive?"

myEnabledMenu="MenuEnabled?"

myMenuHeight="MenuHeight:"

myMenuWidth="MenuWidth:"

txtComBar.Locked=True

txtComBar.maxLength=10000

txtComBar.MultiLine=True

txtComBar.ScrollBars=fmScrollBarsVertical

WithmyComBars

ForEachmyComBarInmyComBars

WithmyComBar

myText=myText&myName&.Name&vbCrLf

myText=myText&myAdaptMenu&.AdaptiveMenu&vbCrLf

myText=myText&myEnabledMenu&.Enabled&vbCrLf

myText=myText&myMenuHeight&.Height&vbCrLf

myText=myText&myMenuWidth&.Width&vbCrLf

txtComBar.Text=myText

EndWith

Next

txtComBar.SetFocus

txtComBar.CurLine=0

EndWith

EndSub

CompanyPropertySetsorreturnsaStringthatrepresentsthenameofthecompanythatcreatedaWebpackage.

expression.Company

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplecreatesanewWebpackageandaddsthepage"test.htm"tothepackage,includingalldependenciesforthepage,andthensavesthenewWebpackage.

DimobjWebAsWebEx

DimobjPackageAsWebPackage

SetobjWeb=ActiveWeb

SetobjPackage=objWeb.CreatePackage("NewWebPackage")

WithobjPackage

.Author="JohnSmith"

.Company="FourthCoffee"

.Subject="ThisisanewWebpackageforFourthCoffee."

.AddobjWeb.Url&"/test.htm",fpDepsDefault

.Save"c:\NewWebPackage.fwp",True

EndWith

ComputationFormulaPropertySetsorreturnsaStringthatrepresentstheformulausedtogetavalueforacalculatedfield.

expression.ComputationFormula

expressionRequired.AnexpressionthatreturnsaListFieldComputedobject.

ShowAll

ConnectionSpeedPropertyReturnsorsetsanFpConnectionSpeedvaluethatindicatestheuser'sInternetconnectiontype.

FpConnectionSpeedcanbeoneoftheseFpConnectionSpeedconstants.fpConnect14414400baud-ratemodemfpConnect28828800baud-ratemodemfpConnect56K56600baud-ratemodemfpConnectISDNISDNconnectionfpConnectT1T1connectionfpConnectT3T3connection

expression.ConnectionSpeed

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

TheConnectionSpeedpropertyisusedinconjunctionwiththeSlowPagepropertytodeterminethesimulateddownloadtimeofaWebpage.ThedefaultvalueisfpConnect144.

Example

ThefollowingexamplesetstheConnectionSpeedpropertytofpConnect56K,simulatinga56Kmodem.Theamountoftimeafiletakestodownloadandthecriteriausedtodeterminea"slow"pageintheReportsviewwillbebasedonthisvalue.

SubSpeedOfConnection()

'ModifiestheConnectionSpeedproperty

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

WithobjApp

'Settheconnectiontypeto56Kmodem

.ConnectionSpeed=fpConnect56K

EndWith

EndSub

CountPropertyReturnsthenumberofitemsinthespecifiedcollection.Read-onlyVariant.

expression.Count

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

Somecollectionsare0-basedandsomeare1-based.TheCountpropertyforcollectionsbeginswith1eventhoughyouaccessthefirstiteminacollectionwitha0.

Example

ThefollowingexamplereturnsthenumberofthemesandfoldersintheactiveWebsite.

PrivateSubGetWebCount()

DimmyWebAsWebEx

DimmyCountAsInteger

SetmyWeb=ActiveWeb

WithmyWeb

myThemeCount=.Themes.Count

myFolderCount=.RootFolder.Folders.Count

EndWith

EndSub

CreatorPropertyReturnsaStringthatrepresentsthenameoftheapplicationinwhichthisobjectwascreated.IftheobjectwascreatedinMicrosoftFrontPage,thispropertyreturnstheString"FrontPage.Editor.Document".

NoteTheCreatorpropertyforFrontPageisdifferentfromtheCreatorpropertyusedbyotherMicrosoftOfficeobjects.TheCreatorpropertyforFrontPageusesastringformat,whileOfficeobjectsusea32-bitintegertoidentifytheapplicationthatcreatedthefile.

expression.Creator

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThisexamplechecksifthecreatorofafileisFrontPage.

PrivateSubGetCreator()

DimmyCreatorAsString

myCreator=ActiveWeb.RootFolder.Files(0).Creator

IfmyCreator<>"FrontPage.Editor.Document"Then

MsgBox"ThisfilewasnotcreatedbyFrontPage."

EndIf

EndSub

ShowAll

CurrencyPropertyReturnsorsetsanFpCurrencyFieldFormatenumeratedconstantthatdeterminesthetypeofcurrencytobeusedinthecurrencyfield.Read/write.

FpCurrencyFieldFormatcanbeoneoftheseFpCurrencyFieldFormatconstants.fpCurrencyFieldArgentinafpCurrencyFieldAustraliafpCurrencyFieldAustriafpCurrencyFieldBelgiumBFfpCurrencyFieldBelgiumFBfpCurrencyFieldBoliviafpCurrencyFieldBrazilfpCurrencyFieldCanadafpCurrencyFieldCanadaFfpCurrencyFieldChilefpCurrencyFieldColombiafpCurrencyFieldCostaRicafpCurrencyFieldCzechfpCurrencyFieldDenmarkfpCurrencyFieldDominicanRepublicfpCurrencyFieldEcuadorfpCurrencyFieldElSalvadorfpCurrencyFieldEurofpCurrencyFieldEuroPostfixfpCurrencyFieldFinlandfpCurrencyFieldFrancefpCurrencyFieldGermanyfpCurrencyFieldGreecefpCurrencyFieldGuatemalafpCurrencyFieldHonduras

fpCurrencyFieldHongKongfpCurrencyFieldHungaryfpCurrencyFieldIrelandfpCurrencyFieldItalyfpCurrencyFieldJapanfpCurrencyFieldKoreafpCurrencyFieldMexicofpCurrencyFieldNetherlandsfpCurrencyFieldNewZealandfpCurrencyFieldNicaraguafpCurrencyFieldNorwayfpCurrencyFieldPanamafpCurrencyFieldParaguayfpCurrencyFieldPerufpCurrencyFieldPolandfpCurrencyFieldPortugalfpCurrencyFieldPRChinafpCurrencyFieldRussiafpCurrencyFieldSingaporefpCurrencyFieldSlovakiafpCurrencyFieldSloveniafpCurrencyFieldSouthAfricafpCurrencyFieldSpainfpCurrencyFieldSwedenfpCurrencyFieldSwitzerlandfpCurrencyFieldTaiwanfpCurrencyFieldTurkeyfpCurrencyFieldUnitedKingdomfpCurrencyFieldUnitedStatesfpCurrencyFieldUruguayfpCurrencyFieldVenezuela

expression.Currency

expressionRequired.AnexpressionthatreturnsaListFieldCurrencyobject.

Remarks

Thedefaultvalueforthisfieldisdeterminedbytheuser'ssystemsettings.

Example

ThefollowingexamplecreatesanewfieldoftypefpFieldCurrencyandchangesthedefaultcurrencysettingtodisplayCanadian.

SubCreateCurrencyField()

'AddnewCurrencyfield

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimobjFldChoiceAsListFieldCurrency

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="NewCurrencyField"

'AddnewFieldoftypefpFieldCurrencytolist

objLstFlds.AddName:=strName,Description:="NewChoicevalueField",_

Fieldtype:=fpFieldCurrency,Required:=True

SetobjFldChoice=objLstFlds.Item("NewCurrencyField")

'ChangecurrencytypetoCanadian

objFldChoice.Currency=fpCurrencyFieldCanada

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&"."

EndSub

DefaultTextPropertySetsorreturnsaStringthatrepresentsthedefaultvalueforahyperlinkfield,whichistheURLandthetextdisplayedtextforthehyperlink.

expression.DefaultText

expressionRequired.AnexpressionthatreturnsaListFieldURLobject.

DefaultValuePropertyReturnsorsetsaVariantthatdefinesthedefaultvalueofthefield.Read/write.

expression.DefaultValue

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

Thedefaultvalueofallpre-populatedfieldsisEmpty.

Example

Thefollowingexampledisplaysthenamesofallfieldsinthelistandtheirassociateddefaultvalues.IftheactiveWebsitedoesnotcontainanylists,amessageisdisplayedtotheuser.

SubFieldDefaultValue()

'Displaythedefaultvalueofthefield

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

'Displayfieldsinfirstlistofcollection

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

IfstrType=""Then

'iffirstvalueinstring

strType=objField.Name&"-"&_

objField.DefaultValue&vbCr

Else

'addvaluetostring

strType=strType&objField.Name&"-"&_

objField.DefaultValue&vbCr

EndIf

NextobjField

MsgBox"Thenamesofthefieldsinthislistandtheirdefault"&_

"valuesare:"&vbCr&strType

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

DefaultViewPagePropertyReturnsorsetsaStringthatdefinestherelativeURLtothepagethatisviewedwhenthelistisopened.ThispropertycorrespondstothedefaultviewpagefieldontheSupportingFilestabofthePropertiesdialogbox.

expression.DefaultViewPage

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

ThedefaultstartpageisAllItems.htm.

Example

ThefollowingexampleliststhenamesofalllistsinthedocumentandtheircorrespondingdefaultviewpageURLs.Thesubroutinecreatesasinglestringcontainingalllistnamesanddefaultviewpagesanddisplaystheformattedmessagetotheuser.

SubViewDefaultPage()

'Letstheuserviewthedefaultview

'pageforalllistsintheweb.

DimlstWebListAsList

DimstrURLAsString

IfNotActiveWeb.ListsIsNothingThen

'Cyclethroughlists

ForEachlstWebListInActiveWeb.Lists

'adddefaultviewpagesnamestostring

IfstrURL=""Then

strURL=lstWebList.Name&"-"&_

lstWebList.DefaultViewPage&vbCr

Else

strURL=strURL&lstWebList.Name&"-"&_

lstWebList.DefaultViewPage&vbCr

EndIf

Next

'Displaydefaultviewpagesofalllists

MsgBox"Thedefaultviewpagesofalllistsinthecurrentwebare:"_

&vbCr&vbCr&strURL

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebcontainsnolists."

EndIf

EndSub

DescriptionPropertyReturnsorsetsaStringthatrepresentsthedescriptionforthecurrentlist.Thedescriptionappearsbelowthetitleofthelistonthedefaultviewpage.Read/write.

expression.Description

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

Thefollowingexamplepromptstheusertoenteradescriptionforthefirstlistinthecollection,andthenchangestheDescriptionpropertybasedontheuser'sinput.

SubSetDescription()

'Setthelistdescription

DimobjAppAsFrontPage.Application

DimobjWebAsWebEx

DimlstWebListAsList

DimStrDescAsString

SetobjApp=FrontPage.Application

SetobjWeb=objApp.ActiveWeb

'Referencefirstlistincollection

SetlstWebList=objWeb.Lists.Item(0)

'Getnewdescriptionfromuser

StrDesc=InputBox("Enteranewdescriptionforthelist"&_

lstWebList.Name&".")

'Setdescriptionproperty

lstWebList.Description=StrDesc

EndSub

ShowAll

DesignSecurityPropertyReturnsorsetsanFpListDesignSecurityconstantthatdefinesthesecuritypermissionsoftheList.

FpListDesignSecuritycanbeoneoftheseFpListDesignSecurityconstants.fpListDesignSecurityCreatorOnlythecreatorofthelisthaspermissiontomodifyit.fpListDesignSecurityEveryoneAllusershavepermissiontomodifythelist.

expression.DesignSecurity

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplechangesthesecuritymodeofeachBasicListobjectinthecurrentweb.ThesubroutinechangestheDesignSecuritypropertytofpListDesignSecurityEveryoneifitisn'talreadyset.Oncethepropertyisset,alluserscaneditthedesignsettingsofBasicListobjectsinthecurrentweb.

NoteUsetheApplyChangesmethodtosaveanychangesmadetothelist.

SubSetSecurityType()

'ChangessecuritytypeofallBasicLists.

DimobjAppAsFrontPage.Application

DimobjListAsList

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Cyclethrougheachlistandcheckforlisttype

ForEachobjListInobjLists

'Ifit'saBasicListthanchangepermissions

IfobjList.Type=fpListTypeBasicListThen

IfobjList.DesignSecurity<>_

fpListDesignSecurityEveryoneThen

objList.DesignSecurity=_

fpListDesignSecurityEveryone

EndIf

objList.ApplyChanges

EndIf

Next

EndSub

DisplayFormPropertyReturnsorsetsaStringthatrepresentstherelativeURLoftheformthatcontainstheuserinterfaceassociatedwiththelist.Read/write.

expression.DisplayForm

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexampledisplaysthenamesofalllistsintheactiveWebsiteandtherelativeURLsoftheirassociatedWebforms.

SubViewFormURL()

'DisplaystheURLoftheform

'associatedwiththelist

DimlstWebListAsList

DimstrURLAsString

IfNotActiveWeb.ListsIsNothingThen

'CyclethroughlistsandaddURLstostring

ForEachlstWebListInActiveWeb.Lists

IfstrURL=""Then

strURL=lstWebList.Name&"-"&_

lstWebList.DisplayForm&vbCr

Else

strURL=strURL&lstWebList.Name&"-"&_

lstWebList.DisplayForm&vbCr

EndIf

Next

'DisplayURLsofallformsinWebsite

MsgBox"TherelativeURLsoftheformsare:"_

&vbCr&vbCr&strURL

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

ShowAll

DisplayFormatPropertyDisplayFormatpropertyasitappliestotheListFieldChoiceobject.

ReturnsorsetsanFpChoiceFieldFormatenumeratedconstantthatrepresentsthetypeofuserinterfacecontrolusedbythefield.Read/write.

FpChoiceFieldFormatcanbeoneoftheseFpChoiceFieldFormatconstants.fpChoiceFieldDropdownfpChoiceFieldRadioButtons

expression.DisplayFormat

expressionRequired.AnexpressionthatreturnsaListFieldChoiceobject.

DisplayFormatpropertyasitappliestotheListFieldDateTimeobject.

ReturnsorsetsanFpDateTimeFieldFormatenumeratedconstantthatrepresentsthewayinwhichthedateandtimevaluesaredisplayed.Read/write.

FpDateTimeFieldFormatcanbeoneoftheseFpDateTimeFieldFormatconstants.fpDateTimeFieldDateAndTimefpDateTimeFieldDateOnlyfpDateTimeFieldTimeOnly

expression.DisplayFormat

expressionRequired.AnexpressionthatreturnsaListFieldDateTimeobject.

DisplayFormatpropertyasitappliestotheListFieldNumberobject.

ReturnsorsetsanFpNumberFieldFormatenumeratedconstantthatdeterminesthewayinwhichnumbersaredisplayedintheList.Read/write.

FpNumberFieldFormatcanbeoneoftheseFpNumberFieldFormatconstants.fpNumberFieldAutoThenumberwillbeautomaticallyformatted.fpNumberFieldFiveDecimalsThenumberwillbedisplayedwithfivedecimalplaces.fpNumberFieldFourDecimalsThenumberwillbedisplayedwithfourdecimalplaces.fpNumberFieldIntegerThenumberwillbedisplayedasanintegerwithnodecimalplaces.fpNumberFieldOneDecimalThenumberwillbedisplayedwithonedecimalplace.fpNumberFieldThreeDecimalsThenumberwillbedisplayedwiththreedecimalplaces.fpNumberFieldTwoDecimalsThenumberwillbedisplayedwithtwodecimalplaces.

expression.DisplayFormat

expressionRequired.AnexpressionthatreturnsaListFieldNumberobject.

DisplayFormatpropertyasitappliestotheListFieldURLobject.

ReturnsorsetsanFpURLFieldFormatenumeratedconstantthatrepresentstheimage-linkinginformation.Read/write.

FpURLFieldFormatcanbeoneoftheseFpURLFieldFormatconstants.fpURLFieldImagefpURLFieldLink

expression.DisplayFormat

expressionRequired.AnexpressionthatreturnsaListFieldURLobject.

Example

AsitappliestotheListFieldChoiceobject.

ThefollowingexamplechangesthedisplaytypeofafieldnamedNewChoiceFieldinthefirstlistoftheactiveWebsite.Thechoiceswillnowbedisplayedinadrop-downlist.

SubChangeViewFormat()

'Changethedisplaytypeofthefield

DimobjAppAsFrontPage.Application

DimobjListFieldsAsListFields

DimobjListFieldAsListFieldChoice

SetobjApp=FrontPage.Application

SetobjListFields=objApp.ActiveWeb.Lists.Item(0).Fields

SetobjListField=objListFields.Item("NewChoiceField")

'ChangedisplayformattoDropDownlist

objListField.DisplayFormat=fpChoiceFieldDropdown

EndSub

DocumentProperty(WebObjectModel)ReturnsanFPHTMLDocumentobject,providingaccesstothePageobjectmodelinMicrosoftFrontPagethatiscompatiblewithMicrosoftInternetExplorer4.0andlater.FormoreinformationonthePageobjectmodel,seeExploringtheObjectModelinFrontPage.

expression.Document

expressionRequired.AnexpressionthatreturnsaPageWindowExobject.

Example

ThefollowingexampleopensapageandusestheinsertAdjacentTextmethodtoaddtexttothedocument.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\RogueCellars"thatcontainsafilenamedSales.htm.YoumaysubstituteanalternativeWebsiteURLorfilename.

PrivateSubAddTextToDoc()

DimmyWebAsWebEx

DimmyPageWindowAsPageWindowEx

DimmyTextAsString

SetmyWeb=_

Webs.Open("C:\MyDocuments\MyWebSites\RogueCellars")

myWeb.Activate

myText="WinterSaleBeginsNovember1st!"

SetmyPageWindow=_

ActiveWeb.RootFolder.Files("Sales.htm").Edit

myPageWindow.Document.body.insertAdjacentText_

"BeforeEnd",myText

ActivePageWindow.Save

ActiveWeb.Close

EndSub

DownloadTimePropertyReturnsaLongthatrepresentsthesimulatedamountoftime(inseconds)agivenfilewilltaketodownload.Read-only.

expression.DownloadTime

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Remarks

ThispropertyisusedinconjunctionwiththeConnectionSpeedpropertytodeterminewhichfileswillappearintheSlowPagesreport.

Example

ThefollowingexampledisplaysthenamesofallfilesinthecurrentWebsitewithadownloadtimegreaterthanaspecifiedvalue.Thesubroutinepromptstheusertoenteradownloadtimeinseconds.ItthensearchesthrougheachfileintheAllcollectionanddisplaysthenamesofanyfilewithadownloadtimegreaterthanthespecifiednumberofseconds.TheNamepropertyvalueisaddedtoaStringcontainingthenamesofallmatchingfilesinthecollection.TheString,storedinthevariablestrName,isthendisplayedtotheuser.IfnomatchingfilesarefoundintheWebsite,amessageisdisplayedtotheuser.

SubDownloadTime()

'Displaysthenamesofallfileswithadownloadtimegreaterthan

'agivenvalue

DimobjAppAsFrontPage.Application

DimobjwebFileAsWebFile

DimobjWebFielsAsWebFiles

DimstrSecAsString'Userinputvalue

DimstrNamesAsString'Nameofallmatchingfiles

DimblnFoundAsBoolean'Booleanflag

SetobjApp=FrontPage.Application

SetobjWebFiles=objApp.ActiveWeb.AllFiles

blnFound=False

'Promptusertoenterinput

strSec=InputBox("Enterthenumberofsecondsdownloadtime.")

'Searchthrougheachfileinthecollection

ForEachobjwebFileInobjWebFiles

'Ifuserinputislessthandownloadtime

IfstrSec<objwebFile.DownloadTimeThen

blnFound=True

IfstrName=""Then

strName=strName&objwebFile.Name

Else

'Otherwiseaddnextfilenametostring

strName=strName&","&vbCr&objwebFile.Name

EndIf

EndIf

NextobjwebFile

IfblnFound=TrueThen

'Displaynamesofallfilesthatmatchthecriteria

MsgBox"Thefilesthattakelongerthan"&_

strSec&"secondstodownloadare:"&vbCr&vbCr&_

strName&"."

Else

'Nofiles,displaymessage

MsgBox"Therearenofilesthatmatchyourcriteria."

EndIf

EndSub

DynamicTemplatePropertyReturnsaStringthatrepresentsreturnsthepathandfilenameofaDynamicWebTemplate.AnemptyStringindicatesthatnoDynamicWebTemplateisattached.

expression.DynamicTemplate

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Remarks

Ifanerroroccurs,theupdateprocesswillterminateunlesstheSkipOnQuerypropertyissettoTrue.

Example

ThefollowingexampleupdatestheDynamicWebTemplateforeachfileintheactiveWebsiteifaDynamicWebTemplateisattached.

DimobjStateAsDynamicTemplateState

DimobjFileAsWebFile

DimstrLogAsString

SetobjState=Application.CreateDynamicTemplateState

ForEachobjFileInActiveWeb.AllFiles

IfobjFile.DynamicTemplate<>""Then_

objFile.UpdateDynamicTemplateobjState,strLog

Next

EditFormPropertyReturnsorsetsaStringthatrepresentstherelativeURLoftheformusedforeditingthecurrentlistinMicrosoftFrontPage.Theeditformallowsyoutomodifythecolumnsinthecurrentlist.Read/write.

expression.EditForm

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

ThedefaultfilenameisEditForm.htm.

Example

ThefollowingexampledisplaysthenamesofalllistsintheactiveWebsiteandtherelativeURLoftheirassociatededitforms.

SubViewEditFormURL()

'DisplaystheURLoftheform

'associatedwitheditingthelist

DimlstWebListAsList

DimstrURLAsString

IfNotActiveWeb.ListsIsNothingThen

'CyclethroughlistsandaddURLstostring

ForEachlstWebListInActiveWeb.Lists

IfstrURL=""Then

strURL=lstWebList.Name&"-"&_

lstWebList.EditForm&vbCr

Else

strURL=strURL&lstWebList.Name&"-"&_

lstWebList.EditForm&vbCr

EndIf

Next

'DisplayURLsofalleditingformsinWebsite

MsgBox"TherelativeURLsoftheeditingformsare:"_

&vbCr&vbCr&strURL

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

ShowAll

EditSecurityPropertyReturnsorsetsanFpListEditSecurityconstantthatdetermineswhichuserscaneditthecurrentlist.

FpListEditSecuritycanbeoneoftheseFpListEditSecurityconstants.fpListEditSecurityAllAlluserscaneditthelist.fpListEditSecurityNoneNouserscaneditthelist.fpListEditSecurityOnlyOwnUserscanonlyedittheirownlists.

expression.EditSecurity

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplechangestheeditpermissionsofalllistsoftypefpListTypeBasicListtofpListEditSecurityOnlyOwn.Oncethepropertyisset,userscaneditonlyliststhattheyhavecreated.

NoteUsetheApplyChangesmethodtosaveanychangesmadetothelist.

SubChangeEditPermissions()

'ChangesthepermissionsofallBasicListsintheweb

DimobjAppAsFrontPage.Application

DimobjListAsObject

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Cyclethrougheachlistandcheckforlisttype

ForEachobjListInobjLists

'Ifit'saBasicListthenchangepermissions

IfobjList.Type=fpListTypeBasicListThen

IfobjList.EditSecurity<>fpListEditSecurityOnlyOwnThen

objList.EditSecurity=fpListEditSecurityOnlyOwn

objList.ApplyChanges

EndIf

EndIf

Next

EndSub

EndNumberPropertySetsorreturnsaLongthatrepresentstheendingnumberforthenumberscaleinaratingscalefield.

expression.EndNumber

expressionRequired.AnexpressionthatreturnsaListFieldRatingScaleobject.

ExtensionPropertyReturnsaStringthatrepresentstheextensionforthespecifiedfile.Read-only.

expression.Extension

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Example

ThisstatementreturnstheextensionofthefirstpageintherootfolderoftheactiveWebsite.

myHomePageExt=ActiveWeb.RootFolder.File(0).Extension

FieldsPropertyReturnsaListFieldscollectionthatrepresentsallfieldsinthecurrentlist.TheListFieldscollectioncontainsListFieldobjectsthatcorrespondtothecolumnpropertiesofalistmemberdocument.

expression.Fields

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexampledisplaysthenamesofallfieldsinthefirstlistoftheListscollection.

SubDisplayFields()

'Returnsthefieldscollection

DimobjAppAsFrontPage.Application

DimlstWebListAsList

DimlstFieldsAsListFields

DimlstFieldAsListField

DimStrNameAsString

SetobjApp=FrontPage.Application

SetlstWebList=objApp.ActiveWeb.Lists.Item(0)

SetlstFields=lstWebList.Fields

IfNotActiveWeb.ListsIsNothingThen

ForEachlstFieldInlstFields

'addURLstostring

IfStrName=""Then

'Ifemptystring

StrName=lstField.Name&vbCr

Else

'addnamestostring

StrName=StrName&lstField.Name&vbCr

EndIf

Next

'Displayformattedstring

MsgBox"Thelist"&lstWebList.Name&_

"containsthefollowingfields"&vbCr&vbCr&_

StrName

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebcontainsnolists."

EndIf

EndSub

FilePropertyReturnsaWebFileobjectthatrepresentstheWebpageassociatedwiththespecifiedobject.

expression.File

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThisexamplereturnsthenameoftheWebpageassociatedwithanavigationnodeintheactiveWebsite.

PrivateSubGetFileFromNavNode()

DimmyNavNodeAsNavigationNode

DimmyNavNodesAsNavigationNodes

DimmyNavFilesAsString

DimmyNavFileAsString

OnErrorResumeNext

SetmyNavNodes=ActiveWeb.HomeNavigationNode.Children

ForEachmyNavNodeInmyNavNodes

myNavFile=myNavNode.File.Name

IfERR<>0ThenExitSub

myNavFiles=myNavFiles&myNavFile&vbCrLf

Next

EndSub

ShowAll

FileDialogPropertyReturnsaFileDialogobjectthatrepresentsasingleinstanceofafiledialogbox.

expression.FileDialog(DialogType)

expressionRequired.AnexpressionthatreturnsanApplicationobject.

DialogTypeRequiredMsoFileDialogType.Thetypeofdialogboxtoopen.

MsoFileDialogTypecanbeoneoftheseMsoFileDialogTypeconstants.msoFileDialogFilePickermsoFileDialogFolderPickermsoFileDialogOpenmsoFileDialogSaveAs

Example

ThefollowingexampledisplaystheSaveAsdialogbox.

SubShowSaveAsDialog()

'DisplaytheSaveAsdialogbox

DimdlgSaveAsAsFileDialog

'Setthedialogtype

SetdlgSaveAs=Application.FileDialog(msoFileDialogSaveAs)

'Displaythedialog

dlgSaveAs.Show

EndSub

ThefollowingexampledisplaystheOpendialogbox,andallowstheusertoopenmultiplefilesatthesametime.

SubShowOpenDialog()

'DisplaytheOpendialogbox

DimdlgOpenAsFileDialog

'SetthedialogboxtypetoOpen

SetdlgOpen=Application.FileDialog(msoFileDialogOpen)

'Displaythedialogbox

WithdlgOpen

.AllowMultiSelect=True

.Show

EndWith

EndSub

ThefollowingexampledisplaystheOpendialogbox,andallowstheusertoopenmultiplefilesatthesametime.IfthedocumentsareHTMLfiles,theyareopenedinMicrosoftFrontPage.

SubShowOpenDialog()

'DisplaytheOpendialogbox

DimdlgOpenAsFileDialog

'SetthedialogboxtypetoOpen

DimiasInteger

SetdlgOpen=Application.FileDialog(msoFileDialogOpen)

'Displaythedialogbox

WithdlgOpen

.AllowMultiSelect=True

.Show

EndWith

Fori=1TodlgOpen.SelectedItems.Count

IfRight(dlgOpen.SelectedItems(i),3)="htm"Then

ActiveWebWindow.PageWindows.AdddlgOpen.SelectedItems(i)

EndIf

Next

EndSub

FileDialogViewPagePropertyReturnsorsetsaStringthatrepresentstherelativeURLofthepageassociatedwiththeDocumentLibraryobject.Read/write.

expression.FileDialogViewPage

expressionRequired.AnexpressionthatreturnsaDocumentLibraryobject.

Example

ThefollowingexamplecreatesanewdocumentlibrarycalledNewLibraryanddisplaystherelativeURLoftheFiledialogpage.

SubNewLibrary()

'Addanewlisttothecurrentweb

DimobjAppAsFrontPage.Application

DimobjListsAsLists

DimobjLibraryAsDocumentLibrary

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Addnewlist

objLists.AddName:="NewLibrary",_

ListType:=fpListTypeDocumentLibrary,_

Description:="ListofSharedfiles"

SetobjLibrary=objLists.Item("NewLibrary")

'Displaymessagetouser

MsgBox"AnewlistwasaddedtotheListscollection."&_

"Thepageassociatedwiththefiledialogis"&_

objLibrary.FileDialogViewPage&"."

EndSub

FilesPropertySomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

ReturnsaWebFilescollectionthatrepresentstheitemsinthespecifiedWebfolder.Read-onlyobject.

expression.Files

expressionRequired.AnexpressionthatreturnsaWebFolderobject.

Remarks

TheFilespropertyisanaccessorpropertyusedtoaccesstheWebFilescollection.Toaccessthecollection,declareavariableoftypeWebFilesasshowninthestatementDimmyFilesAsWebFiles,andthensetthevariablemyFilestoWeb.RootFolder.Files.

Example

ThefollowingexampleretrievesallofthepropertiesofafileandconcatenatestheMETAtagsintoastringwithapipe("|")delimiterseparatingthedata.

NoteThePropertyKeysshowninthisexampleapplytoaWebsitecreatedwiththeOnePageWebSitetemplate.OthertemplatesmayuseotherPropertyKeys.FormoreinformationaboutusingPropertyKeys,seethePropertiescollection.

PrivateSubGetFileProperties()

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyAuthorAsString

DimmyModifiedByAsString

DimmyTimeCreatedAsString

DimmyTimeLastModifiedAsString

DimmyFileSizeAsString

DimmyTitleAsString

DimmyMetaTagsAsVariant

DimmyMetaTagAsVariant

DimmyProgIDAsVariant

DimmyGeneratorAsString

DimmyTimeLastWrittenAsString

DimmyPropertiesAsProperties

DimmyMetaTagListAsString

SetmyFiles=ActiveWeb.RootFolder.Files

ForEachmyFileInmyFiles

SetmyProperties=myFile.Properties

myAuthor=myAuthor&myProperties("vti_author")

myModifiedBy=myModifiedBy&_

myProperties("vti_modifiedby)&"|"

myTimeCreated=myTimeCreated&_

myProperties("vti_timecreated")&"|"

myTimeLastModified=myTimeLastModified&_

myProperties("vti_timelastmodified")&"|"

myFileSize=myFileSize&_

myProperties("vti_FileSize)&"|"

myTitle=myTitle&myProperties("vti_title")&"|"

myProgID=myProgID&myProperties("vti_title")&"|"

myGenerator=myGenerator&_

myProperties("vti_generator")&"|"

myTimeLastWritten=myTimeLastWritten&_

myProperties("vti_timelastwritten")&"|"

myMetaTags=myProperties("vti_metatags")

ForEachmyMetaTagInmyMetaTags

myMetaTagList=myMetaTagList&myMetaTag&"|"

Next

Next

EndSub

FileSaveFormPropertyReturnsorsetsaStringthatrepresentstherelativeURLoftheformpagethatisdisplayedwhenfilesaresaved.Read/write.

expression.FileSaveForm

expressionRequired.AnexpressionthatreturnsaDocumentLibraryobject.

Example

Thefollowingexamplecreatesanewdocumentlibrarycalled"NewLibrary"anddisplaystherelativeURLofthepageassociatedwithsavingafiletothelibrary.

SubNewLibrary()

'Addsanewlisttothecurrentweb

DimobjAppAsFrontPage.Application

DimobjListsAsLists

DimobjLibraryAsDocumentLibrary

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Addnewlist

objLists.AddName:="NewLibrary",_

ListType:=fpListTypeDocumentLibrary,_

Description:="ListofSharedfiles"

SetobjLibrary=objLists.Item("NewLibrary")

'Displaymessagetouser

MsgBox"AnewlistwasaddedtotheListscollection."&_

"TheURLofthepageassociatedwiththeSavedialogis"&_

objLibrary.FileSaveForm&"."

EndSub

FileSearchPropertyReturnsaFileSearchobjectthatprovidesaccesstofilesearchcapabilitieswithinaWebsite.

expression.FileSearch

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

TheFileSearchobjectisaMicrosoftOfficesharedobjectanddoesnotacceptaURLasafilenameorfoldernamevalue.

Example

ThefollowingexamplesearchestheAdventureWorksWebsiteanditssubdirectoriesandreturnsthenumberofIndex.htmfilesfound.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\AdventureWorks".Asanalternative,youcanchangethevaluefortheLookInpropertytoaWebsitethatiscurrentlyavailabletoyou.YoumayalsoneedtosetareferencetotheMicrosoftOfficeObjectLibrary(ReferencesoptionontheToolsmenu).

PrivateSubWebFileSearch()

DimmyFileSearchAsFileSearch

DimmyFileCountAsInteger

SetmyFileSearch=Application.FileSearch

WithmyFileSearch

.FileName="index.htm"

.LookIn="C:\MyWebSites\AdventureWorks"

.SearchSubFolders=True

.Execute

myFileCount=.FoundFiles.Count

EndWith

EndSub

FolderPropertyReturnsaWebFolderobjectthatrepresentsthefolderassociatedwiththelist.TheWebfolderhierarchyprovidesthelinktofoldersandfilesonaWebserverdirectory.ThenavigationstructureprovidestheunderlyingstructurefortheWebobjectswithinindividualMicrosoftFrontPageWebsites.

expression.Folder

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexampledisplaysthenameoftheWebfolderassociatedwiththecurrentlist.IfthecurrentWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubReturnFolder()

'Returnsthefolderassociatedwiththelist

DimobjAppAsFrontPage.Application

DimobjFolderAsWebFolder

SetobjApp=FrontPage.Application

IfNotobjApp.ActiveWeb.ListsIsNothingThen

SetobjFolder=objApp.ActiveWeb.Lists(0).Folder

MsgBox"ThenameoftheassociatedWebfolderis:"&_

objFolder.Name&"."

Else

MsgBox"TheActiveWebsitecontainsnolists."

EndIf

EndSub

FoldersPropertySomeofthecontentinthistopicmaynotbeapplicabletosomelanguages.

ReturnsaWebFolderscollectionthatrepresentsthechildfolderscontainedthespecifiedfolder.Read-only.

expression.Folders

expressionRequired.AnexpressionthatreturnsaWebFolderobject.

Remarks

TheFolderspropertyreturnstheWebFolderscollectionforthespecifiedWebsite.Toaccessthecollection,youdeclareavariableoftypeWebFoldersasinthestatementDimmyFoldersAsWebFolders,andthensetthevariabletoWeb.RootFolder.Folders.

Example

Thefollowingexampleretrievestwoofthepropertiesofafolderandconcatenatesthedataintoastringwithapipe("|")delimiterseparatingthedata.

NoteThePropertyKeysshowninthisexampleapplytoaWebsitecreatedwiththeOnePageWebSitetemplate.OthertemplatesmayuseotherPropertyKeys.FormoreinformationaboutusingPropertyKeys,seethePropertiescollection.

PrivateSubGetFolderProperties()

DimmyFoldersAsWebFolders

DimmyFolderAsWebFolder

DimmyHasSubDirsAsString

DimmyIsScriptableAsString

DimmyPropertiesAsProperties

SetmyFolders=ActiveWeb.RootFolder.Folders

ForEachmyFolderInmyFolders

SetmyProperties=myFolder.Properties

myHasSubDirs=myHasSubDirs&_

myProperties("vti_hassubdirs")&"|"

myIsScriptable=myIsScriptable&_

myProperties("vti_isscriptable")&"|"

Next

EndSub

FormatPropertyReturnsaStringthatrepresentstheformatofthespecifiedThemeobject.Read-only.

expression.Format

expressionRequired.AnexpressionthatreturnsaThemeobject.

Remarks

ThethemeformatreflectsthedifferencebetweentheformatsforthedifferentversionsofMicrosoftFrontPage.Forexample,theformatnumberforFrontPage98canbeeither0.0or1.0,whiletheformatnumberforFrontPage2000is2.0,andsoon.

Example

ThefollowingexampleretrievestheformatoftheappliedthemefortheactiveWebsite.

PrivateSubGetThemeFormat()

DimmyFormatAsString

myFormat=ActiveWeb.Themes(0).Format

EndSub

FrameWindowPropertyReturnsanFPHTMLWindow2objectthatrepresentsthepagewindowandaccessestheInternetExplorerWindowobjects.

NoteTheDocumentpropertyoftheFPHTMLWindow2objectpointstotheFPHTMLDocumentobjectoftheframespage.

expression.FrameWindow

expressionRequired.AnexpressionthatreturnsaPageWindowExobject.

Example

ThisexampleretrievestheIHTMLLocationpropertyoftheFrameWindowobject.

PrivateSubGetFrameWindowLocation()

DimmyWebAsWebEx

DimmyPageAsPageWindowEx

DimmyFrameWindowLocationAsString

SetmyWeb=Webs("C:\MyWebs\CohoWinery")

SetmyPage=_

myWeb.ActiveWebWindow.ActivePageWindow

myFrameWindowLocation=myPage.FrameWindow.Location.href

EndSub

HomePropertyReturnsaHomeNavigationNodeobjectthatrepresentsthenavigationnodeforaspecifiedpage.

expression.Home

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Example

Thefollowingexamplesearchesforanavigationnodewiththelabel"Sale",andthenupdatesit.

PrivateSubChangeNavLabel()

DimmyFilesAsWebFiles

DimmyFileAsWebFile

SetmyFiles=ActiveWeb.RootFolder.Files

ForEachmyFileInmyFiles

IfmyFile.NavigationNode.Home.Label="Sale"Then

myFile.NavigationNode.Home.Label="SalesItems"

EndIf

Next

EndSub

HomeNavigationNodePropertyReturnsaNavigationNodeobjectforthehomepage.

expression.HomeNavigationNode

expressionRequired.AnexpressionthatreturnsaWebExobject.

Remarks

Thehomenavigationnodeisthestartingpointforallnavigationaddressingwithinthenavigationstructure.Wheneveryouwanttoadd,move,ordeleteanode,changeanyoftheattributesforanode,orjustaccessthecurrentnavigationstructure,youusetheHomeNavigationNodeobjectasastartingpoint.TheonlytimeyouwouldusetheRootNavigationNodeobjecttoaccessthenavigationstructureiswhenyouwanttoaddoraccessanavigationnodeatthesamelevelastheHomeNavigationNodeobject.

Example

ThefollowingexampleaccessestheHomeNavigationNodeobjectandretrievestheURLforthehomepage.

PrivateSubGetHomeNavigationNode()

DimmyWebAsWebEx

DimmyHomeNodeAsNavigationNode

DimmyHomeUrlAsString

SetmyWeb=ActiveWeb

myHomeNode=myWeb.HomeNavigationNode

myHomeUrl=myHomeNode.Url

EndSub

HorizontalResolutionPropertyReturnsthehorizontalresolutionofthescreeninpixels.Read-onlyLong.

expression.HorizontalResolution()

expressionRequired.AnexpressionthatreturnsaSystemobject.

Example

Thefollowingexamplereturnsthehorizontalresolutionofthescreen.

myHoriz=System.HorizontalResolution

InNavBarsPropertyTruetospecifythatthecurrentpagewillbevisibleintheWebsite'slinkbars.Read/writeBoolean.

NoteAlinkbarisasetofhyperlinksusedfornavigatingaWebsite.

expression.InNavBars

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Remarks

AllpageswiththeInNavBarspropertysettoFalsewillappeargrayedoutinNavigationview.

Example

Thefollowingexamplepromptstheusertoselectwhichnavigationnodeswillappearinthelinkbar.IftheuserselectsYes,thecurrentpagewillappearinthelinkbar.IftheuserselectsNo,thecurrentpagewillnotappearinthelinkbarandwillappeargrayedoutinNavigationview.TheuserispromptedforeachnavigationnodeintheactiveWebsite.

SubAllNavigationNodes()

'Returnacollectionofallnavigationnodesusedinthecurrentweb

'Allowsyoutoselectwhichpageswillappearinthelinkbar

DimobjAppAsFrontPage.Application

DimobjNavNodeAsNavigationNode

DimobjNavNodesAsNavigationNodes

DimstrAnsAsString

SetobjApp=FrontPage.Application

'CreateareferencetotheNavigationNodescollection

SetobjNavNodes=objApp.ActiveWeb.AllNavigationNodes

'Foreachnodeinthecollection

ForEachobjNavNodeInobjNavNodes

'Prompttheuser

strAns=MsgBox("Doyouwantthepage"&objNavNode.Label&_

"toappearinthelinkbar?",vbYesNo)

'Ifuseranswersyes,settoTrue

IfstrAns=vbYesThen

objNavNode.InNavBars=True

Else

'Ifno,settoFalse

objNavNode.InNavBars=False

EndIf

'Gotonextnode

NextobjNavNode

EndSub

IsDirtyPropertyTrueifthepagedisplayedinthespecifiedpagewindowhaschangedsincethelasttimetheusersavedthepage.Read-writeBoolean.

expression.IsDirty

expressionRequired.AnexpressionthatreturnsaPageWindowExobject.

Example

Thefollowingexamplechecksiftheactivepagehaschanged,andthenexecutestheSavemethodifthepagehasbeenmodified.

PrivateSubDirtyDocument()

DimmyPageAsPageWindowEx

DimmyDocAsFPHTMLDocument

DimmySaveCheckAsBoolean

SetmyDoc=WebWindows(0).PageWindows(0).Document

CallmyDoc.body.insertAdjacentHTML("BeforeEnd",_

"<b>modified</b>")

IfActivePageWindow.IsDirty=TrueThen

ActivePageWindow.Save

EndIf

EndSub

IsExecutablePropertyReturnsorsetsaBooleanthatrepresentsthesettingforexecutepermissionforaWebFolderobject.

expression.IsExecutable

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThisexampleretrievesthesettingoftheIsExecutablepropertyforaWebFolderobject.

PrivateSubCheckExecutable()

DimmyFolderAsWebFolder

DimmyExeStatusAsBoolean

SetmyFolder=ActiveWeb.RootFolder.Folders("images")

myExeStatus=myFolder.IsExecutable

EndSub

IsHiddenPropertySetsorreturnsaBooleanthatrepresentswhetheralistisdisplayedinthebrowser.

expression.IsHidden

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

IsHiddenFoldersEnabledPropertyTruetodisplayhiddenfoldersinthespecifiedWebsite.Read/writeBoolean.

expression.IsHiddenFoldersEnabled

expressionRequired.AnexpressionthatreturnsaWebExobject.

Example

ThefollowingexamplepromptstheusertodisplayhiddenfoldersinthecurrentWebsite.TheIsHiddenFoldersEnabledpropertyissetbasedontheuser'sresponse.

SubViewAllFolders()

'Promptstheusertoviewhiddenfolders

DimobjAppAsFrontPage.Application

DimobjWebAsWebEx

DimstrAnsAsString

SetobjApp=FrontPage.Application

SetobjWeb=objApp.ActiveWeb

'promptuser

strAns=MsgBox("Doyouwanttoviewhiddenfolders?",vbYesNo)

'Setvalueofpropertytomatchuser'sresponse

IfstrAns=vbYesThen

objWeb.IsHiddenFoldersEnabled=True

Else

objWeb.IsHiddenFoldersEnabled=False

EndIf

EndSub

IsLinkBarPropertyTrueindicatesthatthenavigationnodeisalinkbar.Read-onlyBoolean.

NoteLinkbarsprovidehypertextlinksthatallowyoutonavigatethroughthepagesinthecurrentWebsite.

expression.IsLinkBar

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Example

ThefollowingexampletraversesthenavigationnodehierarchyanddisplaysthenamesofanylinkbarsintheWebsite.Ifnolinkbarsarefoundamessageisdisplayedtotheuser.

SubDisplayLinkBar()

'ReturnacollectionofallnavigationnodesusedinthecurrentWebsite

'Searchesthroughthecollectionanddisplaysthenamesofalllinkbars

DimobjAppAsFrontPage.Application

DimobjNavNodeAsNavigationNode

DimobjNavNodesAsNavigationNodes

DimstrAnsAsString

DimblnFoundAsBoolean

blnFound=False

SetobjApp=FrontPage.Application

'CreateareferencetotheNavigationNodescollection

SetobjNavNodes=objApp.ActiveWeb.AllNavigationNodes

'Foreachnodeinthecollection

ForEachobjNavNodeInobjNavNodes

'IfsettoTrue,thisisalinkbar

IfobjNavNode.IsLinkBar=TrueThen

MsgBoxobjNavNode.Label&"isalinkbar."

blnFound=True

EndIf

'Gotonextnode

NextobjNavNode

'Ifnolinkbarsarefound,displayamessage

IfblnFound=FalseThen

MsgBox"TherearenolinkbarsinthecurrentWebsite."

EndIf

EndSub

IsModifiedPropertyReturnsaBooleanthatrepresentswhetheralisthasbeenchangedsincethelasttimethelistwasupdated.

expression.IsModified

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

IsOpenPropertyTrueifthespecifiedWebpageisdisplayedinthepagewindow.Read-onlyBoolean.

expression.IsOpen

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Example

ThefollowingexampleusestheIsOpenpropertytocheckifafilenamed"index.htm"isopen,andopensitifitisn't.

PrivateSubCheckForOpenFile()

DimmyWebAsWebEx

DimmyFilesAsWebFiles

DimmyFileAsWebFile

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyWeb

ForEachmyFileInmyFiles

IfmyFile.Name="index.htm"Then

IfmyFile.IsOpen=TrueThen

MsgBox"Thisfileisopen,tryagainlater."

ExitSub

Else

myFile.Open

ExitSub

EndIf

EndIf

Next

EndWith

EndSub

IsOrphanPropertyTrueindicatesthatthefilecannotbereachedbyhyperlinkfromanypageintheWebsite.Read-only.

expression.IsOrphan

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Example

ThefollowingexamplesearchesthroughthecurrentWebsiteanddisplaysthenamesofallorphanfiles.AnorphanfileisdenotedbyitsIsOrphanproperty.OnceafileisfoundwithanIsOrphanpropertythatequalsTrue,theLabelpropertyvalueisaddedtoaStringcontainingthenamesofallorphannodesintheWebsite.Thenamesoftheorphanfiles,storedintheStringvariablestrName,arethendisplayedtotheuser.IfnoorphanfilesarefoundintheWebsite,amessageisdisplayedtotheuser.

SubListOrphans()

'Displaysthenamesoforphanfiles.

DimobjAppAsFrontPage.Application

DimobjWebFileAsWebFile

DimstrNameAsString

SetobjApp=FrontPage.Application

'ForeachfileintheWebsitesite

ForEachobjWebFileInActiveWeb.AllFiles

'Checkifthefileisanorpahn

IfobjWebFile.IsOrphanThen

strName=strName&objWebFile.Name&"|"

EndIf

Next

IfstrName<>""Then

'Displaynamesofallorphanpages

MsgBox"TheorphanpagesinthecurrentWebsiteare:"&vbCr&vbCr&_

strName&"."

Else

'Noorphans,displaymessage

MsgBox"TherearenoorphanpagesintheWebsite."

EndIf

EndSub

IsReadablePropertyTrueindicatesthatafolderishasreadpermission.Read/writeBoolean.

expression.IsReadable

expressionRequired.AnexpressionthatreturnsaWebFolderobject.

Example

ThefollowingexampleretrievesthesettingoftheIsReadablepropertyforafoldercalled"images"intheactiveWebsite.

PrivateSubCheckReadable()

DimmyFolderAsWebFolder

DimmyReadStatusAsBoolean

SetmyFolder=ActiveWeb.RootFolder.Folders("images")

myReadStatus=myFolder.IsReadable

EndSub

IsRootPropertyTrueifthespecifiedWebfolderistherootfolderintheWebsite.Read-onlyBoolean.

expression.IsRoot

expressionRequired.AnexpressionthatreturnsaWebFolderobject.

Example

ThefollowingexampleretrievesthesettingoftheIsRootpropertyforaWebFolderobject.

PrivateSubCheckExecutable()

DimmyFolderAsWebFolder

DimmyIsRootAsBoolean

SetmyFolder=ActiveWeb.RootFolder.Folders("images")

myIsRoot=myFolder.IsRoot

EndSub

IsUnderRevisionControlPropertyTrueifsourcecontrolisusedonfilesinthespecifiedWebsite.Read-onlyBoolean.

expression.IsUnderRevisionControl

expressionRequired.AnexpressionthatreturnsaWebExobject.

Remarks

YoumusthaveasourcecontrolprojectcreatedthroughMicrosoftVisualSourceSafeorMicrosoftOfficeinordertouserevisioncontrol.Forinformationaboutsourcecontrolprojects,refertoManagingSourceControlProjects.

Example

Thefollowingexamplecreatesasourcecontrolprojectandthen,inthesecondprocedure,checksthestateoftheIsUnderRevisionControlproperty.

PrivateSubSourceControlProject()

DimmyWebAsWebEx

SetmyWeb=ActiveWeb

IfNot(myWeb.IsUnderRevisionControl)Then

myWeb.RevisionControlProject=_

"<FrontPage-basedLocking>"

EndIf

EndSub

PrivateSubGetRevisionState()

DimmyWebAsWebEx

DimmyRevCtrlProjAsString

DimmyIsRevCtrlAsBoolean

SetmyWeb=ActiveWeb

WithmyWeb

myRevCtrlProj=.RevisionControlProject

myIsUnderRevCtrl=.IsUnderRevisionControl

EndWith

EndSub

IsWebPropertyTrueifthespecifiedWebfolderistherootfolderforaWebsite,whichmaybetherootfolderfortheactiveWebsiteorasubsiteoffoftheactiveWebsite.Read-only.

expression.IsWeb

expressionRequired.AnexpressionthatreturnsaWebFolderobject.

Example

ThisexampleretrievesthesettingoftheIsWebpropertyforaWebFolderobject.

PrivateSubCheckExecutable()

DimmyFolderAsWebFolder

DimmyWebStatusAsBoolean

SetmyFolder=ActiveWeb.RootFolder.Folders("images")

myWebStatus=myFolder.IsWeb

EndSub

IsWritablePropertyTrueifafolderhaswritepermissions.Read-onlyBoolean.

expression.IsWritable

expressionRequired.AnexpressionthatreturnsaWebFolderobject.

Example

ThefollowingexampleretrievesthesettingoftheIsWritablepropertyforaWebFolderobject.

PrivateSubCheckExecutable()

DimmyFolderAsWebFolder

DimmyWritableStatusAsBoolean

SetmyFolder=ActiveWeb.RootFolder.Folders("images")

myWritableStatus=myFolder.IsWritable

EndSub

ShowAll

ItemPropertyItempropertyasitappliestotheMetaTagsobject.

ReturnsaVariantrepresentingapropertykey/valuepair.

expression.Item(PropertyKey)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

PropertyKeyRequiredString.Astringthatcontainsanindexnumberofthecollection.Theindexstartsatzero.

ItempropertyasitappliestothePropertiesobject.

ReturnsorsetsaVariantthatrepresentsaproperty.Read/write.

expression.Item(PropertyKey)

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

PropertyKeyRequiredString.Astringthatcontainsanindexnumberofthecollection.Theindexstartsatzero.

ItempropertyasitappliestoallotherobjectsintheAppliesTolist.

Returnsaanindividualobjectinacollection.

expression.Item(Index)

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

IndexRequiredVariant.Thenameorordinalvalueoftheobjectwithinthecollection.Indexstartsatzero.

Example

AsitappliestotheNavigationNodescollection.

Thefollowingexampledemonstratesreturningavaluebyindexinganiteminthecollection.ThisexamplereturnsthelabelforthefirstnavigationnodeinthenavigationstructureoftheactiveWeb.

NoteYouaccesstheNavigationNodescollectionthroughtheChildrenpropertyoftheRootNavigationNodepropertyoftheactiveWeb.

PrivateSubGetNavigationNode()

DimmyWebAsWebEx

DimmyNavNodesAsNavigationNodes

DimmyNavNodeLabelAsString

SetmyWeb=ActiveWeb

myNavNodeLabel=myWeb.RootNavigationNode_

.Children.Item(0).LabelEndSub

AsitappliestotheMetaTagsobject.

ThefollowingstatementreturnsthecontentsofaMETAtagthatexistsonaWebpageintheactiveWeb,anddemonstratesthePropertyKeyargument.

myMetaTagContents=ActiveWeb.RootFolder.Files_

.Item(0).MetaTags.Item("generator")

Itisn'talwaysnecessarytospecifytheindexorpropertynameoftheItempropertywhenreturningvaluesfromacollection.ThefollowingexamplereturnsalistoffilenamesofeachWebpagethatcontainsaMETAtagnameequivalentto"generator"intheactiveWeb,withoutspecifyingtheItemproperty.FindGeneratorTagsretrievesalistofthefilesthatcontainthe"generator"METAtagandaddsvalueoftheItempropertytothevariablemyMetaTag,becauseinthiscasethevalueoftheItempropertyisthesameasthefilename.Thisisdifferentfromthepreviousexample,whichreturnedthecontentsofthe"generator"METAtag.

FunctionFindGeneratorTags()AsString

DimmyWebAsWebEx

DimmyMetaTagsAsMetaTags

DimmyMetaTagAsVariant

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyMetaTagNameAsString

DimmyReturnFileNameAsString

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyWeb

ForEachmyFileInmyFiles

SetmyMetaTags=myFile.MetaTags

ForEachmyMetaTagInmyMetaTags

myMetaTagName=myMetaTag

IfmyMetaTagName="generator"Then

myReturnFileName=myReturnFileName&myFile.Name

EndIf

Next

Next

EndWith

FindGeneratorTags=myReturnFileName

EndFunction

ShowAll

LabelPropertyAsitappliestotheNavigationNodeobject.

SetsorreturnsaStringthatrepresentsthelabelassociatedwiththeactivenavigationnode.ThislabelisusedasareferenceforindividualnavigationnodesinNavigationview.Read/write.

expression.Label()

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Remarks

UsethetextintheLabelpropertyforthetextinabannerorbuttonthatlinkstoanothernavigationnodeinthenavigationstructure.

AsitappliestotheThemeobject.

ReturnsaStringthatrepresentsthenameofthespecifiedtheme.

expression.Label()

expressionRequired.AnexpressionthatreturnsaThemeobject.

Example

AsitappliestotheNavigationNodeobject.

Thefollowingexamplesetsthetextforthelabelofthefirstchildnode.ThelabelshowstheplacementofthenodeinNavigationview.

PrivateSubAddLabelToNavigationNode()

DimmyNodeAsNavigationNode

SetmyNode=ActiveWeb.HomeNavigationNode.Children(0)

myNewNode.Label="FinancePage"

EndSub

AsitappliestotheThemeobject.

Thefollowingexampleretrievesthenameofatheme.

NoteTorunthisprocedure,youmusthaveanopenWebsitewithapagethathaspreviouslyhadathemeappliedtoit.

PrivateSubGetThemeName()

DimmyThemeAsString

myTheme=ActiveWeb.Themes(0).Label

EndSub

LanguageDesignationPropertyReturnstheabbreviatednameofthedesignatedlanguageofthesystemsoftware.Read-onlyString.

expression.LanguageDesignation()

expressionRequired.AnexpressionthatreturnsaSystemobject.

Remarks

Usingthetwo-letterlanguageabbreviationfromtheISOStandard639andaddingathirdletter,suchas"u"fortheUnitedStates,createsthethree-letterabbreviation.

Youcanalsogetthetwo-letterlanguageabbreviationwithGetLocaleInfo()byspecifyingLOCALE_SABBREVLANGNAMEastheLCType.Theabbreviatedname"enu"isreturnedfortheEnglish(U.S.)languageandisthesameabbreviationthatisreturnedwiththeLanguageDesignationproperty.

Example

Thisexampledisplaystheabbreviatednameofthedesignatedlanguageofthesystemsoftware.

myLang=System.LanguageDesignation

LanguageSettingsPropertyReturnstheLanguageSettingsobjectfortheMicrosoftFrontPageapplication.Read-onlyLanguageSettings.

expression.LanguageSettings()

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThefollowingexamplereturnstheLanguageIDpropertyfortheuserinterfaceandsetstheLanguagePreferredForEditingproperties.

TheLanguageSettingspropertyhasarequiredconstantcalledMsoAppLanguageID.TheenumeratedvaluesforthisconstantaremsoLanguageIDHelp,msoLanguageIDInstall,msoLanguageIDUI,andmsoLanguageIDUIPrevious.TheLanguagePreferredForEditingpropertyalsohasenumeratedconstantsfortheavailablelanguages.Formoredetailedinformation,seetheLanguageSettingsobject.

PrivateSubGetLanguageInfo()

DimmyLSetAsLanguageSettings

DimmyLangIDAsString

DimprfLangAsString

SetmyLSet=Application.LanguageSettings

WithmyLSet

myLangID=.LanguageID(msoLanguageIDUI)

prfLang=_

.LanguagePreferredForEditing(msoLanguageIDEnglishUS)_

=True

EndWith

EndSub

ListPropertyReturnsaListobjectthatrepresentsthelistassociatedwiththespecifiedfolder.

expression.List

expressionRequired.AnexpressionthatreturnsaWebFolderobject.

Example

ThefollowingexamplereturnsthelistobjectassociatedwiththesecondfolderintheactiveWebsiteanddisplaysthenamesofallfieldsinthelist.

SubReturnList()

'Returnsthelistassociatedwithafolder

DimobjAppAsFrontPage.Application

DimobjFolderAsWebFolder

DimobjListFieldAsListField

DimobjListAsList

DimstrNameAsString

SetobjApp=FrontPage.Application

ForEachobjFolderInobjApp.ActiveWeb.AllFolders

IfNotobjFolder.ListIsNothingThen

'ReturntheListusingtheListproperty

SetobjList=objFolder.List

ForEachobjListFieldInobjList.Fields

'Addlistnamestostring

IfstrName=""Then

strName=objListField.Name&vbCr

Else

strName=strName&objListField.Name&vbCr

EndIf

Next

MsgBox"Thefieldnameswithinthe"&objList.Name&"listare:"&vbCr&_

strName

EndIf

Next

EndSub

ListsPropertyReturnsaListscollectionobjectthatrepresentsacollectionofalllistsinaWebsite.AlistcanbeaDocumentLibraryobject,aBasicListobject,oraSurveyobject.

expression.Lists

expressionRequired.AnexpressionthatreturnsaWebExobject.

Example

ThefollowingexamplereturnsareferencetotheListscollectionusingtheListspropertyfortheactiveWebsite.Theexampledisplaysthenameofeachlistinthecollection.

SubViewLists()

'ReturnsacollectionofalllistsintheWebsite

DimobjAppAsFrontPage.Application

DimobjWebAsWebEx

DimobjlistsAsLists

DimobjlistAsList

SetobjApp=FrontPage.Application

SetobjWeb=objApp.ActiveWeb

'ReferencetheListscollection

Setobjlists=objWeb.Lists

'DisplaythenameofeachlistintheListscollection

Fori=1Toobjlists.Count

MsgBox"Thenameofthelistis"&objlists.Item(i).Name

Nexti

EndSub

LookupFieldPropertyReturnsaListFieldobjectthatdefinesthefieldonwhichtoperformasearch.

expression.LookupField

expressionRequired.AnexpressionthatreturnsaListFieldLookupobject.

Example

ThefollowingexamplecreatesanewfieldoftypefpFieldLookupanddisplaysthenameofthenewfieldandthenameofthefieldthatisbeingsearched.

SubCreateLookup()

'AddsnewLookupfield

DimobjAppAsFrontPage.Application

DimobjLstFldsAslistFields

DimobjFldLookupAsListFieldLookup

DimObjFieldAsListField

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="NewFileLookupField"

'AddnewFieldoftypefpFieldLookuptolist

objLstFlds.AddName:=strName,Description:="NewLookupField",_

Fieldtype:=fpFieldLookup

SetobjFldLookup=objLstFlds.Item("NewFileLookupField")

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&".Thefieldusedforthe"&_

"lookupis"&objFldLookup.LookupField.Name&"."

EndSub

MaximumValuePropertyReturnsorsetsaVariantthatspecifiesthemaximumvalueallowedforthisfield.ThispropertyistheequivalentofsettingtheMaximumvalueallowedfieldintheModifyFielddialogboxoftheuserinterface.Read/write.

expression.MaximumValue

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

Anerrormessagewillbedisplayedtotheuserifinvaliddataisenteredintothisfield.UsetheMinimumValuepropertyvaluetosettheminimumvalueforthefield.

Example

ThefollowingexampledisplaysthenamesandmaximumvaluesofallfieldsoftypefpFieldNumberandfpFieldCurrencyinthefirstlistoftheactiveWebsite.Ifthelistcontainsnofieldsofthistype,amessageisdisplayedtotheuser.

SubDisplayMaximum()

'DisplaysthemaximumvalueofallListFieldNumber

'andListFieldCurrencyfieldsinthelist

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

DimobjLstFldAsObject

DimstrValuesAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

'Cyclethroughlistsandaddvaluetostring

ForEachobjLstFldInobjLstFlds

If(objLstFld.Type=fpFieldNumber)Or(objLstFld.Type=fpFieldCurrency)Then

strValues=strValues&objLstFld.Name&vbTab&_

objLstFld.MaximumValue&vbCr

EndIf

NextobjLstFld

IfstrValues<>""Then

MsgBox"Thefieldsandtheirmaximumvaluesare:"&vbCr&_

vbCr&strValues

Else

MsgBox"TherearenoListFieldNumberorListFieldCurrencyfieldsinthecurrentlist."

EndIf

EndSub

ThefollowingexamplechangesthemaximumvalueofallfieldsoftypeListFieldNumberinthefirstlistoftheactiveWebsitetoaconstantwiththevalue200.

NoteUsetheApplyChangesmethodtoapplyanychangesmadetothelist.

SubChangeMaximum()

'Changesmaximumvalueforallfieldsoftype

'ListFieldNumber

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

DimobjLstFldAsObject

ConstvarMaxAsVariant=200

SetobjApp=FrontPage.Application

IfobjApp.ActiveWeb.Lists.Count>0Then

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

'Cyclethroughlistsandchangevalues

ForEachobjLstFldInobjLstFlds

IfobjLstFld.Type=fpFieldNumberThen

objLstFld.MaximumValue=varMax

EndIf

NextobjLstFld

objApp.ActiveWeb.Lists(0).ApplyChanges

Else

MsgBox"TheactiveWebsitecontainsnolists."

EndIf

EndSub

MaxLengthProperty(WebObjectModel)ReturnsorsetsaLongthatrepresentsthemaximumlength(incharacters)ofthespecifiedfield.Read/write.

expression.MaxLength

expressionRequired.AnexpressionthatreturnsaListFieldSingleLineobject.

Example

ThefollowingexampleaddsanewfieldoftypefpFieldSingleLinetotheListFieldscollectionofthefirstlistintheactiveWebsiteanddisplaysthenameofthenewfield,thenameofthelisttowhichitwasadded,andthemaximumlengthincharactersofthenewfield.

SubCreateSingleLineField()

'AddnewSingleLineField

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimobjListFieldAsListFieldSingleLine

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="AlternativeName"

'AddnewfieldoftypefpFieldSingleLinetolist

objLstFlds.AddName:=strName,Description:="NumericTotalField",_

Fieldtype:=fpFieldSingleLine

SetobjListField=objLstFlds.Item("AlternativeName")

MsgBox"Anewfieldnamed"&strName&_

"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&

_".Themaximumlengthofthe"&_

"fieldis"&objListField.MaxLength&"characters."

EndSub

MetaTagsPropertyReturnstheMetaTagscollectionforthespecifiedWebFileobject.

expression.MetaTags

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Example

ThefollowingexampleiteratesthroughtheMETAtagscollectionineachfileintheactiveWebsiteandconcatenatesthefilenamesandMETAtagnamesintoastringcalledmyReturnInfo.

PrivateSubGetMetaTagInfo_Click()

DimmyWebAsWebEx

DimmyFilesAsWebFiles

DimmyFileAsWebFile

DimmyMetaTagsAsMetaTags

DimmyMetaTagAsVariant

DimmyFileNameAsString

DimmyMetaTagNameAsString

DimmyReturnInfoAsString

SetmyWeb=ActiveWeb

SetmyFiles=myWeb.RootFolder.Files

WithmyWeb

ForEachmyFileInmyFiles

SetmyMetaTags=myFile.MetaTags

ForEachmyMetaTagInmyMetaTags

myFileName=myFile.Name

myMetaTagName=myMetaTag

myReturnInfo=myFileName&":"_

&myMetaTagName

Next

Next

EndWith

EndSub

MinimumValuePropertyReturnsorsetsaVariantthatspecifiestheminimumallowedvalueforthefield.ThispropertyistheequivalentofsettingtheMinimumvalueallowedfieldintheModifyFielddialogboxoftheuserinterface.Read/write.

expression.MinimumValue

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

Anerrormessagewillbedisplayedtotheuserifinvalidinformationisenteredintothisfield.UsetheMaximumValuepropertytosetthemaximumallowedvalueofthefield.

Example

ThefollowingexampledisplaysthenamesandminimumvaluesforallfieldsoftypefpFieldNumberandfpFieldCurrencyinthefirstlistoftheactiveWebsite.

SubDisplayMinimum()

'DisplaystheminimumvalueofallListFieldNumber

'andListFieldCurrencyfieldsinthelist

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

DimobjLstFldAsObject

DimstrValuesAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

'Cyclethroughlistsandaddvaluetostring

ForEachobjLstFldInobjLstFlds

If(objLstFld.Type=fpFieldNumber)Or(objLstFld.Type=fpFieldCurrency)Then

strValues=strValues&objLstFld.Name&vbTab&_

objLstFld.MinimumValue&vbCr

EndIf

NextobjLstFld

IfstrValues<>""Then

MsgBox"Thefieldsandtheirminimumvaluesare:"&vbCr&_

vbCr&strValues

Else

MsgBox"TherearenoListFieldNumberorListFieldCurrencyfieldsinthecurrentlist."

EndIf

EndSub

ThefollowingexamplechangestheminimumvalueofallfieldsoftypefpListFieldNumberinthefirstlistintheactiveWebsitetoaconstantwiththevalue200.

NoteUsetheApplyChangesmethodtoapplyanychangesmadetothelist.

SubChangeMinimum()

'Changesminimumvalueforallfieldsoftype

'ListFieldNumber

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

DimobjLstFldAsObject

ConstvarMinAsVariant=1

SetobjApp=FrontPage.Application

IfobjApp.ActiveWeb.Lists.Count>0Then

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

'Cyclethroughlistsandchangevalues

ForEachobjLstFldInobjLstFlds

IfobjLstFld.Type=fpFieldNumberThen

objLstFld.MinimumValue=varMin

EndIf

NextobjLstFld

objApp.ActiveWeb.Lists(0).ApplyChanges

Else

MsgBox"TheactiveWebsitecontainsnolists."

EndIf

EndSub

MonthsShownPropertyReturnsorsetsaLongthatdetermineshowmanymonthswillbedisplayedintheMicrosoftFrontPageReportsview.Read/write.

expression.MonthsShown

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

Thefollowingexamplepromptstheusertoenterthenumberofmonthsheorshewantstoviewinthereport,andthensetstheMonthsShownpropertytothatvalue.Thesubroutine"SetMonths"promptstheuserforinput,performsavalidationontheinputdata,convertsittothecorrecttypeandsetstheMonthsShownpropertytothenewvalue.Ifthevalueisofanincorrecttype,anerrormessageisdisplayedtotheuser.

SubSetMonthsShown()

'ModifiestheMonthsShownproperty

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

CallSetMonths(objApp)

EndSub

SubSetMonths(ByRefobjAppAsApplication)

'SetsthenumberofmonthstoviewinReportsview

DimvarNumAsVariant

DimlngNumAsLong

'Prompttheusertoenteravalue

varNum=InputBox("Enterthenumberofmonthsyouwishtoviewinthereport.")

'Checktoseethatthevalueisofthecorrecttype

IfIsNumeric(varNum)Then

'Ifit'snumeric,convertittoLong

lngNum=CLng(varNum)

'SettheMonthsShownvaluetothenewvalue

objApp.MonthsShown=lngNum

'Displaythenewsettinginformationtotheuser

MsgBox"TheMonthsShownvaluewassetcorrectly."&_

"Thenumberofmonthsthatwillbeshownis"_

&lngNum&"."

Else

'Otherwise,displayanerrormessagetotheuser

MsgBox"Theinputvaluewasincorrect",vbCritical

EndIf

EndSub

NamePropertyReturnsaStringthatrepresentsthenameassignedtothespecifiedobject.Read-onlyString.

expression.Name

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

ThenameofafileorfolderisusuallythelastpartoftheURL.Forexample,ifyouhaveaURLof"C:\MyWebSites\AdventureWorks\index.htm",thevalueoftheNamepropertyforthefileis"index.htm".Similarly,"Images"isthevalueoftheNamepropertyforthefolderintheURL"C:\MyWebSites\AdventureWorks\Images".

Example

ThefollowingstatementreturnstheapplicationnamewithAppNameasthestringvariable.

AppName=Application.Name

NavigationNodePropertyReturnsaNavigationNodeobjectthatrepresentsthecurrentnodeinthenavigationstructure.

expression.NavigationNode

expressionRequired.AnexpressionthatreturnsaWebFileobject.

Remarks

IfaNavigationNodeisnotfoundwithinthenavigationstructureforthespecifiedWebsite,theNavigationNodepropertyreturnsNull.

Example

ThefollowingexampleusestheNavigationNodepropertytoreturnthefilenameassociatedwiththenavigationnode.

PrivateSubGetNavNode()

DimmyWebAsWebEx

DimmyNavNodeAsNavigationNode

DimmyNavNodeLabelAsString

SetmyWeb=ActiveWeb

SetmyNavNode=_

myWeb.RootNavigationNode.Files(0).NavigationNode

WithmyNavNode

myNavNodeLabel=.Label

EndWith

EndSub

NewFormPropertyReturnsorsetsaStringthatrepresentstheformusedforaddingnewcontenttothecurrentlistinMicrosoftFrontPage.Read/write.

expression.NewForm

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

ThedefaultfilenamefortheBasicListandSurveyobjectsisNewForm.htm.ThedefaultfilenamefortheDocumentLibraryobjectisUpload.htm.

Example

ThefollowingexampledisplaysthenameofeachlistintheactiveWebsiteandtherelativeURLsoftheirassociatedNewformpages.IftheactiveWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubViewNewFormURL()

'DisplaytheURLoftheform

'associatedwithaddingnewcontent

DimlstWebListAsList

DimstrURLAsString

IfNotActiveWeb.ListsIsNothingThen

'CyclethroughlistsandaddURLstostring

ForEachlstWebListInActiveWeb.Lists

IfstrURL=""Then

strURL=lstWebList.Name&"-"&_

lstWebList.NewForm&vbCr

Else

strURL=strURL&lstWebList.Name&"-"&_

lstWebList.NewForm&vbCr

EndIf

Next

'DisplayURLsofallNewformsinWebsite

MsgBox"TherelativeURLsoftheNewformsare:"_

&vbCr&vbCr&strURL

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

NewPageorWebPropertyReturnsaNewFileobjectthatrepresentsapageorWebsitelistedontheNewtaskpane.

expression.NewPageorWeb

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThefollowingexamplecreatesanewinstanceoftheNewFileobjectandaddsafilenamed"template.htm"totheNewtaskpane.ThenewfilelistingwillshowupundertheOtherfilessectionlistedatthebottomofthetaskpane.

SubNewPage()

'CreatesanewpageusingtheNewFileobject

DimobjAppAsFrontPage.Application

DimobjNewFileAsNewFile

SetobjApp=FrontPage.Application

'CreateareferencetoaninstanceoftheNewFileobject

SetobjNewFile=objApp.NewPageorWeb

objNewFile.Add"template.htm"

EndSub

NextPropertyReturnsaNavigationNodeobjectthatrepresentsthenextnavigationnodeinthenavigationsequence.Read-onlyObject.

expression.Next

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Remarks

AlthoughtheNextpropertyisamemberoftheNavigationNodeclass,thispropertynavigateswithintheChildrencollectionofthespecifiedNavigationNodeobject.

NoteTheChildrencollectiondoesnotwrap,sothatcodesuchasChildren(Children.Count–1).Nextreturnsan"ObjectvariableorWithblockvariablenotset"error.

Example

Thefollowingexamplemovesthenavigationpointertothenextnode,unlessthecurrentnodeisthelastnodeofthelevelinthenavigationstructure.

PrivateSubMoveNext()

DimtheNodeAsNavigationNode

DimtheNextNodeAsNavigationNode

OnErrorResumeNext

SettheNode=ActiveWeb.HomeNavigationNode.Children(1)

SettheNextNode=theNode.Next

IfErr<>0then

MsgBox"Endofthecurrentnavigationrow"

EndIf

EndSub

NumberOfLinesPropertyReturnsorsetsaLongthatrepresentsthenumberoflinesthatwillappearinthefield.Read/write.

expression.NumberOfLines

expressionRequired.AnexpressionthatreturnsaListFieldMultiLineobject.

Example

ThefollowingexampleaddsanewListFieldMultiLinefieldnamed"Description"totheListFieldscollection.Thesubroutinedisplaysthenameofthenewfieldaswellasthenumberoflinesitwillcontain.

SubCreateMultiLine()

'AddnewMultiLineField

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimObjFieldAsListField

DimobjLstFldMultiAsListFieldMultiLine

DimstrNameAsString

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

strName="Description"

'AddnewFieldoftypefpFieldMultiLinetolist

objLstFlds.AddName:=strName,Description:="DescriptionField",_

Fieldtype:=fpFieldMultiLine

SetobjLstFldMulti=objLstFlds.Item(strName)

objLstFldMulti.NumberOfLines=5

MsgBox"Anewfieldnamed"&strName&"wasaddedtothelist"&_

objApp.ActiveWeb.Lists.Item(0).Name&".Itcontains"&_

objLstFldMulti.NumberOfLines&"lines."

EndSub

OlderFilePropertyReturnsorsetsaLongthatdeterminesthenumberofdaysthatafilemustexistinaWebsite(withoutbeingmodified)beforeitisclassifiedasolder.Onceafileisclassifiedasolder,itappearsintheOlderFilesviewintheReportsview.Read/write.

expression.OlderFile

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

UsetheRecentFilepropertytoreturnorsetthenumberofdaysthataneworrecentlymodifiedfileshowsupintheRecentlyAddedFileslistintheReportsview.

Example

Thefollowingexamplepromptstheusertoenteravaluethatspecifiesthenumberofdaysafilemustexistbeforeitisclassifiedasolder.ThesubroutineSetOldValpromptstheuserforinput,performsavalidationontheinputdata,convertsittothecorrecttype,andsetstheOlderFilepropertytothenewvalue.Ifthevalueisofanincorrecttype,anerrormessageisdisplayedtotheuser.

SubFPOldFile()

'Setsavaluethatdetermineshowoldafileis

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

CallSetOldVal(objApp)

EndSub

SubSetOldVal(ByRefobjAppAsApplication)

'Setsthevaluethatdetermineshowoldafileis

DimvarNumAsVariant

DimlngNumAsLong

'Prompttheusertoenteravalue

varNum=InputBox("Enterthenumberofdaysafilecanexist"&

_"beforeitisclassifiedasold.")

'Checktoseethatthevalueisofthecorrecttype

IfIsNumeric(varNum)Then

'Ifit'snumeric,convertittoLong

lngNum=CLng(varNum)

'SettheOlderFIlevaluetothenewvalue

objApp.OlderFile=lngNum

'Displaythenewsettinginformationtotheuser

MsgBox"TheOlderFilevaluewassetcorrectly."&vbCr&_

"Thenumberofdaysafterwhichafilebecomesoldis"_&lngNum&"."

Else

'Otherwise,displayanerrormessagetotheuser

MsgBox"Theinputvaluewasincorrect.",vbCritical

EndIf

EndSub

OperatingSystemPropertyReturnsaStringthatrepresentsthenameofthecurrentoperatingsystem,forexample,“Windows”or“WindowsNT”.

expression.OperatingSystem()

expressionRequired.AnexpressionthatreturnsaSystemobject.

Example

Thefollowingexampledisplayssysteminformationinalabelonaform.

lblSystemInfo.Caption=System.OperatingSystem

ThisexampleprintsthenameofthecurrentoperatingsystemintheImmediatewindow.

myOpSys=System.OperatingSystem

ShowAll

OptimizeHTMLFlagsPropertyReturnsorsetsanFpOptimizeHTMLFlagsconstantthatrepresentshowtheHyperTextMarkupLanguage(HTML)isoptimizedinaWebpage.

FpOptimizeHTMLFlagscanbeoneormoreofthefollowingFpOptimizeHTMLFlagsconstants.

fpHtmlOptAdjacentTags Combinesadjacentelementsofthesametype.

fpHtmlOptAuthorComponents RemovesAuthor-TimeFrontPageWebcomponentcomments.

fpHtmlOptBrowseComponents RemovesBrowse-TimeFrontPageWebcomponentcomments.

fpHtmlOptCellFormattingAttr Removescellformattingsttributes.

fpHtmlOptDwtCmnts RemovesDynamicWebTemplatecomments.

fpHtmlOptEmpty Removesemptytags.

fpHtmlOptGeneratorRemovesMETAelementsthatcontainGeneratorandProgramaticIdentifierinformation.

fpHtmlOptHTMLAllWhitespace Removesallwhitespacesthatdon'taffectrendering.

fpHtmlOptHTMLCmnts RemovesallotherHTMLcomments.

fpHtmlOptHTMLLeadWhitespace Removesleadingwhitespacesfromeachline.fpHtmlOptHTMLMisnest Removesincorrectlynestedtags.fpHtmlOptOn Enablesoptimization.fpHtmlOptScriptCmnts Removesscriptcomments.fpHtmlOptThemes Removesthemecomments.

fpHtmlOptTrcImageAttr RemovesimagetracingattributesfromtheBODYelement.

fpHtmlOptUnusedStyles Removesunusedstyles.RemovesVectorMarkupLanguage

fpHtmlOptVMLGraphics (VML)fromapagethatusesOfficedrawingsandWordArt.

fpHtmlOptWordHTML RemovesWord-specificHTMLmarkup.

expression.OptimizeHTMLFlags

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

UsefpHTMLOptOntoturnoptimizationon.Specifyadditionaloptimizationsettingsbyseparatingeachwithanampersand(&).

Example

ThefollowingexampleturnsoptimizationonforthecurrentpageandspecifiesthatallMicrosoftFrontPageWebcomponentcommentsaretoberemovedfromthepage.

Application.OptimizeHTMLFlags=fpHtmlOptOn_

+fpHtmlOptAuthorComponents+fpHtmlOptBrowseComponents

ShowAll

OptimizeHTMLPublishFlagsPropertySetsorreturnsoneormoreFpOptimizeHTMLFlagsconstantsthatrepresentshowtheHyperTextMarkupLanguage(HTML)inthepagesofaWebsiteisoptimizedduringpublishing.

FpOptimizeHTMLFlagscanbeoneormoreofthefollowingFpOptimizeHTMLFlagsconstants.

fpHtmlOptAuthorComponents RemovesAuthor-TimeFrontPageWebcomponentcomments.

fpHtmlOptBrowseComponents RemovesBrowse-TimeFrontPageWebcomponentcomments.

fpHtmlOptCellFormattingAttr Removescellformattingattributes.

fpHtmlOptDwtCmnts RemovesDynamicWebTemplatecomments.

fpHtmlOptGeneratorRemovesMETAelementsthatcontainGeneratorandProgramaticIdentifierinformation.

fpHtmlOptHTMLAllWhitespace Removesallwhitespacesthatdon'taffectrendering.

fpHtmlOptHTMLCmnts RemovesallHTMLcomments.

fpHtmlOptHTMLLeadWhitespace Removesleadingwhitespacesfromeachline.fpHtmlOptOn Enablesoptimization.fpHtmlOptScriptCmnts Removesscriptcomments.fpHtmlOptThemes Removesthemecomments.

fpHtmlOptTrcImageAttr RemovesimagetracingattributesfromtheBODYelement.

fpHtmlOptVMLGraphicsRemovesVectorMarkupLanguage(VML)fromapagethatusesOfficedrawingsandWordArt.

fpHtmlOptWordHTML RemovesWord-specificHTMLmarkup.

expression.OptimizeHTMLPublishFlags

expressionRequired.AnexpressionthatreturnsoneaWebExobject.

Remarks

UsefpHTMLOptOntoturnoptimizationon.Specifyadditionaloptimizationsettingsbyseparatingeachwithanampersand(&).

Example

ThefollowingexampleturnsoptimizationonfortheactiveWebsiteandspecifiesthatallMicrosoftFrontPageWebcomponentcommentsaretoberemovedwhenpublishingthesite.

ActiveWeb.OptimizeHTMLPublishFlags=fpHtmlOptOn_

+fpHtmlOptAuthorComponents+fpHtmlOptBrowseComponents

OrganizationNamePropertyReturnsthenameoftheorganizationfortheapplication.Read-onlyString.

NoteThenameoftheorganizationisusuallysetduringtheinstallationofanapplicationoroperatingsystem.

Example

InsteadofcreatingacompanynamevariableforyourWebpage,youcanusetheorganizationnameasshowninthefollowingstatement.

myCompanyName=Application.OrganizationName

PageWindowsPropertyReturnsthespecifiedPageWindowExobject.

expression.PageWindows

expressionRequired.AnexpressionthatreturnsaWebWindowExobject.

Example

ThefollowingexampleretrievesapagewindowthatcontainsthepageSpain.htmandsetstheviewmodetoPreview.

NoteTorunthisprocedure,youmusthaveanopenWebsitethatcontainsanopenpagecalledSpain.htm,orsubstituteafileofyourchoice.

PrivateSubSetPagePreview()

DimmyPageAsPageWindowEx

SetmyPage=ActiveWebWindow.PageWindows("Spain.htm")

myPage.ViewMode=fpPageViewPreview

EndSub

ParentPropertyReturnsanObjectthatrepresentstheParentobjectforthespecifiedobject.

expression.Parent

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

SpecifyingtheParentpropertyofaWebFileobjectreturnstheWebFolderobject.WhenanobjectiscontainedinaWebsite,theParentpropertyreturnstheWebExobject.Forexample,iftheThemeobjectiscontainedinaWebExobjectcalled"AdventureWorksWeb",theParentpropertyreturns"AdventureWorksWeb";otherwise,forathemereferencedoutsideofaWebExobject,theParentpropertyreturnsthenameoftheApplicationobject—inthiscase,"MicrosoftFrontPage".However,whentheSystemobjectisspecifiedfromaclientcomputer,theParentpropertyreturnstheApplicationobjectofthehost,nottheclient.

Thefollowingtabledescribesthevaluesreturnedforthedifferentobjecttypes.

Object DescriptionMetaTags ReturnstheWebFileobjectfortheMETAtags.

NavigationNodeReturnstheparentNavigationNodeobject,exceptinthecaseoftheRootNavigationNodeobject,whoseparentistheWebExobject.

NavigationNodes ReturnstheparentNavigationNodeobjectforthecollectionofnavigationnodesbasedonthenavigationstructure.

PageWindowEx ReturnstheWebWindowExorApplicationobjectinwhichthepageresides.

PageWindows ReturnstheApplicationobjectthatcontainsthecollection.

Properties ReturnstheWebEx,WebFile,orWebFolderobjectfromtheMETAtaginformation.

System ReturnstheApplicationobject.Theme ReturnstheparentWebExorWebFileobjectforthetheme.Themes ReturnstheWebExobjectthatcontainsthecollection.WebEx ReturnstheApplicationobject.WebFile ReturnstheWebFolderobject.WebFiles ReturnstheparentWebFolderobject.

WebFolderReturnseithertheparentWebFolderobject(ifit'sasubfolder)ortheWebExobjectfortherootfolder.

WebFolders ReturnstheWebFolderobjectthatcontainsthecollection.Webs ReturnstheApplicationobject.

WebWindowEx ReturnstheApplicationobjectthatcontainsthespecifiedobject.

WebWindows ReturnstheApplicationobjectthatcontainsthecollection.

Example

Inthefollowingexample,myParentreturnsthefiletypeandbuildoftheparentapplicationfortheactiveWebsite.

PrivateSubGetParentInfo()

DimmyWebAsWebEx

DimmyParentAsString

DimmyParentBuildAsString

SetmyWeb=Application.ActiveWeb

WithmyWeb

myParent=.Parent.FileSearch.FileType

myParentBuild=.Parent.Build

EndWith

EndSub

PrevPropertyReturnsaNavigationNodeobjectthatrepresentsthepreviousnavigationnodeinthenavigationsequence.Read-only.

expression.Prev

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Example

Thefollowingexamplemovesthenavigationpointertothepreviousnode,unlessthecurrentnodeisthefirstnodeofthelevelinthenavigationstructure.

PrivateSubMovePrev()

DimtheNodeasNavigationNode

DimthePrevNodeasNavigationNode

OnErrorResumeNext

SettheNode=ActiveWeb.HomeNavigationNode.Children(1)

SetthePrevNode=theNode.Prev

IfErr<>0Then

MsgBox"Thecurrentnavigationlevelstartshere."

EndIf

EndSub

PreviewDocumentPropertyReturnsanIHTMLDocument2objectthatrepresentsthedocumentinthepreviewmodeofthePageview.

expression.PreviewDocument

expressionRequired.AnexpressionthatreturnsaPageWindowExobject.

Remarks

ThePreviewDocumentpropertyreturnsnothingiftheactivepagewindowisnotcurrentlyinpreviewmode.

Example

Thefollowingexampledisplaysthetitleofthedocumentcurrentlyinpreviewmode.Ifthereisnodocumentinpreviewmode,amessageisdisplayedtotheuser.

SubPreviewDocument()

'Displaysthetitleofthedocumentcurrentlyinpreviewmode

DimFPAppAsFrontPage.Application

DimobjPageWindowAsPageWindowEx

SetFPApp=FrontPage.Application

SetobjPageWindow=FPApp.ActivePageWindow

'Ifthepagewindowisinpreviewmode,displaythetitle

IfobjPageWindow.ViewMode=fpPageViewPreviewThen

MsgBox"Thetitleofthedocumentis:"_

&objPageWindow.PreviewDocument.Title

Else

MsgBox"Thepagewindowisnotinpreviewmode."

EndIf

EndSub

ProductCodePropertyReturnsthegloballyuniqueidentifier(GUID)forMicrosoftFrontPage.Read-onlyString.

expression.ProductCode()

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThisstatementreturnstheProductIDforFrontPage.

mySystem=Application.ProductCode

ProfileStringPropertyReturnsorsetsaStringthatrepresentsanentryintheMicrosoftWindowsregistryunderthefollowingsubkey:

HKEY_CURRENT_USER\Software\Microsoft\FrontPage\

expression.ProfileString(RegistrySection,RegistryKey)

expressionRequired.AnexpressionthatreturnsaSystemobject.

RegistrySectionRequiredString.Asubkeybelowthe"HKEY_CURRENT_USER\Software\Microsoft\FrontPage\"subkeyintheWindowsregistry.

RegistryKeyRequiredString.ThenameoftheentryinthesubkeyspecifiedbyszSection.Forexample,SoftwareorNetworkintheRegistryEditoraresubkeys.

Example

Thefollowingexamplereturnsthevalueofthesubkey,0(zero),intheRecentlyUsedURLsentry.

NoteTorunthisexample,youmusthaverecentlyopenedapagethatexistsinoneofyourWebsites.

PrivateSubGetRegRecentlyUsedInfo()

DimmySecKeyAsString

DimmyRegKeyAsString

DimmyProfileAsString

mySecKey="HKEY_CURRENT_USER\Software"

mySecKey=mySecKey&_

"\Microsoft\FrontPage\Editor\RecentlyUsedURLs"

myRegKey="0"

myProfile=System.ProfileString(mySecKey,myRegKey)

EndSub

PropertiesPropertyReturnsaPropertiescollectionthatrepresentsthepropertiesforthespecifiedobject.

expression.Properties

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexampleaddsanewpropertyanddisplaysitontheactiveWebpage.

NoteTorunthisexample,youmusthaveaWebsitecalled"C:\MyDocuments\MyWebSites\RogueCellars"andafilecalled"Zinfandel.htm".Or,youmaysubstituteanalternativeWebsiteURLandfilename.

PrivateSubCopyrightAdd()

DimmyWebAsWebEx

DimmyCopyrightAsString

myCopyright="Copyright1999byRogueCellars"

SetmyWeb=Webs.Open("C:\MyDocuments\MyWebSites\RogueCellars")

myWeb.Activate

ActiveWeb.Properties.Add"Copyright",myCopyright

ActiveWeb.RootFolder.Files("Zinfandel.htm").Open

ActiveDocument.body.insertAdjacentText"BeforeEnd",_

ActiveWeb.Properties("Copyright")

ActivePageWindow.Save

ActiveWeb.Close

EndSub

ReadOnlyPropertyReturnsaBooleanthatdeterminesifaspecifiedfieldhasread-onlypermissions.IfTrue,thefieldcannotbemodifiedbytheuser.Read-only.

expression.ReadOnly

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

Thefollowingexamplestoresthenamesanddefaultvaluesofallfieldswithread-onlypermissionsinthefirstlistoftheactiveWebsite.IftheactiveWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubFieldPermissions()

'Displaysread/writepermissionsofall

'fieldsinthelist.

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimobjFieldsAslistFields

DimstrPermsAsString

SetobjApp=FrontPage.Application

SetobjFields=objApp.ActiveWeb.Lists.Item(0).Fields

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjFields

'Iffieldisread-only,addtolist

IfobjField.ReadOnly=TrueThen

IfstrPerms=""Then

'iffirstvalueinstring

strPerms=objField.Name&"-"&_

objField.DefaultValue&vbCr

Else

'addvaluetostring

strType=strPerms&objField.Name&"-"&_

objField.DefaultValue&vbCr

EndIf

EndIf

NextobjField

Else

'displaymessagetouser

MsgBox"TheactiveWebsitecontainsnolists."

EndIf

EndSub

ShowAll

ReadSecurityPropertyReturnsorsetsanFpListReadSecurityconstantthatrepresentswhichuserscanreadtheinformationinaspecifiedlist.Read/write.

FpListReadSecuritycanbeoneoftheseFpListReadSecurityconstants.fpListReadSecurityAllAlluserscanreadthelist.fpListReadSecurityOnlyOwnOnlythecreatorofthelistcanreadit.

expression.ReadSecurity

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplechangesthereadpermissionsofalllistsoftypefpListBasicListintheactiveWebsitetofpListReadSecurityAll.AlluserscannowreadalllistsoftypefpListTypeBasicList.

NoteUsetheApplyChangesmethodtosaveanychangestothelist.

SubChangePermissions()

'ChangespermissionofallBasicListsinthecurrentWebsite

DimobjAppAsFrontPage.Application

DimobjListAsObject

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Cyclethrougheachlistandcheckforlisttype

ForEachobjListInobjLists

'Ifit'saBasicListthenchangepermissions

IfobjList.Type=fpListTypeBasicListThen

IfobjList.ReadSecurity<>fpListReadSecurityAllThen

objList.ReadSecurity=fpListReadSecurityAll

objList.ApplyChanges

EndIf

EndIf

Next

EndSub

RecentFilePropertyReturnsorsetsaLongthatrepresentsthenumberofdaysthataneworrecentlymodifiedfileshowsupintheRecentlyAddedFileslistinReportsview.Forexample,iftheRecentFilepropertyissetto20,anewfileorafilethathasbeenmodifiedwillbeclassifiedasrecentforthefirst20daysofitsexistence.Read/write.

expression.RecentFile

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

UsetheOlderFilepropertytosetthenumberofdaysafileexistsinaWebsitewithoutbeingmodifiedbeforeitshowsupintheOlderFileslistinReportsview.

Example

Thefollowingexamplepromptstheusertoenterthenumberofdaysafilecanexistwiththeclassificationrecent,andthensetstheRecentFilepropertytothatvalue.ThesubroutineSetRecentpromptstheuserforinput,performsavalidationontheinputdata,convertsittothecorrecttype,andsetstheRecentFilepropertytothenewvalue.Ifthevalueisofanincorrecttype,anerrormessageisdisplayedtotheuser.

SubFPRecentFile()

'Setsavaluethatdetermineshowlongafilecanbeclassifiedrecent

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

CallSetRecent(objApp)

EndSub

SubSetRecent(ByRefobjAppAsApplication)

'Setsthevaluethatdetermineshowlongafilewillbeclassifiedasrecent

DimvarNumAsVariant

DimlngNumAsLong

'Prompttheusertoenteravalue

varNum=InputBox("Enterthenumberofdaysafile"&_

"canexistbeforeitisclassifiedasold.")

'Checktoseethatthevalueisofthecorrecttype

IfIsNumeric(varNum)Then

'Ifit'snumeric,convertittoLong

lngNum=CLng(varNum)

'SettheRecentFilevaluetothenewvalue

objApp.RecentFile=lngNum

'Displaythenewsettinginformationtotheuser

MsgBox"TheRecentFilevaluewassetcorrectly."&vbCr&_

"Thenumberofdaysanewormodifiedfilewillbeclassifiedasrecentis"_

&lngNum&"."

Else

'Otherwise,displayanerrormessagetotheuser

MsgBox"Theinputvaluewasincorrect.",vbCritical

EndIf

EndSub

RequiredPropertyReturnsorsetsaBooleanthatdeterminesifthefieldisrequired.Ifthefieldisrequired,itcannotberemovedfromthecurrentlist.Read/write.

expression.Required

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

Thefollowingexampledisplaysthenamesanddefaultvaluesofallrequiredfieldsinthecurrentlist.IfnorequiredfieldsexistoriftheactiveWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubDisplayRequiredFields()

'Displaysthenamesanddefaultvalues

'ofallrequiredfieldsinthefirstlistof

'theweb.

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimobjFieldsAsListFields

DimstrReqAsString

DimBlnFoundAsBoolean

SetobjApp=FrontPage.Application

SetobjFields=objApp.ActiveWeb.Lists.Item(0).Fields

'setfoundflagtofalse

BlnFound=False

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjFields

'Iffieldisrequired,addtolist

IfobjField.Required=TrueThen

IfstrReq=""Then

'iffirstvalueinstring

strReq=objField.Name&"-"&_

objField.DefaultValue&vbCr

'Thelistcontainsatleast1requiredfield

BlnFound=True

Else

'addvaluetostring

strReq=strReq&objField.Name&"-"&_

objField.DefaultValue&vbCr

EndIf

EndIf

NextobjField

Else

'displaymessagetouser

MsgBox"Theactivewebcontainsnolists."

EndIf

IfBlnFound=TrueThen

MsgBox"Thecurrentlistcontainsthefollowingrequiredfields:"&_

vbCr&strReq

Else

MsgBox"Thecurrentlistcontainsnorequiredfield(s)."

EndIf

EndSub

ShowAll

ReturnTypePropertyReturnsanFpFieldTypethatrepresentsthetypeoffield.

FpFieldTypecanbeoneofthefollowingFpFieldTypeconstants.

fpFieldAttachments ReturnsaListFieldAttachmentsobject.fpFieldChoice ReturnsaListFieldChoiceobject.fpFieldComputed ReturnsaListFieldComputedobject.fpFieldCounter ReturnsaListFieldCounterobject.fpFieldCurrency ReturnsaListFieldCurrencyobject.fpFieldDateTime ReturnsaListFieldDateTimeobject.fpFieldFile ReturnsaListFieldFileobject.fpFieldInteger ReturnsaListFieldIntegerobject.fpFieldLookup ReturnsaListFieldLookupobject.fpFieldMultiLine ReturnsaListFieldMultilineobject.fpFieldNumber ReturnsaListFieldNumberobject.fpFieldRatingScale ReturnsaListFieldRatingScaleobject.fpFieldSingleLine ReturnsaListFieldSingleLineobject.fpFieldTrueFalse ReturnsaListFieldTrueFalseobject.fpFieldURL ReturnsaListFieldURLobject.

expression.ReturnType

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

RevisionControlProjectPropertyReturnsorsetstheRevisionControlProjectproperty.Read/writeString.

expression.RevisionControlProject()

expressionRequired.AnexpressionthatreturnsaWebExobject.

Remarks

ArevisioncontrolprojectcaneitherbeaMicrosoftVisualSourceSafeproject,oraFrontPage-basedlockingproject.ForaVisualSourceSafecontrolproject,youmuststarttheRevisionControlProjectpropertywiththestring"$/";foraFrontPage-basedlockingcontrolproject,youmustsettheRevisionControlProjectpropertyto"<FrontPage-basedLocking>".

Toremoveasourcecontrolproject,settheRevisionControlProjectpropertytoanemptystring.

Example

ThefollowingexamplesetstheRevisionControlProjectpropertyinaVisualSourceSafeproject.

PrivateSubSetRevisionControlProjectName()

DimmyWebAsWebEx

DimmyRevisionControlProjectAsString

SetmyWeb=ActiveWeb

myRevisionControlProject=_

"$/RogueCellars/RogueCellarsUpdate"

myWeb.RevisionControlProject=_

myRevisionControlProject

EndSub

RootFolderPropertyReturnsaWebFolderobjectthatrepresentstheactiveWebExobject'sroot.

expression.RootFolder()

expressionRequired.AnexpressionthatreturnsaWebExobject.

Example

Thefollowingstatementreturnsthenameoftherootfolder.

ActiveWeb.RootFolder.Name

RootNavigationNodePropertyReturnsaNavigationNodeobjectthatrepresentsthetop-levelnavigationnode.

expression.RootNavigationNode()

expressionRequired.AnexpressionthatreturnsaWebExobject.

Remarks

YoucanusetheRootNavigationNodepropertytodeterminetherootnavigationnode.TheRootNavigationNodepropertyreturnstheNavigationNodeobjectfromwhichyoucanaccessallothernavigationnodesinaWebsite.TheRootNavigationNodeobjectiscreatedbydefaultwhenyoucreateaWebsiteandprovidesthebasisforthenavigationstructure,whichisaccessedthroughtheChildrencollection.ThefirstchildnodeofthenavigationstructureisthehomepageoftheWebsite.

Example

Thefollowingexampleaddsaglobalnavigationnodetotherightofthehomenavigationnode.

PrivateSubAddNode()

DimmyRNodeAsNavigationNode

DimmyPageAsString

SetmyRNode=ActiveWeb.RootNavigationNode

myPage="http://myServer/myWeb/search.htm"

CallmyRNode.Children.Add(myPage,"Search",_

fpStructRightmostChild)

ActiveWeb.ApplyNavigationStructure

EndSub

ShowAll

SelectedFilesPropertyReturnsanarrayofWebFileobjectsrepresentingtheselectedfiles.

expression.SelectedFiles

expressionRequired.AnexpressionthatreturnsaWebWindowExobject.

Remarks

YoumusthaveFoldersviewopeninMicrosoftFrontPageinordertoselectmultiplefilesandyoumustusetherightpanetoselectthefiles.FromFoldersviewyoucanselectmultiplefilesinasingleWebsiteorinmultipleWebsites.IfyoumustusePageview,youcanonlyselectonefileperWebsitefromtheleftpane.

Tip

YoucanusethefpWebViewFoldersconstantoftheViewModepropertytosettheviewtotheFoldersview.

Example

Thefollowingexampleconcatenatesthenamesoftheselectedfiles.

NoteThedelimiterusedtoseparatethefilenamesinthevariablemySelNameisaspace.

PrivateSubGetSelectedFileNames()

DimmyWebWindowsAsWebWindows

DimmyWebWindowAsWebWindowEx

DimmySelFilesAsVariant

DimmySelFileAsWebFile

DimmySelNameAsString

DimmyCountAsInteger

SetmyWebWindows=WebWindows

mySelFiles=ActiveWebWindow.SelectedFiles

FormyCount=0ToUBound(mySelFiles)

SetmySelFile=mySelFiles(myCount)

mySelName=mySelName&""&mySelFile.Name

Next

EndSub

SelectedFoldersPropertyReturnsanarrayofWebFolderobjectsrepresentingtheselectedfolders.

expression.SelectedFolders

expressionRequired.AnexpressionthatreturnsaWebWindowExobject.

Remarks

YoumusthaveFoldersviewopeninMicrosoftFrontPageinordertoselectmultiplefoldersandyoumustusetherightpanetoselectthefolders.FromFoldersview,youcanselectmultiplefoldersinasingleWebsiteorinmultipleWebsites.IfyoumustusePageview,youcanonlyselectonefolderperWebsitefromthefoldersintheleftpane.

NoteIfyou'reprogrammaticallyselectingfolders,youcanusethefpWebViewFoldersconstantoftheViewModepropertytosettheviewtoFoldersview.

Example

Thefollowingexampleconcatenatesthenamesoftheselectedfolders.

NoteThedelimiterusedtoseparatethefoldernamesinthevariablemySelNameisaspace.

PrivateSubGetSelectedFolderNames()

DimmyWebWindowsAsWebWindows

DimmyWebWindowAsWebWindowEx

DimmySelFoldersAsVariant

DimmySelFolderAsWebFolder

DimmySelNameAsString

DimmyCountAsInteger

SetmyWebWindows=WebWindows

mySelFolders=ActiveWebwindow.SelectedFolders

FormyCount=0ToUBound(mySelFolders)

SetmySelFolder=mySelFolders(myCount)

mySelName=mySelName&""&mySelFolder.Name

Next

EndSub

ShowAll

SharedBordersPropertyTrueifanysharedbordersareinusefortheWebExorWebFileobject.Read/writeVariant.

expression.SharedBorders(BorderIndex)

expressionRequired.AnexpressionthatreturnsaWebExorWebFileobject.

BorderIndexOptionalFpSharedBorders.TheborderindexcanbeoneoftheFpSharedBordersconstants.ThedefaultconstantisfpBorderTop.

FpSharedBorders Value DescriptionfpBorderTop 1 Setsaborderforthetopofapage.fpBorderLeft 2 Setsaborderfortheleftsideofapage.fpBorderRight 4 Setsaborderfortherightsideofapage.fpBorderBottom 8 Setsaborderforthebottomofapage.fpBorderAll 255or&HFF Setsbordersonallsidesofapage.

Remarks

Sharedborders,suchastheconstantfpBorderLeft,canbeusedtosetindividualbordervalues.

NoteThedefaultsharedborderisusedifasharedborderisnotspecified.

Example

ThefollowingexamplesetsthesharedborderfortheactiveWebsite.

PrivateSubSetSharedBorders()

DimmyPageAsPageWindowEx

ActiveWeb.SharedBorders(fpBorderLeft)=True

EndSub

ShowAsPercentagePropertyReturnsorsetsaBooleanthatdeterminesifthevalueinthefieldwillbedisplayedasapercentage.Read/write.

expression.ShowAsPercentage

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplesetstheShowAsPercentagepropertyofallfieldsoftypefpFieldNumbertoTrue.Thevaluesinthefieldswillnowappearaspercentages.

NoteUsetheApplyChangesmethodtoapplyanychangesmadetothelist.

SubDisplayAsPercentage()

'DisplaysallfieldsoftypefpFieldNumberas

'apercentage

DimobjAppAsFrontPage.Application

DimobjLstFldsAsListFields

DimstrNameAsString

DimobjLstFldAsObject

SetobjApp=FrontPage.Application

SetobjLstFlds=objApp.ActiveWeb.Lists.Item(0).Fields

'Cyclethroughlistsanddisplaysasapercentage

ForEachobjLstFldInobjLstFlds

IfobjLstFld.Type=fpFieldNumberThen

objLstFld.ShowAsPercentage=True

EndIf

NextobjLstFld

objApp.ActiveWeb.Lists.Item(0).ApplyChanges

EndSub

ShowStartupDialogPropertyReturnsorsetsaBooleanthatdeterminesiftheNewtaskpanewillbedisplayedwhenMicrosoftFrontPageisstarted.

expression.ShowStartupDialog

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

TheShowStartuppropertyisglobal,meaningthatanychangeswillnottakeaffectuntilFrontPageisrestarted.

Example

ThefollowingexamplesetstheShowStartupDialogpropertytoTrue.ThenexttimeFrontPageisstarted,theNewpanewillappear.

SubTaskPaneStartup()

'ModifestheStartuptaskpaneproperty

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

WithobjApp

'SettoTrue,thetaskpanewillappearonstartup

.ShowStartupDialog=True

EndWith

EndSub

ShowUserNamesInResultsPropertyReturnsorsetsaBooleanthatdeterminesifthenamesofuserswhohavecompletedthesurveywillbevisible.Read/write.

expression.ShowUserNamesInResults

expressionRequired.AnexpressionthatreturnsaSurveyobject.

Example

ThefollowingexamplesetstheShowUserNamesInResultspropertyforeachSurveyobjectintheactiveWebsitetoTrue,displayingthenamesofalluserswhocompletedthesurvey.

NoteUsetheApplyChangesmethodtosaveanychangesmadetothelist.

SubChangePermissions()

'ChangespermissionofallBasicListsinthecurrentWebsite

DimobjAppAsFrontPage.Application

DimobjListAsObject

DimobjListsAsLists

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

'Cyclethrougheachlistandcheckforlisttype

ForEachobjListInobjLists

'Ifit'saSurveythenchangepermissions

IfobjList.Type=fpListTypeSurveyThen

IfobjList.ShowUserNamesInResults<>TrueThen

objList.ShowUserNamesInResults=True

objList.ApplyChanges

EndIf

EndIf

Next

EndSub

SlowPagePropertyReturnsorsetsaLongthatspecifiesthenumberofsecondsapagecantaketodownloadbeforeitisclassifiedasslow.PagesthatareclassifiedasslowappearintheSlowPageslistintheMicrosoftFrontPageReportsview.Read/write.

expression.SlowPage

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

TheSlowPagepropertyisusedinconjunctionwiththeConnectionSpeedpropertytodeterminethesimulateddownloadtimeofaWebpage.

Example

ThefollowingexamplesetstheSlowPagepropertyto10seconds,indicatingthatallpagesthattakeover10secondstodownload(inthiscase,usinga56Kmodem)willbeclassifiedasslowintheFrontPageReportsview.

SubSetSlowPage()

'ModifiestheSlowPageproperty

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

WithobjApp

'Setvalueto10,slowpagestakeatleast10seconds

.SlowPage=10

'Setuser'sconnectionspeedto56Kmodem

.ConnectionSpeed=fpConnect56K

EndWith

EndSub

StartNumberPropertyReturnsaLongthatrepresentsthestartingnumberforthenumberscaleinaratingscalefield.

expression.StartNumber

expressionRequired.AnexpressionthatreturnsaListFieldRatingScaleobject.

SubjectPropertySetsorreturnsaStringthatrepresentsthesubjectofaWebpackage.

expression.Subject

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplecreatesanewWebpackageandaddsthepage"test.htm"tothepackage,includingalldependenciesforthepage,andthensavesthenewWebpackage.

DimobjWebAsWebEx

DimobjPackageAsWebPackage

SetobjWeb=ActiveWeb

SetobjPackage=objWeb.CreatePackage("NewWebPackage")

WithobjPackage

.Author="JohnSmith"

.Company="FourthCoffee"

.Subject="ThisisanewWebpackageforFourthCoffee."

.AddobjWeb.Url&"/test.htm",fpDepsDefault

.Save"c:\NewWebPackage.fwp",True

EndWith

SubTreePropertyReturnsaNavigationNodescollectionobjectthatrepresentsacollectionofallthenodesinthesubtreeofthecurrentnavigationnode.Asubtreeofanodeisdefinedasallnodeswhichareadjacenttoorattachedtotheparentnodeandappearbelowtheparentnodeinthetreehierarchy.

expression.SubTree

expressionRequired.AnexpressionthatreturnsaNavigationNodeobject.

Example

ThefollowingexamplepromptstheusertoenterthenameofanavigationnodeinthecurrentWebsiteandreturnsthesubtreeforthatparticularnode.Ifthenodeisfound,itslabelpropertyvalueisaddedtoaStringcontainingthenamesofallnodesintheparentnode'ssubtree.TheStringstoredinthevariablestrSubNodesisdisplayedtotheuser.IfthenodeisnotfoundintheWebsite,amessageisdisplayedtotheuser.

SubDisplaySubTree()

'Returnsthesubtreeofagivennode

DimobjAppAsFrontPage.Application

DimobjNavNodeAsNavigationNode

DimobjNavNodesAsNavigationNodes

DimobjSubTreeAsNavigationNodes

DimobjSubNodeAsNavigationNode

DimstrAnsAsString'Userinput

DimblnFoundAsBoolean'Booleanfoundflag

DimintCountAsInteger'Integercounter

DimstrSubNodesAsString'Namesofallsubnodes

blnFound=False

intCount=0

SetobjApp=FrontPage.Application

'CreateareferencetotheNavigationNodescollection

SetobjNavNodes=objApp.ActiveWeb.AllNavigationNodes

'Prompttheusertoenterthenameofthenode

strAns=InputBox("Enterthenameofthenodeforwhich"&_

"youwanttoviewthesubtree.")

'Whilethenodeisnotfoundandtherearemorenodesinthetree

DoWhile(NotblnFound=True)And(intCount<=objNavNodes.Count-1)

'Compareuserinputwithnodelabel

IfTrim(strAns)=objNavNodes.Item(intCount).LabelThen

'Iffound,returnnode

SetobjNavNode=objNavNodes.Item(intCount)

'Setfoundflagtotrue

blnFound=True

Else

'Otherwiseincreasecounter,keepchecking

intCount=intCount+1

EndIf

Loop

IfblnFound=TrueThen

SetobjSubTree=objNavNode.SubTree

ForEachobjSubNodeInobjSubTree

'Ifthestringisemptyorhasnotyetbeenset

IfstrSubNodes=""Then

strSubNodes=strSubNodes&objSubNode.Label

Else

'otherwiseaddnextnodelabletostring

strSubNodes=strSubNodes&","&vbCr&objSubNode.Label

EndIf

NextobjSubNode

'Displaynamesofallnodesinsubtree

MsgBox"Thenodesfoundinthesubtreeof"&objNavNode.Label&"are:"_

&vbCr&vbCr&strSubNodes&"."

Else

'Ifnotfound,displaymessagetouser

MsgBox"Thenavigationnode"&strAns&"wasnotfound."

EndIf

EndSub

ShowAll

SubViewModePropertyReturnsorsetsanFpWebSubViewconstantthatdeterminestheviewtypeinthecurrentsubwindow.Read/write.

FpWebSubViewcanbeoneoftheseFpWebSubViewconstants.fpWebSubViewFoldersChangethecurrentsubwindowviewtoFoldersview.fpWebSubViewNavigationChangethecurrentsubwindowtoNavigationview.fpWebSubViewNoneClosethecurrentsubwindow.

expression.SubViewMode

expressionRequired.AnexpressionthatreturnsaWebWindowExobject.

Example

ThefollowingexamplepromptstheusertoopenthesubwindowinFoldersviewifthesubwindowisnotcurrentlyvisible.Ifthesubwindowiscurrentlyopen,theuserisnotpromptedandtheprogramends.

SubSubModeType()

'Modifiesthesubwindowviewmodeofthecurrentwebwindow

DimobjAppAsFrontPage.Application

DimobjWebwdwAsWebWindowEx

DimstrAnsAsString

SetobjApp=FrontPage.Application

SetobjWebwdw=objApp.ActiveWebWindow

'Checkifthesubwindowisopenorclosed

IfobjWebwdw.SubViewMode=fpWebSubViewNoneThen

strAns=MsgBox("Thesubwindowisnotvisible."&_

"Wouldyouliketoviewthesubwindow?",vbYesNo)

'Prompttheusertoopenthesubwindow

IfstrAns=vbYesThen

'ChangethesubwindowtoFolderview

objWebwdw.SubViewMode=fpWebSubViewFolders

EndIf

EndIf

EndSub

SystemPropertyReturnstheSystemobject.

expression.System()

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

Thisstatementreturnsthecurrentoperatingsystem.

mySystem=Application.System.OperatingSystem

TemplatePropertyReturnsorsetsaStringthatrepresentsthefilepathofthetemplateappliedtothedocumentlibrary.Read/write.

expression.Template

expressionRequired.AnexpressionthatreturnsaDocumentLibraryobject.

Example

ThefollowingexamplecreatesareferencetoadocumentlibrarynamedNewLibraryanddisplaysthefilepathofthetemplateassociatedwiththelibrary.

SubTemplatePath()

'Displaysthefilepathofthetemplate

DimobjAppAsFrontPage.Application

DimobjListsAsLists

DimobjLibraryAsDocumentLibrary

SetobjApp=FrontPage.Application

SetobjLists=objApp.ActiveWeb.Lists

SetobjLibrary=objLists.Item("NewLibrary")

'Displaymessagetouser

MsgBox"Thefilepathofthetemplateassociatedwiththe"&_

"documentlibraryis"&objLibrary.Template&"."

EndSub

ShowAll

ThemePropertiesPropertyReturnstheThemeobjectforthespecifiedobject.

expression.ThemeProperties(PropertyIndex)

expressionAnexpressionthatreturnsaPageWindowEx,WebEx,orWebFileobject.

PropertyIndexOptionalFpThemeProperties.Returnsorsetsthethemeproperties.

FormoredetailedinformationontheindividualTypeconstantsshowninthefollowingtable,seethetablesandlistsintheApplyThememethod.

FpThemeProperties Value Description

fpThemeActiveGraphics 16or&H10 Returnstheactivegraphicsconstant.

fpThemeBackgroundImage 1 Returnsabackgroundimage.

fpThemeCSS 4096or&H1000 Returnsthecascadingstylesheet.

fpThemeDefaultSettings16777216or&H1000000

Returnsthethemeappliedtotheweb.

fpThemeName33554432or&H2000000

ReturnstheThemeNameconstant.

fpThemeNoBackgroundImage 0 Returnsabackgroundwithoutanimage.

fpThemeNoCSS 0Returnsthispropertyifacascadingstylesheethasnotbeensetorisnotwanted.

fpThemeNormalColors 0 Returnsthecolormodefornormalcolor.Returnsthegraphicsmodefor

fpThemeNormalGraphics 0 normalgraphics.

fpThemePropertiesAll 4369or&H1111

Returnsallofthethemeproperties.Afterathemeisappliedtoanobject,thefpThemePropertiesAllpropertycombinesallthepropertiesappliedtotheobject.

fpThemePropertiesNone 0 Returnsnoneforthethemeproperties.

fpThemeVivdColors 256 Returnsthevividcolorsproperty.

Example

Thefollowingexamplechecksthethemepropertiesforactivegraphics.Ifactivegraphicshavebeenapplied,thenvividcolorsareappliedinadditiontothethemepropertiesthatarealreadyappliedtotheactivepagewindow.Ifactivegraphicsaren'tapplied,thenactivegraphicsandvividcolorsarebothappliedtotheactivepagewindow.

PrivateSubGetThemeProperties()

DimmyPageWindowAsPageWindowEx

SetmyPageWindow=ActiveWeb.ActiveWebWindow.ActivePageWindow

IfmyPageWindow.ThemeProperties(fpThemeActiveGraphics)Then

myPageWindow.AppyTheme(fpThemePropertiesAll+_

fpThemeVividColors)

ExitSub

Else

myPageWindow.ApplyTheme(fpThemePropertiesAll+_

fpThemeActiveGraphics+fpThemeVividColors)

EndIf

EndSub

Thefollowingexampleaddsabackgroundpicturetothespecifiedfile.

PrivateSubAddBackgroundImage()

DimmyFileAsWebFile

SetmyFile=Webs(0).Rootfolder.Files("index.htm")

IfmyFile.ThemeProperties(fpThemeBackgroundImage)=0Then

myFile.ApplyThememyFile.ThemeProperties(fpThemeName),_

myfile.ThemeProperties(fpThemePropertiesAll)+_

fpThemeBackgroundImage

EndIf

EndSub

ThemesPropertyReturnsaThemescollectionthatrepresentsthethemesavailableforthespecifiedobject.

expression.Themes

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliestolist.

Remarks

TheThemespropertyasappliedtotheApplicationobjectreturnsthecollectionofthemesavailabletobeapplied.WhentheThemespropertyisappliedtotheWebExobject,itreturnsthecollectionofthemesthathavebeenappliedtotheWebsite.ThisisthesameasthelistthatappearsintheWeb’s_themedirectory.IfathemeisappliedtoaWebExobject,therewillbeonethemeinthecollection.However,ifapageinaWebsitehasitsowntheme,separatefromthethemethatwasappliedtotheWebsite,thentheThemescollectionfortheWebExobjectwillhavetwothemesinit—thethemethatwasoriginallyappliedtotheWebsite,andthethemethatwasappliedspecificallytothepage.

Example

Thefollowingexamplesearchesforaspecificthemeamongthethemesthatareavailablelocallyontheclient,aswellasthethemesappliedtotheactiveWebsite.

PrivateSubSearchAllThemes()

DimmyThemeAsTheme

DimmyThemeToFindAsString

DimmyIsFoundAsBoolean

myThemeToFind="blends"

myIsFound=False

ForEachmyThemeInApplication.Themes

IfmyTheme.Label=myThemeToFindThen

myIsFound=True

ExitFor

EndIf

Next

ForEachmyThemeInActiveWeb.Themes

IfmyTheme.Label=myThemeToFindThen

myIsFound=True

ExitFor

EndIf

Next

EndSub

TitlePropertyReturnsthetitleofthespecifiedobject.Read-onlyorread/writeStringdependingonthespecifiedobject.

expression.Title

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliestolist.

Remarks

FortheWebExandWebFileobjectstheTitlepropertyreturnsthetitleoftheactiveWebExobjectasaread/writeString.

Example

Atthesametimeasyou'retraversingthenavigationnodes,youcanalsoreturnthetitle(filename)ofthefilethat'sassociatedwithaparticularnode.ThefollowingexamplereturnsthetitleofthefileassociatedwithanavigationnodeintheactiveWebsite.

PrivateSubGetFileFromNavNode()

DimmyWebAsWebEx

DimmyNavNodeAsNavigationNode

DimmyFileFromNavNodeAsString

SetmyWeb=ActiveWeb

SetmyNavNode=_

myWeb.RootNavigationNode.File.NavigationNode

WithmyNavNode

myFileFromNavNode=.File.Title

EndWith

EndSub

ThefollowingexampleshowshowyoucansetthetitleofthefirstfileintheWebsite.

PrivateSubSetTitle()

DimmyWebAsWebEx

DimmyNewTitleAsString

DimmyFileAsWebFile

MyNewTitle="Inventory.htm"

SetmyWeb=ActiveWeb

SetmyFile=myWeb.RootFolder.Files(0)

MyFile.Title=myNewTitle

EndSub

ShowAll

TypePropertyTypepropertyasitappliestotheBasicList,DocumentLibrary,List,and

Surveyobjects.

ReturnsanFpListTypeconstantthatrepresentsthetypeofthecurrentlist.Read-only.

FpListTypecanbeoneoftheseFpListTypeconstants.fpListTypeBasicListfpListTypeDocumentLibraryfpListTypeSurveyfpListTypeDiscussion

expression.Type

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

TypepropertyasitappliestoallotherobjectsintheAppliesTolist.

ReturnsanFpFieldTypeconstantthatrepresentsthetypeofthecurrentfield.Read-only.

FpFieldTypecanbeoneoftheseFpFieldTypeconstants.fpFieldAttachmentsfpFieldChoicefpFieldComputedfpFieldCounterfpFieldCurrencyfpFieldDateTimefpFieldFilefpFieldIntegerfpFieldLookupfpFieldMultiLine

fpFieldNumberfpFieldRatingScalefpFieldSingleLinefpFieldTrueFalsefpFieldURL

expression.Type

expressionRequired.Anexpressionthatreturnsoneoftheobjectsasmentionedabove.

Example

AsitappliestotheBasicList,DocumentLibrary,List,andSurveyobjects.

ThefollowingexampledisplaysthenamesofalllistsintheactiveWebsiteandtheirassociatedtypenames.IftheactiveWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubViewListTypes()

'Displaysthenameofthelistand

'itsassociatedtype

DimlstWebListAsList

DimstrTypeAsString

IfNotActiveWeb.ListsIsNothingThen

'Cyclethroughlists

ForEachlstWebListInActiveWeb.Lists

'addtypestostring

IfstrType=""Then

strType=lstWebList.Name&"-"&_

lstWebList.Type&vbCr

Else

strType=strType&lstWebList.Name&"-"&_

lstWebList.Type&vbCr

EndIf

Next

'Displaytypesofalllistsintheweb

MsgBox"Thelisttypesinthecurrentwebare:"_

&vbCr&strType

Else

'Otherwisedisplaymessagetouser

MsgBox"Thecurrentwebcontainsnolists."

EndIf

EndSub

AsitappliestotheListFieldobject.

ThefollowingexampledisplaysthenamesofallfieldsinthefirstlistoftheListscollectionandtheirassociatedtypenames.IftheactiveWebsitecontainsnolists,amessageisdisplayedtotheuser.

SubFieldtype()

'Displaysthefieldtypesofthecurrentlist

DimobjAppAsFrontPage.Application

DimobjFieldAsListField

DimstrTypeAsString

SetobjApp=FrontPage.Application

IfNotActiveWeb.ListsIsNothingThen

ForEachobjFieldInobjApp.ActiveWeb.Lists.Item(0).Fields

IfstrType=""Then

strType=objField.Name&"-"&_

objField.Type&vbCr

Else

strType=strType&objField.Name&"-"&_

objField.Type&vbCr

EndIf

NextobjField

MsgBox"Thenamesofthefieldsinthislistandtheirtypesare:"&_

vbCr&strType

Else

'Otherwisedisplaymessagetouser

MsgBox"ThecurrentWebsitecontainsnolists."

EndIf

EndSub

UrlPropertyReturnstheURLforthespecifiedobject.Read-onlyString.

expression.Url

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliestolist.

Remarks

URLscanbeabsoluteorrelative.AnabsoluteURLcontainstheexactpathtothespecifiedobjectwhilearelativeURLmaycontaincharacterssuchas"../..","?",or";"dependingontheURLaccessschemeusedtoparsetherelativeURL.TheMicrosoftFrontPageobjectmodelalwaysusesabsoluteURLs.FormoreinformationonURLs,seeUnderstandingAbsoluteandRelativeURLsinFrontPage.

Example

ThefollowingexamplereturnstheURLofthefirstfileintherootfolderoftheactiveWebsite.

PrivateSubGetFileUrl()

DimmyFileAsWebFile

DimmyURLAsString

SetmyFile=ActiveWeb.RootFolder.Files(0)

myURL=myFile.Url

EndSub

UserNamePropertyReturnsthelogonnameoftheuserthatiscurrentlyloggedontothenetworkoroperatingsystem.Read/writeString.

expression.UserName

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Remarks

TheUserNamepropertyisthedefaultparameterwheneverausernameisrequiredforaparameterintheWebObjectModel.Forexample,theWebs.OpenandWebs.PublishmethodsbothrequireaUserNameparameter.Whentheparameterisn'tspecified,thedefaultparameteristheusernameoftheusercurrentlyloggedon.

Example

Thefollowingexamplereturnsthecurrentuser'slogonname.

myLogonName=Application.UserName

VBEPropertyReturnsaVBEobjectthatrepresentstheMicrosoftVisualBasicEditor.

expression.VBE

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThefollowingexamplecreatesareferencetotheVisualBasicEditoranddisplaysthenameoftheactiveprojecttotheuser.

SubReturnVBE()

'CreatesareferencetotheVBEanddisplaysamessagetouser

DimobjAppAsFrontPage.Application

SetobjApp=FrontPage.Application

'Displaythenameoftheactiveproject

MsgBox"Thenameoftheactiveprojectis:"&_

objApp.VBE.ActiveVBProject.Name

EndSub

VersionPropertyReturnstheversionofthespecifiedobjectwiththeformat:"x.x.x",wherexrepresentsanumberintheversion.Read-onlyString.

expression.Version()

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Remarks

IftheApplicationobjectisspecified,theVersionpropertyreturnstheversionoftheapplication.WhentheVersionpropertyfortheSystemobjectisaccessed,itreturnsthecurrentversionoftheoperatingsystemasyoumightseeusedonthePropertiespageoftheSystemdialogbox.

Example

Thefollowingexamplereturnstheversionoftheapplication.

PublicSubGetAppVersion()

DimmyAppVersionAsString

myAppVersion=Application.Version

EndSub

VerticalResolutionPropertyReturnstheverticalresolutionofthescreeninpixels.Read-onlyLong.

expression.VerticalResolution()

expressionRequired.AnexpressionthatreturnsaSystemobject.

Example

Thisexamplereturnstheverticalresolutionofthescreen.

myVerticalRes=System.VerticalResolution

ShowAll

ViewModeProperty(WebObjectModel)

ViewModepropertyasitappliestothePageWindowExobject.

ReturnsorsetsanFpPageViewModeconstantthatrepresentstheviewmodeoftheactivepagewindow.Read/write.

FpPageViewModecanbeoneoftheseFpPageViewModeconstants.fpPageViewNoFramesfpPageViewNormalfpPageViewNoWindowfpPageViewPreviewfpPageViewDefaultfpPageViewHtml

expression.ViewMode

expressionRequired.AnexpressionthatreturnsaPageWindowExobject.

ViewModepropertyasitappliestotheWebWindowExobject.

ReturnsorsetsanFpWebViewModeconstantthatdefinestheviewmodeofthecurrentwindow.Read/write.

FpWebViewModecanbeoneoftheseFpWebViewModeconstants.fpWebViewAllFilesfpWebViewBrokenLinksfpWebViewFoldersfpWebViewLinksfpWebViewPagefpWebViewSiteSummaryfpWebViewStructure

fpWebViewTodo

expression.ViewMode

expressionRequired.AnexpressionthatreturnsaWebWindowExobject.

ViewModepropertyasitappliestotheFPHTMLDocumentandIFPDocumentobjects.

ReturnsaLongthatrepresentstheviewmodeofthedocument.Read-only.

expression.ViewMode(ViewMode)

expressionRequired.AnexpressionthatreturnsanFPHTMLDocumentorIFPDocumentobject.

ViewModeRequiredLong.Thenewviewingmode.

Example

AsitappliestothePageWindowExobject.

ThefollowingexamplechangestheviewmodeoftheactivewindowtothevaluefpPageViewNormal(Designview)ifitisnotalreadyinthedefaultviewmode.

SubChangeViewMode()

'Changestheviewmodeoftheactivewindow

DimfpAppAsFrontPage.Application

DimobjPageAsPageWindowEx

SetfpApp=FrontPage.Application

SetobjPage=fpApp.ActivePageWindow

IfobjPage.ViewMode<>fpPageViewDefaultThen

objPage.ViewMode=fpPageViewNormal

MsgBox"Thecurrentpagewindowhasbeenrestored"&_

"tonormalview."

EndIf

EndSub

AsitappliestotheWebWindowExobject.

ThefollowingexamplechangestheviewmodeoftheactiveWebsitewindowtofpWebBrokenLinks(BrokenLinksview)ifthewindowisnotalreadyintheview.

SubChangeViewMode()

'Changestheviewmodeoftheactivewindow

DimfpAppAsFrontPage.Application

DimobjWebWindowAsWebWindowEx

SetfpApp=FrontPage.Application

SetobjWebWindow=fpApp.ActiveWebWindow

IfobjWebWindow.ViewMode<>fpWebViewBrokenLinksThen

objWebWindow.ViewMode=fpWebViewBrokenLinks

MsgBox"Thecurrentpagewindowhasbeenrestored"&_

"toBrokenLinksview."

EndIf

EndSub

AsitappliestotheFPHTMLDocumentobject.

Thefollowingexampledisplaystheviewmodeoftheactivedocument.

SubDisplayViewMode()

'Changestheviewmodeoftheactivewindow

DimfpAppAsFrontPage.Application

DimobjDocAsFPHTMLDocument

SetfpApp=FrontPage.Application

SetobjDoc=fpApp.ActiveDocument

SelectCaseobjDoc.ViewMode

Case1

MsgBox"ThedocumentisinNormalmode."

Case2

MsgBox"ThedocumentisinHTMLmode"

Case8

MsgBox"ThedocumentisinPreviewmode"

EndSelect

EndSub

ShowAll

ViewModeExPropertyReturnsorsetsanFpWebViewModeExenumeratedconstantthatrepresentsthecurrentviewmodeoftheWebsitewindow.Read/write.

FpWebViewModeExcanbeoneoftheseFpWebViewModeExconstants.fpWebViewExAccessibilityfpWebViewExAllFilesfpWebViewExAssignedTofpWebViewExBrokenLinksfpWebViewExBrowserTypesfpWebViewExCategoriesfpWebViewExCheckoutStatusfpWebViewExComponentErrorsfpWebViewExCSSLinksfpWebViewExDailyPageHitsfpWebViewExDailySummaryfpWebViewExFoldersfpWebViewExLinksfpWebViewExMasterPagesfpWebViewExMonthlyPageHitsfpWebViewExMonthlySummaryfpWebViewExNavigationfpWebViewExOlderFilesfpWebViewExOsTypesfpWebViewExPagefpWebViewExPublishStatusfpWebViewExRecentlyAddedFilesfpWebViewExRecentlyChangedFilesfpWebViewExReferringDomainsfpWebViewExReferringURLsfpWebViewExRemoteSite

fpWebViewExReviewStatusfpWebViewExSearchStringsfpWebViewExSharedBordersfpWebViewExSiteSummaryfpWebViewExSlowPagesfpWebViewExThemesfpWebViewExTodofpWebViewExUnlinkedFilesfpWebViewExUsageSummaryfpWebViewExVisitingUsersfpWebViewExWeeklyPageHitsfpWebViewExWeeklySummary

expression.ViewModeEx

expressionRequired.AnexpressionthatreturnsaWebWindowExobject.

Example

Thefollowingexamplechangestheviewmodetodisplaythedailypagehits.

SubViewPageHits()

'Changesthecurrentviewmodetoviewpagehits

ActiveWeb.ActiveWebWindow.ViewModeEx=fpWebViewExDailyPageHits

EndSub

ViewPagesPropertyRreturnsaStringarraythatrepresentsalistofpagesthatcontainaviewforthelist.

expression.ViewPages

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

VisiblePropertyReturnsorsetsthevisiblestateofthePageWindowExorWebWindowExobject.ThevisiblestateforthePageWindowExobjectisread-onlyBoolean.ThevisiblestatefortheWebWindowExobjectisread/writeBoolean.

expression.Visible

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

Inthefollowingexample,theGetVisibleStateprocedurereturnsthevisiblestateofthefirstPageWindowExobjectfromtheCheckIfVisiblefunction.

PrivateSubGetVisibleState()

DimmyIsVisibleAsBoolean

myIsVisible=CheckIfVisible

EndSub

FunctionCheckIfVisible()AsBoolean

DimmyPageAsPageWindowEx

DimmyVisibleStateAsBoolean

SetmyPage=Application.Webs(0).WebWindows(0).PageWindows(0)

myVisibleState=myPage.Visible

CheckIfVisible=myVisibleState

EndFunction

ThefollowingexamplesetsthevisiblestateofaWebWindowExobjecttoawindowlessstate.

PrivateSubOpenInNoWindow()

DimmyWebWindowAsWebWindowEx

SetmyWebWindow=Webs(0).WebWindows(0)

myWebWindow.Visible=False

EndSub

WebPropertyReturnsaWebExobjectthatrepresentsaMicrosoftFrontPageWebsite.

expression.Web

expressionRequired.Anexpressionthatreturnsoneoftheaboveobjects.

Example

ThefollowingexamplereturnsthetitleoftheactiveWebsite.

PrivateSubGetWebTitle()

DimmyWebAsWebEx

DimmyWebNameAsString

SetmyWeb=ActiveWeb

myWebName=myWeb.RootFolder.Web.Title

EndSub

WebsPropertyReturnsthecollectionofopenWebsitesforthespecifiedobject.

expression.Webs

expressionRequired.AnexpressionthatreturnsanApplicationobject.

Example

ThefollowingexamplecreatesanarraythatcontainsalloftheURLsforalltheopensubsitesinyourWebsite.

NoteYoumustopenanyWebsitesforwhichyouwishtoretrievetheURLs.

PrivateSubGetWebs()

DimmyWebsAsWebs

DimmyWebAsWebEx

DimmyOpenWebs()AsVariant

DimiAsInteger

DimmyWebCountAsInteger

SetmyWebs=Application.Webs

myWebCount=myWebs.Count

ReDimmyOpenWebs(myWebCount)

Do

ForEachmyWebInmyWebs

myOpenWebs(i)=myWeb.Url

i=i+1

Next

LoopUntili>myWebCount

EndSub

WebWindowsPropertyReturnsthecollectionofopenWebWindowsobjectsinthespecifiedobject.

expression.WebWindows

expressionRequired.AnexpressionthatreturnsoneoftheobjectsintheAppliesTolist.

Example

ThefollowingexamplechecksifanyoftheWebwindowsaresettoPageview,andchangesthosethatareinPageviewtoFoldersview.

PrivateSubGetViewModes()

DimmyWebWindowsAsWebWindows

DimmyWebWindowAsWebWindowEx

DimmyViewAsFpWebViewMode

SetmyWebs=Webs

SetmyWebWindows=myWebs.WebWindows

ForEachmyWebWindowInmyWebWindows

myView=myWebWindow.ViewMode

IfmyView=fpWebViewPageThen

myWebWindow.ViewMode=fpWebViewFolders

EndIf

Next

EndSub

OnActivateEventOccurswhenthepagewindoworWebwindowobtainsthefocusandbecomesthecurrentwindow.

PrivateSubexpression_OnActivate()

expressionAvariablewhichreferencesanobjectoftypePageWindowExorWebWindowExdeclaredwitheventsinaclassmodule.

Example

ThefollowingexampleusestheIsDirtypropertytodetermineifthepageshowninthespecifiedwindowhaschangedsincethelastrefreshorsaveandsavesthedocumentthathaschanged.

PrivateSubPageWindowEx_OnActivate()

'Displaysamessagewhenthewindowobtainsfocus

IfPageWindowEx.IsDirtyThen

PageWindowEx.Save

EndIf

EndSub

OnAfterPageSaveEventOccursafterapageissaved.

PrivateSubApplication_OnAfterPageSave(ByValpPageAsPageWindowEx,SuccessAsBoolean)

pPageRequiredPageWindowExobject.

SuccessRequiredBoolean.TrueifthePageWindowExobjectwassuccessfullysaved.

Remarks

TheOnAfterPageSaveeventisassociatedwiththeApplicationobject.AftertheusersavesapageorclosesMicrosoftFrontPage,theOnAfterPageSaveeventfiresandexecutesthecodethatyouspecifiedwithintheeventprocedure.

Example

Thefollowingexampledisplaysamessageboxafterthepagehasbeensavedanddisplaysthefilenameofthepage.

NoteTorunthisexample,youmusthaveatleastoneopenWebsiteandoneopenpagewithinthatWebsite.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdSaveandabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdSave_Click()

DimmyPageWindowAsPageWindowEx

SetmyPageWindow=ActiveWeb.ActiveWebWindow.ActivePageWindow

myPageWindow.Save

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnAfterPageSave(ByValpPageAs_

PageWindow,SuccessAsBoolean)

IfSuccess=TrueThen

MsgBox"Thefollowingpagewassaved:"&pPage.File.Name

Else

MsgBox"Therewasaproblemwithsavingyourpage:"&_

pPage.File.Name

EndIf

EndSub

OnAfterPageWindowViewChangeEventOccurswhenapagewindowhasswitchedviewtypes.

PrivateSubexpression_OnAfterPageWindowViewChange(ByValpPageAsPageWindowEx)

expressionAnobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pPageThePageWindowExobjectinwhichtheviewhaschanged.

Example

Thefollowingexamplepromptstheusertorefreshthewindowafterithaschangedviewmodes.

PrivateSubobjApp_OnAfterPageWindowViewChange(ByValpPageAsPageWindowEx)

'Occurswhenaviewchanges

DimstrAnsAsString

'Promptusertorefreshview

strAns=MsgBox("Theviewhaschanged,wouldyouliketorefreshthewindow?",vbYesNo)

IfstrAns=vbYesThen

pPage.Refresh

EndIf

EndSub

OnAfterPublishEventOccursafteraWebsiteispublished.

PrivateSubexpression_OnAfterPublish(SuccessAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypeWebExdeclaredwitheventsinaclassmodule.

SuccessABooleanthatdeterminesifthepublishoperationwassuccessful.IfTrue,thentheWebsitewassuccessfullypublished.

Example

ThefollowingexampledisplaysamessagetotheuserbasedontheresultofthePublishmethod.

PrivateSubobjWeb_OnAfterPublish(SuccessAsBoolean)

'Occursafterawebispublished

IfSuccess=TrueThen

MsgBox"Thewebwaspublishedsuccessfully."

Else

MsgBox"Anerroroccurred,thewebwasnotpublished.",vbExclamation

EndIf

EndSub

OnAfterSaveEventOccursaftertheactivedocumenthasbeensavedbytheuser.

PrivateSubexpression_OnAfterSave(SuccessAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypePageWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

SuccessABooleanthatindicatesiftheoperationwassuccessful.IfTrue,thefilewassaved.

Example

Theeventinthefollowingexampleoccursaftertheactivedocumentissavedinanextendedpagewindow.Amessageisdisplayedtotheuserbasedontheresultoftheoperation.

PrivateSubPageWindowEx_OnAfterSave(SuccessAsBoolean)

'DisplaysmessagebasedonvalueofSuccess

IfSuccess=TrueThen

MsgBox"Thefile"&PageWindowEx.ActiveDocument.Title&"wassaved."

Else

MsgBox"Thefile"&PageWindowEx.ActiveDocument.Title&"wasnotsaved."

EndIf

EndSub

OnAfterSubViewChangeEventOccursaftertheWebwindowsubviewchanges.

PrivateSubexpression_OnAfterSubViewChange()

expressionAvariablenamewhichreferencesanobjectoftypeWebWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

Example

ThefollowingexampledisplaysamessagetotheuserwheneverthesubviewoftheactiveWebsitewindowchangesorafterthesubviewcloses.

PrivateSubobjWebWindow_OnAfterSubViewChange()

'Displayamessageindicatingwhichviewthesubwindowiscurrentlyin

SelectCaseobjwebWindow.SubViewMode

CasefpWebSubViewFolders

MsgBox"TheviewinthesubwindowhaschangedtoFolderView."

CasefpWebSubViewNavigation

MsgBox"TheviewinthesubwindowhaschangedtoNavigationView."

CasefpWebSubViewNone

MsgBox"Thesubwindowhasclosed."

EndSelect

EndSub

OnAfterViewChangeEventOccursaftertheviewhaschangedintheactivepagewindoworWebsitewindow.

PrivateSubexpression_OnAfterViewChange()

expressionAvariablenamewhichreferencesanobjectintheAppliesTolistdeclaredusingtheWithEventskeywordinaclassmodule.

Example

Thefollowingexampledisplaysthenameofthenewpagewindowviewmode.

PrivateSubPageWindowEx_OnAfterViewChange()

'Occurswhentheviewchangesintheactivewindow

MsgBox"Thepagehaschangedto"&PageWindowEx.ViewMode&"."

EndSub

OnAfterWebPublishEventOccursafteraWebsiteispublished.

PrivateSubexpression_OnAfterWebPublish(ByValpWebAsWebEx,SuccessAsBoolean)

expressionAvariablenamewhichreferencesanobjectintheAppliesTolistdeclaredusingtheWithEventskeywordinaclassmodule.

pWebRequiredWebEx.ThespecifiedWebExobject.

SuccessRequiredBoolean.TrueifthespecifiedWebwassuccessfullypublished.

Remarks

TheOnAfterWebPublisheventisassociatedwiththeApplicationobject.AftertheuserpublishesaWebsiteinMicrosoftFrontPage,theOnAfterWebPublisheventfiresandexecutesthecodethatyouspecifiedwithintheeventprocedure.

Example

Thefollowingexamplecreatesapropertycalled"Published"withthevalueofTrueafteraWebsitehasbeenpublished.

NoteTorunthisexampleyoumusthaveoneWebsiteopen.ThisexampleusesaWebsitecalledRogueCellars.YoucancreateaWebsitecalledRogueCellars,oryoucansubstituteaWebsiteofyourchoiceinthefollowingcodesample.

CreateaformcalledfrmLaunchEvents.frmandaddtwocommandbuttons,abuttoncalledcmdPublishWeb,andabuttoncalledcmdCancel.Thenaddthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivatepPageAsPageWindowEx

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdPublishWeb_Click()

ActiveWeb.Publish"C:\MyDocuments\MyWebSites\RogueCellars"

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnAfterWebPublish(ByValpWebAsWebEx,SuccessAsBoolean)

IfSuccess=TrueThen

pWeb.Properties.Add"Published",True

pWeb.Properties.ApplyChanges

Else

MsgBox"Therewasaproblempublishingyour"&pWeb&"web."

EndIf

EndSub

OnAfterWebWindowSubViewChangeEventOccursaftertheFolderListintheWebviewsubwindowhaschangedfromFoldersviewtoNavigationview.

PrivateSubapplication__OnAfterWebWindowSubViewChange(ByValpWebWindowAsWebWindowEx)

applicationAnobjectoftypeApplicationdeclaredwitheventsinaclassmodule.

pWebWindowTheWebWindowExobjectinwhichtheviewhaschanged.

Example

Thefollowingexampledisplaysthenameoftheviewtypeinthesubwindow,unlessthesubwindowisclosedbytheuser.

PrivateSubobjApp_OnAfterWebWindowSubViewChange(ByValpWebWindowAsWebWindowEx

'OccurswhenasubviewintheWebwindowchanges

'Displayamessageindicatingwhatviewthesubwindowiscurrentlyin

SelectCasepWebWindow.SubViewMode

CasefpWebSubViewFolders

MsgBox"TheviewinthesubwindowhaschangedtoFolderView."

CasefpWebSubViewNavigation

MsgBox"TheviewinthesubwindowhaschangedtoNavigationView."

CasefpWebSubViewNone

MsgBox"Thesubwindowhasclosed."

EndSelect

EndSub

OnAfterWebWindowViewChangeEventOccursaftertheWebsitewindowviewhaschanged.

PrivateSubexpression_OnAfterWebWindowViewChange(ByValpWebWindowAsWebWindowEx)

expressionAnobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebWindowTheWebWindowExobjectinwhichtheviewhaschanged.

Example

Thefollowingexampledisplaysthenameofthenewviewtypetotheusereverytimetheviewischanged.

PrivateSubobjApp_OnAfterWebWindowViewChange(ByValpWebWindowAsWebWindowEx)

'OccursaftertheWebsitewindowviewchanges.

'Displaymessagetouser

MsgBox"Theviewhaschangedto"&pWebWindow.ViewModeEx&"mode."

EndSub

OnBeforePageSaveEventOccursbeforeapageissaved.

PrivateSubexpression_OnBeforePageSave(ByValpPageAsPageWindowEx,SaveAsUIAsBoolean,CancelAsBoolean

expressionAvariablenamewhichreferencesanobjectoftypePageWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

pPageRequiredPageWindowEx.ThespecifiedPageWindowExobject.

SaveAsUIRequiredBoolean.TruewhentheSaveAsdialogboxisusedtosaveapage.Thiscanbethefirsttimethepageissavedorwhenthepageissavedasanewpage.Falsewhenwhenanexistingpageissaved.

CancelRequiredBoolean.CausesMicrosoftFrontPagetoabortthesavewhensettoTrue.WhenCancelisprogrammaticallysettoTrue,theusercanabortthesaveprocessbyclickingtheCancelbuttonontheform.DefaultisFalse.

Remarks

TheOnBeforePageSaveeventisassociatedwiththeApplicationobject.WhentheusersavesapageorclosesFrontPage,theOnBeforePageSaveeventfiresandexecutesthecodethatyouspecifiedwithintheeventprocedure.

NoteIfyousetCanceltoTrue,thepagewon'tbesaved.

Example

Thefollowingexampledisplaysamessageboxbeforethepagehasbeensavedanddisplaysthedocumenttitleofthefileforthepage.

NoteTorunthisexample,youmusthaveatleastoneopenWebsiteandoneopenpagewithinthatsite.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdSave,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdSave_Click()

DimmyPageWindowAsPageWindowEx

SetmyPageWindow=ActiveWeb.ActiveWebWindow.ActivePageWindow

myPageWindow.Save

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnBeforePageSave(ByValpPageAs_

PageWindowEx,SaveAsUIAsBoolean,CancelAsBoolean)

MsgBox"Thefollowingpagewillbesaved:"&pPage.File.Name_

&"willbesavedwiththetitle:"&pPage.Document.Title

EndSub

OnBeforePageWindowViewChangeEventOccursbeforethecurrentPagewindowviewischanged.

PrivateSubapplication__OnBeforePageWindowViewChange(ByValpPageAsPageWindowEx,ByValTargetViewAsFpPageViewMode,CancelAsBoolean)

applicationAnobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pPageThePageWindowExobjectinwhichtheviewhaschanged.

TargetViewThespecifiedtargetwindowtype.

CancelABooleanthatdeterminesiftheeventwillbecancelled.IfFalse,theeventwillnotbecancelled.IfTrue,theeventwillbecancelled.

Remarks

Thiseventcanbecancelled.

Example

Thefollowingexamplepromptstheuserbeforethecurrentviewischanged.TheCancelargumentismodifiedbasedontheuser'sresponse.

PrivateSubobjApp_OnBeforePageWindowViewChange(ByValpPageAsPageWindowEx,_

ByValTargetViewAsFpPageViewMode,CancelAsBoolean)

'Promptstheuserbeforechangingtheviewtype

DimstrAnsAsString

'Promptusertochangeview

strAns=MsgBox("Areyousureyouwanttochangethecurrentview?",_

vbYesNo)

IfstrAns=vbYesThen

'Don'tcancelevent

Cancel=False

Else

'Cancelevent

Cancel=True

EndSub

OnBeforePublishEventOccursbeforeaWebsiteispublished.

PrivateSubexpression_OnBeforePublish(DestinationAsString,CancelAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypeWebExdeclaredusingtheWithEventskeywordinaclassmodule.

DestinationAStringthatspecifiestheURLofthepublishedWebsite.

CancelABooleanthatspecifieswhethertocancelthepublishoperation.TruecancelspublishingtheWebsite.

Remarks

Thiseventcanbecancelled.

Example

ThefollowingexampledisplaysamessagetotheuserbeforeaWebsiteispublished.Italsoallowstheusertocanceltheeventbeforeitoccurs.

PrivateSubexpression_OnBeforePublish(DestinationAsString,CancelAsBoolean)

'Occursbeforeawebispublished.

DimblnAnsAsBoolean

blnAns=MsgBox_

("Areyousureyouwanttopublishtothefollowingdestination:"&_

Destination)

IfblnAns=FalseThen

Cancel=True

Else

Cancel=False

EndIf

EndSub

OnBeforeSaveEventOccursbeforeapageinanactiveextendedpagewindowissaved.

PrivateSubexpression_OnBeforeSave(SaveAsUIAsBoolean,CancelAsBoolean)

expressionAvariablenamethatreferencesanobjectoftypePageWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

SaveAsUIABooleanthatdeterminesiftheuserinterfacewillbedisplayed.IfTrue,theSaveAsdialogboxwillbedisplayed.

CancelABooleanthatdeterminesifthesaveoperationwillbecancelled.IfTrue,thedocumentwillnotbesaved.

Example

Thefollowingexamplepromptstheuserbeforesavingthedocument.IftheuserclicksNo,thedocumentwillnotbesaved.IftheuserclicksYes,thedocumentwillbesaved.

PrivateSubPageWindowEx_OnBeforeSave(SaveAsUIAsBoolean,CancelAsBoolean)

'Promptuserbeforesavingthedocument

DimstrAnsAsString

strAns=MsgBox("Doyoureallywanttosavethedocument?",vbYesNo)

'Changecancelvaluebasedonuserinput

IfstrAns=VbNoThen

Cancel=True

EndIf

EndSub

OnBeforeSubViewChangeEventOccursbeforethesubviewoftheWebsitewindowchanges.

PrivateSubexpression_OnBeforeSubViewChange(ByValTargetSubViewAsFpWebSubView,CancelAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypeWebWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

TargetSubViewAnFpWebSubViewenumeratedconstantthatrepresentsthenewsubviewtype.

CancelABooleanthatdeterminesiftheoperationwillbecancelled.IfFalse,thesubviewwillchangeviewtypes.

Example

ThefollowingexamplepromptstheuserbeforechangingthesubviewoftheWebsitewindow.IftheuserclicksNo,thesubviewwillnotchange.IftheuserclicksYes,thesubviewwillchangetoanewviewtype.

PrivateSubobjwebWindow_OnBeforeSubViewChange

(ByValTargetSubViewAsFpWebSubView,CancelAsBoolean)

'Occurswhenthesubviewoftheactivewebwindowischanged

DimstrAnsAsString

'Promptuser

strAns=MsgBox("Areyousureyouwanttochangethesubview?",vbYesNo)

IfstrAns=vbYesThen

Cancel=False

Else

Cancel=True

EndIf

EndSub

ShowAll

OnBeforeViewChangeEventOnBeforeViewChangeeventasitappliestothePageWindowExobject.

Occursbeforetheviewmodeofthepagewindowchanges.

PrivateSubexpression_OnBeforeViewChange(ByValTargetViewAsFpPageViewMode,CancelAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypePageWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

TargetViewAnFpPageViewModeenumeratedconstantthatrepresentsthenewviewtype.

CancelABooleanthatdeterminesiftheoperationwillbecancelled.IfTrue,theviewwillnotbechanged.

OnBeforeViewChangeeventasitappliestotheWebWindowExobject.

OccursbeforetheviewmodeoftheWebsitewindowchanges.

PrivateSubexpression_OnBeforeViewChange(ByValTargetViewAsFpWebViewModeEx,CancelAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypeWebWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

TargetViewAnFpWebViewModeExenumeratedconstantthatrepresentsthenewviewtype.

CancelABooleanthatdeterminesiftheoperationwillbecancelled.IfTrue,theviewwillnotbechanged.

Example

Thefollowingexamplepromptstheuserbeforechangingtheviewofthepagewindow.IftheuserclicksYes,theviewischanged.

PrivateSubPageWindowEx_OnBeforeViewChange(ByValTargetViewAsFpPageViewMode,_

CancelAsBoolean)

'Promptsuserbeforechangingviews

DimblnAnsAsBoolean

strAns=MsgBox("Areyousureyouwanttochangethecurrentview?",_

vbYesNo)

IfstrAns=vbYesThen

Cancel=False

Else

Cancel=True

EndIf

EndSub

OnBeforeWebPublishEventOccursbeforeaWebsiteispublished.

PrivateSubexpression_OnBeforeWebPublish(ByValpWebAsWebEx,DestinationAsString,CancelAsBoolean)

expressionThevariablenameofanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebRequiredWebEx.ThespecifiedWebExobject.

DestinationRequiredString.TheURLofthetargetlocation.

CancelRequiredBoolean.CausesMicrosoftFrontPagetoabortthepublishwhensettoTrue.WhenCancelisprogrammaticallysettoTrue,theusercanabortthesaveprocessbyclickingtheCancelbuttonontheform.DefaultisFalse.

Remarks

TheOnBeforeWebPublisheventisassociatedwiththeApplicationobject.WhentheuserpublishesaWebsiteinFrontPage,theOnBeforeWebPublisheventfiresandexecutesthecodewithintheeventprocedure.

Example

ThefollowingexampleaddsacopyrightstringtotheindexpageofthespecifiedWebsite.

NoteTorunthisexample,youmusthaveatleastoneopenWebsite.ThisexampleusesaWebsitecalledRogueCellars.YoucancreateaWebsitecalledRogueCellarsoryoucansubstituteaWebsiteofyourchoiceinthefollowingcodesample.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdPublishWeb,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivatepPageAsPageWindowEx

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdPublishWeb_Click()

ActiveWeb.Publish"C:\MyDocuments\MyWebSites\RogueCellars"

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnBeforeWebPublish(ByValpWebAsWebEx,_

DestinationAsString,CancelAsBoolean)

DimmyCopyrightAsString

DimmyIndexFileAsWebFile

myCopyright="Copyright1999byRogueCellars"

SetmyIndexFile=pWeb.RootFolder.Files("index.htm")

myIndexFile.Open

IfmyIndexFile.Application.ActiveDocument.body.outerText<>_

myCopyrightThen

myIndexFile.Application.ActiveDocument.body.insertAdjacentText_

"BeforeEnd",myCopyright

EndIf

ActivePageWindow.Close

EndSub

OnBeforeWebWindowSubViewChangeEventOccursbeforethesubwindowofthecurrentWebwindowischangedbytheuser.

PrivateSubexpression_OnBeforeWebWindowSubViewChange(ByValpwebwindowAsWebWindowEx,ByValTargetSubViewAsFpWebSubView,CancelAsBoolean)

expressionAnobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebWindowTheWebWindowExobjectthatcontainsthesubwindow.

TargetSubViewThesubwindowviewtype.

CancelABooleanthatdeterminesiftheeventwillbecancelled.IfFalse,theeventwillnotbecancelled.IfTrue,theeventwillbecancelled.

Example

Thefollowingexamplepromptstheuserbeforechangingthecurrentsubwindowview.TheCancelargumentismodifiedbasedontheusers'response.

PrivateSubobjApp_OnBeforeWebWindowSubViewChange(ByValpwebwindowAsWebWindowEx,_

ByValTargetSubViewAsFpWebSubView,CancelAsBoolean)

'Occursbeforethewebwindowsubviewischanged.Promptstheusertoverifythechange

DimstrAnsAsString

'Prompttheuserbeforechangingviews

strAns=MsgBox("Areyousureyouwanttochangethesubwindowview?",_

vbYesNo)

IfstrAns=vbYesThen

'Yes,don'tcanceltheevent

Cancel=False

Else

'No,canceltheevent

Cancel=True

EndIf

EndSub

OnBeforeWebWindowViewChangeEventOccursbeforetheWebsitewindowviewchanges.

PrivateSubexpression__OnBeforeWebWindowViewChange(ByValpWebWindowAsWebWindowEx,ByValTargetViewAsFpWebViewModeEx,CancelAsBoolean)

expressionAnobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebWindowTheWebWindowExobjectthatcontainstheview.

TargetViewTheFPWebViewModeExwindowviewtype.

CancelABooleanthatdeterminesiftheeventwillbecancelled.IfFalse,theeventwillnotbecancelled.IfTrue,theeventwillbecancelled.

Example

Thefollowingexamplepromptstheuserbeforechangingthecurrentview.TheCancelargumentismodifiedbasedontheusers'response.

PrivateSubobjApp_OnBeforeWebWindowViewChange(ByValpWebWindowAsWebWindowEx,_

ByValTargetViewAsFpWebViewModeEx,CancelAsBoolean)

'Occursbeforetheviewischangedinthewebwindow.Promptstheusertoverifythechange

DimstrAnsAsString

'Prompttheuserbeforechangingviews

strAns=MsgBox("Areyousureyouwanttochangetheviewmode?",_

vbYesNo)

IfstrAns=vbYesThen

'Yes,don'tcanceltheevent

Cancel=False

Else

'No,canceltheevent

Cancel=True

EndIf

EndSub

ShowAll

OnCloseEventOnCloseeventasitappliestothePageWindowExobject.

Occurswhentheactivepagewindowisclosedbytheuser.

PrivateSubexpression_OnClose(CancelAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypePageWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

CancelABooleanthatdeterminesiftheoperationwillbecancelled.Truecancelsclosingtheactivepagewindow.

OnCloseeventasitappliestotheWebExobject.

OccurswhentheactiveWebsitewindowisclosedbytheuser.

PrivateSubexpression_OnClose(pCancelAsBoolean)

expressionAvariablenamewhichreferencesanobjectoftypeWebExdeclaredusingtheWithEventskeywordaclassmodule.

CancelABooleanthatdeterminesiftheoperationwillbecancelled.TruecancelsclosingtheactiveWebsite.

Example

Thefollowingexamplepromptstheuserbeforeclosingtheactivepagewindow.IftheuserclicksNo,thewindowwillnotclose.

PrivateSubPageWindowEx_OnClose(CancelAsBoolean)

'Displaysamessage

DimstrAnsAsString

'Promptuser

strAns=MsgBox("Areyousureyouwanttoclosetheactivepagewindow?",_

vbYesNo)

IfstrAns=vbYesThen

Cancel=False

Else

Cancel=True

EndIf

EndSub

OnDeactivateEventOccurswhenauserswitchestoanotherapplicationwindowandtheactiveWebsitewindowlosesthefocus.

PrivateSubexpression_OnDeactivate()

expressionAvariablenamewhichreferencesanobjectoftypeWebWindowExdeclaredusingtheWithEventskeywordinaclassmodule.

Example

Thefollowingexampledisplaysamessagetotheuserwhenthewindowisdeactivated.

PrivateSubobjWebWindow_OnDeactivate()

'Occurswhenthecurrentwebwindowisdeactivated

MsgBox"Thewindowhasbeendeactivated."

EndSub

OnPageCloseEventOccurswhenapageisclosed.

PrivateSubexpression_OnPageClose(ByValpPageAsPageWindowEx,CancelAsBoolean)

expressionThevariablenameofanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pPageRequiredPageWindowEx.ThespecifiedPageWindowExobject.

CancelRequiredBoolean.CausesMicrosoftFrontPagetoaborttheclosewhensettoTrue.WhenCancelisprogrammaticallysettoTrue,theusercanabortthesaveprocessbyclickingtheCancelbuttonontheform.DefaultisFalse.

Remarks

TheOnPageCloseeventisassociatedwiththeApplicationobject.WhentheuserclosesaPageWindowExobject,theOnPageCloseeventfiresandexecutesthecodewithintheeventprocedure.

Example

ThefollowingexampleusestheIsDirtypropertytocheckifapagehasbeenmodified,andifithassavesthepagebeforeclosingit.

NoteTorunthisexample,youmusthaveatleastoneopenWebsiteandoneopenpagewithinthatWebsite.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdClosePage,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivatepPageAsPageWindowEx

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdClosePage_Click()

ActivePageWindow.Close

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnPageClose(ByValpPageAs_

PageWindowEx,CancelAsBoolean)

IfpPage.IsDirty=TrueThenpPage.Save

EndSub

OnPageNewEventOccurswhenanewpageiscreated.

PrivateSubexpression_OnPageNew(ByValpPageAsPageWindowEx)

expressionThevariablenameofanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pPageRequiredPageWindowEx.APageWindowExobject.

Remarks

Whentheusercreatesanewpagewithinaframeset,theOnPageNeweventisonlyfiredonce—whenthepagecontainingtheframesettagsisopened.ThenMicrosoftFrontPageexecutesthecodewithintheeventprocedure.

NoteTheOnPageNeweventonlyfiresforthedefaultframeset,eveniftherearemoreframesonthepage.ThiseventonlyfiresifFrontPageisinPageview.IfFrontPageisinanyotherview,theOnPageNeweventwon'tfire.

Example

Thefollowingexampleappliesathemetoanewpage.

NoteTorunthisexample,youmusthaveatleastoneopenWebsite.ThisexampleusesRogueCellarsasthespecifiedWebsiteandZinfandel.htmasthespecifiedpage.YoucancreateaWebsiteandpageusingthesenamesoryoucansubstituteaWebsiteandpageofyourchoice.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdAddPage,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivatepPageAsPageWindowEx

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdAddPage_Click()

DimmyPageWindowsAsPageWindows

DimmyFileAsString

SetmyPageWindows=ActiveWeb.ActiveWebWindow.PageWindows

myFile=_

"C:/MyDocuments/MyWebSites/RogueCellars/Zinfandel.htm"

myPageWindows.Add(myFile)

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnPageNew(ByValpPageAsPageWindowEx)

pPage.ApplyTheme("artsy")

EndSub

OnPageOpenEventOccurswhenapageisopened.

PrivateSubexpression_OnPageOpen(ByValpPageAsPageWindowEx)

expressionThevariablenameofanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pPageRequiredPageWindowEx.APageWindowExobject.

Remarks

TheOnPageOpeneventisassociatedwiththeApplicationobject.Whentheuseropensapage,MicrosoftFrontPageopenstheframesetforthepageandfirestheOnPageOpeneventforthedefaultframeset.ThenFrontPageexecutesthecodethatyouspecifiedwithintheeventprocedure.

NoteTheOnPageOpeneventonlyfiresforthedefaultframeset,eveniftherearemoreframesonthepage.TheOnPageOpeneventonlyfiresifthepageisnotopen.

Example

ThefollowingexamplechangesthetitleoftheFPHTMLDocumentobject,whenthedocumentisopenedinaPageWindowExobject.

NoteTorunthisexample,youmusthaveatleastoneopenWebsite.ThisexampleusesRogueCellarsasthespecifiedWebsiteandZinfandel.htmasthespecifiedpage.YoucancreateaWebsiteandpageusingthesenamesoryoucansubstituteaWebsiteandpageofyourchoice.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdAddPage,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdAddPage_Click()

DimmyPageWindowsAsPageWindows

DimmyFileAsString

SetmyPageWindows=ActiveWeb.ActiveWebWindow.PageWindows

myFile=_

"C:/MyDocuments/MyWebSites/RogueCellars/Zinfandel.htm"

myPageWindows.Add(myFile)

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnPageOpen(ByValpPageAs_

PageWindowEx)

DimmyDocAsFPHTMLDocument

SetmyDoc=pPage.ActiveDocument

myDoc.Title="RogueCellarsHomePage"

EndSub

OnPageWindowActivateEventOccurswhenthepageinthecurrentwindowobtainsthefocus.

PrivateSubexpression_OnPageWindowActivate(ByValpPageAsPageWindowEx)

expressionThevariablenameofanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pPageThePageWindowExobjectthatcontainstheview.

Example

Thefollowingexamplepromptstheusertorefreshthepageeachtimethepagewindowobtainsthefocus.

PrivateSubobjApp_OnPageWindowActivate(ByValpPageAsPageWindowEx)

'Occurswhencurrentpageinthemainwindowobtainsfocus.

'Promptstheusertorefreshthecurrentpage.

DimstrAnsAsString

strAns=MsgBox("Doyouwanttorefreshthepage"&pPage.Caption&"?",_

vbYesNo)

IfstrAns=vbYesThen

pPage.Refresh

EndIf

EndSub

OnRecalculateHyperlinksEventOccursbeforethehyperlinkstructureinHyperlinksviewisrecalculatedtoviewanychangesmadetotheWebsite.

PrivateSubexpression_OnRecalculateHyperlinks(ByValpWebAsWebEx,CancelAsBoolean)

expressionAnobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebTheWebExobjectthatcontainstheview.

CancelABooleanthatdeterminesiftheeventwillbecancelled.IfFalse,theeventwillnotbecancelled.IfTrue,theeventwillbecancelled.

Example

Thefollowingexamplepromptstheuserbeforerecalculatingthehyperlinkstructure.Iftheuseraccepts,theeventwillcontinueandthehyperlinkswillberecalculated.

PrivateSubobjApp_OnRecalculateHyperlinks(ByValpWebAsWebEx,CancelAsBoolean)

'Occurswhenthecurrentweb'shyperlinksarerecalculated.

DimstrAnsAsString

strAns=MsgBox("Thisactionwillcausethehyperlinksstructuretoberecalculated."_

&"Doyouwanttocontinue?",vbYesNo)

'SetvalueofCancelargumenttousers'response

IfstrAns=vbYesThen

Cancel=False

Else

Cancel=True

EndIf

EndSub

OnWebCloseEventOccurswhenaWebsiteisclosed.

PrivateSubexpression_OnWebClose(ByValpWebAsWebEx,CancelAsBoolean)

expressionAnobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebRequiredWebEx.AWebExobject.

CancelRequiredBoolean.Trueiftheclosingprocesswascancelledthroughtheuserinterface,orifCancelwassettoTrue.DefaultisFalse.

Remarks

TheOnWebCloseeventisassociatedwiththeApplicationobject.WhenyoucloseaWebsite,theOnWebCloseeventfiresandexecutesthecodethatyouspecifiedwithintheeventprocedure.

Example

Thefollowingexampleiteratesthroughtheopenpagesand,ifnecessary,savesthembeforetheWebsiteisclosed.

NoteTorunthisexample,youmusthaveatleastoneopenWebsiteandoneopenpagewithinthatWebsite.ThisexampleusesRogueCellarsasthespecifiedWebsite.YoucancreateaWebsitecalledRogueCellarsorsubstituteaWebsiteofyourchoice.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdCloseWeb,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivatepPageAsPageWindowEx

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdCloseWeb_Click()

Webs("C:/MyDocuments/MyWebSites/RogueCellars").Close

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnWebClose(ByValpWebAsWebEx,_

CancelAsBoolean)

DimmyPageWindowsAsPageWindows

DimmyPageWindowAsPageWindowEx

SetmyPageWindows=pWeb.ActiveWebWindow.PageWindows

ForEachmyPageWindowInmyPageWindows

IfmyPageWindow.IsDirty=TrueThenmyPageWindow.Save

Next

EndSub

ShowAll

OnWebFileCheckOutEventOccurswhenafileinthecurrentWebsiteischeckedout.

PrivateSubexpression_OnWebFileCheckOut(ByValpWebAsWeb,ByValpFileAsWebFile,CheckedOutAsBoolean,pCheckOutOptionAsFpCheckOutOption)

expressionThevariablenamethatreferencesanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebThecurrentWebExobjectthatcontainsthefile.

pFileTheWebFilebeingcheckedout.

CheckedOutABooleanthatindicatesthestatusofthefile.IfTrue,thefileischeckedout.IfFalse,thefilehasnotbeencheckedout.

pCheckOutoptionFpCheckOutOption.Specifiesthecheckoutfileoption.

FpCheckOutOptioncanbeoneoftheseFpCheckOutOptionconstants.FPCheckOutDefault.Checkthefileout.FPCheckOutCancelCancelthefilecheckout.FPCheckOutReadOnlyChecksoutaread-onlyversionofthefile.FPCheckOutPromptUserPromptstheuserbeforecheckingoutthefile.

Example

Thefollowingexamplepromptstheuserbeforethefileischeckedout.

PrivateSubobjApp_OnWebFileCheckOut(ByValpWebAsWeb,ByValpFileAsWebFile,

_CheckedOutAsBoolean,_

pCheckOutOptionAsFpCheckOutOption)

'Occurswhenafileinthecurrentwebischeckedout.

'Prompttheuserbeforecheckingoutthefile

pCheckOutOption=fpCheckOutPromptUser

EndSub

OnWebNewEventOccurswhenanewWebsiteiscreated.

PrivateSubexpression_OnWebNew(ByValpWebAsWeb)

expressionThevariablenamethatreferencesanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebRequiredWebEx.AWebExobject.

Remarks

TheOnWebNeweventisassociatedwiththeApplicationobject.WhentheusercreatesanewWebsiteinMicrosoftFrontPage,theOnWebNeweventfiresandexecutesthecodewithintheeventprocedure.

Example

ThefollowingexamplecreatesatemporaryWebsiteandaddsanewfile.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdCreateWeb,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivatepPageAsPageWindowEx

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdCreateWeb_Click()

Webs.Add("C:/MyDocuments/MyWebSites/TempWeb")

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnWebNew(ByValpWebAsWeb)

DimmyFileAsWebFile

SetmyFile=pWeb.RootFolder.Files.Add("index.htm")

myFile.Open

EndSub

OnWebOpenEventOccurswhenaWebsiteisopened.

PrivateSubexpression_OnWebOpen(ByValpWebAsWeb)

expressionThevariablenamethatreferencesanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebRequiredWebEx.AWebExobject.

Remarks

TheOnWebOpeneventisassociatedwiththeApplicationobject.WhentheuseropensaWebsiteinMicrosoftFrontPage,theOnWebOpeneventfiresandexecutesthecodethatyouspecifiedwithintheeventprocedure.

Example

ThefollowingexampleopenstheIndex.htmfilewhenaWebsiteisopened.

NoteThisexampleusesRogueCellarsasthespecifiedWebsitetobeopened.YoucancreateaWebsitecalledRogueCellarsoryoucansubstituteaWebsiteofyourchoice.

CreateaformcalledfrmLaunchEvents.frmandaddtwobuttons,abuttoncalledcmdOpenWeb,andabuttoncalledcmdCancel.Addthefollowingcodetotheformcodewindow.

OptionExplicit

PrivateWithEventseFPApplicationAsApplication

PrivatepPageAsPageWindowEx

PrivateSubUserForm_Initialize()

SeteFPApplication=NewApplication

EndSub

PrivateSubcmdOpenWeb_Click()

Webs.Open("C:/MyDocuments/MyWebSites/RogueCellars")

EndSub

PrivateSubcmdCancel_Click()

'Hidetheform.

frmLaunchEvents.Hide

ExitSub

EndSub

PrivateSubeFPApplication_OnWebOpen(ByValpWebAsWeb)

DimmyFileAsWebFile

SetmyFile=pWeb.RootFolder.Files.Add("index.htm")

myFile.Open

EndSub

WindowActivateEventOccurswhenawindowisactivated.

PrivateSubexpression_WindowActivate(ByValpWebWindowAsWebWindowEx)

expressionThevariablenameofanobjectoftypeApplicationdeclaredusingtheWithEventskeywordinaclassmodule.

pWebWindowTheWebWindowExobject.

Remarks

WhenaninstanceofMicrosoftFrontPageobtainsthefocus,aWindowActivateeventwillfireforeachopenwindow.

Example

ThefollowingexamplepromptstheusertoclosethewindowwhentheFrontPagewindowobtainsthefocus.

PrivateSubexpression_WindowActivate(ByValpWebWindowAsWebWindowEx)

'OccurswhenaFrontPagewindowobtainsfocus.

DimstrAnsAsString

strAns=MsgBox("Areyousureyouwanttoopenthewindow"_

&pWebWindow.Caption&"?",_

vbYesNo)

IfstrAns=vbNoThen

pWebWindow.Close

EndIf

EndSub

WindowDeactivateEventOccurswhenaWebwindowisdeactivated.

PrivateSubexpression_WindowDeactivate(ByValpWebWindowAsWebWindowEx)

expressionThevariablenameofanobjectoftypeApplicationdeclaredwitheventsinaclassmodule.

pWebWindowTheWebWindowExobject.

Example

Thefollowingexamplepromptstheusertoclosethewindowwhenthewindowlosesthefocus.

PrivateSubexpression_WindowDeactivate(ByValpWebWindowAsWebWindowEx)

'OccurswhenaMicrosoftFrontPagewindowlosesfocus.

DimstrAnsAsString

strAns=MsgBox("Doyouwanttoclosethiswindow?"_

&pWebWindow.Caption&"?",_

vbYesNo)

IfstrAns=vbYesThen

pWebWindow.Close

EndIf

EndSub

ShowAll

FrontPageWebObjectModelEnumeratedConstantsThistopicprovidesalistofallenumeratedconstantsintheMicrosoftFrontPageWebObjectModel.

FpCheckOutOption

Constant ValuefpCheckOut 1fpCheckOutCancel 3fpCheckOutPromptUser 0fpCheckOutReadOnly 2

FpChoiceFieldFormat

Constant ValuefpChoiceFieldCheckBoxes 2fpChoiceFieldDropdown 0fpChoiceFieldRadioButtons 1

FpConnectionSpeed

Constant ValuefpConnect1000K 9fpConnect128K 3fpConnect144 0fpConnect1500K 4fpConnect256K 6fpConnect288 1fpConnect384K 7fpConnect512K 8

fpConnect56K 2fpConnectISDN 3fpConnectT1 4fpConnectT3 5

FpCurrencyFieldFormat

Constant ValuefpCurrencyFieldAlgerian 5121fpCurrencyFieldArgentina 11274fpCurrencyFieldAustralia 3081fpCurrencyFieldAustria 3079fpCurrencyFieldBahraini 15361fpCurrencyFieldBelgiumBF 2067fpCurrencyFieldBelgiumFB 2060fpCurrencyFieldBolivia 16394fpCurrencyFieldBrazil 1046fpCurrencyFieldCanada 4105fpCurrencyFieldCanadaF 3084fpCurrencyFieldChile 13322fpCurrencyFieldColombia 9226fpCurrencyFieldCostaRica 5130fpCurrencyFieldCzech 1029fpCurrencyFieldDenmark 1030fpCurrencyFieldDominicanRepublic 7178fpCurrencyFieldEcuador 12298fpCurrencyFieldEgyptian 3073fpCurrencyFieldElSalvador 17418fpCurrencyFieldEuro -1fpCurrencyFieldEuroPostfix -2fpCurrencyFieldFinland 1035fpCurrencyFieldFrance 1036fpCurrencyFieldGermany 1031

fpCurrencyFieldGreece 1032fpCurrencyFieldGuatemala 4106fpCurrencyFieldHonduras 18442fpCurrencyFieldHongKong 3076fpCurrencyFieldHungary 1038fpCurrencyFieldIndian 1081fpCurrencyFieldIranian 1065fpCurrencyFieldIraqi 2049fpCurrencyFieldIreland 6153fpCurrencyFieldIsraeli 1037fpCurrencyFieldItaly 1040fpCurrencyFieldJapan 1041fpCurrencyFieldJordanian 11265fpCurrencyFieldKorea 1042fpCurrencyFieldKuwaiti 13313fpCurrencyFieldLebanese 12289fpCurrencyFieldLibyan 4097fpCurrencyFieldMexico 2058fpCurrencyFieldMoroccan 6145fpCurrencyFieldNetherlands 1043fpCurrencyFieldNewZealand 5129fpCurrencyFieldNicaragua 19466fpCurrencyFieldNorway 1044fpCurrencyFieldOmani 8193fpCurrencyFieldPakistani 1056fpCurrencyFieldPanama 6154fpCurrencyFieldParaguay 15370fpCurrencyFieldPeru 10250fpCurrencyFieldPoland 1045fpCurrencyFieldPortugal 2070fpCurrencyFieldPRChina 2052fpCurrencyFieldQatari 16385fpCurrencyFieldRussia 1049

fpCurrencyFieldSaudiArabian 1025fpCurrencyFieldSingapore 4100fpCurrencyFieldSlovakia 1051fpCurrencyFieldSlovenia 1060fpCurrencyFieldSouthAfrica 7177fpCurrencyFieldSpain 1034fpCurrencyFieldSweden 1053fpCurrencyFieldSwitzerland 2055fpCurrencyFieldSyrian 10241fpCurrencyFieldTaiwan 1028fpCurrencyFieldThai 1054fpCurrencyFieldTunisian 7169fpCurrencyFieldTurkey 1055fpCurrencyFieldUAE 14337fpCurrencyFieldUnitedKingdom 2057fpCurrencyFieldUnitedStates 1033fpCurrencyFieldUruguay 14346fpCurrencyFieldVenezuela 8202fpCurrencyFieldVietnamese 1066fpCurrencyFieldYemeni 9217

FpDateTimeFieldFormat

Constant ValuefpDateTimeFieldDateAndTime 0fpDateTimeFieldDateOnly 1

FpDependencyFlags

Constant ValuefpDepsDefault 255fpDepsImages 2fpDepsLinkbars 16fpDepsLinks 1

fpDepsLists 4fpDepsNavbars 32fpDepsNone 0fpDepsRecurse 256fpDepsSharedBorders 128fpDepsThemes 8fpDepsWebParts 64

FpFieldType

Constant ValuefpFieldAttachments 13fpFieldChoice 5fpFieldComputed 11fpFieldCounter 9fpFieldCurrency 3fpFieldDateTime 4fpFieldFile 12fpFieldInteger 10fpFieldLookup 6fpFieldMultiLine 1fpFieldNumber 2fpFieldRatingScale 14fpFieldSingleLine 0fpFieldTrueFalse 7fpFieldURL 8

FpFolderType

Constant ValuefpFolderDHTMLSharedLib 1

FpListDesignSecurity

Constant ValuefpListDesignSecurityCreator 1fpListDesignSecurityEveryone 0

FpListEditSecurity

Constant ValuefpListEditSecurityAll 0fpListEditSecurityNone 2fpListEditSecurityOnlyOwn 1

FpListReadSecurity

Constant ValuefpListReadSecurityAll 0fpListReadSecurityOnlyOwn 1

FpListType

Constant ValuefpListTypeBasicList 0fpListTypeDiscussion 3fpListTypeDocumentLibrary 2fpListTypeSurvey 1

FpNumberFieldFormat

Constant ValuefpNumberFieldAuto -1fpNumberFieldFiveDecimals 5fpNumberFieldFourDecimals 4fpNumberFieldInteger 0fpNumberFieldOneDecimal 1fpNumberFieldThreeDecimals 3

fpNumberFieldTwoDecimals 2

FpOptimizeHTMLFlags

Constant ValuefpHtmlOptAdjacentTags 64fpHtmlOptAuthorComponents 8fpHtmlOptBots 8fpHtmlOptBrowseComponents 131072fpHtmlOptCellFormattingAttr 256fpHtmlOptDreamWeaver 2fpHtmlOptDwtCmnts 1024fpHtmlOptEmpty 32fpHtmlOptGenerator 16fpHtmlOptHTMLAllWhitespace 16384fpHtmlOptHTMLCmnts 4096fpHtmlOptHTMLLeadWhitespace 8192fpHtmlOptHTMLMisnest 32768fpHtmlOptOn -2147483648fpHtmlOptScriptCmnts 2048fpHtmlOptThemes 4fpHtmlOptTrcImageAttr 512fpHtmlOptUnusedStyles 65536fpHtmlOptVMLGraphics 128fpHtmlOptWordHTML 1

FpPageViewMode

Constant ValuefpPageViewDefault 0fpPageViewHtml 2fpPageViewInBetween 512fpPageViewInvalid -1fpPageViewNoFrames 4

fpPageViewNormal 1fpPageViewNoWindow 128fpPageViewPreview 8fpPageViewPrintPreview 256fpPageViewSplit 16fpPageViewText 32fpPageViewXml 64

FpPkgImportConflictOpts

Constant ValuefpPkgFileConflictMask 15fpPkgListConflictMask 240fpPkgOnConflictSkip 17fpPkgOnConflictStop 0fpPkgOnFileConflictOverwrite 2fpPkgOnFileConflictSkip 1fpPkgOnFileConflictStop 0fpPkgOnListConflictMergeOrRename 64fpPkgOnListConflictMergeOrSkip 48fpPkgOnListConflictMergeOrStop 32fpPkgOnListConflictRename 80fpPkgOnListConflictSkip 16fpPkgOnListConflictStop 0

FpPkgImportResult

Constant ValuefpPkgImportCancelled 2fpPkgImportComplete 0fpPkgImportErrorInPackage 3fpPkgImportFailed 1fpPkgImportNotTrusted 5fpPkgImportServerNotSupported 6

fpPkgImportStopped 4

FpPkgTrustLevel

Constant ValuefpPkgTrustAll 1fpPkgTrustCertificateStore 2

FpSharedBorders

Constant Value_fpBorderNone 0fpBorderAll 255fpBorderBottom 8fpBorderLeft 2fpBorderRight 4fpBorderTop 1

FpStructModType

Constant ValuefpStructBaseOnSibling 0fpStructLeftmostChild 1fpStructRightmostChild 2

FpThemeProperties

Constant ValuefpThemeActiveGraphics 16fpThemeBackgroundImage 1fpThemeCSS 4096fpThemeDefaultSettings 16777216fpThemeName 33554432fpThemeNoBackgroundImage 0

fpThemeNoCSS 0fpThemeNormalColors 0fpThemeNormalGraphics 0fpThemePropertiesAll 4369fpThemePropertiesNone 0fpThemeVividColors 256

FpURLComponent

Constant ValuefpURLComponentBookmark 256fpURLComponentFileExtension 128fpURLComponentFileName 64fpURLComponentPassword 4fpURLComponentPath 32fpURLComponentPort 16fpURLComponentQuery 512fpURLComponentScheme 1fpURLComponentServer 8fpURLComponentUserName 2

FpURLFieldFormat

Constant ValuefpURLFieldImage 1fpURLFieldLink 0

FpWebDeleteFlags

Constant ValuefpDeleteEntireWeb 0fpDeleteFrontPageInfoFromWeb 1

FpWebOpenFlags

Constant ValuefpOpenInWindow 0fpOpenNoWindow 2

FpWebPublishFlags

Constant ValuefpPublishAddToExistingWeb 2fpPublishCopyAllFiles 64fpPublishCopySubwebs 4fpPublishIncremental 1fpPublishLogInTempDir 8fpPublishNoDeleteUnmatched 16fpPublishNone 0fpPublishRemoteToLocal 128fpPublishSynchronize 256fpPublishUseLastPublishTime 32fpPublishUsingDav 512fpPublishUsingPassiveFtp 1024

FpWebSubView

Constant ValuefpWebSubViewFolders 1fpWebSubViewNavigation 2fpWebSubViewNone 0

FpWebViewMode

Constant ValuefpWebViewAllFiles 4fpWebViewBrokenLinks 6fpWebViewFolders 1fpWebViewLinks 0

fpWebViewPage 3fpWebViewRemoteSite 8fpWebViewSiteSummary 7fpWebViewStructure 2fpWebViewTodo 5

FpWebViewModeEx

Constant ValuefpWebViewExAccessibility 37fpWebViewExAllFiles 4fpWebViewExAssignedTo 13fpWebViewExBrokenLinks 6fpWebViewExBrowserTypes 29fpWebViewExCategories 17fpWebViewExCheckoutStatus 16fpWebViewExComponentErrors 18fpWebViewExCSSLinks 33fpWebViewExDailyPageHits 19fpWebViewExDailySummary 22fpWebViewExFolders 1fpWebViewExLinks 0fpWebViewExMasterPages 32fpWebViewExMonthlyPageHits 21fpWebViewExMonthlySummary 24fpWebViewExNavigation 2fpWebViewExOlderFiles 8fpWebViewExOsTypes 28fpWebViewExPage 3fpWebViewExPublishStatus 15fpWebViewExRecentlyAddedFiles 9fpWebViewExRecentlyChangedFiles 10fpWebViewExReferringDomains 25

fpWebViewExReferringURLs 26fpWebViewExRemoteSite 34fpWebViewExReviewStatus 14fpWebViewExSearchStrings 27fpWebViewExSharedBorders 36fpWebViewExSiteSummary 7fpWebViewExSlowPages 11fpWebViewExThemes 35fpWebViewExTodo 5fpWebViewExUnlinkedFiles 12fpWebViewExUsageSummary 31fpWebViewExVisitingUsers 30fpWebViewExWeeklyPageHits 20fpWebViewExWeeklySummary 23