スクリーンショットをペーストした後にサイズを調整、そのままワードの作業が続けられるようにする。
Sub ResizeAndInsertReturn()
Dim sel As Selection
Set sel = Selection
' 縮小率を設定(40%)
Dim scaleFactor As Single
scaleFactor = 0.4
' 選択しているオブジェクトをチェック
If sel.Type = wdSelectionInlineShape Then
With sel.InlineShapes(1)
' オブジェクトのサイズを縮小
.ScaleHeight = .ScaleHeight * scaleFactor
.ScaleWidth = .ScaleWidth * scaleFactor
End With
ElseIf sel.Type = wdSelectionShape Then
With sel.ShapeRange(1)
' オブジェクトのサイズを縮小
.ScaleHeight factor:=scaleFactor, RelativeToOriginalSize:=msoFalse
.ScaleWidth factor:=scaleFactor, RelativeToOriginalSize:=msoFalse
End With
Else
MsgBox "選択しているオブジェクトがありません。"
Exit Sub
End If
' リターンキー(改行)を挿入
sel.TypeParagraph
End Sub