Frame For Word Doc

Posted on  by admin
-->

In Word, you can use frames in your Web page design to make your information organized and easy to access. A frames page, also called a frameset, is a Web page that is divided into two or more sections, each of which points to another Web page. A frame on a frames page can also point to another frames page. For information about creating frames and frames pages in the Word user interface, see Word Help.

Frames and frames pages are created with a series of HTML tags. The Visual Basic object model for working with frames and frames pages is best understood by examining their HTML tags.

Frames pages in HTML

In HTML, frames pages and the frames they contain are built using a hierarchical set of and tags. A frameset can contain both frames and other framesets. For example, the following HTML creates a frameset with a frame on top and a frameset immediately below it. That frameset contains a frame on the left and a frameset on the right. That frameset contains two frames, one on top of the other.

red colour border design . text box transparent background . border design for microsoft word . decorative borders for google docs . page borders for word document .

The Frameset Object

The Frameset object encompasses the functionality of both tags. Each Frameset object is either of type wdFramesetTypeFrameset or wdFramesetTypeFrame, which represent the HTML tags and respectively. Properties beginning with "Frameset" apply to Frameset objects of type wdFramesetTypeFrameset (FramesetBorderColor and FramesetBorderWidth . Properties beginning with "Frame" apply to Frameset objects of type wdFramesetTypeFrame (FrameDefaultURL, FrameDisplayBorders, FrameLinkToFile, FrameName, FrameResizable, and FrameScrollBarType).

Traversing the Frameset Object Hierarchy

Because frames pages are defined as a hierarchical set of HTML tags, the object model for accessing Frameset objects is also hierarchical. Use the ChildFramesetItem and ParentFrameset properties to traverse the hierarchy of Frameset objects. For example,

returns a Frameset object corresponding to the n th first-level MyFrameset.

If MyFrameset is a Frameset object corresponding to the outermost $gt;FRAMESET$gt; tags in the preceding HTML example, MyFrameset.ChildFramesetItem(1) returns a Frameset object of type wdFramesetTypeFrame that corresponds to the frame named "top." Similarly, MyFrameset.ChildFramesetItem(2) returns a Frameset object of type wdFramesetTypeFrameset, itself containing two Frameset objects: the first object corresponds to the frame named "left," the second is of type wdFramesetTypeFrameset.

Frameset objects of type wdFramesetTypeFrame have no child frames, while objects of wdFramesetTypeFrameset have at least one.

The following Visual Basic example displays the names of the four frames defined in the preceding HTML example.

Individual Frames and the Entire Frames Page

To return the Frameset object associated with a particular frame on a frames page, use the Frameset property of a Pane object. For example,

returns the Frameset object that corresponds to the first frame of the frames page.

The frames page is itself a document separate from the documents that make up the content of the individual frames. The Frameset object associated with a frames page is accessed from its corresponding Document object, which in turn is accessed from the Window object in which the frames page appears. For example,

returns the Frameset object for the frames page in the active window.

Note When working with frames pages, the ActiveDocument property returns the Document object associated with the frame in the active pane, not the entire frames page.

Creating a Frames Page and Its Content from Scratch

This example creates a new frames page with three frames, adds text to each frame, and sets the background color for each frame. It inserts two hyperlinks into the Left frame: the first hyperlink opens a document called One.htm in the Main frame, and the second opens a document called Two.htm in the entire window. For these hyperlinks to work, you must create files called One.htm and Two.htm or change the strings to the names of existing files.

Note As each frame is created, Word creates a new document whose content will be loaded into the new frame. The example saves the frames page which automatically saves the documents associated with each of the three frames.

Creating a Frames Page that Displays Content from Existing Files

This example creates a frames page similar to the one above, but sets the default URL for each frame to an existing document so that the content of that document is displayed in the frame. For this example to work, you must create files called Main.htm, Left.htm, and Banner.htm or change the strings in the example to the names of existing files.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.