如何在工作簿中粘贴/插入图片(不是链接)?

时间:2015-01-27 22:31:07

标签: excel vba excel-vba excel-2013

Sub InsertAndSizePic(Target As Range, PicPath As String)
    Dim s As Shape
    Application.ScreenUpdating = False
    Dim sh As Worksheet: Set sh = ActiveSheet

    If Target.Cells.Count = 1 Then Set Target = Target.MergeArea
    With Target
        Set s = sh.Shapes.AddPicture(PicPath, True, True, .Left, .Top, .Width, .Height)
    End With
    Application.ScreenUpdating = True
End Sub

这段代码很棒!我唯一的问题是,当我通过电子邮件将电子表格发送给某个人时,他们不会将图片发送到破损的链接!请帮助!!!

这是对的吗?

Sub InsertAndSizePic(Target As Range, PicPath As String)
    Dim s As Shape
    Application.ScreenUpdating = False
    Dim sh As Worksheet: Set sh = ActiveSheet

    If Target.Cells.Count = 1 Then Set Target = Target.MergeArea
    With Target
        Set s = sh.Shapes.AddPicture(PicPath, False, True, .Left, .Top, .Width, .Height)
    End With
    Application.ScreenUpdating = True
End Sub

0 个答案:

没有答案