I am trying to use a UDF (loaded from an add-in) to force the active workbook to execute a application.CalculateFullRebuild. I am aware that the user can simply do a CTRL+ALT+SHIFT+F9. And I am also aware that I can run a sub with one line with
line: application.CalculateFullRebuild
or like so:
Code:
Again, the idea is to get this to work using a function (UDF) rather than via a sub.Sub calfullrebuild() Dim thisbook As Workbook Set thisbook = ThisWorkbook With thisbook .application.CalculateFullRebuild End With End Sub
Or I would like the UDF to call this sub from an .xlam add-in that gets launched from XLStart.
Anyone have any ideas for code that will solve this? Thanks for viewing
Why would you do this? If you have a cell with a formula calling your special function, I think it will recal itself endlessly.
I am doing because the data that the UDF draws from (5 .dat files) is updated 1 x daily and is called via a dll. When the .dat files are changed and if Excel is already open and has instantiated the dll, I have difficulty getting excel to "bring in" the new data. I may not be explaining this exactly right but hopefully you get the point. So my question above is really just part of a much bigger issue I am trying to solve.
You cannot, as far as I am aware, force calculation from a UDF since it would affect the Excel environment beyond returning a value and that is (generally) not permissible.
Good luck.
Bummer. Thanks for the input.
I have just done some testing as this piqued my interest and it appears that:
application.calculate is ignored
Application.calculatefullrebuild does freeze excel
Range.calculate causes the function to error and terminate.
Good luck.
Did you try refreshing the addin by VBA ?
What does it mean to refresh the addin? Can you give an example? I did try to set the .cls file related to the dll to nothing, then unchecked the addin, then re-checked, then tried to instantiate the shelll.cls. But the existing functions on the open workbook did not update.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks