Why to use VBA?

L

Leon_Amirreza

Hi,
Does VBA language any special benefit that still is used by MS in Office
Applications such as Word, Access, ...?
I can see some drawbacks:

1- more learning curve for c#, c++ developers
2- more components installed on a machine with .net and vb installed =
sotrage waste
3- more technologies to be used in an office automation (.net c#, VBA, sql
server, ...)
4- more costs for MS in developing 2 different technologies that word the
same way?!

why MS does not reuse c# and its form designer instead of vba in word and
especially in Access? (access has a forms designer)!
in my humble opinion VBA should b kept just for backward compatibility!

there maybe benefits in VBA that i am not aware of? could some1 please tell
me?
 
J

Jonathan West

Leon_Amirreza said:
Hi,
Does VBA language any special benefit that still is used by MS in Office
Applications such as Word, Access, ...?
I can see some drawbacks:

1- more learning curve for c#, c++ developers

Tough. You think of yourselves as ace programmers. Prove it! :)
2- more components installed on a machine with .net and vb installed =
sotrage waste

There's very little waste. VBA requires a very small runtime compared with
the bloatware that is the .NET platform.
3- more technologies to be used in an office automation (.net c#, VBA, sql
server, ...)

These technologies were there before .NET came along. If Microsoft were to
rewrite Office using the .NET platfrm instead of the ActiveX platform it
uses now, they would probably be 4 years doing the rewrite with no features
added. They might have expected VB6 programmers to do that when converting
their apps to VB.NET or C#, but they aren't foolish enough to do it
themselves!
4- more costs for MS in developing 2 different technologies that word the
same way?!

They don't work the same way. If they did, one could argue (and many did at
the time) that the waste was in developing the .NET platform which came a
long time after the development of ActiveX.
why MS does not reuse c# and its form designer instead of vba in word and
especially in Access? (access has a forms designer)!
in my humble opinion VBA should b kept just for backward compatibility!

Some parts of Microsoft probably agree with you. But given that Office is on
the platform it is, and its primary automation interfaces use ActiveX, and
Microsoft isn't going to fundamentally rewrite Office any time soon,
continuing to use VBA within Office has a number of definite advantages.

1. Existing VBA code (there is quite a lot of it about) can continue to be
used and extended. If that forward-compatibility were ever to be broken, it
would just about kill Office upgrades in large businesses. I pointed this
out in an article a long time ago
http://web.archive.org/web/20020701...com/vsm/2002_08/magazine/departments/guestop/

2. VBA, operating in-process within the applications, usually runs rather
faster than external programs especially .NET programs which must negotiate
2 levels of interop (.NET -> ActiveX, then out-of-process -> in-process).
This means that if the majority of the time is spent manipulating the object
model of the host application, the performance of .NET apps is often dire
compared with VBA.

3. Many of the Office apps (Word, Excel and PPT at least) have a "macro
recorder" feature that automatically generates VBA code to match a set of
actions carried out by the user. While the generated code is often not very
good, it can often serve as a useful starting point even for experienced
programmers in seeing which parts of the object model need to be used to
execute a particular task.

But you are a bit late to the party. Many people did argue at the time of
the initial introduction of .NET that an updated VB6/VBA editor and compiler
ought to have been included. Microsoft weren't interested. For more on this
take a look here.

http://vfred.mvps.org
 
L

Leon_Amirreza

from http://vfred.mvps.org :

From a more philosophical (and personal) standpoint, there just seems to be
something… I dunno, wrong about trying to standardize a variant of BASIC.
Paul Vick, Microsoft VB.NET blogger and author of the Visual Basic .NET
Language Specification, Will VB ever be standardized?, December 30, 2005

definitely hear your point that change needs to be gradual & incremental.
It isn't cost effective to keep rewriting code to get back to functional
equivalence.
Paul Yuknewicz, Program Manager for Visual Studio, Slow Chat with the MS
Visual Basic Team, CodeGuru.com, August 8, 2008

