![]() |
Enabling add-in causes excel to crash
I am using Excel 2007...and saving everything as Office Excel 97-2003
Worksheet. I created an Excel 97-2003 Add-in called CompFxnsAddIn.xla which contains the code at the bottom of this post. The code seems to work fine...giving me the expected values, etc (they are intended to be used on a timeseries in a single column). Anyway, now everytime I open the file, I get the following notification: "Excel experienced a serious problem with the CompFxnsAddIn add-in. If you have seen this message mutiple times you should disable this add- in and check to see if an update is available. Do you want to disable this add-in?" If I click no, Excel crashes. If I click yes, Excel loads. But then when I go into Excel options/Add-Ins and check the compfxnsaddin box, Excel crashes. The only way I was able to get it to load was to enable/install Solver Add-In and then afterwards it allowed me to enable my add-in. However, next time I opened the file even disabling and re-enabling Solver Add-In failed to work. I had to load something else new (Conditional Sum Wizard) at the same time. Obviously I'm going to run out of new add-ins to load very soon, but I don't understand what is happening. I don't believe it has anything to do with the VBA code....but I posted it just in case. I was unable to google any other mention of something that seemed relevant to this....but I am quickly getting fed up with the 20 minute delays each time I want to get in the file. Any help???? Please..... Oh....and I'm running Windows XP. -------------CompFxnsAddIn.xla code--------------------------------------- Public Function HigherThanB4(cell As Range, ByVal rowsback As Integer) As Integer Dim d1 As Double Dim d2 As Double d1 = cell d2 = cell.Offset(-rowsback) Select Case d1 d2 Case True HigherThanB4 = 1 Case False HigherThanB4 = 0 End Select End Function Public Function LowerThanB4(cell As Range, ByVal rowsback As Integer) As Integer Dim d1 As Double Dim d2 As Double d1 = cell d2 = cell.Offset(-rowsback) Select Case d1 < d2 Case True LowerThanB4 = 1 Case False LowerThanB4 = 0 End Select End Function Public Function HigherThanMA(cell As Range, ByVal MAperiod As Integer) As Integer d1 = cell d2 = WorksheetFunction.Average(Range(cell, cell.Offset(-MAperiod + 1, 0))) Select Case d1 d2 Case True HigherThanMA = 1 Case False HigherThanMA = 0 End Select End Function Public Function LowerThanMA(cell As Range, ByVal MAperiod As Integer) As Integer d1 = cell d2 = WorksheetFunction.Average(Range(cell, cell.Offset(-MAperiod + 1, 0))) Select Case d1 < d2 Case True LowerThanMA = 1 Case False LowerThanMA = 0 End Select End Function |
Enabling add-in causes excel to crash
Hello 3, Not having Excel 2007 I can't why you're having this problem, but here a few things to keep in mind. When you create an add-in you need to have code that will handle any possible errors. Case in point, if the user passes rowsback and it it is greater the number of rows to the active cell, you will get an error and everything grinds to halt. The other problem here that can cause an error is rowsback is typed as an integer. Rows should always be typed as long, unless you are sure you will never exceed the integer limit. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45167 |
Enabling add-in causes excel to crash
I don't believe it has anything to do with the VBA code
I agree. If that is truly all there is to this add-in I think I try recreating it from scratch. It may be corrupted. -- Jim "3" wrote in message ... |I am using Excel 2007...and saving everything as Office Excel 97-2003 | Worksheet. I created an Excel 97-2003 Add-in called CompFxnsAddIn.xla | which contains the code at the bottom of this post. | | The code seems to work fine...giving me the expected values, etc (they | are intended to be used on a timeseries in a single column). Anyway, | now everytime I open the file, I get the following notification: | "Excel experienced a serious problem with the CompFxnsAddIn add-in. If | you have seen this message mutiple times you should disable this add- | in and check to see if an update is available. Do you want to disable | this add-in?" | | If I click no, Excel crashes. If I click yes, Excel loads. But then | when I go into Excel options/Add-Ins and check the compfxnsaddin box, | Excel crashes. | | The only way I was able to get it to load was to enable/install Solver | Add-In and then afterwards it allowed me to enable my add-in. | However, next time I opened the file even disabling and re-enabling | Solver Add-In failed to work. I had to load something else new | (Conditional Sum Wizard) at the same time. Obviously I'm going to run | out of new add-ins to load very soon, but I don't understand what is | happening. I don't believe it has anything to do with the VBA | code....but I posted it just in case. | | I was unable to google any other mention of something that seemed | relevant to this....but I am quickly getting fed up with the 20 minute | delays each time I want to get in the file. | | Any help???? Please..... | | Oh....and I'm running Windows XP. | | -------------CompFxnsAddIn.xla | code--------------------------------------- | | Public Function HigherThanB4(cell As Range, ByVal rowsback As Integer) | As Integer | Dim d1 As Double | Dim d2 As Double | | d1 = cell | d2 = cell.Offset(-rowsback) | | Select Case d1 d2 | Case True | HigherThanB4 = 1 | Case False | HigherThanB4 = 0 | End Select | End Function | | Public Function LowerThanB4(cell As Range, ByVal rowsback As Integer) | As Integer | Dim d1 As Double | Dim d2 As Double | | d1 = cell | d2 = cell.Offset(-rowsback) | | Select Case d1 < d2 | Case True | LowerThanB4 = 1 | Case False | LowerThanB4 = 0 | End Select | End Function | | Public Function HigherThanMA(cell As Range, ByVal MAperiod As Integer) | As Integer | d1 = cell | d2 = WorksheetFunction.Average(Range(cell, cell.Offset(-MAperiod + | 1, 0))) | | Select Case d1 d2 | Case True | HigherThanMA = 1 | Case False | HigherThanMA = 0 | End Select | End Function | | Public Function LowerThanMA(cell As Range, ByVal MAperiod As Integer) | As Integer | d1 = cell | d2 = WorksheetFunction.Average(Range(cell, cell.Offset(-MAperiod + | 1, 0))) | | Select Case d1 < d2 | Case True | LowerThanMA = 1 | Case False | LowerThanMA = 0 | End Select | End Function |
All times are GMT +1. The time now is 12:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com