将所有选定的切片器项目值读取到数组变量 [英] Read all selected slicer item values to an array variable

查看:669
本文介绍了将所有选定的切片器项目值读取到数组变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将所有选定的切片器项目值读取到数组变量?我认为这可能有效:

How to read all selected slicer item values to an array variable? I thought this might work:

Dim MyArr() as Variant
MyArr = ActiveWorkbook.SlicerCaches(1).VisibleSlicerItemsList

但事实并非如此.一些参考:
https://docs.microsoft.com/zh-我们/office/vba/api/excel.slicercache.visiblesliceritemslist

But it does not. Some reference:
https://docs.microsoft.com/en-us/office/vba/api/excel.slicercache.visiblesliceritemslist

推荐答案

除非使用OLAP数据源,否则不能使用VisibleSlicerItemsList. 从文档中:

You can't use VisibleSlicerItemsList, unless you are using an OLAP data source. From the documentation:

VisibleSlicerItemsList 属性仅适用于基于OLAP数据源的切片器.

The VisibleSlicerItemsList property is only applicable for slicers that are based on OLAP data sources.

我认为最简单的方法是遍历VisibleSlicerItems.

I think the easiest way is to iterate over VisibleSlicerItems.

这篇关于将所有选定的切片器项目值读取到数组变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