Thanks Han’s , thanks Alan for the detailed reply. :xsmile:
Seems OOP has been around a lot longer than I thought then..i had a good google at Smalltalk stuff last night”_…
_..Sadly I can’t really understand too much in detail – it is a bit over my head. I tried to think of a “fun” answer to satisfy my lust to understand rather than delving in too deep for me…. To save anyone the grief of me asking fully .. Lol… :) ;) :xsmile:
The thing actually cropped up again in my head recently with this sort of Code …
Code: Select all
Sub ApplicationRangeObject() '
' String referrence build
Dim strRef As String: Let strRef = "='" & ThisWorkbook.Path & "\" & "[" & ActiveWorkbook.Name & "]" & ActiveSheet.Name & "'!A1:A2"
Debug.Print strRef ' Immediate Window (Ctrl+G form VB Editor) gives ='H:\Excel0202015Jan2016\OffenFragensForums\eileenslounge\[VIXData050824Start17Dec.xls]Tabelle1'!A1:A2
Let strRef = "='[" & ActiveWorkbook.Name & "]" & ActiveSheet.Name & "'!A1:A2"
Debug.Print strRef ' gives VIXData050824Start17Dec.xls]Tabelle1!A1:A2
' Range Object Direct Referrence ?
Let Application.Range(strRef).Value = "AyOneAyTwo"
End Sub
Two things I keep reading.
_OOP has a Hierarchy, progressing “along” or ”down” the chain
_A Range Object is “got at” through Properties , ( Cells Property, Range Property) . ( Sometimes people say methods instead )
That code Snippet “works” as I want getting to the first couple of cells in Tabell1 Worksheet
It works in any Class module.
It seems to be telling me
_1) I can go back up the Hierarchy
_ 2) I have a fundamental way to reference a ( Range ) Object directly through a string reference
(_ regarding the latter, 2) , I think I am using a Range Object
***. Or possibly a Range(” “) Method were the strRef is the argument. I was guessing that, as always, if we do not write that full reference, ( as is more usual ) , then Excel adds it , giving a different version depending on exactly where the code is and / or what is active et…. )
(
***I do get the point and understand that a Worksheet has a Cells Property and Range Property. I do also understand that a Range Object has a Cells Property and Range Property – I do not get confused anymore with the unfortunate use of the same Range word for a Range Object and a Range Property )
I appreciate your efforts to inform me in better detail. I like to understand..
I thought a post here with a “fun”” Layman’s solution / explanation might be better than for me to bore or distract from the Xmas spirit by asking it more directly :) ;)
MAyBea it is better for me just to think of VBA as being a bit anarchistic in what is doing there!!
_.. then go and finally write my Xmas cards instead .. Lol..
Anarchy in the VB Ay ?_...
_..”.. it’s coming some time.. & mAy Bea ..” _.. There is a nub of a song in there somewhere…
Merry
Me
mbe
rs
Xmases :xsmile:
![Xmas Grin :xgrin:](./images/smilies/xmas-grin.gif)
:xsmile:
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also