Unicode

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

Can anyone give me ideas on how to import Cyrillic text e.g. in Russian
language from .TXT file (Unicode format) to a Word document or a UserForm
using VBA or VB6.

Presently, I face the difficulty that the text appears as boxed characters
in User form.

Any help would be appreciated.

Raj
 
Hi Raj,

When opening the file using the Open method of the Documents collection, you
should set the Format parameter to wdOpenFormatUnicodeText.

In order to ensure that the text displays correctly when you transfer it to
a UserForm, you will at least have to ensure that the relevant controls use
a font that supports all the necessary Unicode characters. Most fonts using
the Latin alphabet do not support all the non-latin characters.

The Arial Unicode MS font contains *all* the Unicode characters that have so
far been defined. If you do not have it already installed on your PC, there
are a number of locations on the internet from which you can download it.

Even this might not be sufficient, you will have to experiment. I'm not sure
that the controls in UserForms are fully Unicode-enabled. If they aren't,
then I think you will simply be stuck, unfortunately.
 
Hi Jonathan,

Thank you very much for your kind advise.

I knew about the font part but wdOpenFormatUnicodeText was new.

I tried out this as below:

Dim myDoc As Document
Set myDoc = Documents.Add
Set myDoc = Documents.Open("FileUnicode.txt", , , , , , , , ,
wdOpenFormatUnicodeText)

This opens the DELIMITED .TXT as a new Word document showing the unicode
text correctly but how to access the data next?

What I need is to display the unicode data contained in .TXT file at a
specific place using bookmark. Do you have any ideas on how to use this
'mydoc' as a datasource? I mean how to access specific fields?

I can skip displaying the data in userform because most liked VB or VBA user
forms do not support unicode.

Once again, Thanks a million for your help.
 
Hi Jonathan,

Thank you very much for your kind advise.

I knew about the font part but wdOpenFormatUnicodeText was new.

I tried out this as below:

Dim myDoc As Document
Set myDoc = Documents.Add
Set myDoc = Documents.Open("FileUnicode.txt", , , , , , , , ,
wdOpenFormatUnicodeText)

This opens the DELIMITED .TXT as a new Word document showing the unicode
text correctly but how to access the data next?

What I need is to display the unicode data contained in .TXT file at a
specific place using bookmark. Do you have any ideas on how to use this
'mydoc' as a datasource? I mean how to access specific fields?

I can skip displaying the data in userform because most liked VB or VBA
user forms do not support unicode.

Once again, Thanks a million for your help.
 
Raj said:
Hi Jonathan,

Thank you very much for your kind advise.

I knew about the font part but wdOpenFormatUnicodeText was new.

I tried out this as below:

Dim myDoc As Document
Set myDoc = Documents.Add
Set myDoc = Documents.Open("FileUnicode.txt", , , , , , , , ,
wdOpenFormatUnicodeText)

This opens the DELIMITED .TXT as a new Word document showing the unicode
text correctly but how to access the data next?

Probably the simplest thing to do is load the whole lot into a string, with
the following code that would follow directly from your code above

Dim strUnicode as String
strUnicode = myDoc.Range.Text

Then you can close the document and manipulate the string in any way you
want, and place it or portions of it in the appropriate places within your
own document.
What I need is to display the unicode data contained in .TXT file at a
specific place using bookmark. Do you have any ideas on how to use this
'mydoc' as a datasource? I mean how to access specific fields?

Exactly how you would manipulate the string depends on the layout of the
data wihin the unicode file. You may find vaiour of the string handling
functions useful, including Left, Mid, Right, Instr, InstrRev and Split.
 
Thanks a million Jonathan, Keeping your advise in mind, I have thought
of using Word doc as data source. This Word doc can have bookmark as the
key for each record.

I shall try this solution in a day or two.

Thank you very much.
 
Back
Top