在单元格中插入图片的macros创build链接,导致“链接的图像无法显示”错误

我正在使用下面的插入一个单元格的图像,并调整与该单元格。 但是,当我把它发送给没有访问驱动器的人链接到我得到的“链接的图像不能显示错误”。 我想'断开'这个链接,并保存在文件中的图片。 我已经读过,我需要使用形状,而不是图像,但我正在努力得到这个工作。 你能帮我吗? 谢谢。

Sub InsertPicture() Dim sPicture As String, pic As Picture sPicture = Application.GetOpenFilename _ ("Pictures (*.gif; *.jpg; *.bmp; *.tif), *.gif; *.jpg; *.bmp; *.tif", _ , "Select Picture to Import") If sPicture = "False" Then Exit Sub Set pic = ActiveSheet.Pictures.Insert(sPicture) With pic .ShapeRange.LockAspectRatio = msoFalse .Height = ActiveCell.Height .Width = ActiveCell.Width .Top = ActiveCell.Top .Left = ActiveCell.Left .Placement = xlMoveAndSize End With Set pic = Nothing End Sub 

尝试:

 Sub InsertPicture() Dim sPicture As String sPicture = Application.GetOpenFilename _ ("Pictures (*.gif; *.jpg; *.bmp; *.tif), *.gif; *.jpg; *.bmp; *.tif", _ , "Select Picture to Import") If sPicture = "False" Then Exit Sub Dim Rng As Range: Set Rng = ActiveCell ActiveSheet.Shapes.AddPicture(sPicture, msoFalse, msoTrue, _ Rng.Left, Rng.Top, Rng.Width, Rng.Height).Placement = xlMoveAndSize End Sub