从文件夹和子文件夹中获取图像

时间:2018-10-09 16:53:36

标签: image excel-vba subdirectory

我有这个宏,用于根据计划中的选择单元格值在UserForm上打开图像。我工作得很好,但现在我需要它来查看同一目录的子文件夹,我进行了一些研究,但找不到任何东西。您对如何操作有任何想法吗?

Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error Resume Next

If Target.Column = 2 Then

    InsertImage (Target.Value)

End If
End Sub

Sub InsertImage(Produto As String)
On Error Resume Next

Dim Image, path As String


Image = Dir("\\clfssrvfar\share\dve\coleções\33 - Melissa Family 18\" & Produto & "*", vbDirectory)

path = "\\clfssrvfar\share\dve\coleções\33 - Melissa Family 18\" & Imagem

FrmImagem.Produto.Picture = LoadPicture(CaminhoImagem)
FrmImagem.Show


End Sub

0 个答案:

没有答案