ComatePlus + Excel + Autofit
Posted: Wed Jun 04, 2014 3:34 pm
Hi All,
What I want to do is take the contents of the clipboard an paste it into excel - then autisize the columns/rows if possible.
The following does the first part but I cant get the autosize to work
I think the syntax for the autofit is correct, but it keeps crashing .
Anyone got any ideas ??
Cheers
What I want to do is take the contents of the clipboard an paste it into excel - then autisize the columns/rows if possible.
The following does the first part but I cant get the autosize to work
Code: Select all
; open excel, create a new sheet and paste the contents of the clipboard
Define.COMateObject ExcelObject, WorkBook, WorkSheet
ExcelObject = COMate_CreateObject("Excel.Application")
If ExcelObject
If ExcelObject\SetProperty("Visible = #True") = #S_OK
WorkBook = ExcelObject\GetObjectProperty("Workbooks\Add")
If WorkBook
WorkSheet = ExcelObject\GetObjectProperty("Sheet1")
ExcelObject\Invoke("ActiveSheet\Paste")
; should autofit the columns - i think
;WorkSheet\Invoke("Columns('A:F')\AutoFit()")
WorkBook\Release()
EndIf
EndIf
ExcelObject\Release()
Else
MessageRequester("COMate -Excel demo", "Couldn't create the application object!")
EndIf
Anyone got any ideas ??
Cheers