Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why do we use vba over vb ?

Status
Not open for further replies.

access97to2000

Programmer
Aug 12, 2002
45
US
why do we use vba over vb? are there any specific reasons ?
 
VBA editor is free and convenient. I use VB but I need some scripting for an excel sheet I'm not gonna write a VB program just to do what I need, it's more work.
 
vb is a stand alone language
vbA is visual basic FOR APPLICAIOTNS and contains application specific references eg EXCEL - WorkBook, workSheet , Range etc
WORD - Document, Paragraph etc

You can reference other apps libraries from one app to the other but the native language for each and every MS App is vbA - vb is a way of tying it all in together with some extra functionality

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Look at it this way:

VBA is a scripting language (that looks like Visual Basic) that is embedded in Microsoft products - Word, Access, Excel, FrontPage,...

Visual Basic is a standalone programming language.
 
Dimanfja

You stated, "VBA is a scripting language (that looks like Visual Basic)"

This is not really correct. There IS a Microsoft Script that is not VB.

VBA is programming language, a subset of VB, that is packaged within various Microsoft application.

Anything that you can do in VBA, can be done in VB. The reverse is not true.

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Hi Skip,

Your assessment is correct. I should have explained my definitions in more detail, though.

As I mentioned before, VBA is embedded in the application it ships with. Also, VBA has the same capabilities found in VB, and as you say, is a subset of VB.

However, VBA cannot be compiled into an EXE nor a DLL. VBA code is also stored in the same data carried by the application. For example, if you distribute an Excel sheet, your VBA goes along with the data to the recipient.

This means that there is far less overhead - and more speed - in manipulating an application thru VBA - because VBA is already part of that application. VB would require OLE, ODBC or some other fancy system - and more code - to accomplish the same thing.

So, if you are manipulating data or building forms for Access or Excel, VBA will be the better choice. But, if you want code independence from those applications or full access to the VB language capabilities, then use VB.

Dimandja
 
VBA is the underlying engine for Access, Word, Excel, and VB![/color blue] VB sits on top of VBA just like Access does, just like Excel does.

VBA is NOT a subset of VB, any more than VBA is a subset of Excel. VBA is the basic underlying engine, where all of the native functions, commands and statements are defined. VB adds considerable functionality, different from the functionality that one of the Office apps does. VB uses the VBA engine just like Access, Excel, Word, etc do.

The Access application presents itself as a Database Tool, the VB application presents itself as a stand-alone language.

SkipVought said:
Anything that you can do in VBA, can be done in VB. The reverse is not true.
Absolutely true, but then it has to be that way. Anything that you can do in VBA can be done in Excel, can be done in Access, can be done in VB.

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
From the MS website:
Visual Basic is a stand-alone tool for creating separate software components, such as executable programs, COM components and ActiveX® Controls, and is useful when you must build a specialized solution from scratch.

VBA offers the same powerful tools as Visual Basic in the context of an existing application, and is the best option for customizing software that already meets most of your needs.

VBScript is a lightweight version of the Visual Basic language, and is designed specifically for use on Web pages. While scripting can sometimes be used for simple automation, VBA is the premier technology designed specifically for application automation. Unlike VBA, VBScript does not have an IDE.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I understand that is what MS says, but pull up a VB project, any VB project, and look at the references. What is the very first reference. Try to remove that reference.

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I'm not disputing your assertion, just posting info.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top