ApplyTheme Method

Microsoft FrontPage Visual Basic

Show All Show All

ApplyTheme Method

Applies the value contained in the ThemeName argument to the property named in the ThemeProperties argument. For example, a theme can be applied to a WebFile, WebFiles, PageWindowEx, or WebEx object in a Microsoft FrontPage-based Web site.

expression.ApplyTheme(ThemeName, ThemeProperties)

expression    An expression that returns an object in the Applies To list.

ThemeName    Required String. A string that contains the name of the theme that you want to apply to a file. The ThemeName parameter can be one of the following:

aftrnoon concrete modular strtedge
arcs corporat nature studio
arctic cypress network sumipntg
artsy deepblue papyrus sunflowr
axisechopassporttabs
balanceeclipsepiecharttechnolo
barsedgepixeltopo
blankevergreenpoetictravel
blendsexpeditnprofilewater
blitzfolioquadwatermar
blocksglacierradialwaves
bluecalmglobalrefinedwillow
blueprnthighwayricepaprzero
boldstriiceripple
breezeindustrmnsque
canyoninmotionsandston
capsulesirissatin
cascadejournalsky
checkerslayersslate
citruslevelsonora
classicloosegstspiral
compassmdshapesspring

ThemeProperties   Optional FpThemeProperties. The properties associated with the theme.

FpThemeProperties can be one of these FpThemeProperties constants.
fpThemeActiveGraphics
fpThemeBackgroundImage
fpThemeCSS
fpThemeDefaultSettings
fpThemeName
fpThemeNoBackgroundImage
fpThemeNoCSS
fpThemeNormalColors default
fpThemeNormalGraphics
fpThemePropertiesAll
fpThemePropertiesNone
fpThemeVividColors

Remarks

The following code applies the Sumi Painting theme to a file with active graphics.

    Dim strTheme As String

strTheme = "sumipntg"
Call WebFile.ApplyTheme(strTheme, fpThemeActiveGraphics)
  

To change more than one theme property when applying the theme, use the plus sign (+), as shown in the following example.

    strTheme = "sumipntg"
WebFile.ApplyTheme(strTheme, _
fpThemeVividColors + fpThemeActiveGraphics)
  

This method is essentially the same one you'd use for applying a theme to a PageWindowEx or WebEx object.

Example

This example contains a function, ApplyThemeToFilesInFolder, and a procedure that you can modify to apply any of the available themes. This example applies the Artsy theme to all files in a specified folder.

Note  To run this example, copy the code into a module in the Microsoft Visual Basic Editor and run the ChangeToArtsy procedure.

    Function ApplyThemeToFilesInFolder(myThemeName As String, _
        myFolderObject As WebFolder) As Boolean
    Dim myFile As WebFile
    Dim myTheme As Theme

    On Error GoTo ERR

    For Each myFile In myFolderObject.Files
        Call myFile.ApplyTheme(myThemeName, fpThemePropertiesAll)
    Next myFile

    ApplyThemeToFilesInFolder = True
    Exit Function

ERR:
    MsgBox "An error occurred: " & ERR.Description, vbCritical, "Error!"
    ApplyThemeToFilesInFolder = False
Exit Function

End Function


Private Sub ChangeToArtsy()
    ApplyThemeToFilesInFolder "artsy", ActiveWeb.RootFolder
End Sub