FrontPage/web

Word 選択画像のサイズを変更

Sub Macro5()
'
' Macro5 Macro (Ctrl+r)
'
' 画像の横幅を変更(アスペクト比保持)
' 選択した複数の画像ファイルを処理
'
' (2015/12/20) Tomoyuki Nohara
' version 1.0
'

    Const MILL As Double = 0.3527           ' mm に変換する定数を宣言
    
    target_width = 40#                      ' 変換後の幅を宣言[mm]
       
 
    With Selection
        '選択されている画像全てにしょり
        For i = 1 To .InlineShapes.Count
        
            w = .InlineShapes(i).Width * MILL       '変換前のサイズ
            h = .InlineShapes(i).Height * MILL      '変換前のサイズ
            
            '横幅の変更比を計算
            ratio = target_width / w
            
            'サイズを設定
            .InlineShapes(i).Height = h * ratio / MILL
            .InlineShapes(i).Width = w * ratio / MILL
            
        Next
    End With
End Sub

Windowsファイルツリーコマンド

tree /f . > tree.txt
トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS