Re: Using public members of a class inside the class



No reason why not. It's even fairly common: you have some standard function
that you use throughout the app; it's just as useful from within the module
as elsewhere; and for consistency's sake it's better, as far as possible,
always to use the same method.

You don't need the 'me', BTW. And your example looks more like a function
than a property.





"Guillermo López-Anglada" <guillermo@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:uaGfHM0DHHA.4144@xxxxxxxxxxxxxxxxxxxxxxx

Hello,

I have a class like this:

'Class module

Public Property Get GetTextFromRange() as String
'Code
End Property

Public Function ProcessText() as String

'For example:
ProcessText = Left$(Me.GetTextFromRange,5)


End Sub
'End of Class module

Is it a good practice to use public members of a class like that?

Regards,

Guillermo


.



Relevant Pages

  • Re: Open File Dialog Filter
    ... Double checked class module name, ... >>> Dim cFileOpen As clsGetOpenFileName ... As String ... Public Property Let FileType ...
    (microsoft.public.excel.programming)
  • Re: Opinion from Doug Robbins and Peter Hewett Requested
    ... If you're not sure what going on create a new Template/Project and add the Class Module ... >Public Sub DoSomething() ... >>Private mstrFile As String ... >>Public Property Let Path ...
    (microsoft.public.word.vba.general)
  • Re: Using public members of a class inside the class
    ... Public Property Let TargetText (StringA as String) ... 'End of class module ... GetTextFromRange isn't a property of anything; nor would it make any sense to *set* the GetTextFromRange property. ...
    (microsoft.public.word.vba.beginners)
  • Re: Reproducable Hard Crash in Excel 2003 (and earlier versions) with the following VBA code.
    ... Private m_patternLabel As String ... Public Property Get PatternLabel() As String ... Public Property Let PatternLabel ... > correctly It's just a special type of class module. ...
    (microsoft.public.excel.programming)
  • Re: VB 6 and CheckSpelling
    ... Here's a class module that I use: ... Private m_sTextCorrected As String ... Public Function PerformSpellCheckAs PerformSpellCheckConstants ... Public Property Get TextCorrectedAs String ...
    (microsoft.public.office.developer.vba)