A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

sub or function not defined error - HELP!!



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 2nd 07, 07:54 PM posted to microsoft.public.outlook.program_vba
adenke
external usenet poster
 
Posts: 4
Default sub or function not defined error - HELP!!

I have created a Macro in VB in Outlook 2007, and when I run it, I get a "Sub
or function not defined" error message box. I have not been able to
troubleshoot this properly. Once I click OK on the message box, I can just
press F5 and the macro runs perfectly, but I would rather not have this
annoying step. Where should I look for the problem
Ads
  #2  
Old July 3rd 07, 05:24 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default sub or function not defined error - HELP!!

Turn on Option Explicit and try compiling your code - it'll tell you where
there are calls for functions or procedures that don't exist.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I have created a Macro in VB in Outlook 2007, and when I run it, I get a "Sub
or function not defined" error message box. I have not been able to
troubleshoot this properly. Once I click OK on the message box, I can just
press F5 and the macro runs perfectly, but I would rather not have this
annoying step. Where should I look for the problem

  #3  
Old July 3rd 07, 06:16 PM posted to microsoft.public.outlook.program_vba
adenke
external usenet poster
 
Posts: 4
Default sub or function not defined error - HELP!!

I did that. I assume that Option Explicit goes in the Declarations section of
the module. The behavior is exactly the same. When I try to compile the code,
it doesn't seem like anything happens (other that "Complile Spamdeath" (my
project name) turns grey after running "Compile Spamdeath once). No errors
pop up or anything. If I add the statement "bob=mickeymouse(), then it shows
me that mickeymouse() doesn't exist, so I'm guessing that the sub or function
not defined error is a red herring for the actual problem.

All I have in my project is this:

Option Explicit

Public Sub SpamDeath()

UserForm1.Show
End Sub

Plus a user form with some ListBoxes and CommandButtons and the code
associated with those.

I am throroughly confused here. I do a lot of VB programming, but this is my
first macro through MSOffice attempt since a much earlier version of Excel.

It may be worth noting that I went into the VB Editor first to create the
project and then later did the "Create" step from the macro directory at
which point I added the line of code to load my form. Perhaps that was wrong?

"Eric Legault [MVP - Outlook]" wrote:

Turn on Option Explicit and try compiling your code - it'll tell you where
there are calls for functions or procedures that don't exist.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I have created a Macro in VB in Outlook 2007, and when I run it, I get a "Sub
or function not defined" error message box. I have not been able to
troubleshoot this properly. Once I click OK on the message box, I can just
press F5 and the macro runs perfectly, but I would rather not have this
annoying step. Where should I look for the problem

  #4  
Old July 3rd 07, 06:32 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default sub or function not defined error - HELP!!

At what line does the error occur? Is that ALL your code?? Also try
inserting On Error Goto YourLabelNumber statements in all your methods so
that you can properly determine where the error is occuring during runtime.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I did that. I assume that Option Explicit goes in the Declarations section of
the module. The behavior is exactly the same. When I try to compile the code,
it doesn't seem like anything happens (other that "Complile Spamdeath" (my
project name) turns grey after running "Compile Spamdeath once). No errors
pop up or anything. If I add the statement "bob=mickeymouse(), then it shows
me that mickeymouse() doesn't exist, so I'm guessing that the sub or function
not defined error is a red herring for the actual problem.

All I have in my project is this:

Option Explicit

Public Sub SpamDeath()

UserForm1.Show
End Sub

Plus a user form with some ListBoxes and CommandButtons and the code
associated with those.

I am throroughly confused here. I do a lot of VB programming, but this is my
first macro through MSOffice attempt since a much earlier version of Excel.

It may be worth noting that I went into the VB Editor first to create the
project and then later did the "Create" step from the macro directory at
which point I added the line of code to load my form. Perhaps that was wrong?

"Eric Legault [MVP - Outlook]" wrote:

Turn on Option Explicit and try compiling your code - it'll tell you where
there are calls for functions or procedures that don't exist.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I have created a Macro in VB in Outlook 2007, and when I run it, I get a "Sub
or function not defined" error message box. I have not been able to
troubleshoot this properly. Once I click OK on the message box, I can just
press F5 and the macro runs perfectly, but I would rather not have this
annoying step. Where should I look for the problem

  #5  
Old July 3rd 07, 08:18 PM posted to microsoft.public.outlook.program_vba
adenke
external usenet poster
 
Posts: 4
Default sub or function not defined error - HELP!!

Forgive my ignorance of Outlook VB Macros - this is very frustrating.

