PC Review


Reply
Thread Tools Rate Thread

Custom Addin Reference Crashes Excel

 
 
sdwalker
Guest
Posts: n/a
 
      3rd Apr 2008
I have a very challenging issue for you. I have created a custom addin that
contains common code that can be used across many workbooks. I add a
reference to the addin in my workbook and the 1st time that it calls the
addin, things run fine. If I then save the workbook, reopen and call the
addin again, Excel crashes. My issue can be duplicated by doing the
following.

1) Close any other workbooks in Excel, so that you don't lose anything.
2) Create an addin with a single function ... say ...
Public Function ReturnString() as String
ReturnString = "Test"
End Function
3) Save this addin locally
4) Create a new workbook
5) In the Visual Basic Editor, add a reference to this addin
6) Create a button on Sheet1 and have it point to code that says ...
Range("A1").value = MyAddin.ReturnString
7) Save the workbook, click the button and everything works fine.
8) Now, delete the text from cell A1, save the workbook and close Excel.
9) Reopen the workbook and click the button.
10) Observe Excel crash

Why is this happening?

Would anyone be willing to take this on? It will take about 5-10 minutes to
duplicate. It is killing my coworkers and me ... we can't figure it out.

Thanks in advance,

Scott
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      3rd Apr 2008

Load the add-in from Tools (menu) | Add-Ins by check marking the add-in name.
If you do that the add-in will be opened when Excel is opened.
That will probably eliminate your crash problem.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"sdwalker"
wrote in message
I have a very challenging issue for you. I have created a custom addin that
contains common code that can be used across many workbooks. I add a
reference to the addin in my workbook and the 1st time that it calls the
addin, things run fine. If I then save the workbook, reopen and call the
addin again, Excel crashes. My issue can be duplicated by doing the
following.

1) Close any other workbooks in Excel, so that you don't lose anything.
2) Create an addin with a single function ... say ...
Public Function ReturnString() as String
ReturnString = "Test"
End Function
3) Save this addin locally
4) Create a new workbook
5) In the Visual Basic Editor, add a reference to this addin
6) Create a button on Sheet1 and have it point to code that says ...
Range("A1").value = MyAddin.ReturnString
7) Save the workbook, click the button and everything works fine.
8) Now, delete the text from cell A1, save the workbook and close Excel.
9) Reopen the workbook and click the button.
10) Observe Excel crash

Why is this happening?

Would anyone be willing to take this on? It will take about 5-10 minutes to
duplicate. It is killing my coworkers and me ... we can't figure it out.

Thanks in advance,

Scott
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      3rd Apr 2008
Pretty sure I replicated all your instructions, no problems, no crash, all
worked as expected.

Did you rename your addin's project name from default "VBAProject", if not
maybe that is causing some confusion with similarly named projects

Regards,
Peter T

"sdwalker" <(E-Mail Removed)> wrote in message
news:F1AEADD2-459B-413A-ADFB-(E-Mail Removed)...
> I have a very challenging issue for you. I have created a custom addin

that
> contains common code that can be used across many workbooks. I add a
> reference to the addin in my workbook and the 1st time that it calls the
> addin, things run fine. If I then save the workbook, reopen and call the
> addin again, Excel crashes. My issue can be duplicated by doing the
> following.
>
> 1) Close any other workbooks in Excel, so that you don't lose anything.
> 2) Create an addin with a single function ... say ...
> Public Function ReturnString() as String
> ReturnString = "Test"
> End Function
> 3) Save this addin locally
> 4) Create a new workbook
> 5) In the Visual Basic Editor, add a reference to this addin
> 6) Create a button on Sheet1 and have it point to code that says ...
> Range("A1").value = MyAddin.ReturnString
> 7) Save the workbook, click the button and everything works fine.
> 8) Now, delete the text from cell A1, save the workbook and close Excel.
> 9) Reopen the workbook and click the button.
> 10) Observe Excel crash
>
> Why is this happening?
>
> Would anyone be willing to take this on? It will take about 5-10 minutes

to
> duplicate. It is killing my coworkers and me ... we can't figure it out.
>
> Thanks in advance,
>
> Scott



 
Reply With Quote
 
sdwalker
Guest
Posts: n/a
 
      3rd Apr 2008
Peter. Thanks for trying. We did use a different project name, but still
had the problem.

Thanks again,

Scott

"Peter T" wrote:

> Pretty sure I replicated all your instructions, no problems, no crash, all
> worked as expected.
>
> Did you rename your addin's project name from default "VBAProject", if not
> maybe that is causing some confusion with similarly named projects
>
> Regards,
> Peter T
>
> "sdwalker" <(E-Mail Removed)> wrote in message
> news:F1AEADD2-459B-413A-ADFB-(E-Mail Removed)...
> > I have a very challenging issue for you. I have created a custom addin

