문제

I am using Microsoft.Office.Interop.Excel in a C# winform but I can't figure out how to create a new Excel workbook. I have tried everything in the documentation but I get nothing but errors. Workbook wb = new Workbook() compiles just fine but throws an incomprehensible runtime error.

도움이 되었습니까?

해결책

You are probably getting the same error as you would get if you tried to instantiate a Workbook in Excel VBA using

Dim w As Workbook
Set w = New Workbook

Try instantiating the Application object, then call the Application.Workbooks.Add method. It takes an optional parameter, which is the name of a template.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top