Class WebOptions (Word VBA)

Contains document-level attributes used by Microsoft Word when you save a document as a webpage or open a webpage.

Set

To use a WebOptions class variable it first needs to be instantiated, for example

Dim wos as WebOptions
Set wos = ActiveDocument.WebOptions

WebOptions class variables can be set using the Document.WebOptions procedure.

Properties

AllowPNG true if PNG (Portable Network Graphics) is allowed as an image format when you save a document as a webpage. False if PNG is not allowed as an output format. The default value is False.

ActiveDocument.WebOptions.AllowPNG = True

BrowserLevel returns or sets WdBrowserLevel that represents the level of web browser at which you want to target the specified Web page.

ActiveDocument.WebOptions.BrowserLevel = wdBrowserLevelMicrosoftInternetExplorer5

Encoding returns or sets the document encoding (code page or character set) to be used by the web browser when you view the saved document.

ActiveDocument.WebOptions.Encoding =

FolderSuffix returns the folder suffix that Microsoft Word uses when you save a document as a webpage, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True).

Dim strFolderSuffix As String
strFolderSuffix = ActiveDocument.WebOptions.FolderSuffix

OptimizeForBrowser true if Word optimizes the specified Web page for the web browser specified by the BrowserLevel property.

ActiveDocument.WebOptions.OptimizeForBrowser = True

OrganizeInFolder true if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a webpage. False if supporting files are saved in the same folder as the webpage. The default value is True.

ActiveDocument.WebOptions.OrganizeInFolder = True

Parent returns an object that represents the parent object of the specified WebOptions object.

Dim objParent As Object
Set objParent = ActiveDocument.WebOptions.Parent

PixelsPerInch returns or sets the density (pixels per inch) of graphics images and table cells on a webpage.

ActiveDocument.WebOptions.PixelsPerInch =

RelyOnCSS true if cascading style sheets (CSS) are used for font formatting when you view a saved document in a web browser. The default value is True.

ActiveDocument.WebOptions.RelyOnCSS = True

RelyOnVML true if image files are not generated from drawing objects when you save a document as a webpage. False if images are generated. The default value is False.

ActiveDocument.WebOptions.RelyOnVML = True

ScreenSize returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a web browser.

ActiveDocument.WebOptions.ScreenSize =

TargetBrowser sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a web browser.

ActiveDocument.WebOptions.TargetBrowser =

UseLongFileNames true if long file names are used when you save the document as a webpage. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True.

ActiveDocument.WebOptions.UseLongFileNames = True