我创建了一个宏,可以将多个图表从excel导出到word。但是,我想将那些图表放在某个BOOKMARK中以固定其位置。我可以帮忙吗?
Sub ExportingToWord_MultipleCharts_Worksheet()
'Declare Word Variables
Dim WrdApp As Word.Application
Dim WrdDoc As Word.Document
Dim SecCnt As Integer
'Declare Excel Variables
Dim wbBook As Workbook
Dim ChrtObj As ChartObject
Dim Rng As Range
Set wbBook = ThisWorkbook
'Create a new instance of Word
Set WrdApp = New Word.Application
Set WrdDoc = WrdApp.Documents.Open(wbBook.Path & "\md.docx")
'WrdApp.Visible = True
'Loop through the charts on the active sheet
For Each ChrtObj In ActiveSheet.ChartObjects
'Copy the chart
ChrtObj.Chart.ChartArea.Copy
'Paste the Chart in the Word Document
With WrdApp.Selection
.PasteSpecial Link:=True, DataType:=wdPasteOLEObject, Placement:=wdInLine
End With
'Count the pages in the Word Document
SecCnt = WrdApp.ActiveDocument.Sections.Count
'Add a new page to the document.
WrdApp.ActiveDocument.Sections.Add
'Go to the newly created page.
WrdApp.Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext
Next ChrtObj
End Sub