LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Can objects be passed around as in Java?

Well, here it is, but it's going to take a learning curve to figure out
my problem.
But maybe not; like I said, I'm new to Excel/VBA, and maybe it just
looks weird to me.

The main line creates oMACdefn objects of class clsMACdefn5A.
Each oMACdefn contains oFUNCTdefn objects of class clsFUNCTdefn5A.
I want to access the main line's wsWorksheet object from a method (for
now), but I first have a problem coding the Property method. Then the
main line doesn't seem to pass me a good wsWorksheet, tho it looks okay
in the debugger.

Hope it's not too difficult to get thru this stuff,
and maybe even to figure it out!
Thanks,
Peter.


main line :
Dim oMACdefn As clsMACdefn5A
Dim oFUNCTdefn As clsFUNCTdefn5A
Public wsWorksheet As Worksheet

BTW, the main line contains both oMACdefn and oFUNCTdefn's because it's
reading a page that contains the data for both.

clsMACdefn5A:
Private aAllFUNCTRows(1 To maxNumberFUNCTs) As clsFUNCTdefn5A

PROBLEM ONE -- How to code the Property that sets the oMACdefn object
into clsFUNCTdefn5A.

===========

Main line :
Set oFUNCTdefn = New clsFUNCTdefn5A
oFUNCTdefn.doParent oMACdefn 'Compile error,
'Invalid use of Property
' (see below)
oFUNCTdefn.setParent oMACdefn ' ok
' debugger shows obj

clsFUNCTdefn5A
Private oParent As clsMACdefn5A

Public Property Let doParent(ByRef inn As clsMACdefn5A)
Set oParent = inn
End Property
--OR--
Public Property Set doParent(ByRef inn As clsMACdefn5A)
Set oParent = inn
End Property


WORK AROUND:
============

clsMACdefn5A:
oFUNCTdefn.setParent oMACdefn

clsFUNCTdefn5A
Private oParent As clsMACdefn5A
Public Sub setParent(ByRef inn As clsMACdefn5A)
Set oParent = inn
End Sub


PROBLEM TWO -- why doesn't clsMACdefn5A.getWorksheet() work when called
from clsFUNCTdefn5A?

===========

clsMACdefn5A:
Public wsWorksheet As Worksheet
Set wsWorksheet = ActiveSheet ' Class_Initialize
Public Function getWorksheet() As Worksheet
Set getWorksheet = wsWorksheet
End Function

clsFUNCTdefn5A:
Private wsWorksheet As Worksheet
wsWorksheet = oParent.getWorksheet ' runtime error
' obj doesn't support funct/prop.
' this happens when it's getting back to
clsFUNCTdefn5A



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
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
java to vba PST Excel Discussion (Misc queries) 4 May 10th 07 11:15 PM
Dialogue with Java v_verno Excel Worksheet Functions 0 January 8th 06 09:11 PM
How to use Java in Excel VBA? Sirin Excel Programming 0 November 27th 04 11:52 AM
Little bit of Java in VB? Soulblade Excel Programming 2 August 30th 04 02:39 PM
Unable to remove Sheet objects in the Microsoft Excel Objects Adrian[_7_] Excel Programming 1 August 26th 04 10:49 PM


All times are GMT +1. The time now is 01:27 PM.

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"