The error occurs before my form loads. I have more code, but it is all on
the controls on userform1, which doesn't even load when I go through the menu
tree Tools-Macro-Macros-SpamDeath-Run. As soon as I click on Run, I get
the sub or function not defined messagebox. I did what you suggested and put
on error statements in absolutely every subroutine in my project, and those
errors never get triggered. This appears to be something in the initial
running of the Macro before it executes. My form never loads, just the
messagebox...


"Eric Legault [MVP - Outlook]" wrote:

At what line does the error occur? Is that ALL your code?? Also try
inserting On Error Goto YourLabelNumber statements in all your methods so
that you can properly determine where the error is occuring during runtime.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I did that. I assume that Option Explicit goes in the Declarations section of
the module. The behavior is exactly the same. When I try to compile the code,
it doesn't seem like anything happens (other that "Complile Spamdeath" (my
project name) turns grey after running "Compile Spamdeath once). No errors
pop up or anything. If I add the statement "bob=mickeymouse(), then it shows
me that mickeymouse() doesn't exist, so I'm guessing that the sub or function
not defined error is a red herring for the actual problem.

All I have in my project is this:

Option Explicit

Public Sub SpamDeath()

UserForm1.Show
End Sub

Plus a user form with some ListBoxes and CommandButtons and the code
associated with those.

I am throroughly confused here. I do a lot of VB programming, but this is my
first macro through MSOffice attempt since a much earlier version of Excel.

It may be worth noting that I went into the VB Editor first to create the
project and then later did the "Create" step from the macro directory at
which point I added the line of code to load my form. Perhaps that was wrong?

"Eric Legault [MVP - Outlook]" wrote:

Turn on Option Explicit and try compiling your code - it'll tell you where
there are calls for functions or procedures that don't exist.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I have created a Macro in VB in Outlook 2007, and when I run it, I get a "Sub
or function not defined" error message box. I have not been able to
troubleshoot this properly. Once I click OK on the message box, I can just
press F5 and the macro runs perfectly, but I would rather not have this
annoying step. Where should I look for the problem

  #6  
Old July 3rd 07, 08:28 PM posted to microsoft.public.outlook.program_vba
adenke
external usenet poster
 
Posts: 4
Default sub or function not defined error - HELP!!

Thanks for your help. I still don't know what was wrong, but I fixed it by
creating a new macro and posting the exact same code into it. Something was
clearly messed up with the first macro.



"Eric Legault [MVP - Outlook]" wrote:

At what line does the error occur? Is that ALL your code?? Also try
inserting On Error Goto YourLabelNumber statements in all your methods so
that you can properly determine where the error is occuring during runtime.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I did that. I assume that Option Explicit goes in the Declarations section of
the module. The behavior is exactly the same. When I try to compile the code,
it doesn't seem like anything happens (other that "Complile Spamdeath" (my
project name) turns grey after running "Compile Spamdeath once). No errors
pop up or anything. If I add the statement "bob=mickeymouse(), then it shows
me that mickeymouse() doesn't exist, so I'm guessing that the sub or function
not defined error is a red herring for the actual problem.

All I have in my project is this:

Option Explicit

Public Sub SpamDeath()

UserForm1.Show
End Sub

Plus a user form with some ListBoxes and CommandButtons and the code
associated with those.

I am throroughly confused here. I do a lot of VB programming, but this is my
first macro through MSOffice attempt since a much earlier version of Excel.

It may be worth noting that I went into the VB Editor first to create the
project and then later did the "Create" step from the macro directory at
which point I added the line of code to load my form. Perhaps that was wrong?

"Eric Legault [MVP - Outlook]" wrote:

Turn on Option Explicit and try compiling your code - it'll tell you where
there are calls for functions or procedures that don't exist.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"adenke" wrote:

I have created a Macro in VB in Outlook 2007, and when I run it, I get a "Sub
or function not defined" error message box. I have not been able to
troubleshoot this properly. Once I click OK on the message box, I can just
press F5 and the macro runs perfectly, but I would rather not have this
annoying step. Where should I look for the problem

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub or Function not defined ladyhawke Outlook and VBA 3 January 27th 07 09:06 PM
Outlook 2003 error "An internal support function returned an error" with multiple distribution lists [email protected] Outlook - Using Contacts 0 December 14th 06 10:08 PM
Import Error with Excel - Too many fields defined RealGomer Outlook - Calandaring 2 October 27th 06 12:18 AM
Getting an Internal Support Function Error TK Outlook - General Queries 2 March 8th 06 01:17 AM
outlook macro doesn;t run - sub/function not defined mudshark Outlook and VBA 1 February 6th 06 11:04 PM


All times are GMT +1. The time now is 09:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.