|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 导入图片()
Dim sp As Shape, rng As Range, rg As Range, arg As Range
For Each sp In Sheets("插入图片").Shapes
If sp.Type <> 8 Then sp.Delete
Next sp
Set arg = Columns("a").End(xlDown)
For Each rng In Range([a2], arg)
pah = thisworkbook.Path & "\tupian\" & rng.Value & ".jpg"
Set rg = Cells(rng.Row, "b")
Sheets("插入图片").Shapes.AddPicture pah, True, True, rg.Left, rg.Top, rg.Width, rg.Height
Next
End Sub
【pah = thisworkbook.Path & "\tupian\" & rng.Value & ".jpg"】
我的代码是网上复制的,因为自己还是个小白,就想问下这个位置怎么插入图片格式呢?我在网上找了一些好像都不行,就变成显示错误1004,未找到指定文件 |
|