Link to home
Start Free TrialLog in
Avatar of Autofreak
Autofreak

asked on

additional properties and methods to existing class

Hello All,
               I have a set of Excel workbooks with similar features which I think would be nicely dealt with thru classes. I would like to add some properties and methods but how I can add them if this object class, workbook, already exists with its standard set of properties, methods, and events?

Thank you very much!
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Are you asking about this in VB 6, or .NET?

AW
Avatar of Autofreak
Autofreak

ASKER

It's VB6. Thanks
ASKER CERTIFIED SOLUTION
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent Arthur, that is the path I thought of taking too.

Thanks,
Serge
so why only a B???

AW
Hey Arthur,
                 sorry if my mark caused your disagreement  - I respect your point of view. I gave "B" because to me an A answer would have to have an example of such "mimmicing" the way it would be done in VB6. If you insist I can raise this issued again and with pleasure award you an A. Say, we need a class clsCashRec that have all properties of an Excell workbook and for which we implement a method Reconcile. This method would look like myWorkbook.Reconcile

I'd appreciate if you could show how to do that and even raise the pints awarded to 250.

Thanks!
 
no, but you could have asked for the additional explanation.

Public Class clsCashRec
    Private m_clsCashRecXLS as Excel.WorkBook
    Private m_LocalData as Integer

    Public Sub Class_Initialize()
       Set m_clsCashRecXLS  = New Excel.WorkBook
    End Sub

    Public Property Get WorkBookPropertyToMimic1() as PropertyType
         WorkBookPropertyToMimic1 = m_clsCashRecXLS.WorkBookPropertyToMimic1
    End Property
    Public Property Let WorkBookPropertyToMimic1(RHS as PropertyType)
         m_clsCashRecXLS.WorkBookPropertyToMimic1 = RHS
    End Sub
.
.
.
    Public Sub Reconcile(ByVal Arg as ArgType)
     '  code to do what you need to do, using the m_clsCashRecXLS  workbook object as needed
    End Sub
End Class

is the basic structure of the approach, using DELEGATION

AW
 
Thanks a lot Arthur!,
                       You now what, I lost my confidence temporarily since one of the experts slept me a worning that asking additional questions, and in that case the situation was very close, is violating the clause about asking several questions in one Q.   I desagreed with him in writing  , (https://www.experts-exchange.com/questions/21373500/query-results-into-spreadsheet.html) but decided to act more concervatively. This case proves my point - additional answares MUST be asked for the answer to rich its maximum value!!!

Do you want you me to post this Q once again?