Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Incorrect Classic PivotTable Format Constant Recorded in Macro


View products that this article applies to.

This article was previously published under Q236378

↑ Back to the top


Symptoms

When you run a recorded macro that formats a PivotTable, the PivotTable may be incorrectly formatted with the Report 1 style.

↑ Back to the top


Cause

This problem may occur if you formatted your PivotTable with the PivotTable Classic AutoFormat when you recorded your macro.

In this case, the macro recorder adds an invalid constant (xlClassicPivotTable) to the Format method in your code. So, this constant gets evaluated to a value of zero, which is the same value as the xlReport1 constant.

↑ Back to the top


Workaround

To work around this problem, modify the macro code that was generated by the macro recorder as follows:
  1. Start the Visual Basic Editor (press ALT+F11).
  2. Replace the invalid constant xlClassicPivotTable with the correct constant xlPTClassic.
  3. Close the Visual Basic Editor (press ALT+F11).

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


Keywords: KB236378, kbpending, kbdtacode, kbmacro, kbbug

↑ Back to the top

Article Info
Article ID : 236378
Revision : 5
Created on : 9/12/2006
Published on : 9/12/2006
Exists online : False
Views : 242