Title: VBA vs Visual Basic vs VBScript

Issue: Spectrum Nov/Dec '98

author:Nathan Rector

company:Natec Systems

email:nater@northcoast.com

http:www.northcoast.com/~nater/

 

Visual Basic is becoming the programming language of choice for the MultiValue programmers that have to work in the Windows environment. There are actually three flavors of Visual Basic to chose from. Each one has its own special use and advantage.

The three flavors of Visual Basic are Visual Basic for Applications, VBScript, and Visual Basic. Visual Basic for Applications is primarily thought of in terms of Microsoft Excel to create macros, but that's only a small part of it. VBScript is most commonly used in Active Server Pages and the Internet. Visual Basic has been widely talked about in Spectrum and is considered a full compilable programming language.

 

Visual Basic for Applications

-----------------------------

Visual Basic for Applications (VBA) is more than just the Macro Language it is most commonly thought of and used as. It has the same abilities normal Visual Basic except Visual Basic for Applications programs can not be compiled into Executables or DLLs. Visual Basic for Applications also doesn't run in its own memory space as a normal Visual Basic executables would.

VBA is a part of the application it is shipped with; for example, Office 97 or AutoCad16. VBA programs run as a DLL (or in the same memory space) to these applications. Thus the overhead in accessing these host programs is less cumbersome and quicker than a pure Visual Basic using OLE.

Why would a programmer choose Visual Basic for Applications as opposed to Visual Basic? VBA is finding its way into more and more applications. Since VBA is actually a part of the application (ie. Microsoft Office, AutoCAD16, etc.), the overhead is lower which makes accessing and manipulating the host application faster. It also gives users greater ability to manipulate the host application. For example, adding new options to the menu bar or the tool bar.

Normally VBA programs are saved in the same file as the data. An example of this is Excel spreadsheets. When that data file is transferred to someone else, the program goes with it. Since not all workstations may have the same Windows programs loaded on them, this is a big advantage when users move the data from computer to computer or client to client. This way, the VBA program gets transferred with the data.

A Visual Basic programmer can write VBA programs. However, without intimate knowledge of the Objects supplied with VBA the programmer will be unable to make optimal use of the VBA programming environment.

If you use Microsoft Office as an example of VBA programming, you can see extensive use of the object module:

Sub Macro2()

'

' Macro2 Macro

' Macro recorded 2/19/98 by Nathan Rector

'

Range("B33").Select

Charts.Add

ActiveChart.ChartType = xlLineMarkers

ActiveChart.SetSourceData Source:=Sheets("Monthly

Sales").Range("B4:N12"), _

PlotBy:=xlColumns

ActiveChart.Location Where:=xlLocationAsObject, Name:="Monthly Sales"

With ActiveChart

.HasTitle = False

.Axes(xlCategory, xlPrimary).HasTitle = False

.Axes(xlValue, xlPrimary).HasTitle = False

End With

ActiveSheet.Shapes("Chart 3").IncrementLeft 33.75

ActiveSheet.Shapes("Chart 3").IncrementTop 108#

End Sub

 

 

VBScript

--------

VBScript is a scripting language that uses the Visual Basic syntax. Of all three versions of Visual Basic, VBScript is the slowest and has the least functionality. However, it has its place.

So, why would you use VBScript and not Visual Basic or VBA? VBScript is commonly used in web pages for the Internet. Using VBScript, programmers can connect, manipulate, and process MultiValue Host programs and data with native VB hooks rather than ODBC.

With the release of ActiveDesktop in IE4, as well as Windows 98 (which will include ActiveDesktop as part of the OS), programmers are able to create a custom intelligent Desktop for users using VBScript. Imagine a desktop that displays and edits an appointment calendar using data from a MultiValue Host, or displays phone messages from the receptionist. VBScript allows you to manipulate most of the Windows Desktop.

VBScript is also useful if a programmer or administrator wants to write a quick one-time program and have the same overall ability as it they would have in Visual Basic. By using VBScript instead of Visual Basic, they don't have to create a compiled program. VBScript would run just like a standard DOS Batch program, only with more capabilities.

However, keep in mind that even though VBScript uses the same syntax as Visual Basic and VBA it is much slower and you are unable to create custom classes or objects. Yet, you can access existing classes and objects.

 

Visual Basic

------------

The Visual Basic programming language have been chosen by the MultiValue Environment due to its ease of use and the MultiValue BASIC-like programming structure. With little extra work, a MultiValue programmer can write Windows programs using Visual Basic without having to relearn how to program in a different language syntax, for example Visual C++.

Visual Basic programs are free standing programming environment. Windows programs can be compiled and the programs can be exported to other Windows platform. VB programs run in their own memory space, and can be written to run on both 16-bit (Windows 3.1) and 32-bit (Windows 95/98/NT) platforms. They can even run on RISC platforms running on Windows NT without changing any of the existing programs.

Visual Basic also allows programmers to make Custom Controls to be used in other Visual Basic program, as well as Delphi and Visual C++. Using Visual Basic Enterprise, programmers can create n-tiered systems. This allows programmers to create programs that communicate with each other across a network to share information and resources as well as work in unison. This is useful in splitting the client and server processing thus speeding data access for users.

Visual Basic has taken out most of the multi-tasking and multi-threading complications that C++ programs normally have to contend with. It also deals with the memory issue that the higher level languages have.

 

Title: VBA vs Visual Basic vs VBScript

Title: VBA vs Visual Basic vs VBScript

Issue: Spectrum Nov/Dec '98

author:Nathan Rector

company:Natec Systems

email:nater@northcoast.com

http:www.northcoast.com/~nater/

 

Visual Basic is becoming the programming language of choice for the MultiValue programmers that have to work in the Windows environment. There are actually three flavors of Visual Basic to chose from. Each one has its own special use and advantage.

The three flavors of Visual Basic are Visual Basic for Applications, VBScript, and Visual Basic. Visual Basic for Applications is primarily thought of in terms of Microsoft Excel to create macros, but that's only a small part of it. VBScript is most commonly used in Active Server Pages and the Internet. Visual Basic has been widely talked about in Spectrum and is considered a full compilable programming language.

 

Visual Basic for Applications

-----------------------------

Visual Basic for Applications (VBA) is more than just the Macro Language it is most commonly thought of and used as. It has the same abilities normal Visual Basic except Visual Basic for Applications programs can not be compiled into Executables or DLLs. Visual Basic for Applications also doesn't run in its own memory space as a normal Visual Basic executables would.

VBA is a part of the application it is shipped with; for example, Office 97 or AutoCad16. VBA programs run as a DLL (or in the same memory space) to these applications. Thus the overhead in accessing these host programs is less cumbersome and quicker than a pure Visual Basic using OLE.

Why would a programmer choose Visual Basic for Applications as opposed to Visual Basic? VBA is finding its way into more and more applications. Since VBA is actually a part of the application (ie. Microsoft Office, AutoCAD16, etc.), the overhead is lower which makes accessing and manipulating the host application faster. It also gives users greater ability to manipulate the host application. For example, adding new options to the menu bar or the tool bar.

Normally VBA programs are saved in the same file as the data. An example of this is Excel spreadsheets. When that data file is transferred to someone else, the program goes with it. Since not all workstations may have the same Windows programs loaded on them, this is a big advantage when users move the data from computer to computer or client to client. This way, the VBA program gets transferred with the data.

A Visual Basic programmer can write VBA programs. However, without intimate knowledge of the Objects supplied with VBA the programmer will be unable to make optimal use of the VBA programming environment.

If you use Microsoft Office as an example of VBA programming, you can see extensive use of the object module:

Sub Macro2()

'

' Macro2 Macro

' Macro recorded 2/19/98 by Nathan Rector

'

Range("B33").Select

Charts.Add

ActiveChart.ChartType = xlLineMarkers

ActiveChart.SetSourceData Source:=Sheets("Monthly

Sales").Range("B4:N12"), _

PlotBy:=xlColumns

ActiveChart.Location Where:=xlLocationAsObject, Name:="Monthly Sales"

With ActiveChart

.HasTitle = False

.Axes(xlCategory, xlPrimary).HasTitle = False

.Axes(xlValue, xlPrimary).HasTitle = False

End With

ActiveSheet.Shapes("Chart 3").IncrementLeft 33.75

ActiveSheet.Shapes("Chart 3").IncrementTop 108#

End Sub

 

 

VBScript

--------

VBScript is a scripting language that uses the Visual Basic syntax. Of all three versions of Visual Basic, VBScript is the slowest and has the least functionality. However, it has its place.

So, why would you use VBScript and not Visual Basic or VBA? VBScript is commonly used in web pages for the Internet. Using VBScript, programmers can connect, manipulate, and process MultiValue Host programs and data with native VB hooks rather than ODBC.

With the release of ActiveDesktop in IE4, as well as Windows 98 (which will include ActiveDesktop as part of the OS), programmers are able to create a custom intelligent Desktop for users using VBScript. Imagine a desktop that displays and edits an appointment calendar using data from a MultiValue Host, or displays phone messages from the receptionist. VBScript allows you to manipulate most of the Windows Desktop.

VBScript is also useful if a programmer or administrator wants to write a quick one-time program and have the same overall ability as it they would have in Visual Basic. By using VBScript instead of Visual Basic, they don't have to create a compiled program. VBScript would run just like a standard DOS Batch program, only with more capabilities.

However, keep in mind that even though VBScript uses the same syntax as Visual Basic and VBA it is much slower and you are unable to create custom classes or objects. Yet, you can access existing classes and objects.

 

Visual Basic

------------

The Visual Basic programming language have been chosen by the MultiValue Environment due to its ease of use and the MultiValue BASIC-like programming structure. With little extra work, a MultiValue programmer can write Windows programs using Visual Basic without having to relearn how to program in a different language syntax, for example Visual C++.

Visual Basic programs are free standing programming environment. Windows programs can be compiled and the programs can be exported to other Windows platform. VB programs run in their own memory space, and can be written to run on both 16-bit (Windows 3.1) and 32-bit (Windows 95/98/NT) platforms. They can even run on RISC platforms running on Windows NT without changing any of the existing programs.

Visual Basic also allows programmers to make Custom Controls to be used in other Visual Basic program, as well as Delphi and Visual C++. Using Visual Basic Enterprise, programmers can create n-tiered systems. This allows programmers to create programs that communicate with each other across a network to share information and resources as well as work in unison. This is useful in splitting the client and server processing thus speeding data access for users.

Visual Basic has taken out most of the multi-tasking and multi-threading complications that C++ programs normally have to contend with. It also deals with the memory issue that the higher level languages have.