Results 1 to 9 of 9

Difference between Macro code and VBA code?

This is a discussion on Difference between Macro code and VBA code? within the Excel Questions forums, part of the Question Forums category; What is the difference between Macro code and VBA code?...

  1. #1
    Board Regular
    Join Date
    May 2011
    Location
    United States of America, Maryland, Riverdale
    Posts
    221

    Default Difference between Macro code and VBA code?

    What is the difference between Macro code and VBA code?
    Last edited by Hashiru; Jan 2nd, 2012 at 10:47 PM. Reason: Wrong title

  2. #2
    Board Regular
    Join Date
    Aug 2009
    Location
    Southern Finland
    Posts
    1,330

    Default Re: Difference between Macro code and VBA code?

    They're basically the same thing: VBA is the language you use to program macros and functions.

    I'd guess technically the difference would be VBA code can contain both functions and macros where as a macro code is only the macro part of the code.
    Last edited by Misca; Jan 2nd, 2012 at 11:35 PM.

  3. #3
    Board Regular
    Join Date
    May 2011
    Location
    United States of America, Maryland, Riverdale
    Posts
    221

    Default Re: Difference between Macro code and VBA code?

    Thanks for the insight

  4. #4
    Board Regular Weaver's Avatar
    Join Date
    Sep 2008
    Posts
    5,196

    Default Re: Difference between Macro code and VBA code?

    A 'macro' is usually vb written for use in Excel or Word, and sometimes will have been created using a macro recorder, where your actions are interpreted and turned into code. After that, it's largely preference. Some prefer to distiguish along the lines of how it was created (i.e scripted, rather than recorded), some just think 'vba code' sounds more serious & professional than 'macro', myself included.

    They're all macros in the sense that they duplicate a set of instructions a user might concievably perform using the main program interface, although you could argue that when the code is doing something you couldn't perform via the normal user interface, that's when it comes more than just a macro.

    {rant}I have to admit to having a bit of a bee in my bonnet on this one, since in our organisation 'macros' are seen to be trivial, whereas code is something more substantial, yet I'd defy anyone who makes this distinction to actually explain it in terms that made any sense.{/rant}
    If the above suggestion contains vb code and you're not sure about using macros,check the following links (which in no way should be interpreted as being specific to your individual query):

    http://www.mrexcel.com/articles/past...o-into-vbe.php

    You can find help with array formulas here:

    http://www.cpearson.com/excel/arrayformulas.aspx

    If you really want to learn Excel, don't always accept the first solution.

  5. #5
    Board Regular
    Join Date
    May 2011
    Location
    United States of America, Maryland, Riverdale
    Posts
    221

    Thumbs up Re: Difference between Macro code and VBA code?

    Hi
    Thanks for you detailed account and the links to further digrest. I asked this question, because I used MrExcel Macros and VBA Video tutorials and one of the amazing means we are asked to use to see what goes on when you record the macro was to have the main interface and the VBE opened. When you try to learn VBA scripting these are the things I saw: Keywords, Objects, Methods and Properties. I think from this and what I know is that Macro is generally recorded and short written in VBA language and VBA is generally the scripting of VBA language and can be long and so can perform more tasks as it can use both Sub and Function procedures, use variables instead of being hard-corded which the macro recorder tend to do most of the time. VBA scripting is more flexible.

  6. #6
    Board Regular Weaver's Avatar
    Join Date
    Sep 2008
    Posts
    5,196

    Default Re: Difference between Macro code and VBA code?

    If the above suggestion contains vb code and you're not sure about using macros,check the following links (which in no way should be interpreted as being specific to your individual query):

    http://www.mrexcel.com/articles/past...o-into-vbe.php

    You can find help with array formulas here:

    http://www.cpearson.com/excel/arrayformulas.aspx

    If you really want to learn Excel, don't always accept the first solution.

  7. #7
    Board Regular
    Join Date
    May 2011
    Location
    United States of America, Maryland, Riverdale
    Posts
    221

    Default Re: Difference between Macro code and VBA code?

    Hi
    Thanks for the additional link. I think this cut it for me. Because I started VBA Scripting but left it to do MOS first to get a detailed insight. From the MrExcel Videos, Excel Programming for VBA and you explanation I am satisfied.

    Thanks once more.
    Last edited by Hashiru; Jan 6th, 2012 at 10:49 AM. Reason: spelling

  8. #8
    New Member
    Join Date
    Jan 2013
    Posts
    4

    Default Re: Difference between Macro code and VBA code?

    Can we use VBA code ( logical) with Macros?

  9. #9
    Board Regular
    Join Date
    Feb 2012
    Location
    Florida, USA
    Posts
    8,888

    Default Re: Difference between Macro code and VBA code?

    Quote Originally Posted by Ocean2 View Post
    Can we use VBA code ( logical) with Macros?
    The short answer is yes. Misca pretty much nailed it. VBA is the code language, Visual Basic for Applications that Microsoft created to use specifically with their applications. It can be used with Access, Power Point, Outlook, Word and Excel as their primary products. A macro is simply a procedure that does something more efficiently in one of the applications than could be done manually. The macro today is written with VBA, whereas at one time years ago it had its own set of DOS functions which were referred to as macro language. But you can write macros in any programming language, most of which can be compiled and stored as executable files. VBA on the other hand cannot be compiled into an .EXE file. VBA compiles on the fly and thus you will periodically get some glitches when running a procedure which has actions to perform that require more time than it takes to execuite the next action. A timing problem with VBA. But those are minimal.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com