Skip to main content

VBScript: Programmer's Reference

VBScript: Programmer's Reference

Susanne Clark, Antonio De Donatis, Adrian Kingsley-Hughes, Kathie Kingsley-Hughes, Brian Matsik, Erick Nelson, Piotr Prussak, Daniel Read, Carsten Thomsen, Stuart Updegrave, Paul Wilton

ISBN: 978-0-764-54367-8

Dec 1999

840 pages

Select type: Paperback

Product not available for purchase


This description refers to a previous edition of VBScript Programmer's Reference. For the most recent edition of this book, look for ISBN 0-7645-5993-1.

What is this book about?

VBScript is one of Microsoft's scripting languages, which can be employed in a variety of ways — from client-side scripting in Internet Explorer to server-side programming in ASP and the new Microsoft Windows Script Host. The language itself has been gradually increasing in power and flexibility, and the newest release, VBScript 5.0 (which comes with IE5.0), represents a huge increase in functionality and effectiveness:

  • VBScript books now in demand from VB and WSH developers
  • New version 5.0 now available with substantial changes — this is first book
  • Proven Programmer's Reference format
  • Extensive reference to langauge and object models

What does this book cover?

Here are just a few of the things you'll find in this book:

  • A complete guide to the VBScript language and its syntax
  • Up-to-date details of the most recent scripting engines for Internet Explorer, ASP and the Windows Script Host
  • Coverage of the new features in VBScript 5, including constructing classes, specific data-types and using regular expressions
  • Coverage of a vast range of uses that VBScript can be put to work with
  • Extensive reference covering the various implementations and all the relevant object models

Who is this book for?

This book will be useful for anyone who wants to get a grip on VBScript. Whether you've just played around with HTML and want to find out about the world of programming, or whether you're an experienced programmer who needs to learn the VBScript language in order to work with the Windows Script Host or develop ASP pages, this book will show you the way. No prior knowledge of programming is assumed.


Part 1. The Language.

Chapter 1. A (Very) Short Introduction to Programming.

Chapter 2. Variables and Data Types.

Chapter 3. Control of Flow.

Chapter 4. Error Handling, Prevention and Debugging.

Chapter 5. Using COM Components and Objects.

Chapter 6. Using COM Components with MTS.

Chapter 7. The Built-In and Scripting Runtime Objects.

Chapter 8. Classes in VBScript Writing Your Own COM Objects).

Chapter 9. Windows Script Components.

Chapter 10. The Windows Script Host.

Chapter 11. General Client-Side Web Scripting.

Chapter 12. High-Powered Client Scripting.

Chapter 13. HTML Applications (HTAs).

Chapter 14. Server-Side Web Scripting with ASP.

Chapter 15. Talking to Databases: ActiveX Data Objects.

Chapter 16. Microsoft Script Control  

Appendix A. Visual Basic Functions and Keywords.

Appendix B. Differences between VB/VBA and VBScript5.

Appendix C. Code Conventions.

Appendix D. Visual Basic Constants Supported in VBScript.

Appendix E. VBScript Err or Codes and the Err Object.

Appendix F. The Scripting Runtime Library Objects Reference.

Appendix G. Windows Script Host 2.0.

Appendix H. The Browser Object Model – IE4.

Appendix I. The Browser Object Model – IE5.

Appendix J. The Integral ASP Objects.

Appendix K. ADO Object Summary, Constants, and Data Types.

Appendix L. The Microsoft Script Encoder.

Complete source code for VBScript Programmers Reference
Always responsive to customer feedback, Wrox now has Appendix A indexed (Word doc).
ChapterPageDetailsDatePrint Run

The code on page 28 will not remove any additional spacing. A better example of the code, which will remove any additional spacing and not allow empty strings, is:

Dim Greeting
Dim UserName
Dim TryAgain

TryAgain = "No"

UserName = InputBox("Please enter your name:")
UserName = Trim(UserName)
If UserName = " Then
MsgBox "You must enter your name."
TryAgain = "Yes"
Greeting = "Hello, " & UserName & ", it's a pleasure to meet you."
End If

Loop While TryAgain = "Yes"

MsgBox Greeting


35Organizing and Reusing Code

2nd Paragraph, 4th Sentence should read:

Before we start the loop, we initialize LoopCount with the numeric value of one.


76What is a Literal?

The text should read:

A literal is any piece of data that appears in your code that is not stored as a variable or named constant...



The code referred to as 'WroxLogGroup.vbg' is called 'page140.vbs' in the downloadable source code.


174Using COM Components and Objects

The code should read:

<BLUE>Dim objFirstDocument
Dim objSecondDocument

' Instantiate the Document class from the Word COM
' component/server on the local machine
Set objFirstDocument = CreateObject("Word.Document")
' Let the second document reference the first document
Set objSecondDocument = objFirstDocument
' Show the instance of Word
objSecondDocument.ActiveWindow.Visible = True

' Destroy the first document after use
Set objFirstDocument = Nothing

<BLACK>NOTE: "<RED>Set<BLACK>" has been deleted from line 10 of the code.


202RegExp (use of "\b" , word boundary)

Paragraph 3 should read:

"... Without this the word 'National' would be changed to 'Nationanal'. Second..."


615FileSystemObject object

The syntax for the following methods of the FileSystemObject object are listed incorrectly in Appendix F. The correct syntax for these methods is:

object.CopyFile source, destination[, overwrite]

object.CopyFolder source, destination[, overwrite]

object.DeleteFile filespec[, force]

object.DeleteFolder folderspec[, force]

object.MoveFile source, destination

object.MoveFolder source, destination

where [] indicate optional parameters