|
老师们,怎么样让下面这段代码,插入图片时,户主图片放第一张,本人图片放第二张
谢谢老师们了!
- Sub test()
- Dim Fso, Fld
- Dim j, k, i As Integer
- Dim path, Name, str1, f As String
- Dim doc As Document
- Set Fso = CreateObject("Scripting.FileSystemObject")
- path = ThisDocument.path & ""
- For Each Fld In Fso.getfolder(path).subfolders
- For k = 1 To Len(Fld)
- 'MsgBox k, , "提示"
- If Left(Right(Fld, k), 1) = "" Then
- Name = Right(Fld, k - 1)
- k = 500
- End If
- Next
- f = Dir(Fld & "" & "*.*")
- 'MsgBox f, , "提示"
- Set doc = Application.Documents.Add
- Do While f <> ""
-
- If InStr(f, "户口本-户主页.jpg") Then
- 'MsgBox Fld & "", , "提示"
- doc.InlineShapes.AddPicture FileName:=Fld & "" & f
- End If
-
-
- If InStr(f, "户口本-本人页.jpg") Then
- 'MsgBox Fld & "", , "提示"
- doc.InlineShapes.AddPicture FileName:=Fld & "" & f
- End If
-
-
- f = Dir()
- Loop
- doc.SaveAs Fld & "" & Name & ".doc"
- doc.Close
- Next
- End Sub
复制代码
Word利用VBA批量.rar
(70.69 KB, 下载次数: 19)
|
|