MSQuery Error When Refreshing the Pivot Cache

Cannot run 'MSQUERY.EXE'.  The program or one of its components is damaged or missing.

Run-time error '1004'.

Sharing for the sake of desperate googlers struggling with this problem…

If you’re working in MS Excel 2007 and you’re programmatically updating PivotCaches, but you get an error about “Cannot run ‘MSQUERY.EXE’.” despite the fact that MS Query seems to be running just fine all the other times, your problem may well be because of the asynchronous updates: if two pivot caches attempt to use MS Query at the same time, the second one explodes with this error. The solution is to set pvtCache.BackgroundQuery to false, which makes the cache refresh synchronous.

This entry was posted in Code Samples. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">