Reputation: 21
I have tried this, but get an error when saving the file:
X0 := ComObjCreate("Excel.Application") ;handle
X0.Visible := True ;by default excel sheets are invisible
X0.Workbooks.Add ;add a new workbook
X0.Range("A1").Value := "00123123" ;in Feld "A1" Text einfügen
Sleep 1000
test := "C:\test.xls"
X0.Excel.ActiveWorkbook.Save(test)
Can anybody tell me what I'm doing wrong?
Upvotes: 2
Views: 3915
Reputation: 1450
oExcel := ComObjCreate("Excel.Application")
oExcel.Visible := True
oExcel.Workbooks.Add
oExcel.Range("A1").Value := "00123123
Sleep 1000
testpath := "C:\test.xls"
oExcel.ActiveWorkbook.SaveAs(testpath)
The SaveAs method is the thing you need http://msdn.microsoft.com/en-us/library/office/ff841185.aspx
Also this may help http://www.autohotkey.com/board/topic/56987-com-object-reference-autohotkey-l/page-10#entry418122
Upvotes: 1