diff of vba and vb6 programming!!

ckmoied

Board Regular
Joined
Oct 13, 2002
Messages
154
Before I was used to do vb programming and that was fun, but I have just shifted to VB6 programming, and thats causing a big headache. I don't know whats the basic diff, b/w vba and vb6 programming. For example I have created a chart and wanna change its type, am doing the following but it gives error. There are similar problems. Please lemme know if there is a good learning reference for VB6. Also MSDN help is quite confusing since it searches its library out of a very large product applications instead of vb6 specific support.


objchart.ChartType = Excel.xlChartType.xlLine
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
What error does it give? You may have to set a reference to the Microsoft Excel Object library before you can use any Excel objects.
 
Upvote 0
Yes it says that object is not defined, or sometimes it says that this property is not supported. I wanna know the basic format of vb6 programming, and know the basic diff of vba and vb6 programming.

MSDN help generally talks about vb.net programming, but least is found for vb6.
 
Upvote 0
Well I have used VB6 but Im not a programmer so this is just my understanding...

VB6 enables you to create stand alone applications independant of other applications. VB is its programming language.

VBA is the programming language behind all the office suite applications. It uses similar methods that are available in VB, but it has been adapted to be application specific. VBA has different objects depending upon what application you are using. For example, Excel has Sheets so has a collection of objects that relate to sheets, while Word doesnt have sheets so it doesnt have these objects but instead has a range of other objects specific to Word.

For Word (or VB6) to use Excels objects, there needs to be a link. In Word you select Tools-References to reference the Excel library in the VBE. There should be something similar in VB6. In addition to a reference you may need to open the application as well but Im unsure on that one.

There is a forum called Extreme Visual Basic which may be able to answer your VB6 questions.
 
Upvote 0
parry said:
For Word (or VB6) to use Excels objects, there needs to be a link. In Word you select Tools-References to reference the Excel library in the VBE. There should be something similar in VB6. In addition to a reference you may need to open the application as well but Im unsure on that one.

There is a forum called Extreme Visual Basic which may be able to answer your VB6 questions.

To add a reference in VB6 click Project, References. You don't need to have the target application open.
 
Upvote 0
After adding the reference, VB6=VBA.
No, not quite... A major difference is that in VB6, you need to be very careful to fully reference any Excel objects; otherwise you'll get errors and strange behaviour (like Excel not quitting etc).
For example, assuming wsMySheet has been properly declared and set to a Worksheet object:
Code:
'this works in VBA
Dim rng As Range
Set rng = wsMySheet.Range(Cells(1,1), Cells(10,2))

'the following will not work correctly in VB6:
Dim rng As Excel.Range
Set rng = wsMySheet.Range(Cells(1,1), Cells(10,2))

'Instead, you'll have to use
Dim rng As Excel.Range
Set rng = wsMySheet.Range(wsMySheet.Cells(1,1), wsMySheet.Cells(10,2))
 
Upvote 0

Forum statistics

Threads
1,207,387
Messages
6,078,197
Members
446,320
Latest member
vatra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top