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, PageWindowEx, or WebEx object in a Microsoft FrontPage-based web.
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. ThemeName can be one of the following constants.
artsy | boldstri | indust | sumipntg |
blank | capsules | ricepapr | |
blends | citrus | rmnsque | |
blueprnt | expeditn | strtedge |
FpThemeProperties can be one of these FpThemeProperties constants. |
fpThemeActiveGraphics |
fpThemeBackgroundImage |
fpThemeCSS |
fpThemeDefaultSettings |
fpThemeName |
fpThemeNoBackgroundImage |
fpThemeNoCSS |
fpThemeNormalColors default |
fpThemeNormalGraphics |
fpThemePropertiesAll |
fpThemePropertiesNone |
fpThemeVividColors |
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.
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 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 occured: " & ERR.Description, vbCritical, "Error!"
ApplyThemeToFilesInFolder = False
Exit Function
End Function
Private Sub ChangeToArtsy()
ApplyThemeToFilesInFolder "artsy", ActiveWeb.RootFolder
End Sub