ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Addin Locking Excel (https://www.excelbanter.com/excel-programming/381127-re-addin-locking-excel.html)

Peter T

Addin Locking Excel
 
Indeed odd. A couple more long shots on the basis of unlikely but no harm to
try -

Instead of setting xlApp in the class initialization event, in the open
event -
Set evtEvents.xlApp = Excel.Application (xlapp would need to be public) or
use Set Property method.

Defer setting the application reference in the Open event with OnTime Now to
a macro in a normal module, ie to run when everything else has loaded.

When I close XL I am prompted to my changes to Book1 which I have
not touched or modified in any way (odd


One thing that might cause that is a change in certain application level
settings, eg events (sometimes but not always changes the saved property),
calculation etc. Not that there's anything in your code that appears to do
that but perhaps a setting is being changed by something else (and perhaps
failing with certain settings due to no visible workbook during startup).

Regards,
Peter T

"Jim Thomlinson" wrote in message
...
I have an addin that uses app level events to catch the before print

event.
It installs and works great on a number of computers including my own. On

one
machine however it causes XL to freeze up. Here are the symptoms:

I open Excel and install the addin. At this point it functions correctly

and
there are no errors generated at any point. When I close XL I am prompted

to
save my changes to Book1 which I have not touched or modified in any way

(odd
but I choose not to save the cahnges). When I go to re-open XL no workbook
opens up and all menus are frozen. If I go in and initiate the code in the
addin and then stop the code then XL unfreezes and a new workbook opens

up.

The system that I am installing on is similar to my own:
XL 2002 with SP3
Essbase Installed
CubeAnalysis Installed

Anyone seen anything like this before???

Here is the code...

Class**************
Option Explicit
Private WithEvents xlApp As Excel.Application

Private Sub Class_Initialize()
Set xlApp = Excel.Application
End Sub

Private Sub xlApp_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As

Boolean)
On Error Resume Next
If ActiveSheet.CodeName = "shtKPIrpt" Then
Wb.Sheets("open").Range("B23").Value = CInt(Mid(Wb.Path, 6, 4))
End If
End Sub

Thisworkbook************
Option Explicit

Private Sub Workbook_Open()
'MsgBox "Test1"
Set evtEvents = New clsXLEvents
'MsgBox "Test2" 'This showed up on re-open after install
End Sub

Standard Code Module**********
Option Explicit

Public evtEvents As clsXLEvents

--
TIA...

Jim Thomlinson





All times are GMT +1. The time now is 10:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com