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: 47
Default sending an array to Excel

Does anyone have experience with sending an array of information to
Excel using OLE Automation and C++ ? I am looking for a way to speed
up the sending of data from our app to Excel. Currently, we send
data to Excel a cell at a time using the following code:

void PutDoubleInTableHorizontal (int row, int column, int count, const double num [])
{
// put the doubles in horizontally
for (int i = 0; i < count; i++)
{
if (uninitializedValue == num [i])
continue;
std::string cellAddress = GetCellEquivalent (row, column + i);
VARIANT result1;
VariantInit ( & result1);
VARIANT range;
VariantInit ( & range);
range.vt = VT_BSTR;
_bstr_t address = _bstr_t (cellAddress.c_str ());
range.bstrVal = address;
OLEMethod (DISPATCH_PROPERTYGET, & result1, pExcelSheet, L"Range", 1, range);
if (result1.vt == VT_DISPATCH)
{
VARIANT result2;
VariantInit ( & result2);
VARIANT value;
VariantInit ( & value);
value.vt = VT_R8;
value.dblVal = num [i];
OLEMethod (DISPATCH_PROPERTYPUT, & result2, result1.pdispVal, L"Value", 1, value);
int res = result2.vt;
result1.pdispVal - Release ();
}
}
}

I am wondering if sending an array of cells to Excel would be faster ?

Sincerely,
Lynn McGuire
 
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
Sending An Email In Excel Programmatically W/O Sending An Object [email protected] Excel Programming 8 December 1st 08 09:35 PM
Sending SMS from excel yshridhar Excel Programming 1 October 13th 08 01:47 PM
sending excel Pammy Excel Discussion (Misc queries) 2 October 7th 08 04:05 PM
Sending array data to Word with DDEPoke VC[_2_] Excel Programming 0 November 9th 03 03:19 AM
Sending an array to DLL Function Domagoj Vulin Excel Programming 1 July 17th 03 11:08 AM


All times are GMT +1. The time now is 06:08 PM.

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"