> that
> > contains common code that can be used across many workbooks. I add a
> > reference to the addin in my workbook and the 1st time that it calls the
> > addin, things run fine. If I then save the workbook, reopen and call the
> > addin again, Excel crashes. My issue can be duplicated by doing the
> > following.
> >
> > 1) Close any other workbooks in Excel, so that you don't lose anything.
> > 2) Create an addin with a single function ... say ...
> > Public Function ReturnString() as String
> > ReturnString = "Test"
> > End Function
> > 3) Save this addin locally
> > 4) Create a new workbook
> > 5) In the Visual Basic Editor, add a reference to this addin
> > 6) Create a button on Sheet1 and have it point to code that says ...
> > Range("A1").value = MyAddin.ReturnString
> > 7) Save the workbook, click the button and everything works fine.
> > 8) Now, delete the text from cell A1, save the workbook and close Excel.
> > 9) Reopen the workbook and click the button.
> > 10) Observe Excel crash
> >
> > Why is this happening?
> >
> > Would anyone be willing to take this on? It will take about 5-10 minutes

> to
> > duplicate. It is killing my coworkers and me ... we can't figure it out.
> >
> > Thanks in advance,
> >
> > Scott

>
>
>

 
Reply With Quote
 
sdwalker
Guest
Posts: n/a
 
      3rd Apr 2008
Jim. Thanks for the reply!!

We thought we tried that, but we'll do it again. We found a workaround for
it. If we add a line of code to the Workbook_Open event of the ADD-IN (not
the spreadsheet), then everything works fine. We just added a DoEvents
statement and that did it.

I think you're on to something regarding the add-in being opened when Excel
opens. We were trying to get away from each user having to individually add
the add-in to their instance of Excel.

Again, I think we have a workaround, but we're not exactly sure WHY it's
working.

Thanks again for your assistance!!

sdwalker

"Jim Cone" wrote:

>
> Load the add-in from Tools (menu) | Add-Ins by check marking the add-in name.
> If you do that the add-in will be opened when Excel is opened.
> That will probably eliminate your crash problem.
> --
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware
> (Excel Add-ins / Excel Programming)
>
>
>
>
> "sdwalker"
> wrote in message
> I have a very challenging issue for you. I have created a custom addin that
> contains common code that can be used across many workbooks. I add a
> reference to the addin in my workbook and the 1st time that it calls the
> addin, things run fine. If I then save the workbook, reopen and call the
> addin again, Excel crashes. My issue can be duplicated by doing the
> following.
>
> 1) Close any other workbooks in Excel, so that you don't lose anything.
> 2) Create an addin with a single function ... say ...
> Public Function ReturnString() as String
> ReturnString = "Test"
> End Function
> 3) Save this addin locally
> 4) Create a new workbook
> 5) In the Visual Basic Editor, add a reference to this addin
> 6) Create a button on Sheet1 and have it point to code that says ...
> Range("A1").value = MyAddin.ReturnString
> 7) Save the workbook, click the button and everything works fine.
> 8) Now, delete the text from cell A1, save the workbook and close Excel.
> 9) Reopen the workbook and click the button.
> 10) Observe Excel crash
>
> Why is this happening?
>
> Would anyone be willing to take this on? It will take about 5-10 minutes to
> duplicate. It is killing my coworkers and me ... we can't figure it out.
>
> Thanks in advance,
>
> Scott
>

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      3rd Apr 2008
I confess I am slightly curious as to why Jim's idea might solve the
problem, or why your addition of DoEvents appears to help

Normally when a reference to FileB has been added to FileA, when FileA opens
FileB will automatically open (if not already open as it might be if an
installed Addin) assuming of course the fileB can be found. At least that's
how it works for me.

Regards,
Peter T


"sdwalker" <(E-Mail Removed)> wrote in message
news:5753DB62-B545-44B7-B0E0-(E-Mail Removed)...
> Jim. Thanks for the reply!!
>
> We thought we tried that, but we'll do it again. We found a workaround

for
> it. If we add a line of code to the Workbook_Open event of the ADD-IN

(not
> the spreadsheet), then everything works fine. We just added a DoEvents
> statement and that did it.
>
> I think you're on to something regarding the add-in being opened when

Excel
> opens. We were trying to get away from each user having to individually

add
> the add-in to their instance of Excel.
>
> Again, I think we have a workaround, but we're not exactly sure WHY it's
> working.
>
> Thanks again for your assistance!!
>
> sdwalker
>
> "Jim Cone" wrote:
>
> >
> > Load the add-in from Tools (menu) | Add-Ins by check marking the

add-in name.
> > If you do that the add-in will be opened when Excel is opened.
> > That will probably eliminate your crash problem.
> > --
> > Jim Cone
> > San Francisco, USA
> > http://www.realezsites.com/bus/primitivesoftware
> > (Excel Add-ins / Excel Programming)
> >
> >
> >
> >
> > "sdwalker"
> > wrote in message
> > I have a very challenging issue for you. I have created a custom addin

that
> > contains common code that can be used across many workbooks. I add a
> > reference to the addin in my workbook and the 1st time that it calls the
> > addin, things run fine. If I then save the workbook, reopen and call

