【发布时间】:2015-12-08 01:54:29
【问题描述】:
我正在从 excel 构建一个 word 文档。当我在文档中插入图像并重新调整大小时,出现运行时错误。我只会在我第二次运行它时发生。
Dim PreparedSigPath As String
Dim sWdth, sHght As Single
'file paths for image
PreparedSigPath = Range("Prepared_Sig").Value
'insert and re-size image
Set PreparedSig = docreport.Bookmarks("PREPARED_SIG").Range.InlineShapes _
.AddPicture(PreparedSigPath)
With PreparedSig
sWdth = .Width
sHght = .Height
'size to max width
.Width = InchesToPoints(2.125)
.Height = sHght * .Width / sWdth
'size to max height if needed
If .Height > InchesToPoints(0.625) Then
.Height = InchesToPoints(0.625)
.Width = sWdth * .Height / sHght
End If
End With
代码在.Width = InchesToPoints(2.125)中断
【问题讨论】:
标签: excel vba ms-word runtime-error