• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

What is API based code?

TarunVerma

New Member
What is API based code, how it is different from others coding of VBA.
If first is called API based code and then what type of codes are rest.


Regards,
Tarun Verma
 
Hi Tarun ,

In case the link posted by Bob is too heavy , the following is a simple answer to your two questions :

A macro is the easiest level of programming ; generally we call it a macro because it is recorded by the in-built Excel Macro Recorder. A macro will often not have Visual Basic for Applications ( VBA ) programming constructs , such as loops , IF statements ...

VBA is the next more sophisticated level of programming , where programming constructs are used along with the Excel Object Model to achieve more complex tasks , which will not be possible using the Excel Macro Recorder alone.

There are however some tasks , which are either not possible using even VBA programming constructs , since VBA is not a full-fledged programming language such as C , C++ ... Secondly , even where the task is possible using VBA , VBA might be too slow ; this is so in the case of timers , where the programming constructs available in VBA are inadequate to get millisecond timing. This is where you have to resort to what is called the Windows API , which has the programming constructs to achieve this.

If you are really new to programming , the starting point is macros , after which you can graduate to VBA , and only thereafter to APIs in general , of which Windows API is only one.

Narayan
 
:DD Yes i new in programming & it seems i will graduate soon as i am getting guidance from ninjas itself. thanks alot for the simple much.
 
API-based code refers to programming code that interacts with external services, libraries, or applications through Application Programming Interfaces (API). APIs provide a set of defined functions, protocols, and tools that allow different software components to communicate and interact with each other. This type of code is not limited to any specific programming language and can be used in various languages such as Python, JavaScript, Java, and more.

In the context of VBA (Visual Basic for Applications), which is a programming language developed by Microsoft for automating tasks within their applications, API-based code refers to writing code that utilizes APIs provided by external applications or libraries. VBA allows developers to interact with various Microsoft applications like Excel, Word, Outlook, etc., and also provides access to Windows API functions, which are low-level functions provided by the Windows operating system.

The distinction between API-based code and other types of VBA coding lies in the scope of interaction:

API-based Code in VBA:
API-based code in VBA involves using external APIs to perform tasks that aren't natively supported by VBA or the target application. For example, you might use the Windows API to manipulate the behavior of certain Windows components or interact with external libraries like dynamically calling functions from a DLL (Dynamic Link Library). This requires a good understanding of API documentation and how to correctly call external functions.

Regular VBA Code:
Regular VBA code involves programming within the VBA environment to automate tasks and manipulate data within Microsoft applications (like Excel macros, Word macros, etc.). This includes using VBA's built-in functions and methods to control the behavior of the application.
 
Back
Top