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.

XL2002: The TextVisualLayout Parameter Is Not Available for the OpenText Method in Excel 2002


View products that this article applies to.

Symptoms

If you use Microsoft Visual Basic for Applications (VBA) in Microsoft Excel 2000, the OpenText method has a parameter that is named TextVisualLayout. This parameter enables the programmer to specify the text layout for text files (right-to-left or left-to-right). The TextVisualLayout parameter is especially important if the text file that is going to be imported was written in code page 28598 (Hebrew ISO-Visual).

The TextVisualLayout parameter is not available in Excel 2002. As a result, the Hebrew text in text files that were written in code page 28598 (Hebrew ISO-Visual) appears reversed when the files are opened in Excel 2002.

↑ Back to the top


Workaround

Use one of the following methods to work around this problem:
  • Workaround 1: Use the Convtext.exe Tool to Convert the Text Files


    Use the Convtext.exe tool to convert the text files to the Hebrew (Microsoft Windows) text format, and then open the converted files in Excel 2002.

    The Convtext.exe tool is included in the Hebrew version of Microsoft Office XP and is located in the following folder:
    C:\Program Files\Common Files\Microsoft Shared\Office 10
    For additional information about the potential issues that may occur when you use the Convtext.exe tool, click the following article number to view the article in the Microsoft Knowledge Base:
    317256 � OFFXP: Error Message: "Problem Loading Bidi32.dll" When You Start Convtext.exe in Arabic or Hebrew Version of Office XP
  • Workaround 2: Use a Microsoft Excel Macro to Reverse the Order of the Characters in the Text Files


    If you have already imported the data to Microsoft Excel, use a macro to reverse the order of characters in right-to-left text. The following VBA sample code iterates through all cells in the used range on the active worksheet and reverses all strings that are made up of right-to-left characters.

    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, see the following Microsoft Web site: For additional information about the support options available from Microsoft, visit the following Microsoft Web site:
    Sub ReverseUsedRange()
    Dim mychar As String
    Dim mynewstring As String
    Dim mycurstring As String
    Dim mycell As Range
    
    For Each mycell In ActiveSheet.UsedRange
        If Not IsNumeric(mycell.Text) And mycell.Formula = mycell.Text Then
            mystring = mycell.Text
            'start value for RTL state
            i = 1
            textlen = Len(mystring)
            rtlstate = GetCharDirection(Mid(mystring, i, 1))
            
            'Loop through all characters in cell
            While i <= textlen
                mychar = Mid(mystring, i, 1)
                x = GetCharDirection(mychar)
                If x = rtlstate Or x = 0 Then
                    mycurstring = mycurstring & mychar
                Else
                    'If RTL state is different then append the characters that were
                    'collected in mycurstring to mynewstring
                    'Reverse mycurstring if it contains RTL characters
                    If rtlstate = 1 Or rtlstate = 0 Then
                        mynewstring = mynewstring & mycurstring
                    Else
                        mynewstring = mynewstring & StrReverse(mytext)
                    End If
                    mycurstring = mychar
                    rtlstate = x
                End If
                i = i + 1
            Wend
            'Add the last characters that are still in mycurstring
            If rtlstate = 1 Or rtlstate = 0 Then
                mynewstring = mynewstring & mycurstring
            Else
                mynewstring = mynewstring & StrReverse(mycurstring)
            End If
            
            'mycell.Offset(rowoffset:=0, columnoffset:=2).Value = mynewstring
            mycell.Value = mynewstring
            mynewstring = ""
            mycurstring = ""
        End If
    Next mycell
    End Sub
     
    Function GetCharDirection(mychar As String) As Integer
    'Input value: One-character string
    'Output value: 2 for right-to-left, 0 for neutral, 1 for left-to-right character
    'Right to Left
    If AscW(mychar) >= 1424 And AscW(mychar) <= 1791 Then
        GetCharDirection = 2
    'Neutral
    ElseIf InStr(1, " .,;:-_?!+*)(/\}{][=<>|'" & Chr(34), mychar, vbTextCompare) Then
        GetCharDirection = 0
    Else
    'Assume that all other characters will be left-to-right ones
        GetCharDirection = 1
    End If
    End Function

↑ Back to the top


More information

Note This article discusses complex scripts functionality. Complex scripts functionality is available when you use the Office Language Settings tool to enable a language, such as Arabic or Hebrew, that requires this functionality. For more information about multilingual features, click Microsoft your Office product Help on the Help menu, type multilingual features in the Office Assistant or the Answer Wizard, and then click Searchto view the topics that are returned.

↑ Back to the top


Status

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

↑ Back to the top


Keywords: KB817358, kbbidi, kbbug, kbmacroexample, kbpending

↑ Back to the top

Article Info
Article ID : 817358
Revision : 6
Created on : 11/23/2006
Published on : 11/23/2006
Exists online : False
Views : 232