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: 5
Default Opening Excel with a stream

Hi All,

I am trying to get Excel to open using the contents of a stream that I
have populated from a database. Are there any samples/examples I can
review /

The code looks something like this (although I have removed error
handling for clarity):

ADO::_RecordsetPtr pRS("ADODB.Recordset",false);

_variant_t vRows;
_bstr_t bstrSelect("SELECT * from MyTable where name = 'Mysheet'");
pRS = m_pConn-Execute(bstrSelect, &vRows,0);

ADO::_StreamPtr pStr("ADODB.Stream");
pStr-Type = ADO::adTypeBinary;
pStr-Open
(vtMissing,ADO::adModeUnknown,ADO::adOpenStreamUns pecified,"","");

pStr-Write(pRS-GetFields()-GetItem((_variant_t)"DATA")-GetValue());


This works as I can use the following to open the spreadsheet
_bstr_t bstrFile("C:\Tmp\MySheet.xls");
pStr-SaveToFile(bstrFile,ADO::adSaveCreateNotExist);
LPDISPATCH lpDisp;
m_app.CreateDispatch("Excel.Application")lpDisp = m_app.GetWorkbooks();
ASSERT(lpDisp);
m_books.AttachDispatch(lpDisp);
m_books.Open
(bstrFile,vOpt,vOpt,vOpt,vOpt,vOpt,vOpt,vOpt,vOpt, vOpt,vOpt,vOpt,vOpt);


 
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 calculate IRR from a monthly income stream rflegeis Excel Discussion (Misc queries) 2 February 10th 06 09:07 PM
stream read error bembaman Excel Discussion (Misc queries) 3 December 23rd 05 04:53 AM
PV of uneven stream of cash flows PJF Excel Worksheet Functions 8 October 30th 05 01:16 AM
How can I figure present value of a stream of payments? shep New Users to Excel 1 December 9th 04 10:05 PM
Command Button Code Stream lining JDonaghue Excel Programming 1 November 11th 03 07:47 PM


All times are GMT +1. The time now is 10:38 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"