I am trying to create a pivot table from a Power Pivot Data Model. If I use the recorder, this is the code that is produced:

    ActiveWorkbook.PivotCaches.Create(SourceType:=xlExternal, SourceData:= _
        ActiveWorkbook.Connections("ThisWorkbookDataModel"), Version:= _
        xlPivotTableVersion15).CreatePivotTable TableDestination:="By Region!R17C1", _
        TableName:="PivotTable14", DefaultVersion:=xlPivotTableVersion15
    Cells(17, 1).Select
But if I simply try to re-run that recorded code, I get an invalid procedure error.

Any ideas on how to accomplish this?