Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default updating a safearray in C++

Can you update a SafeArray size after you have created the
SafeArray sizes ? Here is the code in C++:

int TwoDimensionTableCount = 0;
VARIANT TwoDimensionArray;

void InitTable (int numberOfRows, int numberOfColumns)
{
VariantInit ( & TwoDimensionArray);
TwoDimensionArray.vt = VT_ARRAY | VT_VARIANT;
{
SAFEARRAYBOUND sab[2];
sab[0].lLbound = 1;
sab[0].cElements = numberOfRows;
sab[1].lLbound = 1;
sab[1].cElements = numberOfColumns;
TwoDimensionArray.parray = SafeArrayCreate (VT_VARIANT, 2, sab);
}
TwoDimensionTableCount = 0;
}

Thanks,
Lynn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default updating a safearray in C++

Can you update a SafeArray size after you have created the
SafeArray sizes ? Here is the code in C++:

int TwoDimensionTableCount = 0;
VARIANT TwoDimensionArray;

void InitTable (int numberOfRows, int numberOfColumns)
{
VariantInit ( & TwoDimensionArray);
TwoDimensionArray.vt = VT_ARRAY | VT_VARIANT;
{
SAFEARRAYBOUND sab[2];
sab[0].lLbound = 1;
sab[0].cElements = numberOfRows;
sab[1].lLbound = 1;
sab[1].cElements = numberOfColumns;
TwoDimensionArray.parray = SafeArrayCreate (VT_VARIANT, 2, sab);
}
TwoDimensionTableCount = 0;
}


I figured out that the initial number of rows in the SafeArray does
not matter as long as the SafeArray is big enough to hold all of
the potential number of rows. However, the number of columns in
the SafeArray cannot be varied.

Hope this helps someone else, it was a pain to figure out.

Lynn

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
Problem passing a large safearray to Excel Bill Below[_2_] Excel Programming 2 June 19th 06 05:40 PM
Retrieve Excel Cell Range into SAFEARRAY (VC++) Henry[_7_] Excel Programming 6 August 3rd 05 11:33 AM
SAFEARRAY [in] and [out] MB Blackburn Excel Programming 0 May 12th 05 10:08 PM
When updating a worksheet, how do I create a link updating the sa. Phlashh Excel Worksheet Functions 9 January 27th 05 06:05 PM
Fill a Range with VB SafeArray Rob[_17_] Excel Programming 3 April 9th 04 09:41 AM


All times are GMT +1. The time now is 04:26 AM.

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"