Yes, I should have been more precise. :-)
It's when it reaches the .Commandtext that I get Run-time
Error '1004'. The OldQueryString and NewQueryString are
correctly "populated" with a simple SQL statement.
DBFile = ThisWorkbook.Path & "\CPHNK Måluppföljning.mdb"
Constring = "ODBC;DSN=MS Access Database; DBQ=" & DBFile
NewString = SELECT * FROM Output2007
OldString = ActiveWorkbook.PivotCaches(1).CommandText
With PTCache
.Connection = Constring
.CommandText = Replace(PTCache.CommandText, OldString,
NewString)
End With