我有一个更新 PowerPoint 演示文稿中所有链接的例程。但是,如果组成链接的图像已调整大小,它们将以相同的大小出现,这会使它们变形。
我希望确定图像链接的原始比例,然后在更新后将其重置为该比例(并非我们所有的图像都缩放相同,所以我不能简单地将它们重新缩放为 100% 或你有什么)。
ScaleWidth 和 ScaleHeight 方法似乎没有任何可以读取的相关属性。
Dim objPres As Object
Dim objSlide As Object
Dim objShape As Object
Dim myPath As String
Dim myName As String
Dim valueWidth As Long
Dim valueHeight As Long
Dim sl As Slide, sh As Shape, myMaster As Integer, count As Integer, relinked As Integer, lt As CustomLayout, sm As Master, ds As Design
Dim failureCounter As String, successCounter As Integer
successCounter = 0
'pages
For Each objSlide In ActivePresentation.Slides
For Each objShape In objSlide.Shapes
If objShape.Type = msoLinkedPicture Then
myName = objShape.LinkFormat.SourceFullName
valueWidth = objShape.ScaleWidth '<- this does not work
valueHeight = objShape.ScaleHeight '<- this does not work
If Dir(myName) <> "" Then
objShape.LinkFormat.update
successCounter = successCounter + 1
objShape.ScaleWidth valueWidth, msoTrue
objShape.ScaleHeight valueHeight, msoTrue
Else
failureCounter = failureCounter & "," & myName
End If
End If
Next objShape
Next objSlide