Talk:Visual Basic for Applications

message: 1. Discussion of how VBA, WSH, VB script all are similar and may share technology
2. Links to MS documentation on VBA (found on the MS Office developer page)
Indeed it would be good to list specific differences for example between VBA and VB. For example, "VBA doesn't support type casting. It isn't a fully object-oriented language. You can neither inherit classes in your own custom class definitions, nor can you get your objects to behave polymorphically (e.g., cast them as an instance of their base class). VB6 doesn't support inheritance/polymorphism either, but VB.NET and C# do." (http://p2p.wrox.com/topic.asp?TOPIC_ID=26628) ~TP  —Preceding unsigned comment added by 91.84.98.138 (talk) 08:37, 19 August 2008 (UTC)
replies: text: It's more complicated than that. VBA is not considered a fully OO language, but it does support type casting and polymorphic functions can be written. Further, the language above, addressing the reader with "you", is unencyclopedic. That's why I reverted the edit which inserted the text above into the article. -- Michael Bednarek (talk) 07:32, 25 January 2013 (UTC)

text: Could you please insert a correct explanation of the relationship between VBA and object-oriented languages, then? It seems important. --Jules.LT (talk) 13:20, 8 February 2013 (UTC)
replies: text: There's not all that much that I can add. There are quite a few characteristics of OO Programming in VBA, like classes and some kind of constructors (but not conversion constructors), destructors, and instance methods. OTOH, VBA doesn't support inheritance. All this is my WP:OR; if anything like this should make it into the article, it needs reliable sources better than a quote from a web forum. -- Michael Bednarek (talk) 07:18, 10 February 2013 (UTC)
thread_title: [[Object-Oriented Programming]]

message: Office, Autocad, Intellicad... anything else? Mathcad and Visual Basic Script.
:It looks like the reference to "Hundreds of applications" was removed some time ago. Btw - Visual Basic Script is an independent implementation of Visual Basic based syntax. It is not an application of VBA. Ralphy 09:45, 7 February 2006 (UTC)
thread_title: "Hundreds of applications"?

message: User:Snakeyes060280 - why have you added 'DAO' library qualifications to the object names? Ralphy 16:32, 6 February 2006 (UTC)
thread_title: Examples

message: I've been looking for an online reference to the VBA language, but have not been able to find anything about the language itself (as opposed to APIs for the various MS Office applications for instance).
Does anyone know where there is a VBA language specification?
Erland Lewin 13:40, 15 March 2006 (UTC)
thread_title:  Where is there a VBA language reference/specificaation? 

message: I started to remove errors in the edit by 84.146.195.216 on 22:09, 19 September 2006  however I find almost everything in that edit is incorrect or misleading. Furthermore there is a much better discussion of the strengths and weakness of the Visual Basic language in the visual basic article. This is why I am rolling back to the edit before 84.146.195.216. There some of the problems with the edit I am removing:
VBA's entities can be roughly divided in to classes:
Firstly, there are the usual elements forming a programming language: data types, variables, control- and loop-struktures. This part of VBA is intended not to be application specific and is used to express the program logic.
Secondly, there is an API which allows VBA to interact with it's host application. This API is specific to the relative application. 
The APIs described in this section are not part of the VBA language or runtime environment. They are OLE Automation APIs which can be called from VBA and other languages with COM support. This also simplification of VBA also ignores that VBA is more than a language, it is also an integrated development environment. All these parts of VBA are discussed in the Description section of the article.
VBA itself is an [[Interpreter (computing)|interpreted] language. Precompilation is only used for syntax-check and to build tables for the variables used. Therefore VBA cannot be used to create standalone executables. Interpretation also causes the high memory requirement and low execution speed compaired with compiled programs. 
VBA is an interpreted language and it can't be used to create standalone executables, I am keeping this in the article. However, this section does not say what VBA is being compared to. I some cases VBA may be slower or require more memory than alternatives and in some cases the opposite is the case. Since VBA runs in process with the application it is automating VBA programs often run faster that out of process compiled programs. Many compiled programs also load large libraries used for COM support.
VBA is a descentant of Microsoft's Visual Basic and therefor has it's roots in the Beginner's All-purpose Symbolic Instruction Code. Like BASIC, VBA also targets end users, being unexperienced programmers or complete beginners in the field of programming. It aims to support many of the simple language constructs, that were used in early BASIC Languages. Since BASIC since the early days lacked standardisation, there were lots of different dialects over the time, so VBA usually supports several syntactial constructs for the same programming goal. This can lead to a confusing variety of syntax and logical breaches: 
Examples: 
*) The keyword "Let" might be neglected when asigning predefined types. But when asigning user defined types another keyword, "Set", is mandatory. 
*) Variables are implicitely defined, except a directive, "Option Explicit", is used at the beginning of a script. 
*) Subroutines are cathegorized in "functions" (returning a value) and sub (not returning a value). Functions must be called using brackets arount their arguments. Eigher their returnvalue as to be assigned to a variable, or the keyword "call" must be used, while subs must not be used in an assignment. When calling subs, the keyword "call" is optional but determines, whether brackets have to be used or not. All of the above syntax variants exist with named or unnamed arguments, additionally all arguments might be optional, taking on a default value proposed by the programmer when no value is assigned in the call. 
I am keeping some of this section since it is correct that VBA is a decedent of BASIC and design decisions in the language favor inexperienced programmers. VBA's attempt to hide the difference between value and reference types does lead to confusion and the ability to omit variable deceleration can lead to errors however these are common in many languages. The description of how Let and Set are used is incorrect. Let is used with value types and set with object references, not with predefined types and user defined types. The use of a keyword to specify whether a subroutine returns a value or not may actually lead to less confusion than other approaches such as using a void return type. The discussion about the Call keyword and the use of practices is completely incorrect in VBA 6.
Despite of its close resemplance to many old BASIC dialects, VBA is not compatible to any of them, except Microsoft Visual Basic: Here the source-code of VBA Modules can be directly imported. Compatibility ends with Visual Basic Verison 6, VBA ist not compatible to VB.NET. Although being along with MS-Office a widespread product, VBA is proprietary to Microsoft and forms no Open standard. 
This I am keeping except for the removal of the reference to Microsoft Office as VBA's use within those products has no relationship to whether it is an open standard or not.
VBA still supports flow control using the keyword "goto" (often called Spaghetti code in the jargon) but is mostly designed for Procedural programming. 
VBA supports procedural and object orientated programming, event driven programming and possible other paradigms. Goto can lead to Spaghetti code but they are not the same thing. I will link to article on VBA where there is a more in depth discussion of the strengths and weakness of the Visual Basic language
VBA can depict classes and thereby supports data encapsulation, but lacks support for the other [[Object-oriented programming|object-orientated] techniques, like class-attributes and inheritance. So most of the [[Design pattern (computer science)|design patterns] of object orientated programming cannot be realized and VBA cannot be called an object orientated language. 
VBA supports class-attributes and interface inheritance and can be used to implement many popular design patterns. I don't know if it can implement most design because there is no list of all design patterens.
Interaction with the host application is usually well documented. One of the most important elements is the "application" object, which integrates almost all automatizeable functions. The API is usually specific to an application and incompatible to all others. So VBA-code written for MS-Office API can not be used in [[OpenOffice]} using the StarBasic-API for example, although StarBasic and VBA are very resemblant considering the language. 
Most software products (Autodesk AutoCAD / Microsoft Office / Adobe Illustrator) provide an API in form of an 'Object Model' to the Visual Basic Environment allowing the user to create anything from small macros that perform repetitive tasks to extensive programs that add functionality to the host program. 
The article on OLE Automation provides a good discussion on how VBA can interact with the host application's APIs. I wall callout more clearly at the start of the article.
Macros can be attached to a menu, button a keyboard shortcut or an event in the application like the opening of the document. Also user-defined functions for excel-worksheets can be provided. 
Security Issues 
VBA is designed without any security features in the language, like for example the sandbox that java appletts run in. Any function of the application or even of the whole operating system, that is accessible to the user running an document containing VBA-macros can be (ab)used by a VBA-makro. Even persons of low programming skills can thus easily write a so called macro virus causing damage to almost unlimited extent. 
To ensure basic safety for the system and to protect data from espionage or destruction, several measures are necessary: 
*) An external Virus-Scanner with macro-blocking function must be used, to close the security holes left open by VBA design. 
*) Macro-capable Documents from unknown or unreliable sources must not be opened. 
*) Macro-capable applications must not be run as system administrator. 
*) The signature features provided with newer VBA-Versions should be used to verify the origin of a macro-containing document.
I am leaving this section in with a cleanup tag since it contains a number of errors and typos.
Patleahy 15:59, 20 September 2006 (UTC)
thread_title:  Edit by 84.146.195.216 

