Partager via


Visual Basic Concepts

Compatibility with Other Microsoft Applications

Visual Basic is the senior member of the family of Visual Basic products that includes Visual Basic for Applications and Visual Basic, Scripting Edition (VBScript). While most of the code that you write in Visual Basic can be shared with applications written in Visual Basic for Applications or VBScript, there are some exceptions.

Compatibility with Visual Basic for Applications

Visual Basic for Applications is a single, common application scripting language and environment that users and developers can leverage across their Windows desktop. Visual Basic for Applications is included in Microsoft Office and other Microsoft applications. It is also licensed to other software vendors and included in a wide range of products.

Visual Basic for Applications, contained in Vba6.dll, is the underlying language engine for Visual Basic. This library contains all of the language elements that are shared by Visual Basic for Applications and Visual Basic. You can view the elements by selecting VBA from the Library listbox in the Object Browser. Code written in Visual Basic for Applications is portable to Visual Basic with the following limitations: Visual Basic for Applications code that refers to application-specific elements (such as an Microsoft Excel worksheet) may be ported, provided that they contain a fully qualified reference and provided that the referenced application exists on the target machine.

Elements specific to Visual Basic, such as forms and intrinsic controls, are contained in the type library Vb6.olb (which is also visible in the Object Browser). In general, code written in Visual Basic is portable to Visual Basic for Applications as long as it doesn’t reference these elements.

For More Information   To learn more about Visual Basic for Applications, visit the Microsoft Web site at http://www.microsoft.com.To learn more about referencing objects, see "Creating a Reference to an Object" in "Programming with Components." To learn more about native-code compilation, see "Compiling Your Project to Native Code" in "More About Programming."

Compatibility with Visual Basic Scripting Edition

Visual Basic Scripting edition (VBScript) is designed to be hosted within an Internet browser, such as the Microsoft Internet Explorer or other, third-party browsers. VBScript is a lightweight and extremely fast language engine designed specifically for environments like the Internet, intranets, or the World Wide Web. VBScript leverages the strengths of Visual Basic and enables developers to use their Visual Basic development knowledge to quickly create solutions for the Internet or World Wide Web.

VBScript supports a subset of the Visual Basic for Applications language syntax. Visual Basic Scripting edition does not include an IDE like that found in Microsoft Visual Basic, because it is designed to be a lightweight language engine that can be shared across different platforms. You can write VBScript code in Visual Basic’s Code Editor, but you can’t run or test the application in the Visual Basic IDE.

Because VBScript is a cross-platform development language, some of the elements of the Visual Basic for Applications language are not included. These include any file input/output functions, intrinsic constants, intrinsic data types, and so forth. When porting code from Visual Basic to VBScript, it’s important to review your code for unsupported elements.

For More Information   To learn more about Visual Basic, Scripting Edition, including a list of supported language elements, visit the Microsoft Web site at https://www.microsoft.com.