Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default UserForm Pointers & Class Modules

Hello,

On module level of an UserForm there's a variable declared as a
certain Class (User Defined). When passing a pointer of this UserForm
to a Subroutine in a Module and try to access the variable by this
pointer, it says the Object doesn't support this Property or Method.

Why can't I access the variable by using a pointer of a UserForm?

Example:

[General]
Public myObject as myClass

[Sub]
Public mySub(ByRef myPointer as MSForms.UserForm)
myPointer.myObject.myProperty = "myValue"
End Sub

Regards,
Bart

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default UserForm Pointers & Class Modules

Bart,
It will work if you pass it like this instead:

Public Sub PassRefTest(SomeForm As YourUserFom)
SomeForm.myObject.myProperty = "myValue"
End Sub

NickHK

"Bart" wrote in message
oups.com...
Hello,

On module level of an UserForm there's a variable declared as a
certain Class (User Defined). When passing a pointer of this UserForm
to a Subroutine in a Module and try to access the variable by this
pointer, it says the Object doesn't support this Property or Method.

Why can't I access the variable by using a pointer of a UserForm?

Example:

[General]
Public myObject as myClass

[Sub]
Public mySub(ByRef myPointer as MSForms.UserForm)
myPointer.myObject.myProperty = "myValue"
End Sub

Regards,
Bart



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default UserForm Pointers & Class Modules

Thanks again NickHK!

Somewhere I can see the logic of it, but wouldn't ever think of
assigning this kind of Type!

What about passing an other UserForm than 'YourUserForm'? And then
which specifications does this UseForm need to have? Does it minimal
needs to have the Variables declared at module level which eventually
are used in the procedure?

Bart

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default UserForm Pointers & Class Modules

Yes, basically.
You could try passing a generic Object in the argument, although then you
will lose all Intellisense.

NickHK

"Bart" wrote in message
oups.com...
Thanks again NickHK!

Somewhere I can see the logic of it, but wouldn't ever think of
assigning this kind of Type!

What about passing an other UserForm than 'YourUserForm'? And then
which specifications does this UseForm need to have? Does it minimal
needs to have the Variables declared at module level which eventually
are used in the procedure?

Bart



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Class modules: parametrize class object fields Jean-Pierre Bidon Excel Programming 11 August 31st 06 02:49 PM
PROBLEM: Keywords;= Userform, Class Modules, ButtonGroup and Nomenclature Myles[_24_] Excel Programming 8 April 2nd 06 01:46 AM
Basic question - modules and class modules - what's the difference? Mark Stephens[_3_] Excel Programming 9 May 8th 05 11:48 AM
When to code in sheet or userform modules and when to use modules Tony James Excel Programming 1 December 16th 04 10:02 PM
Class Modules vs Modules Jeff Marshall Excel Programming 2 September 28th 03 07:57 PM


All times are GMT +1. The time now is 12:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"