Calling Macro Visual Basic Procedures of a Different Project

July 23, 2009 by vba excel
Filed under: Excel Vba 
Sponsor

Excel Macro Vba Calling macro visual basic procedures of a different project [Q]
I have different excel macro VBA procedures in different excel workbooks and I need to call a procedure from one workbook to another. How can I do this? How is the right syntaxis?

I appreciate any help.

Excel Macro Vba Calling macro visual basic procedures of a different project [A]
Application.Run “‘another book2.xls’!test_msgbox”

Another method is to set a reference from the workbook that needs to call the function to the workbook that contains the function. In the excel vba editor, open the workbook that contains the functions. Go to the Tools menu and choose “VBA Project Properties”. In that dialog, change the name from “VBAProject” to something meaningful, like “MyFunctions”. Save that workbook. Then open the workbook that is going call upon the functions, go to the Tools menu, choose References, and select “MyFunctions” in the list.

Once you have that reference in place, you can call functions in the
“MyFunctions” project as if they were native VBA functions, without any qualifiers.

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • Live
  • MisterWong
  • Propeller
  • StumbleUpon
  • Technorati
  • TwitThis
  • YahooMyWeb
  • Print this article!

Rate This Tips:

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading ... Loading ...


Incoming excel search terms

excel vba call,strings procedures and macros,,mss,excel vba call procedure in another workbook,vba call another macro,call macro from another project,how to call a function from another project vba excel,vba call function,vba call macro,vba call sub from another project,call macro from other project,excel vba call procedure,excel vba run procedure on another form,how to call macro from other project,strings procedures & macros,vba call function other project,call procedure from different sheet,call sub vba,excel macro,excel macro call macro,excel vba basics,excel vba call function in another project,excel vba calling procedure,excel vba run function in another workbook,excel vba run macro in another workbook,vb excel procedures,vb6 call module from another workbook,vba call procedure from another project,vba calling macro from different project,vba excel call procedure from another project,2h,add reference to different workbook excel vba,basic vba for excel,call a macro from a different worksheet,call a macro vba from a different workbook,call another macro vba,call code from one project to another in vba,call function from different project vba,call macro excel,call macro from different workbook,call macro from macro vb6,call macro in different excel,call macro in vba,call macro vba,call other project vba,call procedure in vb6 by reference,call sub from another project vba excel,call sub module in vb6 macro,call vb from excel



Related Excel Tips

Comments

One Comment on Calling Macro Visual Basic Procedures of a Different Project

  1. Demgar on Wed, 28th Apr 2010 8:57 am
  2. The main drawback of APPLICATION.RUN, aside from the fact that it’s very verbose, is that it won’t pass objects as arguments.

    For anything past a very trivial complexity level, setting a reference is the way to go.

Have another excel answer or questions for this problem ?
Feel free to post it here..