I am not talking about the past dont get me wrong!
and I dont see myself tough!
and dont think rewriting c++ Apps in C# will be good idea!

c# is not suited to be the only language to write eneterprise Apps or system
Programms! there are many examples (like office, SQL Server, maybe VS
itsself, Antivirus, .....)
Many decide to write the kernel in c++ and provide .dll files for .Net (that
u can import in c# and automate the APP); 1 big example is office itself.

so i am telling is that
1- support vba for current customers
2- add to c# features to be able to be used like an interepted language by
..net (i dont think MS current feature are so far from an interpreted laguage
although c# IS a compiled language)
then a developer would have 3 choices:
1- use existing vba apps with new versions of office
2- use c# as an interpreted Language in office (In-Proc and fast)
3- use c# to manipulate office (out Proc slow but u can use many feature of
an stand large App along with office automation)
I guess its time to slowly move to .Net cause its been 8 years from
introducing .net and there are alot of vb.net c# developers out there.
this way new learners will go for c# not (VBA) so in the long run we have c#
and vb.net developers with vb.net and c# critical missions instead of
current mess situation as indicated in the links u posted! after another 7
or 8 years we will have .net developers out there with many obsolete mission
critical Apps that owners/users ARE willing to rewrite or define a
completely new project for the save purpose to replace old App (this way
current mission critical Apps onwers/users dont feel the force by MS but by
time and new technologies out there)
 
L

Leon_Amirreza

as a general path:
I think MS should leave VBA die gradually and invest on interpreted language
features on .net instead of introducing a third language like VBA.net
 
L

Leon_Amirreza

I agree with this:
if the customers dont trust MS then they wont care the technology BUT
there are alot of competitors Like sun with open office for free or star
office with (very cheap)
why should i use MS office?
I think becuase of the technologies used that bring me:
1- easier more strcutured more maintainable code (vb.net and c# are better
in this than VBA)
2- user friendliness and less learning time (better learning curve) due to
familiar procedures in doing different tasks (remmeber office 2003 clicking
properties of an object would bring up a dialog with all tabs containing all
the things u could do with that object; something 2007 lacks becuase u may
find a command yur looking for in a different place althoug more productive
becuase of ribbons instead of toolbars and more beautiful)
3- productivity
4- user freandliness
5- beauty (less tiring adds productivity)
.....
 
J

Jonathan West

Leon_Amirreza said:
I agree with this:
if the customers dont trust MS then they wont care the technology BUT
there are alot of competitors Like sun with open office for free or star
office with (very cheap)
why should i use MS office?

That is a very good question, one which Microsoft have to think very hard
about.
I think becuase of the technologies used that bring me:
1- easier more strcutured more maintainable code (vb.net and c# are better
in this than VBA)

Not significantly, given that the main emphasis is on control of the
application's own object model. The complexity of VBA code is usually in the
object model rather than the program control structures.
2- user friendliness and less learning time (better learning curve) due to
familiar procedures in doing different tasks (remmeber office 2003
clicking properties of an object would bring up a dialog with all tabs
containing all the things u could do with that object; something 2007
lacks becuase u may find a command yur looking for in a different place
althoug more productive becuase of ribbons instead of toolbars and more
beautiful)
3- productivity
4- user freandliness
5- beauty (less tiring adds productivity)

I would put it rather more simply. If companies are to continue to use
Office (and to upgrade to new versions) then it must be cheaper to do so
than to move to something else. The price of the software is only a small
part of that cost. Other elements are rollout and installation costs,
training costs, and the cost of developing, maintaining and upgrading custom
applications. The more Microsoft messes customers about by introducing
incompatibilities between different versions of a product, the more they
increase these costs and the more they risk having customers not upgrade or
worse still, move on to other products.
 
L

Leon_Amirreza

I completely agree with you in the COST thing BUT
I feel there is point in time that companies ARE willing to rewrite the
programs (or at least some modules) not because of changes in MS
technologies but TIME may force them to roll out SO at such a point in TIME
MS must be able to fullfill new needs with new technologies at hand and
mature enough to make companies choose MS products over others BUT if MS
would not be able to do so the companies may decide between 2 things:
1- to Use other products (not good for MS)
2- continue using MS products with very old technology and to forget about
to rolling out : i still have people coming to me to sell them (lets call
it) SUPPORT for their legacy software that is not supported by MS
i have seen some that feel pity that havent upgraded and changed their
technology at the appropriate time
(surprisingly i stil have 2 small businesses running DOS 6.22 thats rare
ofcourse)
As u know many companies have had this experience or read these examples in
many IT books SO they really dont want to go through that

As I stated your completely right about Costs but in the long run would lead
for MS to lose customers
as u have said in your article very clearly that MS is in a messy situation
with VB6, VB.net, and VBA and the company must find a way out of it i know
the article is written a few years ago but the problem is still there
unsolved (although less critical because now there are many .net developers
and .Net is ported to many platforms)!
 
L

Leon_Amirreza

In a very brief I can say that:
1- .Net has proved its productivity and many want to go for it
2- ported to many platforms
3- proved its technological aspect and correct engineering used to biuld it
so why they dont go for it? i think roll out cost
would they start to roll out in near future? i think yes in near future (3
to 5 years later i think)
would have MS something to offer? I hope so build by (in my opinion) add
some functionality to .net to be able to replace VBA i think .Net
technologies have the capacity to add some interpreted features (look at the
IL nature, reflection and ... in the .net)
 
J

Jonathan West

Leon_Amirreza said:
In a very brief I can say that:
1- .Net has proved its productivity and many want to go for it

Well, in some areas, yes it is undoubtedly much improved in what was there
before. For instance, I'm told by friends that it provides a vastly improved
toolset for web programming. That's not kind of programming I get involved
with myself, so I rely on others for news from that area.
2- ported to many platforms

Windows and um, Windows. Last I heard, the Unix and Mac ports aren't stable
enough for serious use yet. I'm not holding my breath.
3- proved its technological aspect and correct engineering used to biuld
it
so why they dont go for it? i think roll out cost
would they start to roll out in near future? i think yes in near future (3
to 5 years later i think)
would have MS something to offer? I hope so build by (in my opinion) add
some functionality to .net to be able to replace VBA i think .Net
technologies have the capacity to add some interpreted features (look at
the IL nature, reflection and ... in the .net)

The problem is incompatibility with existing code, and following on from
that, trust.

The fact is that VB.NET is sufficiently incompatible with the previous
version of VB (VB6, from which VBA is derived) that for all practical
purposes an upgrade wasn't possible, you had to rewrite the code more or
less from scratch. The automated code converters provided by Microsoft were
next to useless, and the fact that Microsoft went and changed lots of names
of objects and properties meant that late-binding code wouldn't work without
rewrite because it couldn't be automatically converted at all.

To take a very simple example, in a VB6 Form, a Label object had a Caption
property. The equivalent property in Windows Forms is called Text. In VB6
there was a naming convention regarding such things. If the visible text of
the control was editable by the user, then the property was called Text. If
it was not editable, it was called Caption. In Winforms, for any text
displayed on a control, the property is called Text irrespective of whether
it is editable or not.

Both are perfectly good naming conventions. If the language was being made
from scratch, you might decide the second one was better than the first.
However, VB.NET was supposedly not being made from scratch, it was supposed
to be an upgrade to VB6. That being the case, there needs to be a much
better reason than "I like the new naming convention better" to make a
change that breaks existing code. Lots of people asked Microsoft what that
reason was, with regard to that and dozens of other changes to the language.
In the vast majority of cases, there was no technically plausible reply from
Microsoft. I was involved in a lot of these discussions and concluded that
of all the changes they made between VB6 and VB.NET, only about 3 had a
valid technical reason based on the design of the framework. From memory
they were:

1, Changing the manner & timing of object destruction, from the ActiveX
method of "deterministic finalization" to "garbage collection". This
wouldn't have affected many projects, but those it did affect would have
needed some serious rewrite.

2. Loss of parameterless default properties

3. Loss of mixed scope for properties (mixed scope was restored in a
subsequent update, but by then they had completely changed the syntax of
property declarations)

There were upwards of a hundred changes of syntax, naming or behavior of
existing VB6 functions. (I'm not counting the new features added, they don't
affect the ability to port existing projects). Each one of these changes
increased the amount of effort necessary to port a VB6 project to VB.NET.
Collectively, they made porting any significant project entirely
impractical. The sad thing is that had Microsoft strived to keep VB.NET as
close as practicable to 100% compatibility with VB6, say 99% compatible,
(i.e. on average only 1 line of code in every hundred having to be
modified), which was perfectly achievable, then we could by now *already*
have had a VBA.NET integrated into Office and making full use of the
framework.

As far as I can tell, the people at Microsoft responsible for this couldn't
distinguish between a language and the platform it compiles to, and
therefore a change in platform justified changes to "clean up" the language,
even where the language changes were not necessitated by the platform
change. I have discussed this with the people responsible, I'm working on
that basis of what they have told me directly.

This brings me to the other issue - trust. If Microsoft has done this once,
and caused immense cost and inconvenience to the very many companies who had
developed VB6 applications, and has neither apologised, attempted to set
things right, nor even quite understood the effect of its actions, what is
to stop them doing it again?

Eventually the .NET platform will become too patched to be usable as a base
for further development and will have to be replaced, just as the old VB
runtime was. When that happens, unless the people in Microsoft have learned
from their mistakes, the .NET languages may be in for another major round of
changes, meaning that *your* code cannot be ported to the post-.NET world
without you rewriting it. And don't think that the Microsoft submitting C#
as a spec to ECMA is any kind of protection. The mere existence of a
standard does not create a legal obligation to continue producing compliant
compilers. They can change the de facto spec any time they want.

Do you want your code to have to be completely rewritten next time Microsoft
replaces its platform? Or having seen it happen once before to others, might
you decide that you are safer moving at your leisure towards a non-Microsoft
product?

Now, if that choice has to be made by a business deciding on an Office
upgrade, Microsoft doesn't just lose the price of a few Visual Studio
licenses. They stand to lose a large number (perhaps several throusand)
sales of Office upgrade licenses as well. If a very large number of
companies end up making similar decisions, then we are talking about some
serious quantities of money missing from Microsoft's sales projections.
While Microsoft as a company could probably recover from the financial
consequences of a mistake of that magnitude, I don't think the careers of
the executives responsible for the decision would be as resilient!

That is why three versions of Office have been developed and launched since
..NET was first introduced, and VBA is in every one of them, and Microsoft
have indicated that this state of affairs is not going to change anytime
soon. Effectively, the people in charge of Office have looked at the likely
consequences of doing the same as what the Visual Studio people have done,
and have decided they don't like what they see.
 
L

Leon_Amirreza

Yes, MS is conservative about any changes too office becuase of large number
of customers!
and about .net incompatibilty i can say that technically and theoretically
there exists non of these to my knowlegde:
1- c++ to c++.net conveter
2- c++ to C#
3- vb to vb.net
4- Java to J# (even though the ideas used in building them are not too far
from each other)
u think there is no technologicall reason for this! WRONG (as a Developer I
can say this)!
I am not going to discuss technical aspect, But from a Market perspective
(so to speak):
as u know there are many non .Net software out there and would be willing to
port to .net IF there is an easy way to do this (see the DEMAND)
so many companies including MS could create a tool to convert existing
software and make benefit from it BUT why they didnt even after 8 years?
because its simply impossible to create such a tool (as far as I know)?
technologies used in .Net have these properties (that can not be avoided so
easily by a simple change in .Net):
1- platform enforces Data Object structures (because Data Classes and
library are in the Platform not the language; for example changing a naming
of Text to caption would change the name everywhere not just in VB.net)
2- too far from the old programming way like the automatice memory
management (Garbage collector is part of it) that were not in other
languages or were totally incompatible with .Net (like activeX that uses
reference counting to manage the memory and resources that is completely
incompatible with Garbage Collector)

