ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   C++ automation problem (https://www.excelbanter.com/excel-programming/357062-c-automation-problem.html)

[email protected]

C++ automation problem
 
I'm using VC++ 6 to automate excel. I created a DLL that will make and
populate a workbook with some input data. Once of the parameters to
the function that creates and populates is a double pointer of
CStrings, which is basically a 2D array of all cell values. In the
last row, I want to send the SUM function to add all cells in the same
column is it. The CString is correctly formatted as

CString sString.Format("=SUM(G1:G%d)",dNumRows);

Where dNumRows is the number of rows in that particular spreadsheet.
Since the number of rows changes depending on how much data there is in
the backend DBs, which will grow in the future. Anyway.

In the actual spreadsheet, the cell that is supposed to contain this
string actually contains (in the formula bar) something that looks like
this:

for dNumRows = 1000,
{=SUM(M1000:M1999)}
for dNumRows = 820:
{=SUM(M1820:M1645)}

Why are there curly brackets? Why is my input string mangled with only
the data as the SUM parameters? Does this have something to do with
the version of Excel I'm using? (2003, btw). Thanks for any info.

-Benry



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com