|
楼主 |
发表于 2023-7-11 19:54
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 生成公示文件()
- Dim arr, i&, j&, s$
- arr = [a1].CurrentRegion
- For i = 2 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- s = IIf(s = "", arr(i, j), s & arr(i, j))
- Next
- s = s & ";" & Chr(10)
- Next
- Dim wordapp As Object
- Set wordapp = CreateObject("word.application")
- With wordapp
- .Documents.Add
- .Selection.TypeText s
- .ActiveDocument.SaveAs ThisWorkbook.Path & "\通知.doc"
- End With
- wordapp.Quit
- Set wordapp = Nothing
- End Sub
复制代码
|
|