Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Update of UDF (User Defined Function)

Hi

I'm developing a COM Addin and an Automation Addin for Excel XP and 2003.
The COM Addin is loaded at startup and it checks that the Automation Addin
is loaded. All this works fine.

The Automation Addin consists of a single function, GetProp, which returns
a CustomDocumentProperty value.
I can for instance type =GetProp("su_title") in a cell and return the value
from
that perticular property.

The "problem" is that the next time I open the spreadsheet, the value is not
updated until I edit the cell (F2) and presses Enter.
Also, the formula reads =EXComFunctions.XLFunctions.GetProp("su_title")
rather than =GetProp("su_title") until I edit the cell (F2) and presses Enter.

F9 (Updating) does not make any difference.

Does anyone know how to solve this?

Thanks in advance

--
Peter Karlström
Midrange AB
Sweden
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Update of UDF (User Defined Function)

There is notihing about a change to a document property that will cause the
cell to believe that it needs to be recalculated so it will not change until
you edit the formula and it must be re-evaluated. To fix this you can add
Application.Volatile
to they function. This will make the function volatile (similar to now())
and it will be re-evaluated every time a calculation occures.
--
HTH...

Jim Thomlinson


"Peter Karlström" wrote:

Hi

I'm developing a COM Addin and an Automation Addin for Excel XP and 2003.
The COM Addin is loaded at startup and it checks that the Automation Addin
is loaded. All this works fine.

The Automation Addin consists of a single function, GetProp, which returns
a CustomDocumentProperty value.
I can for instance type =GetProp("su_title") in a cell and return the value
from
that perticular property.

The "problem" is that the next time I open the spreadsheet, the value is not
updated until I edit the cell (F2) and presses Enter.
Also, the formula reads =EXComFunctions.XLFunctions.GetProp("su_title")
rather than =GetProp("su_title") until I edit the cell (F2) and presses Enter.

F9 (Updating) does not make any difference.

Does anyone know how to solve this?

Thanks in advance

--
Peter Karlström
Midrange AB
Sweden

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Update of UDF (User Defined Function)

Hi Jim

Thanks for your reply.
Maybe I was fuzzy about the art of my problem.

The Automation Addins works fine and updates automatically but only
after I edit the cell and pressed Enter 1 first time.
After that, every change in data updates if I for instance change a value
in another cell.

I use Volatile in the code, but it seems that something must "wake the code
up"
before it automatically updates.

Any suggestions?

Regards
--
Peter Karlström
Midrange AB
Sweden


"Jim Thomlinson" wrote:

There is notihing about a change to a document property that will cause the
cell to believe that it needs to be recalculated so it will not change until
you edit the formula and it must be re-evaluated. To fix this you can add
Application.Volatile
to they function. This will make the function volatile (similar to now())
and it will be re-evaluated every time a calculation occures.
--
HTH...

Jim Thomlinson


"Peter Karlström" wrote:

Hi

I'm developing a COM Addin and an Automation Addin for Excel XP and 2003.
The COM Addin is loaded at startup and it checks that the Automation Addin
is loaded. All this works fine.

The Automation Addin consists of a single function, GetProp, which returns
a CustomDocumentProperty value.
I can for instance type =GetProp("su_title") in a cell and return the value
from
that perticular property.

The "problem" is that the next time I open the spreadsheet, the value is not
updated until I edit the cell (F2) and presses Enter.
Also, the formula reads =EXComFunctions.XLFunctions.GetProp("su_title")
rather than =GetProp("su_title") until I edit the cell (F2) and presses Enter.

F9 (Updating) does not make any difference.

Does anyone know how to solve this?

Thanks in advance

--
Peter Karlström
Midrange AB
Sweden

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Update of UDF (User Defined Function)

I have not tried using Volatile in a COM addin. Have you tried...

Shift + Ctrl + ALT + F9

Which is a full calculation of all formulas. Did that refresh your value...
--
HTH...

Jim Thomlinson


"Peter Karlström" wrote:

Hi Jim

Thanks for your reply.
Maybe I was fuzzy about the art of my problem.

The Automation Addins works fine and updates automatically but only
after I edit the cell and pressed Enter 1 first time.
After that, every change in data updates if I for instance change a value
in another cell.

I use Volatile in the code, but it seems that something must "wake the code
up"
before it automatically updates.

Any suggestions?

Regards
--
Peter Karlström
Midrange AB
Sweden


"Jim Thomlinson" wrote:

There is notihing about a change to a document property that will cause the
cell to believe that it needs to be recalculated so it will not change until
you edit the formula and it must be re-evaluated. To fix this you can add
Application.Volatile
to they function. This will make the function volatile (similar to now())
and it will be re-evaluated every time a calculation occures.
--
HTH...

Jim Thomlinson


"Peter Karlström" wrote:

Hi

I'm developing a COM Addin and an Automation Addin for Excel XP and 2003.
The COM Addin is loaded at startup and it checks that the Automation Addin
is loaded. All this works fine.

The Automation Addin consists of a single function, GetProp, which returns
a CustomDocumentProperty value.
I can for instance type =GetProp("su_title") in a cell and return the value
from
that perticular property.

