I use a macro in PowerPoint 2003 SP3 to find the specified chart in an Excel workbook, copy it, and then paste into the current slide as an extended metafile, ultimately the following line of code:
Application.ActiveWindow.View.PasteSpecial DataType:=ppPasteEnhancedMetafile
Once it works, I also get the following error:
Run-time error '-2147188160 (80048240)':
View (unknown member): Invalid request. The specified data type is unavailable.
If I end the macro and try to manually insert Special as an extended metafile, I have no problem, so it is not as if the clipboard object or paste type is invalid.
Has anyone else experienced this? Do you have a solution or workaround? There are several results in this error and no solutions in a Google search.
Update
The general code is as follows:
Set presPPTCurrent = ActivePresentation Set objXLApp = GetObject(, "Excel.Application") ''
Note that this is in Sub, to which the Shape is transmitted (the transmitted form is used as a link to search for a chart in Excel). I realized that these are only errors when I try to reuse this sub on several forms submitted from the For Next loop to another Sub.
However, if I pass one Shape to this Sub using another Sub, and then re-run the Sub, which passes multiple Shapes, it works fine.
Decision
According to Otaku, the macro was losing its focus on the slide panel. Informing that the problem was solved for re-selecting the slide area.
Application.ActiveWindow.Panes(2).Activate