我正在尝试将数据从excel文件复制到word文件作为屏幕截图。但问题是粘贴的数据非常小。有没有办法在复制或粘贴后增加其大小?以下是我写的代码。提前谢谢。
Range("A" & startRow & ":G" & endRow).Select
Selection.Copy
With WordApp
.Selection.PasteSpecial Link:=False, DisplayAsIcon:=False, _
DataType:=wdPasteMetafilePicture, Placement:=wdInLine
.Selection.TypeParagraph
.Selection.Orientation = wdTextOrientationVertical
End With
答案 0 :(得分:2)
您可以在复制后调整形状大小,因为它是您构建的最后一个形状。
以下是您可以添加的代码:
Dim oShape As Word.InlineShape
Dim i As Integer
i = ActiveDocument.InlineShapes.Count
' set oShape to the LAST inlineshape
Set oShape = ActiveDocument.InlineShapes(i)
With oShape
' examples only - scale to 90%
.ScaleHeight = 90
.ScaleWidth = 90
' * * * etc etc etc * * * *
End With
Set oShape = Nothing
您可以简化Excel代码,因为您无需在复制前选择:
Range("A" & startRow & ":G" & endRow).Copy
就够了