0
votes

I'm aware that there are several posts regarding this Run-time error '438', but I still can't figure out how to fix this. This is my entire code: https://pastebin.com/S6LigcWz but the part in question is this:

With c.ChartData
    .Activate
    .Workbooks.Sheets(1).UsedRange.Clear
    .Workbooks.Sheets(1).Range(A2).Select
    .Selection.PasteSpecial xlPasteValues
    .Workbooks.Close
End With                

This code starts in ppt then goes into excel and copies a range then "tries" to paste into a chart in ppt. This is the part of the code where it's trying to paste into the chart, and the part where the error occurs. It errors on .Workbooks.Sheets(1).UsedRange.Clear

Any help is appreciated.

1
Are you executing this in PowerPoint or Excel? - jcarroll
Where is your object reference to Powerpoint? - braX
I am executing in ppt. So the macro has references to excel instead. @jcarroll - Pinlop
Try taking the dots off the beginning of the Workbooks - DaBeau96
@DaBeau96 oh, good eye! post that as an answer - ChartData definitely doesn't have a Workbooks member! - Mathieu Guindon

1 Answers

2
votes

I would take the dots off the beginning of the Workbooks because ChartData doesn't have a Workbooks member