简体   繁体   中英

how to save excel file using vb.net?

im stuck getting this error whenever i try to save excel in vb.. pleas someone help me what is wrong in this code:

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

the save statement gets the error Exception from HRESULT: 0x800A03EC

I made a simple test using the enum type for file format and it created the file without error. If this does nto work, please show a bit more of your coode:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM