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作者: roych 时间: 2011-4-8 17:49
2007版本宏的安全性比较高,可能需要设置受信任位置才行。——我的本本没装2007版本,暂时无法为您调试。目前下载的附件是没问题的。
此外,建议在VBE界面里点击工具\引用,看看Office库是否引用正确(如果有Missing或者丢失字样就需要重新引用了)。作者: joyark 时间: 2011-4-8 19:34
roych謝謝
我常调试沒有成功作者: joyark 时间: 2011-4-19 20:32
請幫忙解決作者: joyark 时间: 2011-4-20 21:25
解決文件地址:http://www.officefans.net/cdb/vi ... &extra=page%3D1