My 开发者_C百科problem is occuring when I try to open a .xls document by MS Excel from C#, and this document contains macros. I'm using Microsoft.Office.Interop.Excel
library (v12). By this operation I'm getting an error in Microsoft Excel - a message box from Visual Basic says "Module not Found" and Visual Studio debugger stops also with an exception, "HRESULT 0x800A03EC".
How to solve this problem? I don't want to use macros saved with that file, but at least read cells values...
Excel is panicky about macros, it is a setting inside Excel that determines what it does when it sees one in an .xls file. In 2007 use Excel Options, Trust Center, Trust Center settings, Macro Settings. Select the "Disable all macros without notification" radio button.
IIRC, there is also an option in the Open method to suppress messages.
Try OLE DB for Excel. It will be better than using interop.
精彩评论