Microsoft KB Archive/213664

= XL2000: Macro Works Differently on .wk3 Files Than in Microsoft Excel 5.0 =

Article ID: 213664

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q213664





SYMPTOMS
When you open a file that was saved in the Lotus 1-2-3(.wk3) format in Microsoft Excel 2000, a Microsoft Visual Basic for Applications subroutine may return the value False when you try to programmatically determine whether the values in a cell are left-aligned. In Microsoft Excel 5.0, the same subroutine returns the value True.

For an example of this problem, see the "More Information" section of this article.



CAUSE
This behavior can occur when the cells are formatted with the General format. In Excel 5.0, if the cell uses the General format, your subroutine returns True if you test for left alignment. However, in Excel 2000, the same subroutine returns False if the cells use the General format.



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



MORE INFORMATION
Microsoft 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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

To see an example of the problem, follow these steps:  Start Microsoft Excel 5.0. Type the following into a new workbook:

A1: Left

A2: General

 Select cell A1, and then click Cells on the Format menu. Click the Alignment tab in the Format Cells dialog box. Under Horizontal, click Left, and then click OK. On the File menu, click Save As. In the File name box, type test. In the Save file as type list, click WK3 (1-2-3), and then click OK. Click OK again when the Summary Info dialog box appears.</li> On the File menu, click Close. Click No when you are prompted to save the file in the Microsoft Excel format. On the File menu, click Test.WK3.</li> On the Insert menu, point to Macro, and then click Module.</li>  Type the following Visual Basic subroutine in the new module sheet: Sub Test

Msgbox(Worksheets(1).Range("A1").Horizontalalignment = xlLeft) Msgbox(Worksheets(1).Range("A2").Horizontalalignment = xlLeft)

End Sub </li> Move the insertion point inside the subroutine. On the Run menu, click Start.

Both message boxes return True, even though cell A2 uses the General format.</li> Close the Test.wk3 workbook and do not save the changes.</li> Open the Test.wk3 workbook in Excel 2000.</li> Select A1, and then click Cells on the Format menu.</li> Click the Alignment tab in the Format Cells dialog box. Under Horizontal, click Left (Indent), and then click OK.</li>  Press ALT+F11 to start the Visual Basic editor, click Module on the Insert menu, and then type the following on the module sheet: Sub Test

Msgbox(Worksheets(1).Range("A1").Horizontalalignment = xlLeft) Msgbox(Worksheets(1).Range("A2").Horizontalalignment = xlLeft)

End Sub </li> Press ALT+F11 to return to Excel, press ALT+F8 to open the Macro dialog box, click Test, and then click Run.</li></ol>

In Microsoft Excel 2000, the first message box returns True; the second message box returns False.

<div class="references_section">