Encoding in Documents.Open

B

BillCPA

I have a substantial number of text documents that I open in Word (2003) and
do some processing on. To get started, I recorded a macro that opened a
file, did a couple of things to it, and closed it. I have made several
additions to the macro and tested it over the last couple of weeks.

A couple of days ago, I noticed that the file that Word opened did not have
any dashes or apostrophes in it that were in the original text file. I
played with it for a while, but eventually I recorded another macro, and this
time the dashes and apostrophes were included.

In the original macro, the 'Encoding' parameter was set as 65001; in the
most recent recording, the parameter was set to 1252.

The 'Help' in the VBA Editor talks about Encoding, and msoEncoding, as
relating to character sets, but always in terms of names, not numbers. Is
there any information somewhere that tells what number matches with what name?
 
J

Jay Freedman

I have a substantial number of text documents that I open in Word (2003) and
do some processing on. To get started, I recorded a macro that opened a
file, did a couple of things to it, and closed it. I have made several
additions to the macro and tested it over the last couple of weeks.

A couple of days ago, I noticed that the file that Word opened did not have
any dashes or apostrophes in it that were in the original text file. I
played with it for a while, but eventually I recorded another macro, and this
time the dashes and apostrophes were included.

In the original macro, the 'Encoding' parameter was set as 65001; in the
most recent recording, the parameter was set to 1252.

The 'Help' in the VBA Editor talks about Encoding, and msoEncoding, as
relating to character sets, but always in terms of names, not numbers. Is
there any information somewhere that tells what number matches with what name?

In the VBA editor, display the Object Browser (F2) and search for the term
'encoding'. You'll get a list of all the members of the MsoEncoding enumeration,
and when you click on one you'll see its numeric value in the bottom pane.

For the values you mentioned, 65001 is msoEncodingUTF8 and 1252 is
msoEncodingWestern.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top