The information in this article applies to:
SYMPTOMSIn Microsoft Excel 97, if you write a Visual Basic for Applications macro that uses the PasteSpecial method, the macro may not work correctly if it attempts to perform either of the following actions:
Note that the same macro works correctly in earlier versions of Microsoft Excel. CAUSE
This problem occurs because the Paste argument used by the PasteSpecial
method uses the wrong value; it uses the value 6 instead of the value 7.
Because the value 6 is used, the xlPasteAllExceptBorders constant
incorrectly causes validation formatting to be pasted.
WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspTo work around this problem, use the Paste argument and set it to the correct value. To do this, modify the macro so that it resembles one of the following examples. Paste Validation OnlyTo paste only validation formatting, change the value of the Paste argument to 6, as in the following example:
To avoid confusion, Microsoft recommends that you use this method instead
of using the xlPasteAllExceptBorders constant because it does not perform
the correct operation.
To Paste All Information Except BordersIf you want to paste all copied information except borders, change the value of the Paste argument to 7, as in the following example:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem no longer occurs in Microsoft Excel 2000. MORE INFORMATIONIf you click Paste Special on the Edit menu while recording a Visual Basic macro in Microsoft Excel 97, the Paste argument recorded in the code may be incorrect. For example, the action you record and the constant that is recorded are listed in the following table.
Note that if you run the recorded code, it works correctly even though it
does not appear to be correct.
If you write a macro or if you edit a recorded macro, the PasteSpecial method may not work correctly if you use the constant noted in Help. Additional query words: XL97
Keywords : kbprg kbdocerr kbdta kbdtacode KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |