본문 바로가기
카테고리 없음

[vba] 메모(Comments)에 삽입된 이미지를 시트에 삽입(Copy And Paste)

by IT HUB 2020. 9. 5.
728x90
반응형
'Updateby Extendoffcie
    Dim cmt As Comment
    Dim xRg As Range
    Dim visBool As Boolean
    Dim cmtTxt As String
    Dim jpgPath As String
    Dim shpHeight As Integer, shpWidth As Integer
    Application.ScreenUpdating = False
    For Each cmt In ActiveSheet.Comments
        With cmt
            cmtTxt = .Text
            shpHeight = .Shape.Height
            shpWidth = .Shape.Width
            .Text Text:="" & Chr(10& ""
            visBool = .Visible
            .Visible = True
            On Error Resume Next
            Set xRg = .Parent.Offset(01)
            .Shape.CopyPicture _
              Appearance:=xlScreen, Format:=xlPicture
            xRg.PasteSpecial
            Selection.ShapeRange.LockAspectRatio = msoFalse
            Selection.Width = xRg.Width
            Selection.Height = xRg.Height
            .Visible = visBool
            .Text Text:=cmtTxt
        End With
    Next cmt
    Application.ScreenUpdating = True
End Sub
 

 

 

반응형


댓글