Reputation:
i have files that open with excel. when i open the file the text is like gibberish. i need to encode - tools-internet option - general-encode - hebrew iso-visual and then the file turn to hebrew
there is a vba code that do that ?
thanks, omri
Upvotes: 0
Views: 2792
Reputation: 4063
Use the following function from ADODB Stream, with the following code.
Page 1255 is the original Hebrew page. And you need to reference the latest Microsoft ActiveX Data Objects Library. (Tools/References)
Public Function CorrectHebrew(gibberish As String) As String
Dim inStream As ADODB.stream
Set inStream = New ADODB.stream
inStream.Open
inStream.Charset = "WIndows-1255"
inStream.WriteText gibberish
inStream.Position = 0 ' bring it back to start preparing for the ReadText
inStream.Charset = "UTF-8"
CorrectHebrew = inStream.ReadText ' return the corrected text
inStream.Close
End Function
Upvotes: 1
Reputation: 6780
I don't really have a way to test this, so I am just taking a shot:
Excel.ActiveWorkbook.WebOptions.Encoding = msoEncodingHebrew
Upvotes: 1