|
本帖最后由 joyark 于 2011-4-20 21:25 编辑
Option Explicit
Sub fdjpg(nm As String)
With Application.FileSearch '這裡出現問題
.LookIn = ThisWorkbook.Path
.SearchSubFolders = True
.Filename = nm & ".jpg"
If .Execute <> 0 Then
nm = .FoundFiles(1)
Else
nm = ""
End If
End With
End Sub
Sub addPic(tgRng As Range)
Dim rng As Range
Dim nm As String
Dim shp As Shape
With tgRng
nm = .Text
Set rng = .Offset(0, -2).Resize(15, 1)
End With
fdjpg nm
If nm <> "" Then
rng.Worksheet.Pictures.Insert(nm).Select
With Selection
.Top = rng.Top
.Left = rng.Left
.Placement = xlMoveAndSize
.Width = rng.Width
.Height = rng.Height
End With
Else
MsgBox nm & " not found!"
End If
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|