Re: Equivalent VBA Excel code
Hello Eros and Roberto,
I followed your discussion and imho I would not implement Office dependent issues such as COM_ExcelSetCells(). COM, yes but if the user knows the object model of the programs such as Word or Excel the user must reference the right object, method or property. If you use COM_ExcelSetCells() strategie you must implement the whole object model.
I would create a more abstract way of calling the object made available via COM, just as you do now.
I do not know how thinBasic is build internally but if you can use a dotted like construction without making it an object oriented language would be a bennefit.
Just like
[code=vb]dim pWdAppl as P
dim pWdDocs as P
dim pWActDoc as P
pWdAppl = ole.create("word.application")
pWdDocs = pWdAppl.documents
pWdActDoc = pWdDocs.Add()
pWdActDoc.name = "mydoctwo"[/code]
In this example the names of the objects and properties are exact the same as used in the COM object that is called. It doesn't have to be part of thinbasic. You can map them 1:1 to the COM object. If you make a mistake the property or object is not found. Methods can be handled as functions() such as the Add() method. Properties just as they are and handle collections like array's.
[code=vb]pWdActDoc = pWDocs(2)[/code]
It is just an idea.
Re: Equivalent VBA Excel code
Marcel,
your suggestion is exactly what we would like to implement. We do not want to rebuild any COM model but let thinBasic engine understand what user wants using a dot notation. I suggested to have a new variable type called OBJCT because the first element in the dotted notation must be a pointer to a COM interface. Having a DWORD to store such a pointer will not let engine understand that script is dealing with a COM interface already referenced.
Currently the biggest problem is that COM module is a separated module developed in C while thinBasic core engine is written is Power Basic so we need to understand what is better to do.
Ciao
Eros
Re: Equivalent VBA Excel code
Hello Eros,
That is indeed a difficult decision. I know nothing about PowerBasic but when it has to deal with COM I would probable do it in C.
-----------
Added: probable