As a rookie here, how do I save the excel file before quitting?
Code: Select all
XIncludeFile "c:\Program Files\PureBasic\COMatePLUS.pbi"
Define.COMateObject ExcelObject, WorkBook
ExcelObject = COMate_CreateObject("Excel.Application")
If ExcelObject
If ExcelObject\SetProperty("Visible = #True") = #S_OK
WorkBook = ExcelObject\GetObjectProperty("Workbooks\Add")
If WorkBook
ExcelObject\SetProperty("Cells(1,1) = 'Hello'")
ExcelObject\SetProperty("Cells(1,2) = 'from'")
ExcelObject\SetProperty("Cells(1,3) = 'COMate!'")
ExcelObject\SaveAs('C:\scrapbook\Testing.xls')
ExcelObject\Invoke("Quit()")
WorkBook\Release()
EndIf
EndIf
ExcelObject\Release()
Else
MessageRequester("COMate -Excel demo", "Couldn't create the application object!")
EndIf
ExcelObject\SaveAs('C:\scrapbook\Testing.xls')
. . . as I have done here, clearly isn't the way to do it!