- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在编写一些旨在与 Excel 2007 和更新版本兼容的 VBA 代码。从 Excel 2013 开始,图表系列过滤选项和相关的 Chart.FullSeriesCollection
对象被引入,我在我的代码中包含了 If
语句来选择这个对象或旧的 .SeriesCollection
一个取决于 Excel 版本。
但是,VBA 无法编译 Excel 2007 中的代码,因为 .FullSeriesCollection
没有定义。我想尝试后期绑定(bind),以便编译器跳过 If
包含该 undefined object 的语句,但 Excel 2007(使用 VBA 版本 6.3)无法识别 Option Strict Off
要么行;我只能选择Base
, Compare
, Explicit
或 Private
关注Option
陈述。
如何让较旧的 VBA 编译器跳过 .FullSeriesCollection
所在的行用来?我已经学习 VBA 3 天了,如果这非常明显,请原谅。
我的代码的相关部分:
Private Sub EventChart_MouseDown(ByVal Button As Long, _
ByVal Shift As Long, _
ByVal x As Long, _
ByVal y As Long)
Dim ElementID As Long, Arg1 As Long, Arg2 As Long, Arg1b As Long
Dim myX As Variant, myY As Double
Dim xlVrsion As Integer, verSerColl As Object
xlVrsion = CInt(Left(Application.Version, 2)) 'Get Excel version and convert to an integer (2007 = 13.0; 2010 = 14.0; 2013 = 15.0; 2016 = 16.0)
With ActiveChart
.GetChartElement x, y, ElementID, Arg1, Arg2
If ElementID = xlSeries Then
If xlVrsion >= 15 Then 'Check if Excel version is equal or newer than 2013.
Set verSerColl = .FullSeriesCollection(Arg1)
Else
Set verSerColl = .SeriesCollection(Arg1)
End If
'[More irrelevant code]
最佳答案
您可能可以使用 compiler constants如
#If VBA7 Then 'Check if Excel version is equal or newer than 2013.
Set verSerColl = .FullSeriesCollection(Arg1)
#Else
Set verSerColl = .SeriesCollection(Arg1)
#End If
关于vba - 无法在 Excel 2007 VBA 中使用 Option Strict Off 进行后期绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43944928/
总结 我需要在 Camel 服务器 in-modify-out 过程中构建一组统计数据,并将这些统计数据作为一个对象(单个 json 日志行)发出。这些统计数据需要包括: input file met
某个元素使用以下 CSS 功能产生了惊人的结果: 盒子阴影;边界半径;边框和背景上的 RGBA 颜色。 问题是前两个需要延迟 Firefox/Chrome/Safari 浏览器,第二个不兼容 IE8
在我的 Rails 应用程序中有这段代码: window.onload = -> $("#mycontainer").typewriter() $("#div1").fadeIn("slow"
我想检查我的 api 是否工作正常。我有一个只有 post 请求而没有 GET 的 api。 教程在这里:https://learn.microsoft.com/en-us/azure/applica
我想检查我的 api 是否工作正常。我有一个只有 post 请求而没有 GET 的 api。 教程在这里:https://learn.microsoft.com/en-us/azure/applica
我是一名优秀的程序员,十分优秀!