LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Addin close command not working in new workbook

I have an existing workbook (WrkBk1) that contains two sheets. I also
have an addin (addin) that inserts a new sheet into WrkBk1. When the
user is done with the workbook I want it to delete the sheet that was
added in, then save and then close both WrkBk1 and the addin. Here is
the code that I am using to initiate the activity.

Private Sub workbook_beforeclose(cancel As Boolean)
Application.DisplayAlerts = False
ActiveWorkbook.Sheets("What If").Delete
Application.DisplayAlerts = True
ActiveWorkbook.Save
End Sub

It works fine if it is saved into WrkBk1 but I can't do that I need
everything to be contained in the addin. Right now it is saved into a
module, I'm not sure if that makes a difference or not.

 
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
How to close an Addin? FARAZ QURESHI Excel Discussion (Misc queries) 5 June 4th 09 01:15 PM
VBA Code to kick off macro when workbook command to close is initi zulfer7 Excel Discussion (Misc queries) 2 June 23rd 06 08:04 PM
Deleting Command Bars on close of a workbook Stan Bottorff Excel Programming 1 November 6th 05 04:13 AM
Executinh Addin Sub Menu Command Amir Excel Programming 1 August 21st 05 02:30 AM
Addin Close problem S G Booth Excel Programming 1 February 13th 05 03:05 PM


All times are GMT +1. The time now is 07:37 AM.

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"