Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 12th, 2006, 03:53 PM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to coyotworks
Default mysterious error runtime error '451'

Does anyone have any ideas about the following error?

"Runtime error '451':

 Property let procedure not defined and property get procedure did
 not return an object."

I get this in message in a popup when I call a function on a custom class. The function is supposed to return a boolean value if the code it contains executed successfully. It is used in a manner similar to the following:

'Calling code

Dim myClassInstance as myClass
Dim success as boolean

set myClassInstance = new myClass
success = myClassInstance.SomeFunction 'NOTE: Here is where the debugger takes me

'In the class module

'Class declaration
Public Function SomeFunction()
     functionOK = False
     if (test = True) then
          functionOK = True
     end if
     SomeFunction = functionOK
End Function

Why do I get this error upon calling a function (not a Property)? I've googled, but found only one reference to the same code in reference to a C++ project. One site indicates that error '451' means 'Object not a Collection'.

Thanks for any suggestions,

J


"It is better to light a candle than to curse the darkness."  -Chinese proverb
 
Old May 12th, 2006, 03:57 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Try changing the Function declaration to...

Public Function SomeFunction() As Boolean

That way VBA knows what the return type will be. There may be other things causing this error, but I would try that first.

Mike


Mike
EchoVue.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
hi i got runtime error 13 Type Mismatch error sriharsha345 Access VBA 2 February 21st, 2008 09:30 AM
runtime error dhoward VB.NET 2002/2003 Basics 2 November 1st, 2007 03:30 PM
runtime error??? jeffreyJS ASP.NET 2.0 Basics 4 September 14th, 2006 04:07 AM
Runtime Error whiterainbow ASP.NET 2.0 Professional 2 September 12th, 2006 01:20 AM
Runtime Error rwiethorn ASP.NET 1.0 and 1.1 Basics 1 January 27th, 2004 02:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.