我简单地做了一下修改,不是很满意,请楼主测试
Option Explicit
Sub XLSDataSaveAsDoc() Dim rng As Range Dim rDATA As Range Dim wd As Word.Application, wdRange As Word.Range, wdShape As Word.Shape Dim tubiao As Object, wdDoc As Word.Document
Set rDATA = Range(Cells(1, 1), Cells(15, 5)) Set tubiao = ChartObjects("图表 4")
Set wd = CreateObject("word.application") ' 创建 WORD 实例
wd.Visible = True ' 使 WORD 可见 AppActivate wd.Name ' 激活 WORD 窗口 Set wdDoc = wd.Documents.Add ' 添加一新文档 With wdDoc rDATA.Copy .Range(0, 0).Paste tubiao.Copy Set wdRange = .Range(.Content.End - 1, .Content.End - 1) wdRange.Paste Set wdShape = .Shapes(1) wdShape.ConvertToInlineShape .InlineShapes(1).Range.Cut wdRange.Paste .SaveAs ThisWorkbook.Path & "\数据源.doc" End With AppActivate Application.Name ' 激活 EXCEL 窗口 MsgBox "作业已完成. 文件已保存为: " & vbCrLf & ThisWorkbook.Path & "\数据源.doc"
Set wd = Nothing
End Sub
|