Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Create a Document and Save it from a WinForm

I developed a WinForm application wich takes some
information from a database and I want to write some data
to an .XLS document. When I execute the code it throws an
exception:

An unhandled exception of
type 'System.Runtime.InteropServices.COMException'
occurred in Excel Test 01.exe

Additional information: Old format or invalid type
library.

My Code:

Microsoft.Office.Interop.Excel.Application ap = new
Microsoft.Office.Interop.Excel.ApplicationClass();

Microsoft.Office.Interop.Excel.Workbook wb =
ap.Workbooks.Add(Type.Missing);

ap.Workbooks.Close();

I need to know how can I start the Application class
properly. Thanks.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a formatted 'readable' document based on Excel document? [email protected] Excel Discussion (Misc queries) 0 June 23rd 06 06:09 PM
HELP!!--unable to save document steph Excel Worksheet Functions 0 May 9th 06 02:59 PM
"Save as" will not work when trying to save a document in a folder Ernest Excel Discussion (Misc queries) 1 April 13th 06 06:48 AM
'document not saved' for 'save' or 'save as' an EXCEL file Judy Chuang Excel Discussion (Misc queries) 1 July 11th 05 10:12 PM
Document won't save glenlee Excel Discussion (Misc queries) 2 March 2nd 05 01:17 PM


All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"