2013-02-28 93 views
0

IM卡得到這個錯誤,每當我嘗試保存Excel在VB ..認罪有人能幫助我什麼是錯在此代碼:如何使用vb.net保存excel文件?

 xlWorkBook = xlApp.Workbooks.Add 
     xlWorkSheet = xlWorkBook.Sheets("Sheet1") 
     xlWorkBook.SaveAs(Filename:="C:\Users\PB\Documents\thesis\bookrecord", FileFormat:="xlCSV") 
     xlApp.Visible = True 

保存聲明會從HRESULT錯誤例外:0x800A03EC

+1

把這個放在try-catch塊中,看看異常消息告訴你什麼。 – Jaxedin 2013-02-28 19:43:25

回答

1

我使用文件格式的枚舉類型做了一個簡單的測試,並且它創建了沒有錯誤的文件。如果這不起作用,請多顯示一下你的coode:

xlWorkBook.SaveAs(Filename:="C:\Users\PB\Documents\thesis\bookrecord", FileFormat:=XlFileFormat.xlCSV) 
+0

謝謝你的工作:) – user2107624 2013-02-28 23:42:13

+0

歡迎你。很高興我能幫上忙。 – 2013-03-01 03:32:41