PPT内置宏教程——放映时用控件切换动态图表

本文介绍了如何在PPT中通过VBA实现动态图表的控件切换,结合参考资料解决了内嵌图表的控制、动态更新和放映时事件触发问题。详细讲述了VBA代码的优化,包括消除控件操作延迟、减少冗余代码和自定义调整,以提高用户体验。
摘要由CSDN通过智能技术生成

版权声明:本文为博主原创文章,转载请在显著位置标明本文出处以及作者网名,未经作者允许不得用于商业目的。
由于PPT中有多张类似但不太重要的图表,实际汇报时只挑重点说明,其他的基本略过。因此有必要用可选的方式将这些图表折叠到一张PPT中,为PPT瘦身。
参考资料:

A. 首先要解决内嵌图表的控制问题,无极玄易生在文档“演示PPT中动态控制内嵌图表显示”中已列出可用的代码。
B. 其次是图表本身动态更新的问题,实现方法有很多,不熟悉的朋友可以参考小猪也无奈分享的经验【Excel】INDEX函数制作动态图表,里面已经解说得很清楚了。
C. 再是放映时进入事件的触发问题,大梦空间的博文PowerPoint在播放时自动运行宏中有一些示例。

废话不多说,功能实现步骤如下:

  1. 内嵌图表类型问题。本文使用的是“插入”→“对象”→“Microsoft Excel Chart”
  2. 内嵌图表更新问题。按参考资料B做个全套(Excel数据源、控件数据源、图表数据源、目标单元格)也没关系,
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy Useful PowerPoint VBA code snippets More Sharing Services Share | Share on gmail Share on google Share on facebook Share on twitter Determine the current slide in the Slide View mode: Sub SlideIDX() MsgBox "The slide index of the current slide is:" & _ ActiveWindow.View.Slide.SlideIndex End Sub Determine the current slide in Slide Show mode: Sub SlideIDX() MsgBox "The slide index of the current slide is:" & _ ActivePresentation.SlideShowWindow.View.Slide.SlideIndex End Sub Difference between SlideIndex property and SlideNumber property: The SlideIndex property returns the actual position of the slide within the presentation. The SlideNumber property returns the PageNumber which will appear on that slide. This property value is dependent on "Number Slide from" option in the Page Setup. Go to Page Setup and Change the value of "Number Slide from" to 2 and then while on the 1st slide in Slide View run the following Macro Sub Difference() MsgBox "The Slide Number of the current slide is:" & _ ActiveWindow.View.Slide.SlideNumber & _ " while the Slide Index is :" & _ ActiveWindow.View.Slide.SlideIndex End Sub Macro to exit all running slide shows: Sub ExitAllShows() Do While SlideShowWindows.Count > 0 SlideShowWindows(1).View.Exit Loop End Sub Code to refresh current slide during the slide show: Sub RefreshSlide() Dim lSlideIndex As Long lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition SlideShowWindows(1).View.GotoSlide lSlideIndex End Sub Code to reset animation build for the current slide during the slide show: Sub ResetSlideBuilds() Dim lSlideIndex As Long lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition SlideShowWindows(1).View.GotoSlide lSlideIndex, True End Sub Insert a slide after current slide Sub InsertSlide() Dim oView As View With ActivePresentation.Slides Set oView = ActiveWindow.View oView.GotoSlide .Add(oView.Slide.SlideIndex + 1, _ ppLayoutTitleOnly).SlideIndex Set oView = Nothing End With End Sub Copyright 1999-2011 (c) Shyam Pillai. All rights reserved.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值