티스토리 뷰

카테고리 없음

Excel - Macro

파란크리스마스 2017. 7. 23. 18:41
728x90

출처 : [엑셀] 매크로를 이용하여 지정한 크기의 셀 안에 사진 넣기 : 네이버 블로그
엑셀 메크로 그림(이미지)을 엑셀 파일에 직접 포함시키는 방법 - 달집의 팁 - 문하우스

이미지 삽입 - Excel 파일에 이미지 내장

Sub insert_Pic()
    
    Dim Pic   As Variant
    
    Pic = Application.GetOpenFilename _
                    (filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif;*.png;*.jpeg")
    If Pic = False Then
        Exit Sub
    End If
    
    With ActiveSheet.Shapes.AddPicture(Pic, False, True, Selection.Left, Selection.Top, Selection.Width, Selection.Height)
        .LockAspectRatio = msoFalse
    End With
    
End Sub

이미지 삽입 - Excel 파일에 이미지 경로만 저장

Sub ins_Pic()

    Dim myPic   As Variant

    myPic = Application.GetOpenFilename _
                    (filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")
    If myPic = False Then
        Exit Sub
    End If
     With ActiveSheet.Pictures.Insert(myPic).ShapeRange
        .LockAspectRatio = msoFalse
        .Height = Selection.Height
        .Width = Selection.Width
        .Left = Selection.Left
        .Top = Selection.Top
    End With

End Sub
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함