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: Macro Works Differently on .wk3 Files Than in Microsoft Excel 5.0


View products that this article applies to.

This article was previously published under Q213664

↑ Back to the top


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.

↑ Back to the top


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.

↑ 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


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: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: 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, and then click Cells on the Format menu.
  4. Click the Alignment tab in the Format Cells dialog box. Under Horizontal, click Left, and then click OK.
  5. 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.
  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 in 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 the Test.wk3 workbook in Excel 2000.
  12. Select A1, and then click Cells on the Format menu.
  13. Click the Alignment tab in the Format Cells dialog box. Under Horizontal, click Left (Indent), and then click OK.
  14. 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
    					
  15. Press ALT+F11 to return to Excel, press ALT+F8 to open the Macro dialog box, click Test, and then click Run.
In Microsoft Excel 2000, the first message box returns True; the second message box returns False.

↑ Back to the top


References

For more information about aligning data in a cell, click Microsoft Excel Help on the Help menu, type align data in a cell in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB213664, kbpending, kbdtacode, kbbug

↑ Back to the top

Article Info
Article ID : 213664
Revision : 7
Created on : 11/23/2006
Published on : 11/23/2006
Exists online : False
Views : 340