2013-01-24 134 views
1

基于my last question我得到了正确的代码来更改形状的图像。
不幸的是,这不会更新活动的演示文稿。如果我关闭了演示文稿并重新启动,则图像会发生更改,但更改应直接显示。如何刷新幻灯片中的活动幻灯片?

这是我的代码来改变形象:

ActivePresentation.SlideShowWindow.View.Slide.Shapes("SolutionA_Image").Fill.UserPicture ("D:\User\SolutionWrong.jpg") 

我找到了一种方法来更新演示文稿,但是这让演示闪烁。

ActivePresentation.SlideShowWindow.Height = ActivePresentation.SlideShowWindow.Height - 1 
ActivePresentation.SlideShowWindow.Height = ActivePresentation.SlideShowWindow.Height + 1 

编辑
我试图刷新幻灯片所提出here,但这并没有为我工作。

Dim lSlideIndex As Long 
lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition 
SlideShowWindows(1).View.GotoSlide lSlideIndex 

编辑2
我上传我的文件:Download

+0

尝试改变'SlideShowWindows(1).View.GotoSlide lSlideIndex'到'SlideShowWindows(1).View.GotoSlide lSlideIndex,msoTrue' –

+0

这不适用于 – Christopher

+0

我只是测试了代码,它的工作原理。幻灯片放映过程中如何运行宏? –

回答

2

在我发现我的答案this blog post结束。这似乎是在PowerPoint中的错误2007

此代码有助于修复bug:

Dim osld As Slide 
'get current slide 
Set osld = ActivePresentation.SlideShowWindow.View.Slide 
'the next line adds the empty textbox and refreshs the slide 
osld.Shapes.AddTextbox msoTextOrientationHorizontal, 1, 1, 1, 1 
0

我发现在我的Power Point以及这个bug, 我加入这行到代码,它修复错误

Application.SlideShowWindows(1).View.GotoSlide Me.SlideIndex