Sub 插入图片() '调整单元格大小,以适应图片大小 功能 插入身份证照片打印 - 正面在单元格d6 反面单元格d10 ActiveSheet.Pictures.Delete '清理过期照片 Range("d6").Select Dim aa aa = ActiveSheet.Range("j1").Value '激活表的 J1的值 =照片(正)路径 ActiveSheet.Pictures.Insert(aa).Select Dim sh As Shape For Each sh In ActiveSheet.Shapes sh.LockAspectRatio = False sh.Left = sh.TopLeftCell.Left sh.Top = sh.TopLeftCell.Top sh.Width = sh.TopLeftCell.Width sh.Height = sh.TopLeftCell.Height Next sh Call cha End Sub Sub cha() Range("d10").Select Dim aa aa = ActiveSheet.Range("j2").Value '激活表的 J2的值=照片(反)路径 ActiveSheet.Pictures.Insert(aa).Select '当前文件所在目录下以单元内容为名称的.jpg图片 Dim sh As Shape For Each sh In ActiveSheet.Shapes sh.LockAspectRatio = False sh.Left = sh.TopLeftCell.Left sh.Top = sh.TopLeftCell.Top sh.Width = sh.TopLeftCell.Width sh.Height = sh.TopLeftCell.Height Next sh End Sub
功能 插入身份证照片打印 - 正面在单元格d6 反面单元格d10