ID: Q186765
The information in this article applies to:
When you open a file that was saved in the Lotus 1-2-3(.wk3) format in Microsoft Excel 7.0 or Microsoft Excel 97, a Microsoft Visual Basic for Applications subroutine may return False when you try to programatically determine whether the values in a cell are left aligned. In Microsoft Excel 5.0, the same subroutine returns True.
To see an example of this problem, please see the "More Information" section of this article.
This problem may 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 7.0 or Excel 97, the same subroutine returns False if the cells use the General format.
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 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/refguide/
To see an example of the problem, follow these steps:
1. Start Microsoft Excel 5.0.
2. Type the following into a new workbook:
A1: Left
A2: General
3. Select cell A1. On the Format menu, click Cells.
4. Click the Alignment tab on the Format cells dialog box. Under
Horizontal, click Left. Click OK.
5. On the File menu, click Save As. In the File Name box, type "test"
(without the quotation marks). In the Save File as Type list,
click WK3 (1-2-3). Click OK. Click OK again when the Summary Info
dialog box appears.
6. 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.
7. On the Insert menu, point to Macro, and then click Module.
8. Type the following Visual Basic subroutine into the new module sheet:
Sub Test()
Msgbox(Worksheets(1).Range("A1").Horizontalalignment = xlLeft)
Msgbox(Worksheets(1).Range("A2").Horizontalalignment = xlLeft)
End Sub
9. 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.
10. Close the test.wk3 workbook and do not save the changes.
11. Open test.wk3 in Excel 7.
12. Select A1. On the Format menu, click Cells.
13. Click the Alignment tab on the Format cells dialog box. Under
Horizontal, click Left. Click OK.
14. Repeat steps 7 through 9.
In Microsoft Excel 7 and Excel 97, the first message box returns True; the second returns False.
For more information about the alignment of cells, click Microsoft Excel Help Topics on the Help menu, click the Index tab in Microsoft Excel 7.0 Help, type the following text
aligning cell contents
and then double-click the selected text to go to the "Basic Formattting"
topic.
Additional query words: XL97 7.0
Keywords : kbdta kbdtacode KbVBA xlvbmigrate xlwin
Version : WINDOWS:5.0,7.0,97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 18, 1999