message: In the section addressing security, this article uses second person address. I know generally, this type of address has no place in formal writing, but I'm unfamiliar with the etiquette of this type of article. Should someone reword the offending passage?--Amanaplanacanalpanama 23:06, 7 November 2006 (UTC)
replies: text: Yes, you should reword it. --Patleahy 15:47, 9 November 2006 (UTC)
thread_title:  Second Person Adress 

message: This article was tagged advert today. I must say I don't really agree. Anyone in for some discussion? Classical geographer 22:03, 14 August 2007 (UTC)
replies: text: Concur.  I've removed it until the editor can explain his concerns. Kuru talk 23:25, 14 August 2007 (UTC)
thread_title: Advert?

message: Aren't UserForms an OLE/ActiveX object that can be used with VBA?150.101.166.15 (talk) 04:25, 13 December 2007 (UTC)
thread_title:  UserForms aren't "part of the language" are they? 

message: :Image:VBA logo.jpg is being used on this article. I notice the image page specifies that the image is being used under fair use but there is no explanation or rationale as to why its use in this Wikipedia article constitutes fair use. In addition to the boilerplate fair use template, you must also write out on the image description page a specific explanation or rationale for why using this image in each article is consistent with fair use.
Please go to the image description page and edit it to include a fair use rationale. Using one of the templates at Wikipedia:Fair use rationale guideline is an easy way to insure that your image is in compliance with Wikipedia policy, but remember that you must complete the template. Do not simply insert a blank template on an image page.
If there is  other fair use media, consider checking that you have specified the fair use rationale on the other images used on this page.  Note that any fair use images lacking such an explanation can be deleted one week after being tagged, as described on criteria for speedy deletion. If you have any questions please ask them at the Media copyright questions page. Thank you.
BetacommandBot (talk) 06:56, 21 January 2008 (UTC)
thread_title: Fair use rationale for Image:VBA logo.jpg

