LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Microsoft.Office.Interop.Excel.Application

Hi All,


I am using Microsoft.Office.Interop.Excel.Application COM to create a Excel
spreadsheet, and write the value (not from any dataset) into that
spreadsheet, and then StreamWrite to the disk.

For some reason, the following code is not working.

This is the declaration of ws:
Microsoft.Office.Interop.Excel.Worksheet ws
=(Microsoft.Office.Interop.Excel.Worksheet)wb.Work sheets[1];

ws.Cells[1, 1] = "CardNo";
ws.Cells[1, 2] = "PharmacyName";
ws.Cells[1, 3] = "CostPerCard";

sw.Writer(ws.Cells[1, 1]);
sw.Writer(ws.Cells[1, 2]);
sw.Writer(ws.Cells[1, 3]);

I thought this code will write to the spreadsheet like this:
A | B | C
-----------------------------------------------
CardNo | PharmacyName | CostPerCard

but, it wrote to spreasheet like this, all them just in column A:
A
-----------------------------------------------
System.__ComObjectSystem.__ComObjectSystem.__ComOb jectH40655


I have been spent quite lots of time on it, but still couldn't work it out.

Thanks heaps

 
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
Microsoft.Office.Interop.Excel when exporting from another program Colin Excel Discussion (Misc queries) 0 January 2nd 09 06:08 AM
Microsoft.Office.Interop.Excel Texttocolumns C# Cheryl[_5_] Excel Programming 1 April 6th 07 08:40 PM
Where can I find Microsoft.Office.Interop.Excel.dll? Fred Abrahamian Excel Programming 1 December 17th 06 10:52 PM
COMException With Microsoft.Office.Interop.Excel frankvfox Excel Programming 4 September 27th 06 04:36 PM
Microsoft.Office.Interop.Excel SaveAs error when clicking no or ca NeedsExcelAssistance Excel Programming 0 July 14th 06 02:50 PM


All times are GMT +1. The time now is 01:54 AM.

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

About Us

"It's about Microsoft Excel"