|
本帖最后由 雪舞子 于 2017-5-4 10:09 编辑
excel图片和相对应的信息插入到word 文档中;
word的文档为A4纸横向,每一张放一个图片和一个信息。
- Sub eTow_XWZ()
- Dim Wordapp As Object, WordDoc As Object
- Dim arr, s$, i%
- arr = Range("a1").CurrentRegion
- Set Wordapp = CreateObject("Word.Application")
- Set WordDoc = Wordapp.Documents.Add
- With WordDoc
- .PageSetup.Orientation = wdOrientLandscape
- For i = 2 To UBound(arr)
- s = Join(Application.Index(arr, i))
- .Paragraphs(.Paragraphs.Count).Range.Text = s
- .Content.InsertParagraphAfter
- Range("b" & i).CopyPicture
- .Paragraphs(.Paragraphs.Count).Range.Paste
- .Content.InsertParagraphAfter
- .Paragraphs(.Paragraphs.Count).Range.Select
- Wordapp.Selection.InsertBreak Type:=wdPageBreak
- Next
- .SaveAs Filename:=ThisWorkbook.Path & "\问题.docx"
- .Close True
- End With
- End Sub
复制代码
工作簿.rar
(143.53 KB, 下载次数: 17)
|
|