Question : VBA Excel encoding

Hi experts,

For the encoding of an excel file, checking for encoding can be made by Application.DefaultWebOptions.Encoding = msoEncodingWestern

However, is there any way we can validate the encoding of a certain field? For example, the cell value entered is msoEncodingWestern but the desired one would be in msoEncodingTraditionalChineseBig5. Would it be possible for such validation? Thanks.

Manfred

Answer : VBA Excel encoding

manfredino,

Anything that starts with " Application. " will be in effect for the whole Excel program in general, not just a Field (Column).

See here:
http://msdn2.microsoft.com/en-us/library/aa214279(office.11).aspx
And here:
http://msdn2.microsoft.com/en-us/library/aa213696(office.11).aspx
and here:
http://msdn2.microsoft.com/en-us/library/aa221573(office.11).aspx

You can try something like this to change the encoding of the entire Excel File:

Sub ChangeWebEncoding()
    If Application.DefaultWebOptions.Encoding = msoEncodingWestern Then
        Application.DefaultWebOptions.Encoding = msoEncodingTraditionalChineseBig5
    End If
End Sub

But, according to the links, you cannot "Validate" it for a column/cell.
(Cells have no DefaultWebOptions.Encoding property)

This property is used to encode the entire workbook (or sheet, if selected) when saved as a web page.

Jeffrey Coachman

Random Solutions  
 
programming4us programming4us