Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default cell reference in C-API xll


I have a function compiled into an xll add-in using a pascal version of
the C-API for getting the formula in a cell as a string. It needs the
row and column index of a cell and works fine.

However, I would rather have a cell as parameter than its indices,
giving a function like:
function GetFormulaInCellXl(var CellXl: TXloper): PxlOper; stdcall;

However I do not succeed in getting this right for xlfGetCell. It always
returns #VALUE. (I can also manage it to crash excel)

Question: How do you get the row,col values of a cell that is parameter
to a function. (tips using C also welcome.)

The essential lines of the working version are below:

function GetFormulaXl(var RowXl, ColXl: TXloper): PxlOper; stdcall;
....
.... get row and col from XlOpers RowXl, ColXl
....
//Set reference
ref.xlType := xltypesref;
ref.val.sref.Count := 1;
with ref.val.sref.xlref do
begin
firstrow := Row;
firstcol := Col;
lastrow := Row;
lastcol := Col;
end;
tempInt.xlType := xlTypeInt;
tempInt.val.int := 6;
xlresult := _Excel4v(xlfGetCell, @ResultXlOper,
2, [@TempInt, @Ref]);
//Returns the formula in the default reference style
//xlfGetFormula would return R1C1 style
//_Excel4v is excel4v with "asm pop sink end;"
//for removing 4 bytes left by Excel4v function call
end;
result := @ResultXlOper;
....


It is registered with 'PPP#' as type

Thanks,
Janwillem
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default cell reference in C-API xll

Hi Janwillem,

Questions about Excel's C Api and xlls are generally answered in the
Public.Excel.sdk newsgroup. You might like to repost your question
there.

Regards

Stephen Bullen
Microsoft MVP - Excel


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
Nesting a sheet name reference within a cell reference??? Broyston Excel Discussion (Misc queries) 9 July 8th 08 08:35 PM
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
absolute cell reference A spreadsheet cell reference that does no help Excel Discussion (Misc queries) 1 January 18th 06 06:56 PM
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. [email protected] Excel Worksheet Functions 2 December 11th 04 12:05 AM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


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