The Microsoft Script Editor

The Microsoft Script Editor (MSE) has been part of Office for several versions now, but you might not be aware of its existence. It doesn't appear in either the Microsoft Office or Microsoft Office Tools program group, nor is it one of the Open With selections on the right-click menu of a VBS file.

The MSE executable is located in the following path for Office 2007: C:\Program Files\Common Files\Microsoft Shared\OFFICE12\MSE7.EXE, as shown in Figure 17.1.

FIGURE 17.1

The Microsoft Script Editor executable (MSE7.EXE).

FIGURE 17.1

The Microsoft Script Editor executable (MSE7.EXE).

You can open the MSE directly by double-clicking the MSE7.EXE file, and then open a script to edit from its File C Open menu, but for convenience you may wish to pin the executable file to the Start menu, as shown in Figure 17.2.

For even greater convenience, you can select the MSE as the program to use when opening VBS files. To do this, right-click a file with the .vbs extension in an Explorer pane, and select the Choose Default Program command (see Figure 17.3).

Pinning the MSE executable to the Windows Vista Start menu.

Pinning the MSE executable to the Windows Vista Start menu.

FIGURE 17.3

Choosing the MSE as the default program to use with VBS files.

FIGURE 17.3

Choosing the MSE as the default program to use with VBS files.

: i T'P iV The "Microsoft (r) Windows Based Script Host" entry in the Recommended Programs i^&i&^a&i&eBBauB- group on the Open With dialog runs the script, rather than opening it for editing.

Curiously, the MSE is not shown in either the Recommended Programs or Other Programs group in the Open With dialog (shown in Figure 17.4), so you need to browse for it in the C:\Program Files\Common Files\Microsoft Shared\OFFICE12\ folder.

FIGURE 17.4

The Open With dialog for selecting the program to use when opening a VBS file.

Figure 17.5 shows the MSE executable being selected in the Open With . . . Browse dialog.

Back on the main Open With dialog, Microsoft Script Editor is now visible in the Other Programs group, and you can select it and click OK to open the script in the MSE. After selecting MSE7.EXE as the file to use when opening a VBS file, you will see the MSE as a selection on the Open With menu (Figure 17.6).

Selecting the MSE executable as the file to use when opening VBS files.

I J Open With...

P

j •• 1 1 « miciosoft shared ► OFFICE 12 ►

- ** ' 1 îeoir/j

1 1

1 % OrganËe * Views " fi New Foldei

1

¡k Computer S Desktop jjj Recent Places (£) Contact Letters

Documents Qj Startup Qj Office Book gl Office Book Copy [¿j Templates QB Vista Bug Reports More »

File name:

Nam« Date modified

fj Office Setup Conti ollei I f SCHEMAS } VS Runtime HO MSE7.EXE . •^MSOICONSPfö £|JMSOXMLED ' IJODSERV.EXE ■ OFFDLAG.EXI

File description: Microsoft Script Editor Company: Microsoft Corporation File version: 12,0,40171003 Date created: 4/25/2006 9:42 PM Size: 43.7 KB

FIGURE 17.6

Selecting the MSE for use in opening VBS files.

FIGURE 17.6

If you leave the "Always use the selected program to open this kind of file" checkbox checked when opening the script file, then double-clicking a VBS file will open MSE, and you will need to select "Microsoft (r) Windows Based Script Host" from the Open With menu to run the script; leaving this checkbox unchecked means that double-clicking the VBS script file will run the script, and you can select the MSE to edit the script from the Open With menu. I generally leave it unchecked, to make it easier to run scripts.

If you want to run scripts by double-clicking them, select "Microsoft (r) Windows Based Script Host" as the program to use when opening VBS files, and check the "Always use the selected program to open this kind of file" checkbox.

Figure 17.7 shows the new MSE entry on the Open With menu of a VBS file.

FIGURE 17.7

The Microsoft Script Editor selection on a VBS file's Open With menu.

Documents ► Wilting i Wiley i Office Book ► Templates and other files >

% Organize " i|| Views ▼ jj"- Open £ E-mail ^ Bum

Favorite Links li Contact Letters

Documents 5) Startup l^i Office Book [¿i Office Book Copy [¿j Templates IJj Vista Bug Reports

[¿j Office Book I (hapteis 1st DE C hapteis )j Figures ; Guidelines [¿j Otliei Docs [J [¿i Sample Datal

[J 10BS.DBF fS] Jobs.lit m JobsJNI □ JOBS.MDX [_1 Jobs.wkï

§ Jobsxml

|SjJNil'/Document flom Template vl>i r~' Ner. Documents fiom Templates.vbs I pH Open Eiiplorei Folder.vbs §y Open Network Foldei.vbs 0|>eil

|EJ pagef ileconfici vbs Pi PiintRepoit.vbs

PRNCNFG.VBS OpeilV

g PRNDftVR.VBS

PRNJOBS.VBS SelMl T"

¿PRMP0RT.VB5 Cllt

Professional Services.vbs ¡B'i Pi ooress Report.vbs

Opens the document with Microsoft Script Editor.

Date modified 3/4/20 06 11:24 AM 8/4/2006 3:34 PM 9/3/200» 5:16 PM 8/4/2006 11:24 AM 8/3/2006 5:16 PM 8/4/2006 3:35 PM 12/13/2002 5:04 PM 12/31/2002 5:50 PM

Type DBF File

HTML Document Configuiation Settings MDX File WK3 File XML Document VBS File VBS File

^17/2002 12:02 AM VBS File 17/2002 3:55 PM VBS File 1/2002 7:00 AM VBS File M- Microsoft (r) Windows Bo seil Script Host HS XML Editor

! Notepad

Choose Default Program...

Create Shortcut

Delete

Rename

Properties

If you have Visual Studio 2005 installed, you will see that program on the Open With menu, and you can open a script in Visual Studio; however, the Visual Studio editor (for VBScripts) is basically just a text editor with some color-coding, so I recommend using the MSE instead.

The MSE window (shown in Figure 17.8) has some similarities to the Visual Basic module window for an Access (or another Office program), and to the VB 6 editor.

A WSH file open in the Microsoft Script Editor.

©9 Miscellaneous Files Microsoft Scrip! Editor - PiintRepoit.vhs

File Edit View Debug Tools

Window Help

iAS A

fcÄJikJ - Q'fiJfrttä'vH

iB—

f J — =

— —

J

Project Explorer-Miscella , ^

Open Eïplorer Folder.vbs PiintR«poit.vb5* | * ► x

| Properties

B Ql Miscellaneous Files

Dim appAccess Dim strDBWawe

PimtRepoit vbc ProjltemProperties ^J

Name)

PrintReportvbs

Sec appAccess = KTScript.CreateOtaject("Access.Applicati

iateCreated

3 2 4/2006 4:33 PM

DateModified

3/27/1999 8:33 PM

appAccess.OpenCurrentDatabase strDBName appAccess. DoCrnd. OpenReport "rptErnployees"

FilePath

['. ['->3irhriii '.». nth. i

FileSize

241 bytes

Readonly

False

FilePath

- | IFI | »

J

1 .r

Path to the fil

II II

I-,

For full details on using the MSE, open Help from the MSE menu, and select Microsoft Script Editor Help. There are several Help topics related to using the MSE, as shown in Figure 17.9.

The MSE's Help file is web-based, so it is only available if you are connected to the Internet.

0 0

Responses

  • erkki rajala
    How to open a document in MS Script Editor?
    8 years ago
  • daniela
    Where is script editor in excel 2007?
    2 months ago

Post a comment