excel - 嵌入文件不检测 excel 文件
问题描述
下面的代码被设计成可以在PowerPoint演示文稿中用他们的图像替换嵌入的文件。但是,它能够更改 visio 文件,而不是演示文稿中的 excel 文件。知道为什么会这样吗?
enter code here
Sub imagereplacement()
With ActivePresentation
z = .Slides(.Slides.Count).SlideNumber
MsgBox z, vbDefaultButton1, "Total Slides"
End With
For i = 1 To z
Set sld = ActivePresentation.Slides(i)
With ActivePresentation.Slides(i)
s = .Shapes.Count
End With
For c = 1 To s
If sld.Shapes(c).Type = msoEmbeddedOLEObject Then
ActivePresentation.Slides(i).Shapes(c).Copy
Set newsh = ActivePresentation.Slides(i).Shapes.PasteSpecial(ppPasteEnhancedMetafile)(1)
With newsh
.Left = ActivePresentation.Slides(i).Shapes(c).Left
.Top = ActivePresentation.Slides(i).Shapes(c).Top
Do
.ZOrder (msoSendBackward)
Loop Until .ZOrderPosition = .ZOrderPosition
End With
For k = ActivePresentation.Slides(i).TimeLine.MainSequence.Count To 1 Step -1
If ActivePresentation.Slides(i).Shapes(c) Is ActivePresentation.Slides(i).TimeLine.MainSequence.Item(k).Shape Then
ActivePresentation.Slides(i).TimeLine.MainSequence.Item(k).Shape = newsh
End If
Next k
ActivePresentation.Slides(i).Shapes(c).Delete
Else
GoTo skip
End If
skip:
Next c
Next i
MsgBox "Embedded files replaced by their Images", vbDefaultButton1
End Sub
解决方案
推荐阅读
- django - DRF:始终应用默认权限类
- python - 使用自定义 API 更新 Opencart 产品
- robotframework - robotsframework-imaplibrary2 0.3.2 在机器人框架中不工作
- javascript - 即使在示例项目中,vscode-test 设置中的 runTest.ts 类也从未使用过,它有什么用?
- aws-lambda - 强制从 S3 重新部署 Lambda 函数?
- excel - 如果特定单元格具有值,则复制范围
- sql - 使用 Excel-VBA 和 ADODB 对象时出现“自动化错误”“未指定错误”
- java - Temporarily increase log4j2 logger level in multi-threaded service
- csv - 需要运行收集多次迭代并需要运行我为 json body 声明数据的 csv 文件
- java - 在投票应用程序的活动之间传递数据