message: There is a section here that says "VBA is functionally rich and extremely flexible but it does have some important limitations, including limited support for function pointers which are used as callback functions in the Windows API. It has the ability to use (but not create) (ActiveX/COM) DLLs, and later versions add support for class modules."
VBA has an AddressOf operator which returns a pointer to the function for use with API calls.Oorang (talk) 01:19, 28 January 2008 (UTC)
thread_title:  Pointers 

message: Add info box. A second pair of eyes would not be amiss Oorang (talk) 01:46, 28 January 2008 (UTC)
thread_title:  Infobox 

message: Arguably false, but perhaps just a simplification. It uses the VB6 dll,s if they are in memory, or an equivilant set of runtime dlls if the vb6 dlls are not in memory. That is, the virtual machine is hosted by Windows, and the program always runs the same way a non-native mode vb6 program runs. Id change it if I could think of a way to write it that wasnt even more confusing and misleading, but I cant, because of course vba is hosted inside the container application.  —Preceding unsigned comment added by 218.214.18.240 (talk) 07:59, 9 February 2008 (UTC)
thread_title:  a virtual machine hosted inside the container application 

message: :Image:Vba office 2003.PNG is being used on this article. I notice the image page specifies that the image is being used under fair use but there is no explanation or rationale as to why its use in this Wikipedia article constitutes fair use. In addition to the boilerplate fair use template, you must also write out on the image description page a specific explanation or rationale for why using this image in each article is consistent with fair use.
Please go to the image description page and edit it to include a fair use rationale. Using one of the templates at Wikipedia:Fair use rationale guideline is an easy way to insure that your image is in compliance with Wikipedia policy, but remember that you must complete the template. Do not simply insert a blank template on an image page.
If there is  other fair use media, consider checking that you have specified the fair use rationale on the other images used on this page.  Note that any fair use images lacking such an explanation can be deleted one week after being tagged, as described on criteria for speedy deletion. If you have any questions please ask them at the Media copyright questions page. Thank you.
BetacommandBot (talk) 02:33, 12 February 2008 (UTC)
thread_title: Fair use rationale for Image:Vba office 2003.PNG

