Link to home
Start Free TrialLog in
Avatar of mcs26
mcs26

asked on

Outlook VBA Sub or Function Not Defined

Hi,

I have a public sub routine in "ThisOutlookSession" that I am trying to call from a class module I have made. But getting an error message saying sub or function is not defined. I have checked the spelling of the sub so can't see why i cannot do this.

Thanks
Avatar of PeteEngineer
PeteEngineer
Flag of India image

A Sub or Function must be defined in order to be called. Possible causes of this error include:

Misspelling the procedure name.

Trying to call a procedure from another project without explicitly adding a reference to that project in the References dialog box.

Specifying a procedure that is not visible to the calling procedure.

Declaring a Windows dynamic-link library (DLL) routine or Macintosh code-resource routine that is not in the specified library or code resource.

To correct this error

Make sure that the procedure name is spelled correctly.

Find the name of the project containing the procedure you want to call in the References dialog box. If it does not appear, click the Browse button to search for it. Select the check box to the left of the project name, and then click OK.

Check the name of the routine.
Avatar of mcs26
mcs26

ASKER

Hi Pete,

I have check the procedure name is spelled correctly. Is this an outlook issue when having code in the "ThisOutlookSession"?

Thanks
Avatar of omgang
Just to clarify, you have a sub procedure named ThisOutlookSession and it is located in the ThisOutlookSession module?  I'm wondering if it is a naming confilict.  Can you try renaming the sub to see if the error goes away?
OM Gang
ASKER CERTIFIED SOLUTION
Avatar of Chris Raisin
Chris Raisin
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcs26

ASKER

Cheers Chris, xcatly what I was looking for!