VBA Basics and Differences from VB

Publisher:Huanle666Latest update time:2011-06-11 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Visual Basic for Applications (VBA) is a long-term goal pursued by Microsoft, which enables programmable application software to be perfectly realized. As a universal macro language, it can be shared by all Microsoft programmable application software. Before VBA, some application software such as Excel, Word, Access, Project, etc. used their own macro languages ​​for users to develop and use, but each macro language was independent and required users to learn it specifically. They were incompatible with each other, making it impossible for application software to be interconnected in terms of program. It is crucial to have a development tool that can span multiple application software and make each application software product efficient, flexible and consistent.

As a new generation of standard macro language, VBA has the above-mentioned ability to span multiple application software and control application software objects, so that programmers only need to learn a unified standard macro language to switch to specific application software. Programmers see the same user interface when programming and debugging codes, and VBA is compatible with the macro language of the original application software to protect users' investment in code and work. With VBA, multiple applications share a macro language, saving programmers' learning time and improving the mutual development and calling capabilities between different application software.

In Office 2000, the macro language VBA is applicable to all applications, including Word, Excel, PowerPoint, Access, Outlook, and Project. In Office 97, a Visual Basic editor was added to each application. In this way, users have a unified method and standard to create and manage VBA in Excel, Word, or Access.

Before introducing how to use VBA to improve work efficiency, let's first introduce some basic knowledge related to VBA.

VBA is developed based on Visual Basic, and they have similar language structures. Visual Basic is Microsoft's main graphical interface development tool, and VBA 5.0 (also known as VBA 97) is a subset of Visual Basic 5.0. Visual Basic is a fourth-generation language developed from Basic. As an independent Windows system development tool, Visual Basic can be used to develop various applications under the Windows environment. It is a visual, object-oriented, event-driven, structured high-level programming language. It has the characteristics of high efficiency, easy to learn and powerful functions. VB's programming language is simple and convenient. It uses its event-driven programming mechanism, novel and easy-to-use visual design tools, and uses Windows application program interface (API) functions, dynamic link library (DLL), dynamic data exchange (DDE), object linking and embedding (OLE) and open database access (ODBC) technologies to efficiently and quickly compile powerful and graphical interface-rich application software systems under the Windows environment.

1. VB is designed to create standard applications, while VBA is designed to automate existing applications (EXCEL, etc.)

2. VB has its own development environment, while VBA must be parasitic on existing applications.

3. To run applications developed by VB, users do not need to install VB, because applications developed by VB are executable files (*.EXE), while programs developed by VBA must rely on its parent application, such as EXCEL.

Despite these differences, VBA and VB are still very similar in structure. In fact, if you already know VB, you will find that learning VBA is very fast. Accordingly, learning VBA will lay a solid foundation for learning VB. Moreover, once you have learned to create solutions with VBA in EXCEL, you will have most of the knowledge to create solutions with VBA in WORD ACCESS OUTLOOK FOXPRO PROWERPOINT.

* A key feature of VBA is that the knowledge you learn can be transferred between some Microsoft products.

* VBA can be called the "remote control" of EXCEL.

What exactly is VBA? More precisely, it is an automation language that can automate commonly used programs and create customized solutions.

In addition, if you wish, you can also use EXCEL as a development platform to implement applications.

One of the important reasons for the huge success of Office is VBA. Many things can be accomplished using VBA, and there are countless VBA applets based on Excel and Word.

Many VBA programmers are amateur programmers, and precisely because they are amateurs, they solve problems that need to be solved at work; therefore, most VBA programs are just small tools used within a department or by individuals.

There are many other applications that integrate VBA, but not many of them can really add value to the program.

Most people see that VBA can automate a program and extend an existing program, but they don't see that in Office, VBA code can be recorded instead of written, which has the benefit of slowing down the learning curve. Without the macro recording function, it would take a long time to become familiar with the object model of an Office component.

Take ArcGIS as an example. ArcGIS extension must use ArcObject, no matter whether it is VBA, VB, or C++. But at the same time, learning ArcObject is not something that can be done in a day or two. For amateur programmers, it is almost impossible to use VBA to extend ArcGIS; professional programmers disdain to use VBA; and for companies, if they want to extend ArcGIS based on ArcObject, choosing VBA means that it is difficult to protect the source code. Therefore, ArcGIS VBA is like chicken ribs.

However, when learning AO, using VBA is easier than using other languages. Write a few lines of code and then run the test results directly. This interactive learning should be the best learning method.

Another big difference between ArcGIS and AO and Office is that ArcGIS lacks medium-grained objects, such as the Range object of Word and Excel. For Office development, you can do a lot of things without knowing anything about the underlying small-grained objects. This is the power of abstraction. The complexity that ordinary people can handle is limited. When faced with dozens of objects and hundreds of objects, the latter requires not 10 times, but dozens of times or more effort, because in the learning process, these objects must be well organized in the brain to control their complexity.

Visual Basic for Applications (VBA for short) is a new generation of standard macro language, which is developed based on Visual Basic for Windows. It is different from traditional macro languages, which do not have the characteristics of high-level languages ​​and object-oriented programming concepts and methods. VBA provides object-oriented programming methods and a fairly complete programming language. VBA is easy to learn and master, and you can use a macro recorder to record various user operations and convert them into VBA program codes. In this way, users can easily convert daily work into VBA program codes to automate their work. Therefore, for users who need to use Office software packages frequently at work, learning to use VBA helps automate their work and improve work efficiency. In addition, since VBA can directly apply the powerful functions of Office software packages, it is more convenient and quick for programmers to design and develop programs.

Reference address:VBA Basics and Differences from VB

Previous article:Detailed explanation of opnet features and functions
Next article:Introduction to Fiber Bragg Grating (FBG)

Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号