About Web scripts

A Web script is a type of computer code that can be used to make your Web page dynamic. For example, a Web script could be used to include a "number of visitors" counter that increments each time someone visits your Web page. Or a Web script could be used to include a countdown to a special event: "only x more days", where x decreases by 1 every day. Usually Web scripts are run by a Web browser when a Web page is opened, typically to display information produced by the script. Creating Web scripts is an advanced Office feature that requires programming knowledge. You can add Microsoft Visual Basic Scripting Edition (VBScript) (Visual Basic Scripting Edition (VBScript): A subset of the Microsoft Visual Basic programming system. At least Microsoft Internet Explorer 3, along with the other Web browsers, can read VBScript programs that are embedded in HTML pages.) or JavaScript (JavaScript: A scripting language that can be used to add functionality to a Web page or a Web site, or to enhance the look of one. JavaScript scripts can run on any type of client or server computer.) to your page in Microsoft Word, Excel, PowerPoint, and FrontPage.

Scripting is useful for custom Web-based solutions development. It provides a full object model for the Web browser and the objects on the current page. This makes it easy to write code that manipulates elements on the page without you knowing the details of the HTML (HTML: The standard markup language used for documents on the World Wide Web. HTML uses tags to indicate how Web browsers should display page elements such as text and graphics and how to respond to user actions.) or how the objects are implemented. You can also create script code that is specifically designed to handle events that occur on objects (such as ActiveX controls (ActiveX control: A control, such as a check box or button that offers options to users or runs macros or scripts that automate a task. You can write macros for the control in Microsoft Visual Basic for Applications or scripts in Microsoft Script Editor.)) on your page.

You view and edit the HTML code, along with any script code for your Web page, using the Microsoft Script Editor (Microsoft Script Editor: Used to add text, edit HTML tags, and edit any Microsoft Visual Basic Scripting Edition (VBScript) code in a data access page. You can also view your page in the Script Editor as it would appear in a Web browser.). In the Script Editor, you can add text, edit HTML tags, and edit any Web script code. You can also view your Web page as it would appear in a Web browser and edit it in this view. For detailed information about creating scripts, see Microsoft Script Editor Help.

ShowTips

  • When you insert a script in a Web page in an Office program, the Script Editor creates a separate copy of the page you are editing, containing your content along with the script code. After editing the page in the Script Editor and returning to the Office program, click Refresh Button image on the Refresh toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, press ALT and then SHIFT+F10.) to update the original page with the changes you made in the Script Editor.
  • Be careful when copying and moving Web scripts. Although some are self-contained and work correctly in any location on any page, other Web scripts are dependent on the structure of the Web page they are in. When copied or moved to another Web page — or to another location on a Web page — these scripts might not run correctly or might return errors when viewed in a browser.
 
 
Applies to:
Excel 2003, PowerPoint 2003, Word 2003