MS has made the desicion to create such an incompatible platform SO the way
to go is not to come back to the old style programming BUT introduce more
facilities in .Net that can replace VBA and keep the VBA in the office for
the long term (as long as its benefitial for MS; in other words as long as
there are enough customers out there that still use VBA)

MS has made the desicion to create such an incompatible platform AND you are
arguing that this desicion breaks the trust BUT
1- many open source sofware undergo much more changes in a short time
because of just change in the technology (they more care about research and
development of new technology rather than compatibilty) this is a fact about
small to medium size software but may not only be true for very very popular
softwares like DNS Server, Mail Servers and...
2- lets compare .net with another competing technologies like Java:
1-porting from c++ to java has the same challenges (not to say more)
2- introduction of Java IS a change in technology like introduction
of .Net BUT we have Java2 BUT no .Net too (so Java has break the trust more
than MS)
3- many softwares tried to export libraries to Java (many office
software that wanted to be able to be automated by Java; here is the same
incompatibily issue; because many office programs used different flavors of
VB for Macro and development)

What Happend to Sun:
upon introduction of Java it
rewrote the office code some part in c++ some in java; many critisized it
and Sun changed all the code back to c++ = more changes = more costs
Many users that have had followed Sun may have converted the code twice as
Sun itself did!

I think if companies had chosen non MS products they may had more challenges
 
