View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Excel Calculation Question

do you use ActiveCell in any of the code? If so, that may be the reason.

If you are trying to reference the cell with the formula, you would use

set rng = Application.Caller

to get a reference to that cell (as an example); not ActiveCell.

--
Regards,
Tom Ogilvy

"Johnny" wrote in message
oups.com...
Hi all,

I am writing VBA in an excel workbook that has a third-party add-in
loaded. The add-in basically provides function wrappers for calls to
their DLL that talks to an accounting system in Oracle. Anyway, I am
wrapping on of their wrappers to add a new function, and in this
wrapper it is necessary for me to use the evaluate method on some of
their functions. The logic in this routine works and the call to
Application.Evaluate works as expected. However, my wrapper initially
returns a #Value error. If I recalculate the workbook, the #Value
error persists. However, if I put the excel cursor on the cell that
has my custom wrapper in it and then calculate, the value appears
correctly.

Now this very well maybe a problem with the vendor's add-in, but before
I try to drill into their organization to find someone who knows what
they are talking about, I thought I would post here to see if this
sounds like an Excel thing. Specifically, I thought the Calculate
method applied to the entire application. If that's the case, then why
does it matter where the cursor happens to be in the UI when I hit F9
to calc?

Thanks in advance for any help,
Johnny