I have a pivot table which I am refreshing in my macro.

it seemed to work fine, but today it has started returning an error:

"Run-time Error '1004'
[Microsoft][ODBC Microsoft Access Driver] The connection for viewing your linked Microsoft Excel worksheet was lost."

If I refresh it manually, there doesn't seem to be any problem.

the bit of code that is refreshing is:
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh

can anyone suggest what is wrong?

thanks in advance,
Matt