L

Leon_Amirreza

sorry I meant Its impossible to have an automatic tool to convert a non .Net
to a .Net program
and needs alot of user/developer work hours to successfully rewrite and
test. thats why there is no converter or the existing converters can not
even convert something around 10% of the code (i have no statistics about
the effectiveness of converters but they dont do much in general)
 
L

Leon_Amirreza

all I am saying is its time to start introducing new features in .net that
will do the same thing VBA does and give the market time to accept it (the
same happened about .Net itself) without dropping VBA as you said executives
are conservative to change VBA (and they must be to not lose many
customers)! this way the market will break in 2:
1- ppl that use VBA
2- ppl that use .net
this way MS introduce new customres without losing old ones (assuring them
VBA will be there for long run)
 
L

Leon_Amirreza

office 2007 has had many changes = learning costs
BUT without introducing much .net fearture (its a pity); it will make ppl
ask why not new .net features in Office?
MS can not keep VBA for 20 years no technology will remain more than 5 or 6
years in computing field!
if MS wants to make new office features accessible in VBA its a correct
decision but why not have the same thing in .Net?
why VBA evolves but yet no .Net features inside access or word? why not to
evolve both (at least for some time)?
introduction of VS.Net did not cause much license loss because many large
comapnies still have native c++ and buy VS and the had 8 years to put theirs
tip toe in .net and they did? why not the same about Office, VBA, .Net?
 
L

Leon_Amirreza

Please don call me selfish for not counting VB; YES MS did lose some VB
developers that were unwilling to port to new platform BUT the number of
office customers is not comparable to VB 6! may be MS had this in mind even
before introduction of vb.net!
i think vba story is comparable to c++ to c++.net story not the vb6 and
vb.net! companies bought VS and used c++ as before and they could sneak
preview the .Net with no change cost!
same here : add .net to office (like u can write macros in c# or vb.net or
VBA)
 
B

bam

Leon_Amirreza said:
Hi,
Does VBA language any special benefit that still is used by MS in Office
Applications such as Word, Access, ...?
I can see some drawbacks:

1- more learning curve for c#, c++ developers
2- more components installed on a machine with .net and vb installed =
sotrage waste
3- more technologies to be used in an office automation (.net c#, VBA, sql
server, ...)
4- more costs for MS in developing 2 different technologies that word the
same way?!

why MS does not reuse c# and its form designer instead of vba in word and
especially in Access? (access has a forms designer)!
in my humble opinion VBA should b kept just for backward compatibility!

there maybe benefits in VBA that i am not aware of? could some1 please tell
me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top