2

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?

4

1 回答 1

1
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)

SaveAs 方法是您需要的东西http://msdn.microsoft.com/en-us/library/office/ff841185.aspx

这也可能有助于http://www.autohotkey.com/board/topic/56987-com-object-reference-autohotkey-l/page-10#entry418122

于 2013-06-26T22:06:24.013 回答