Forum Discussion

Celia_Alves's avatar
Apr 01, 2019

ActiveX buttons unresponsive or having to be clicked twice to run macro

Hello, community!

I inherited two Excel files that come with a bunch of ActiveX buttons.

In some cases the buttons don't do anything: I click them, it shows kind of a duplicate image of the button on the side when I press the button, but nothing happens. The macro associated runs well if I run it from the VB Editor. 

On the other file, the buttons do work but only when I click them for the second time. Any idea what may cause this to happen?

 

Thank you in advance for any tip or guidance.

  • PratikAngaj's avatar
    PratikAngaj
    Copper Contributor

    Celia_Alves I had the same problem and I solved it by changing the display setting. 
    on the excel status bar > Display Settings> choose : optimise for compatibility.
    issue will resolved.

    • digibrain's avatar
      digibrain
      Copper Contributor

      Excellent! This improved the behavior a lot. Still, for the ActiveX button to work on the first click, the excel workbook has to have focus already. Otherwise, the first click changes the focus to excel and the second click runs the ActiveX macro. It looks like by disabling 'best appearance' we lose just that:  the worksheet appears not at its best.  So, it's a bit of a trade-off.

      • Francois_HA's avatar
        Francois_HA
        Copper Contributor

        digibrain 

         

        Solution of PratikAngaj works also for me, but I really don't like the degraded look of the worksheet.

         

        Another solution I found is to modify the name of the macros in the VB editor (Alt-F11), so as to use the "MouseUp" event or "MouseDown" event, instead of the "Click" event.

        For each control:

        - replace the "ControlName_Click ()"

        - by "ControlName_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

         

        No more trade-off 🙂

         

        Maybe it is also possible to add something to the Class, but I'm not sharp on this.

    • DanielAtlanta's avatar
      DanielAtlanta
      Copper Contributor
      Pratik's answer worked for me. No other change made. Thank you Pratik!
  • _Ness_'s avatar
    _Ness_
    Copper Contributor
    Hi Celia,

    I've just started having this issue - on my old laptop it was only one click to make the buttons work, but now on Windows 10 it takes a double-click to make them work? So strange, never seen this before.

    Just wondering if you ended up finding the issue?

    Cheers
    • Hi, _Ness_.
      Unfortunately, I did not find the cause or a solution.
      If I remember, I think that in one of the cases, deleting the button and creating a new one, helped. I am not sure if I replaced it with an active x button or one of the other button types.
      • androo2351's avatar
        androo2351
        Brass Contributor

        oi tudo bem Celia_Alves  I have this issue too. I don't think it's W10 per-se as they were fine until recently - so it's something to do with a recent update I would say. I did look at replacing them with ordinary buttons but there was some disadvantage to that - which I can't recall right now. I'll try the "delete and replace with new" approach to see if that works, though, even if it does, it's hardly satisfactory. I don't recall a recent update coming with a disclaimer from MS saying that activeX macro buttons may not work (properly) anymore (mind you I expect what the small print actually says is that if their update causes Armageddon it's still not their fault!).

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor
    Hard to say without the file. ActiveX buttons do cause havoc at times, perhaps replacing them with forms buttons helps?

Resources