Application Events

  • Hi all,


    Can someone please help me understand what application events do.


    I'm trying to create a code that will disable an add-in when the whole excel application is closed completely and then enable that same add-in when the application is opened or restarted.


    Any help will be very much appreciated.


    Thank you in advance.


    Mjoza

  • Re: Application Events


    Quote from cytop;775349

    That does not make sense... How can an Add-in be active when Excel is closed?


    Sorry maybe I should be a little more clear. I created an add-in and for some reason when i shut down and try open the excel application the application doesn't open. It just gets stuck. I was thinking about this issue and thought maybe if I disabled the add-in when the application shuts down and reenable after the application opens again that might be the solution I need.


    From what I was reading it sounds like an application event might be what I need to get around the issue. I'm very open to any suggestion that you might have.


    This is also posted here: http://www.mrexcel.com/forum/e…not-open.html#post4599448


    Thanks.

  • Re: Application Events


    Excel is an event driven application. Everything happens in response to an event and events are scoped to the Application, a Workbook or a Worksheet. For example:
    Workbook_Open is fired when a particular workbook is opened.
    Workbook_Change is fired when any worksheet in a workbook is changed
    Worksheet_Change is fired when the worksheet containing the code is changed.


    Your comment that "It just gets stuck" does not really explain anything.


    Is the addin even loading? If it is, does it error? Not do as you expect??


    You must use the Options/Addins menu to set an addin to load automatically when Excel starts. Have you?



    Basically your question is impossible to answer with the information you have given. Upload a copy of the addin.


    [sw]*[/sw]


    You may not be able to upload an XLAM file due to restrictions on the forum, just add a .TXT extension and it will upload.

  • Re: Application Events




    Cytop- thank you so much for the response.


    Please see the add-in attached. The file was initially too big but i had to take out some of the code to make it smaller.


    To answer you question:
    Is the addin even loading? If it is, does it error? - yes it does load. If i try to open excel application for the first time it gets stuck trying to open the add-in but if i open another non excel file it will open and once open the add-in works without a problem. The issue is just when you try to open the excel when the add-in is installed. If the add-in is uninstalled excel opens without a problem.


    ou must use the Options/Addins menu to set an addin to load automatically when Excel starts. Have you? - i havent done this, i cant figure out how to do it.


    Thank you again.

  • Re: Application Events


    Can load this in Excel 2010 no errors, no problems - but strangely enough it simply will not automatically load in 2013/2016. There's no error, but define the add-in, it displays the menu. Close Excel and restart, no add-in.


    Something to look at, but which version are you using?


    Also, It's a little pointless asking someone to have a look at code in a file and then uploading a file with the project password protected... others may have had a problem with that.

  • Re: Application Events


    Quote from cytop;775494

    Can load this in Excel 2010 no errors, no problems - but strangely enough it simply will not automatically load in 2013/2016. There's no error, but define the add-in, it displays the menu. Close Excel and restart, no add-in.


    Something to look at, but which version are you using?


    Also, It's a little pointless asking someone to have a look at code in a file and then uploading a file with the project password protected... others may have had a problem with that.


    Sorry forgot to include the password. It's encompass.


    Im using excel 2013.

  • Re: Application Events


    Thank you but I didn't need the password.


    I take a closer look a little later. Like I said it seems OK in 2010 but just will not remain as a defined Add-in on 2013 & 2016...

  • Re: Application Events


    There is an issue with a recent security update for Office. You need to locate the add-in file in Explorer, right-click it, choose Properties, then check the box to 'Unblock this file' and press Apply.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Application Events


    Quote from rory;775506

    There is an issue with a recent security update for Office. You need to locate the add-in file in Explorer, right-click it, choose Properties, then check the box to 'Unblock this file' and press Apply.


    Rory- did that fix the issue for you? Can you open the add-in without an issue and are you using 2013 or newer excel version?


    I don't have the option to unblock the add-in in properties. It looks like mine was unblocked.

  • Re: Application Events


    Quote from mzimba;775514

    Rory- did that fix the issue for you? Can you open the add-in without an issue and are you using 2013 or newer excel version?


    I don't have the option to unblock the add-in in properties. It looks like mine was unblocked.


    Sorry, I should have made it clear that I was aiming that at cytop, not you.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!