Share via


charset Property

Returns or sets a String that represents the character set for an external style sheet.

expression.charset

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

For information about character sets, see HTML Character Sets.

Example

The following example inserts a <META> tag that contains the character set to use for the active document.

Sub InsertCharset(ByRef objDoc As FPHTMLDocument, ByRef strID As String, _
       ByRef  strHTTP As String, ByRef strContent As String, ByRef strCharset As String)
    Dim objMeta As FPHTMLMetaElement
       
    objDoc.all.tags("head").Item(0) _
        .innerHTML = "<META id=""" & strID & """>"
    Set objMeta = ActiveDocument.all.tags("meta").Item(CVar(strID))
    
    With objMeta
        .httpEquiv = strHTTP
        .content = strContent
        .Charset = strCharset
    End With
End Sub

Use the following example to call the preceding subroutine.

Sub CallInsertCharset()
    Call InsertCharset(objDoc:=ActiveDocument, strID:="iso_content", _
        strHTTP:="Content-Type", strContent:="text/html", strCharset:="ISO Latin-1")
End Sub

Applies to | FPHTMLMetaElement Object | IHTMLMetaElement Object