message: VBA is based on the VB6 engine VB Express 2008 is based on VB.net. They are not synonymous. Undid edit by Benrmac129 —Preceding unsigned comment added by Oorang (talk • contribs) 17:57, 10 September 2008 (UTC)
thread_title:  VBA vs. VB Express 2008 

message: This article's introduction suffers from jargon-laden computer-ese vacuous buzzword-speak. Words like flexible, dynamic, are just gimmicks and explain nothing.Dogru144 (talk) 21:55, 9 April 2009 (UTC)
thread_title: Jargon-laden/buzzword-speak introduction

message: VSTA is actually an expansion of Visual Studio available in the Visual Studio SDK. Not part of VBA. I suggest that it belongs in it's own article, then have a blurb in this article referring to it. Oorang (talk) 14:48, 15 June 2009 (UTC)
replies: text: Is it just me or is the only thing in that section that makes it hard to read all the "citation needed" markings. I understand it just fine. Yeah, maybe it doesn't have a whole lot to do with VBA, other than basically being a direct successor, but half of what is marked as "weasel words" aren't, and almost all calls for citations really don't need it. 198.103.195.30 (talk) 11:47, 6 July 2009 (UTC)
replies: text: I agree. The crazy over-annotation of the section reads more like the equivalent of scare quotes than like a serious attempt to improve the article. Is the meaning of "application customization toolkit" really that unclear in context? 173.14.246.81 (talk) 16:54, 10 July 2009 (UTC)
replies: text: I also wholeheartedly agree.  This is a technical article that assumes a level of understanding of the concepts involved.  While it is not perfect, it makes sense to me, therefore I will remove some or all of the markings. Curb Safe Charmer (talk) 15:02, 15 July 2009 (UTC)
thread_title:  VSTA Section 

message: Is it worth including the fact that WordBASIC has some features that were not carried forward in VBA?
For example, sorting the elements in an array. See Word VBA MVP Site for examples. VBA still includes the WordBASIC object so the functionality is still there, and the WordBASIC Help files can still be downloaded from Microsoft. AncientBrit (talk) 23:33, 10 September 2009 (UTC)
thread_title:  WordBASIC Still Has Functions VBA Does Not? 

message: But wait a minute does not sound formal. Plus it looks like copied from somewhere else. Aphranius (talk) 08:45, 16 December 2011 (UTC)
thread_title:  <nowiki>{{Tone|section}}</nowiki> 

message: This sentence in the article seems backwards:
:The official reason given was that VBA relied heavily on machine code written for the PowerPC architecture, and that rewriting this code for dual PowerPC/Intel architectures would have added another 2 years to the development of the suite.
I would have guessed that VBA relied on the Intel architecture and that it had not been ported to the PowerPC. Perhaps theMicrosoft P-Code engine is implementing a PowerPC?  Unfortunately, the "official reason" did not have a citation and so I can't tell if it's wrong or I don't understand something. --Marc Kupper|talk 22:56, 25 February 2013 (UTC)
thread_title:  This sentence seems backwards 

message: Looking for release dates / office containers for VBA5, VB6.
(PS: History should be at the end of the article, not at the top, where it has unfortunately wound up in many wikipedia software articles)  — Preceding unsigned comment added by 203.206.162.148 (talk) 22:50, 30 October 2016 (UTC)
thread_title:  Version history? 

message: The following Wikimedia Commons file used on this page or its Wikidata item has been nominated for deletion:
* 
Participate in the deletion discussion at the . —Community Tech bot (talk) 19:55, 20 May 2023 (UTC)
thread_title:  A Commons file used on this page or its Wikidata item has been nominated for deletion