00852-52631967
产品详情

'******功能:WPS图片批量插入并添加图片名称。*********

Sub Macro1()

    Dim myPicture As Picture

    Dim folderPath As String

    Dim fileName As String

    Dim wordApp As Word.Application

    Dim doc As Word.Document

    Dim str As String

        folderPath = "C:\图片\"

        fileName = Dir(folderPath & "*.jpg")

        Do While fileName <> ""

           i = i + 1

           Selection.InlineShapes.AddPicture fileName:=folderPath & fileName, LinkToFile:=0, SaveWithDocument:=0

           Selection.TypeParagraph

           str = Mid(fileName, 1, Len(fileName) - 6)

           Selection.TypeText Text:=str

           Selection.TypeParagraph

           fileName = Dir

        Loop

End Sub