C++ Excel Function causes crash when linked to random cells

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

mcmcman

Thread Starter
Joined
Sep 15, 2003
Messages
2
Hi,

I have written a Multivariate Normal C++ function and exported it into a DLL so that I can use it in my VBA Programs. In addition, I have written a VBA function that allows me to use the multivariate Normal function in my Excel spreadsheets.

The function works fine as long as it is linked to only non-random cells. If I try linking it to random cells, however, the function only works if the cells are made random after the links are established. If the cells are random at the time I enter my function, Excel crashes. The following illustrates the dependence on the order in which the functions are entered.

Linking Method A: (Works)

1. My function is entered into cell A3 and is linked to cells A1 and A2, where A1 contains the number 0 and A2 the number 1

2. The rand() function is entered into cells A1 and A2

My function produces the desired results and can be refreshed using the F9 key

Linking Method B: (Does not Work)

1. The rand() function is entered into cells A1 and A2
2. My function is entered into cell A3 and is linked to cells A1 and A2.

The entry of my function into cell A3 causes Excel to crash...

I have tried a number of different things but have been unable to figure out why this dependence exists. I think it must have something to do with how excel sets up its links between the different cells. I am hoping to create an add-in that uses the function and want to avoid these crashes.

Does anyone have an idea of how I can get around this problem?

Additional information:

The Multivariate normal C++ function takes pointers to Safearrays as its arguments. In a univariate normal function, I passed pointers to doubles and the problem does not occur for that function. I can provide additional details if it would help in solving the problem.

mcmcman
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top