缺少参考错误 - Mac 上的 Powerpoint 2011 的 VBA(在 Windows 的 PPT 2007 中工作正常)
对 VBA 返回 Mac 的事实感到兴奋,但在 Windows 的 Powerpoint 2007 中运行良好的代码时遇到问题(在下面的注释语句中给我一个“编译错误:用户定义的类型未定义”):
Private Function m_CreateStackedChart(SourceData As Excel.Range) As Boolean
Dim pptShape As PowerPoint.Shape
Dim pptChart As PowerPoint.Chart ' // This line causes the error
Dim pptSlide As PowerPoint.Slide
Dim pptData As PowerPoint.ChartData
Dim shtData As Excel.Worksheet
Dim lngRow As Long
Dim lngCol As Long
Dim lngOutRow As Long
Dim lngOutCol As Long
Dim lngTopRow As Long
Dim lngNItems As Long
Dim dblXaxisSize As Double
Dim lngAxisFactor As Long
Dim strHolderName As String
Dim rngXData As Range
Dim rngYData As Range
Dim lngNRows As Long
Dim lngSeries As Long
Dim objDLabel As Object
Dim strFormat As String
....
End Function
感谢任何帮助
Excited by the fact that VBA returned to Mac, but having trouble with code that works fine in Powerpoint 2007 for Windows (giving me a "Compile Error: User-defined type not defined" at the commented statement below):
Private Function m_CreateStackedChart(SourceData As Excel.Range) As Boolean
Dim pptShape As PowerPoint.Shape
Dim pptChart As PowerPoint.Chart ' // This line causes the error
Dim pptSlide As PowerPoint.Slide
Dim pptData As PowerPoint.ChartData
Dim shtData As Excel.Worksheet
Dim lngRow As Long
Dim lngCol As Long
Dim lngOutRow As Long
Dim lngOutCol As Long
Dim lngTopRow As Long
Dim lngNItems As Long
Dim dblXaxisSize As Double
Dim lngAxisFactor As Long
Dim strHolderName As String
Dim rngXData As Range
Dim rngYData As Range
Dim lngNRows As Long
Dim lngSeries As Long
Dim objDLabel As Object
Dim strFormat As String
....
End Function
Any help is appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您无法在 Mac PPT 2011 中使用图表做太多事情,至少截至 2011 年 7 月(应用第一个服务包之后)是这样。
.Chart 对象不会在 PowerPoint 2011 对象模型中显示。 PowerPoint 的 VBA 实现和 OM 似乎处于 Office 2007 第一个 Service Pack 发布之前的阶段。
I don't think you'll be able to do much with charts in Mac PPT 2011, at least not as it stands as of July 2011 (after applying the first service pack).
The .Chart object isn't revealed in the PowerPoint 2011 object model. PowerPoint's VBA implementation and OM seem to be at about the stage things were at in Office 2007 before the first service pack for it came out.
我刚刚偶然发现了这个线程,虽然这是一个令人失望的消息,但我刚刚检查了 PowerPoint:mac 2016,图表对象模型似乎在该产品中得到了很好的实现。
I've just stumbled across this thread and whilst it's disappointing news, I just checked PowerPoint:mac 2016 and the Chart object model appears to be pretty well implemented in that product.