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: 63
Default addin running in different Excel instances

I have an addin that saves itself in either the BeforeClose of
AddinUninstall events. If for some reason I open multiple Excel instances,
when I close the one of the later instances the line ThisWorkbook.Save saves
the addin to the active Excel directory, e.g., My Docs. No error is
generated, it just saves a copy to the wrong place.

It's not a big problem if the addins in the multiple instances are not
saved. So instead of ThisWorkbook.Save I wrote code that uses
ThisWorkbook.Saveas and surrounded it with On Error statements and turned of
DisplayAlerts:

If Not ThisWorkbook.Saved Then
'in case it's read-only, which would be true if this were the 2nd (or
more) instance of Excel
On Error Resume Next
Application.DisplayAlerts = False
'I did SaveAs, because if it's read only Save will save to the active
Excel Directory
ThisWorkbook.SaveAs Filename:=ThisWorkbook.FullName
Application.DisplayAlerts = True
On Error GoTo 0
End If
Exit Sub
ErrorHandler:
Application.ScreenUpdating = True
Application.DisplayAlerts = True

This solution falls under the category of "crude but effective, I hope."
Does anybody have a better one?

XL03 Win Vista and XP

Thanks,

Doug

 
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
running multiple instances RanMan Setting up and Configuration of Excel 2 May 9th 08 03:08 PM
addin not running correctly sc Excel Programming 0 July 10th 06 02:54 PM
addin not running correctly sc Excel Programming 1 July 7th 06 11:50 PM
Load xla addin on demand for particular Excel instances DKG Excel Programming 1 June 9th 04 04:09 PM
Remove Excel AddIn from AddIn List !! Help carl Excel Programming 2 December 8th 03 03:36 PM


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