vba 控件先隐藏再显示则无法响应点击事件

vba 控件先隐藏再显示则无法响应点击事件

VBA里面的ActiveX CommandButton 先隐藏再取消隐藏后,再用鼠标点击按钮,没有任何反应

CommandButton.Visible = False --> CommandButton.Visible = True 这之后CommandButton就失去响应事件了

我在网上也看到有遇到过同样的情况,但都没有什么好的解决办法。

However _after a line has been hidden and unhidden the activex elements in it don't react to a click anymore _and when i close and open the file the same activex element aren't in the line the were supposed to be anymore. They just migrate to somewhere else in the sheet. This is very frustrating and this macro it a part of my thesis. Please help me solve this. :(

之前CSDN也有提过类似的问题
https://bbs.csdn.net/topics/390639195?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165431638716781818728917%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=165431638716781818728917&biz_id=&utm_medium=distribute.pc_search_result.none-task-community_post-2~all~first_rank_ecpm_v1~rank_v31_ecpm-1-390639195-null-null.142^v11^control,157^v13^control&utm_term=%E8%87%AA%E5%AE%9A%E4%B9%89picturebox%E4%B8%8A%E7%9A%84%E6%8C%89%E9%92%AE%E5%85%88%E9%9A%90%E8%97%8F%E5%9C%A8%E6%98%BE%E7%A4%BA&spm=1018.2226.3001.4187

有小伙伴知道的嘛?

对,都是类似隐藏再显示就无法响应点击的问题,但至于无法响应的机制和原因是什么不知道,可能和那个问题原因不一样。

问题不一样吧,你说的那个类似的问题是点击时触发了picturebox的onleave事件导致按钮隐藏了才触发不了点击事件,你这个是单纯的隐藏后显示就无法响应点击的问题吧!

你要刷新一下Refresh