excel enable Multi-select on slicer by default

末鹿安然 提交于 2019-12-01 11:52:39

问题


I have slicers in my workbook that I need multi-select enabled by default. I have not been able to find any way to control this with VBA. I even tried SendKeys but it doesnt seem to be working.

Here is the current Not working Sendkeys code.

    ActiveSheet.Shapes.Range(Array("WMS")).Select
        SendKeys "%S", True
    ActiveSheet.Shapes.Range(Array("Equipment")).Select
        SendKeys "%S", True
    ActiveSheet.Shapes.Range(Array("Warehousing Skills")).Select
        SendKeys "%S", True
    ActiveSheet.Shapes.Range(Array("OCF Skills")).Select
        SendKeys "%S", True

This is selecting the slicers as intended but the sendkeys are not enabling multi-select. I have tried adding a pause before and after the sendkey command but still cannot seem to get it to work.

I even tried having the VBA select two slicer options. This did work and selected two options but it did not force multi-select to be enabled.


回答1:


I don't believe you can programatically change that Multiselect toggle as at the time I write this...that property isn't exposed to the user via VBA. Looks like you've either got to go change that setting on all slicers manually, or teach your users to hold down the CTRL key while they make their selections (which lets them make multiple selections as if that toggle was activated).




回答2:


One workaround could be that you select the slicer and then use SendKeys-method.

ActiveSheet.YOURSLICER.Select
SendKeys "%s"  || sends ALT+S key combination to toggle multiselect ON.


来源:https://stackoverflow.com/questions/47018410/excel-enable-multi-select-on-slicer-by-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!