• 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.

Complie Error Sub or Function not defined

ThrottleWorks

Excel Ninja
Hi,


I am trying to call a module from the personal macro.


I have a macro in my personal workbook, this is an add in.


I have a normal 5 macros in the macro file.

4th macro calls the personal macro successfully.


Once this personal macro runs then I want to call 5th module.


I have given the line Call abc at the end of personal macro, but I am getting an error.


The module I am trying to call is named Mod005, Sub ABC.


Can anyone help me in this please.
 
Morning Sachin! IS this possibly another case where we've got the macro name/module name/workbook name mixed up? We also need to make sure there aren't duplicate macro names. Ie., if there's only 1 macro called "MyMacro", you might be able to get by with

[pre]
Code:
Call MyMacro
If there's different modules/workbooks which each have a macro called "MyMacro", you'll have to better define things, a la

Call Module1.MyMacro
[/pre]
 
Morning Luke Sir,


File name "VAR.xlsm", this file has 5 different modules.

I have named modules as mod001, nod002, mod003, mod004, mod004.


I have installed an "add in" in my excel.

I can this addn in any excel file.


At present I am working in "VAR.xlsm" file.

In the mod004 (sub CreateCorrelation) I am calling "Application.Run "CovMatrix".


Once this "CovMatrix" finishes its work, I want to call mod005 (sub CreatTableII) from the "CovMatrix" only.


But if I try to do this I am getting messege Complie Error Sub or Function not defined.
 
I'm not sure what you mean when you say you want to call the CreatTableII from the CovMatrix. It sounds like Cov Matrix is already being called by another macro.


I mod004, I would expect to see something like this:

[pre]
Code:
Application.Run "CovMatrix
Call mod005.CreatTableII
[/pre]
Inidicating that you want the CovMatrix macro to run, and then the macro in module 5. Is that the correct order of things?
 
Hi, sachinbizboy!

Isn't this topic the same as or the continuation of this one, your previous one?

http://chandoo.org/forums/topic/how-to-call-an-add-in-using-vba

If so next time please continue the thread on same topic, thank you.

Regards!
 
@ Luke Sir, greeting of the day & thanks a lot for the help.


Sir CovMattix is an add in, is stored in the personal macro.

This is called by Mod004 (sub CreateCorrelation), now I want to run Mod005 ((sub CreatTableII) from CovMatrix.


But I am getting "Complie Error Sub or Function not defined".


@SirJB7, you are correct, even I was confused wheather I should start a new thread or continue with the original. But as the problem of earlier thread was solved I started new thread. Sorry for the mistake.


Have a nice day.
 
now I want to run Mod005 ((sub CreatTableII) from CovMatrix.

Are you sure this is what you want? Generally, an add-in should be a stand-alone set of code. What you asked is to modify the code within the add-in to call a macro within your regular workbook. This seems a little backwards. Please confirm.
 
Yes I want to run Mod005 ((sub CreatTableII) from CovMatrix.


But if it is wrong I will not try to interfare with the add in.


Just a while ago, I have added a msgbox in the add in, it prompts the user to run mod005.

As advised by you, I will leave the add in code intact.


Have a nice day.
 
Back
Top