The "problem" is that the next time I open the spreadsheet, the value is not
updated until I edit the cell (F2) and presses Enter.
Also, the formula reads =EXComFunctions.XLFunctions.GetProp("su_title")
rather than =GetProp("su_title") until I edit the cell (F2) and presses Enter.

F9 (Updating) does not make any difference.

Does anyone know how to solve this?

Thanks in advance

--
Peter Karlström
Midrange AB
Sweden

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Update of UDF (User Defined Function)

Hi Jim

Thanks. It actually did it!

So, I solved my problem by running the following code in the WorkBookOpen
event: ExcelApp.CalculateFull, which apparently is the same as
CTRL+Alt+Shift+F9.

Regards
--
Peter Karlström
Midrange AB
Sweden


"Jim Thomlinson" wrote:

I have not tried using Volatile in a COM addin. Have you tried...

Shift + Ctrl + ALT + F9

Which is a full calculation of all formulas. Did that refresh your value...
--
HTH...

Jim Thomlinson


"Peter Karlström" wrote:

Hi Jim

Thanks for your reply.
Maybe I was fuzzy about the art of my problem.

The Automation Addins works fine and updates automatically but only
after I edit the cell and pressed Enter 1 first time.
After that, every change in data updates if I for instance change a value
in another cell.

I use Volatile in the code, but it seems that something must "wake the code
up"
before it automatically updates.

Any suggestions?

Regards
--
Peter Karlström
Midrange AB
Sweden


"Jim Thomlinson" wrote:

There is notihing about a change to a document property that will cause the
cell to believe that it needs to be recalculated so it will not change until
you edit the formula and it must be re-evaluated. To fix this you can add
Application.Volatile
to they function. This will make the function volatile (similar to now())
and it will be re-evaluated every time a calculation occures.
--
HTH...

Jim Thomlinson


"Peter Karlström" wrote:

Hi

I'm developing a COM Addin and an Automation Addin for Excel XP and 2003.
The COM Addin is loaded at startup and it checks that the Automation Addin
is loaded. All this works fine.

The Automation Addin consists of a single function, GetProp, which returns
a CustomDocumentProperty value.
I can for instance type =GetProp("su_title") in a cell and return the value
from
that perticular property.

The "problem" is that the next time I open the spreadsheet, the value is not
updated until I edit the cell (F2) and presses Enter.
Also, the formula reads =EXComFunctions.XLFunctions.GetProp("su_title")
rather than =GetProp("su_title") until I edit the cell (F2) and presses Enter.

F9 (Updating) does not make any difference.

Does anyone know how to solve this?

Thanks in advance

--
Peter Karlström
Midrange AB
Sweden



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Update of UDF (User Defined Function)

Even Application.Volatile will only recalculate the function if Excel thinks any recalculation is necessary.

In the worksheet, use
=YourFunction()+NOW()*0

This should force a recalc on loading
Please let us know if it helps

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Peter Karlström" wrote in message ...
| Hi Jim
|
| Thanks for your reply.
| Maybe I was fuzzy about the art of my problem.
|
| The Automation Addins works fine and updates automatically but only
| after I edit the cell and pressed Enter 1 first time.
| After that, every change in data updates if I for instance change a value
| in another cell.
|
| I use Volatile in the code, but it seems that something must "wake the code
| up"
| before it automatically updates.
|
| Any suggestions?
|
| Regards
| --
| Peter Karlström
| Midrange AB
| Sweden
|
|
| "Jim Thomlinson" wrote:
|
| There is notihing about a change to a document property that will cause the
| cell to believe that it needs to be recalculated so it will not change until
| you edit the formula and it must be re-evaluated. To fix this you can add
| Application.Volatile
| to they function. This will make the function volatile (similar to now())
| and it will be re-evaluated every time a calculation occures.
| --
| HTH...
|
| Jim Thomlinson
|
|
| "Peter Karlström" wrote:
|
| Hi
|
| I'm developing a COM Addin and an Automation Addin for Excel XP and 2003.
| The COM Addin is loaded at startup and it checks that the Automation Addin
| is loaded. All this works fine.
|
| The Automation Addin consists of a single function, GetProp, which returns
| a CustomDocumentProperty value.
| I can for instance type =GetProp("su_title") in a cell and return the value
| from
| that perticular property.
|
| The "problem" is that the next time I open the spreadsheet, the value is not
| updated until I edit the cell (F2) and presses Enter.
| Also, the formula reads =EXComFunctions.XLFunctions.GetProp("su_title")
| rather than =GetProp("su_title") until I edit the cell (F2) and presses Enter.
|
| F9 (Updating) does not make any difference.
|
| Does anyone know how to solve this?
|
| Thanks in advance
|
| --
| Peter Karlström
| Midrange AB
| Sweden


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
Cells w/ user defined function do not auto update John Excel Worksheet Functions 2 September 14th 08 07:06 PM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
Need to open the Function Arguments window from VBA for a user defined function. [email protected] Excel Programming 0 June 20th 06 03:53 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


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

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"