what is wrong here? I'll will make a Function to create a Name of a Cell in
Excel. But my COMate-ErrorDiscription tell me an Error into
... ActiveWorkbooks\Names\Add - Methode.
Is it not the same as Workbooks\add ? I don't no.
Please can anyone help me by this code?
Code: Select all
IncludePath "..\"
XIncludeFile "COMatePLUS.pbi"
DisableExplicit
Define.COMateObject ExcelObject, WorkBook, MyNames
ExcelObject = COMate_CreateObject("Excel.Application")
If ExcelObject
If ExcelObject\SetProperty("Visible = #True") = #S_OK
WorkBook = ExcelObject\GetObjectProperty("Workbooks\Add"):Debug COMate_GetLastErrorDescription()
If WorkBook
MyNames=ExcelObject\GetObjectProperty("ActiveWorkbook\Names\Add"):Debug COMate_GetLastErrorDescription()
If MyNames
Debug"MyNames aktiv"
;MyNames\invoke("Add") ;if you erase \Add of the Object MyNames= ....
MyNames\SetProperty("Name := 'MyCellName'"):Debug COMate_GetLastErrorDescription()
MyNames\SetProperty("RefersTo :='=Tabelle1!$A$1'"):Debug COMate_GetLastErrorDescription()
MyNames\Release():Debug COMate_GetLastErrorDescription()
ExcelObject\Invoke("Quit()")
MyNames\Release()
EndIf
WorkBook\Release()
ExcelObject\Release()
EndIf
EndIf
Else
MessageRequester("COMate -Excel demo", "Couldn't create the application object!")
EndIf
Thank you and regards from germany.Names.Add Name:="Tante", RefersTo:="=Tabelle1!$C$3"
(sorry at my little english)
Falko