Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ThisWorkbook.close doesn't wokk :(

H

I have a pb, I have created an Excel addin an I have put the following code in it
----------
Private Sub Workbook_BeforeClose(Cancel As Boolean
MsgBox ("Try to unload"
Application.ThisWorkbook.Close savechanges:=False 'or me.Clos
End Su
---------
I have name my file unloadtest.xl
if I double clic on this file from explorer, it works ok but if I create a shortcut who launch Excel with my file in parameters, it crashes
On excel 97 it does no crash but the unload of my xla fail
on Excel 2000 it crashe

Any Idea ? if it works for you could you tell me too plz

ThX By Advanc

Arnau

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default ThisWorkbook.close doesn't wokk :(

Hi Arnaud,

Thanks for posting in the community!

From my understanding, you have created one Excel xla add-in which will
capture the Workbook_BeforeClose event. If you double-click it, Excel works
very smoothly. However, if you start this from some startup switches, in
Excel 97, the xla can not be unloaded; in Excel 2000, this xla crashes.

In Excel 97, this is one known issue for the Workbook_BeforeClose event in
VBA. I'd suggest you can check the kb article for one workaround.
172749 XL97: Unable to Close File Activated by WorkbookBeforeClose
http://support.microsoft.com/?id=172749

In Excel 2000, since I don't know what Startup switches you used to start
Excel with the XLA add-in, I am not sure whether this event caused the
crash or something else. Moreover, I am also not sure whether you have
installed the latest office updates and patches for Office 2000 from
Office.Microsoft.com. If not, please go to the link to perform one
automatic update checking.
http://office.microsoft.com/search/r...331033&Origin=
HH011136791033&CTT=5

After that, if the issue remains no matter existing in 97 or 2000, I'd
suggest you can give me one detailed repro steps ( for 97 or 2000 or both )
with that add-in file ( or one simplified sample add-in which can crash
Excel2000 ) so that I can test this for you.

Look forward to your reply. Enjoy a nice weekend!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ThisWorkbook.close doesn't wokk :(

Tanks for your fast answer :
Yes You have well understood my problem :
But I don't use particular parameters, only the name of my xla file like this
"C:\Program Files\Microsoft Office 97\Office\EXCEL.EXE" "C:\MyLocalDucuments\UnloadAddins.xla
or
"C:\Program Files\Microsoft Office\Office\EXCEL.EXE" "C:\MyLocalDucuments\UnloadAddins.xla
depending where are my excel application and my addin located

I don't know how to send you the files then I will Email them to You
I have installed SP3 of Excel 2000 but the bug is still here

Step to reproduce my problem
Create an excel file renome it to .xla and set his isaddin property to true
insert this code in ThisWorkboo

---------------- start of code of code ---------------
Public closeLater As Boolea

Private Sub Workbook_BeforeClose(Cancel As Boolean
'set closeLater to false to call the close method no
'set closeLater to true to call the close method in 5 se

closeLater = Fals
MsgBox ("Try to auto-unload"

If (closeLater = False) The
Application.ThisWorkbook.Close savechanges:=Fals
Els
Application.OnTime Now + TimeValue("00:00:05"), "thisworkbook.KillLater
End I
End Su

Private Sub KillLater(
Application.ThisWorkbook.Close savechanges:=Fals
End Su
---------------- end of code ---------------

If I set closeLater to false then
-- crash in Excel 200
-- nothing happens in excel 9

If I set closeLater to true then
-- the adin is closed in 2000 like in 97 like I want but it is only a workaround
I don't want use this workaround because it can implies others bug and it is very dirty

Thx by advanc

arnau

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default ThisWorkbook.close doesn't wokk :(

Hi Arnaud,

Thank you for replying!

I have received your files. I am researching this issue for you. I will
post back when I have any result then.

Enjoy a nice weekend!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

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
ThisWorkbook of personal.xls Jack Sons Excel Discussion (Misc queries) 4 August 29th 07 04:28 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM
Calling Sub(s) from ThisWorkbook BSchwerdt Excel Programming 1 December 11th 03 01:36 AM
ThisWorkbook Macros Random Excel Programming 1 August 16th 03 04:03 PM


All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"