the
> > addin again, Excel crashes. My issue can be duplicated by doing the
> > following.
> >
> > 1) Close any other workbooks in Excel, so that you don't lose anything.
> > 2) Create an addin with a single function ... say ...
> > Public Function ReturnString() as String
> > ReturnString = "Test"
> > End Function
> > 3) Save this addin locally
> > 4) Create a new workbook
> > 5) In the Visual Basic Editor, add a reference to this addin
> > 6) Create a button on Sheet1 and have it point to code that says ...
> > Range("A1").value = MyAddin.ReturnString
> > 7) Save the workbook, click the button and everything works fine.
> > 8) Now, delete the text from cell A1, save the workbook and close Excel.
> > 9) Reopen the workbook and click the button.
> > 10) Observe Excel crash
> >
> > Why is this happening?
> >
> > Would anyone be willing to take this on? It will take about 5-10

minutes to
> > duplicate. It is killing my coworkers and me ... we can't figure it

out.
> >
> > Thanks in advance,
> >
> > Scott
> >



 
Reply With Quote
 
Alan124
Guest
Posts: n/a
 
      11th Apr 2008
On Apr 4, 3:18*am, "Peter T" <peter_t@discussions> wrote:
> I confess I am slightly curious as to why Jim's idea might solve the
> problem, or why your addition of DoEvents appears to help
>
> Normally when a reference to FileB has been added to FileA, when FileA opens
> FileB will automatically open (if not already open as it might be if an
> installed Addin) assuming of course the fileB can be found. At least that's
> how it works for me.
>
> Regards,
> Peter T
>
> "sdwalker" <sdwal...@discussions.microsoft.com> wrote in message
>
> news:5753DB62-B545-44B7-B0E0-(E-Mail Removed)...
>
>
>
> > Jim. *Thanks for the reply!!

>
> > We thought we tried that, but we'll do it again. *We found a workaround

> for
> > it. *If we add a line of code to the Workbook_Open event of the ADD-IN

> (not
> > the spreadsheet), then everything works fine. *We just added a DoEvents
> > statement and that did it.

>
> > I think you're on to something regarding the add-in being opened whenExcel
> > opens. *We were trying to get away from each user having to individually

> add
> > the add-in to their instance ofExcel.

>
> > Again, I think we have a workaround, but we're not exactly sure WHY it's
> > working.

>
> > Thanks again for your assistance!!

>
> > sdwalker

>
> > "Jim Cone" wrote:

>
> > > Load the add-in from *Tools (menu) | Add-Ins *by check marking the

> add-in name.
> > > If you do that the add-in will be opened whenExcelis opened.
> > > That will probably eliminate yourcrashproblem.
> > > --
> > > Jim Cone
> > > San Francisco, USA
> > >http://www.realezsites.com/bus/primitivesoftware
> > > (ExcelAdd-ins /ExcelProgramming)

>
> > > "sdwalker"
> > > wrote in message
> > > I have a very challenging issue for you. *I have created a custom addin

> that
> > > contains common code that can be used across many workbooks. *I add a
> > > reference to the addin in my workbook and the 1st time that it calls the
> > > addin, things run fine. *If I then save the workbook, reopen and call

> the
> > > addin again,Excelcrashes. *My issue can be duplicated by doing the
> > > following.

>
> > > 1) Close any other workbooks inExcel, so that you don't lose anything.
> > > 2) Create an addin with a single function ... say ...
> > > * * * * * *Public Function ReturnString() as String
> > > * * * * * * * * *ReturnString = "Test"
> > > * * * * * *End Function
> > > 3) Save this addin locally
> > > 4) Create a new workbook
> > > 5) In the Visual Basic Editor, add a reference to this addin
> > > 6) Create a button on Sheet1 and *have it point to code that says ....
> > > * * * * Range("A1").value = MyAddin.ReturnString
> > > 7) Save the workbook, click the button and everything works fine.
> > > 8) Now, delete the text from cell A1, save the workbook and closeExcel..
> > > 9) Reopen the workbook and click the button.
> > > 10) ObserveExcelcrash

>
> > > Why is this happening?

>
> > > Would anyone be willing to take this on? *It will take about 5-10

> minutes to
> > > duplicate. *It is killing my coworkers and me ... we can't figure it

> out.
>
> > > Thanks in advance,

>
> > > Scott- Hide quoted text -

>
> - Show quoted text -


Hi,

Did this problem lead to corruption of your excel file? If so, you may
try Advanced Excel Repair at http://www.datanumen.com/aer/ This tool
is rather useful in salvaging damaged Excel xls files.

Hope this helps.

Alan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word with embedded Excel object which has reference to addin Tom Chau Microsoft Excel Misc 0 6th Sep 2006 02:25 AM
Addin Reference crashes Excel =?Utf-8?B?UHJhaXJpZUhvbWU=?= Microsoft Excel Programming 3 7th Dec 2005 10:12 PM
VBA AddIn reference in Excel X for Mac =?Utf-8?B?TG9yaQ==?= Microsoft Excel Programming 3 3rd Dec 2004 09:49 PM
Solver Reference in Hidden Personal.XLS Crashes Excel 2003 zo@gtz.pbz.nh Microsoft Excel Programming 1 12th Jul 2004 11:48 AM
Custom Addin, Excel Shutdown Problem RodT Microsoft Excel Programming 4 15th Apr 2004 06:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:57 AM.