我试过这个,但在保存文件时出错:
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)
有谁能告诉我我做错了什么?
答案 0 :(得分: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