Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Workbook_BeforeClose problem

Running Office XP on Windows XP Home Edition

I am successfully creating a custom toolbar 'on the fly' via an Excel
add-in. However, when I click the close button on the active workbook Excel
prompts me to save it, and at this moment my custom toolbar disappears as it
gets deleted by a Workbook_BeforeClose event.

My question is, if a user clicks 'Cancel' when the workbook save prompt
comes up, how can I still retain my custom toolbar ? In other words, my
toolbar should disappear only when Excel application gets closed.

Thanks,
Amit


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Workbook_BeforeClose problem

The users closes the addin "manually" using the X button ? if so, then, why
do you have the Addin visible ? the idea is that it should be "invisible" to
the user, and that they could only "close" it using Tools | Addins OR
closing the application.

--
Regards

Juan Pablo González

"Amit Shanker" wrote in message
...
Running Office XP on Windows XP Home Edition

I am successfully creating a custom toolbar 'on the fly' via an Excel
add-in. However, when I click the close button on the active workbook

Excel
prompts me to save it, and at this moment my custom toolbar disappears as

it
gets deleted by a Workbook_BeforeClose event.

My question is, if a user clicks 'Cancel' when the workbook save prompt
comes up, how can I still retain my custom toolbar ? In other words, my
toolbar should disappear only when Excel application gets closed.

Thanks,
Amit




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Workbook_BeforeClose problem

The add-in is always invisible - it is just creating my toolbar. My question
refers to when the user activates the 'X' button on the workbook he is
working on. My toolbar should not disappear if the user hits 'Cancel' at the
prompt for saving his work.

"Juan Pablo González" wrote in message
...
The users closes the addin "manually" using the X button ? if so, then,

why
do you have the Addin visible ? the idea is that it should be "invisible"

to
the user, and that they could only "close" it using Tools | Addins OR
closing the application.

--
Regards

Juan Pablo González

"Amit Shanker" wrote in message
...
Running Office XP on Windows XP Home Edition

I am successfully creating a custom toolbar 'on the fly' via an Excel
add-in. However, when I click the close button on the active workbook

Excel
prompts me to save it, and at this moment my custom toolbar disappears

as
it
gets deleted by a Workbook_BeforeClose event.

My question is, if a user clicks 'Cancel' when the workbook save prompt
comes up, how can I still retain my custom toolbar ? In other words, my
toolbar should disappear only when Excel application gets closed.

Thanks,
Amit






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Workbook_BeforeClose problem

It shouldn't. Where do you have your code to delete the toolbar ?

--
Regards

Juan Pablo González

"Amit Shanker" wrote in message
...
The add-in is always invisible - it is just creating my toolbar. My

question
refers to when the user activates the 'X' button on the workbook he is
working on. My toolbar should not disappear if the user hits 'Cancel' at

the
prompt for saving his work.

"Juan Pablo González" wrote in message
...
The users closes the addin "manually" using the X button ? if so, then,

why
do you have the Addin visible ? the idea is that it should be

"invisible"
to
the user, and that they could only "close" it using Tools | Addins OR
closing the application.

--
Regards

Juan Pablo González

"Amit Shanker" wrote in message
...
Running Office XP on Windows XP Home Edition

I am successfully creating a custom toolbar 'on the fly' via an Excel
add-in. However, when I click the close button on the active workbook

Excel
prompts me to save it, and at this moment my custom toolbar disappears

as
it
gets deleted by a Workbook_BeforeClose event.

My question is, if a user clicks 'Cancel' when the workbook save

prompt
comes up, how can I still retain my custom toolbar ? In other words,

my
toolbar should disappear only when Excel application gets closed.

Thanks,
Amit








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Workbook_BeforeClose problem

It's in my add-in's workbook event handler module, as follows :

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
DeleteCommandBar
End Sub

Private Sub Workbook_Open()
CreateCommandbar
End Sub



"Juan Pablo González" wrote in message
...
It shouldn't. Where do you have your code to delete the toolbar ?

--
Regards

Juan Pablo González

"Amit Shanker" wrote in message
...
The add-in is always invisible - it is just creating my toolbar. My

question
refers to when the user activates the 'X' button on the workbook he is
working on. My toolbar should not disappear if the user hits 'Cancel' at

the
prompt for saving his work.

"Juan Pablo González" wrote in message
...
The users closes the addin "manually" using the X button ? if so,

then,
why
do you have the Addin visible ? the idea is that it should be

"invisible"
to
the user, and that they could only "close" it using Tools | Addins OR
closing the application.

--
Regards

Juan Pablo González

"Amit Shanker" wrote in message
...
Running Office XP on Windows XP Home Edition

I am successfully creating a custom toolbar 'on the fly' via an

Excel
add-in. However, when I click the close button on the active

workbook
Excel
prompts me to save it, and at this moment my custom toolbar

disappears
as
it
gets deleted by a Workbook_BeforeClose event.

My question is, if a user clicks 'Cancel' when the workbook save

prompt
comes up, how can I still retain my custom toolbar ? In other words,

my
toolbar should disappear only when Excel application gets closed.

Thanks,
Amit












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Workbook_BeforeClose problem

One way is to create a prompt in the Workbook_BeforeClose event that asks the user if they want to close the work book
Then you can set Cancel to true before it has a chance to remove your toolbar. Therefore pre-empting excels Save dialog
You can even take care of the save yourself by using Save and setting displayalerts to false all within the Workbook_BeforeClose event.
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Workbook_BeforeClose problem

Check out the example on my website: Save Changes?

It gets used in the BeforeClose event and handles the "sure? you haven't
saved!" stuff.



--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Amit Shanker" wrote in message
...
Running Office XP on Windows XP Home Edition

I am successfully creating a custom toolbar 'on the fly' via an Excel
add-in. However, when I click the close button on the active workbook

Excel
prompts me to save it, and at this moment my custom toolbar disappears as

it
gets deleted by a Workbook_BeforeClose event.

My question is, if a user clicks 'Cancel' when the workbook save prompt
comes up, how can I still retain my custom toolbar ? In other words, my
toolbar should disappear only when Excel application gets closed.

Thanks,
Amit




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
Workbook_BeforeClose Ed Davis[_2_] Excel Discussion (Misc queries) 21 September 26th 09 01:01 AM
Workbook_BeforeClose Question Sashi Excel Worksheet Functions 7 July 26th 07 08:36 PM
WorkBook_BeforeClose (Delete Menu) Rockee052[_35_] Excel Programming 5 February 14th 04 06:44 AM
Workbook_Beforeclose vs BeforeClose Event Juan Pablo González Excel Programming 3 February 2nd 04 12:17 AM
Workbook_BeforeClose Event Shatin Excel Programming 2 January 24th 04 03:50 AM


All times are GMT +1. The time now is 10:08 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"