Sheet name shall be also found, for instance:
Sub Button1_Click()
Dim wd As New Word.Application
Dim doc As Word.Document
Dim myChart As ChartObject, i As Integer, seriesFormula As String
Dim seriesSheet As String
Dim rng As Range, hasNonempty As Boolean
Set doc = wd.Documents.Add
wd.Visible = True
For Each myChart In ActiveSheet.ChartObjects
hasNonempty = False
For i = 1 To myChart.Chart.SeriesCollection.Count
seriesFormula = myChart.Chart.SeriesCollection(i).Formula
seriesFormula = Left(seriesFormula, Len(seriesFormula) - 3)
seriesSheet = Left(seriesFormula, InStrRev(seriesFormula, "!") - 1)
seriesSheet = Replace(Mid(seriesSheet, InStrRev(seriesSheet, ",") + 1), "'", "")
seriesFormula = Mid(seriesFormula, InStrRev(seriesFormula, "!") + 1)
For Each rng In Sheets(seriesSheet).Range(seriesFormula)
If Not IsEmpty(rng) Then hasNonempty = True
Next rng
Next i
If hasNonempty Then
myChart.Copy
wd.Selection.PasteSpecial _
Link:=False, _
DataType:=wdPasteEnhancedMetafile, _
Placement:=wdInLine, _
DisplayAsIcon:=False
End If
Next myChart
End Sub
Bookmarks