How do I call a class sub from a userform? Is there a standard way? I have tried calling it like a regular non-class module. Then I get sub not defined and object required error messages.
How do I call a class sub from a userform? Is there a standard way? I have tried calling it like a regular non-class module. Then I get sub not defined and object required error messages.
Unless my brain is getting jumbled between programming languages, you have to create a new instance of the class. So let's say you have a user made class called MyClass. The code would be:
Please Login or Register to view this content.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
Please be more specific. What do you want to achieve and what should tbe the result ?
if the classname is 'Example'
if the class contains a property 'nice'
Please Login or Register to view this content.
I want something to be added to a collection if a button is clicked. I also want something to be gotten from the collection, and put on the spreadsheet, if a button is clicked. I tried this in a public class module:
And this in a userform module:Please Login or Register to view this content.
I get object required error msg. for the line Class1.whatever. If I delete that line I get sub not defined error for the following line.Please Login or Register to view this content.
the classname: 'Eventhandler'
In the Class
In the UserformPlease Login or Register to view this content.
a commandbutton 'knop_vervolg'
Please Login or Register to view this content.
Last edited by snb; 05-10-2011 at 03:23 PM.
I think that puts the info into a collection. How do I access an item from the collection by index #, and put it on the spreadsheet? I think the line below should go somewhere but I'm not sure where.
OrPlease Login or Register to view this content.
I changed the code to this:Please Login or Register to view this content.
Please Login or Register to view this content.
and
Please Login or Register to view this content.
In your first question you were talking about a userform.
Now you introduce controls in a sheet: quite another piece of cake.
My suggestion: implement my suggestion first, secondly try to understand it.
Otherwise adapting is a wild (unsuccessful) gamble.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks