Jump to content
Sign in to follow this  

Weird ExcelCOM_UDF and character problem

Recommended Posts



I got a bit of a weird problem.

I have made a script to extract custom properties values out of files using dsofile.dll.

The weird thing, is that when I extract the properties and put them into a excel workbook using ExcelCOM_UDF some of the characters are displayed as another character then the one you see in the custom properties tab of the file.

Example could be the following:

:: Original

CustomProperties.Name = Beskriv

CustomProperties.Value = ø45x65

:: In a text file using FileOpen / FileWriteLinie it will look like this in notepad

Name = Beskriv

Value = ø45x65

:: But in the excel workbook it looks like this

Name = Beskriv

Value = ø45x65

It seems that all danish characters like ÆØÅ and æøå are "converted" to "rubbish", but the really weird think is that I at the same time writes values from a ini file to create the "layout" of the excel workbook, and the danish characters from the ini file, is NOT being "converted", they look as the should.

I use ExcelCOM_UDF to create all entries in the Excel Workbook.

See the below code snippet:

For $i = 1 to $aFiles[0]

$sCurrentFile = $aFiles[$i]

If StringLen($sCurrentFile) > 35 Then

_InfoTxt("Adding data from: ..." & StringRight($sCurrentFile, 35))


_InfoTxt("Adding data from: " & $sCurrentFile)


$sCurrentRow = $i + 1

_ExcelWriteCell($oExcel, $sCurrentFile, $sCurrentRow, 1)

If not FileExists($sCurrentFile) Then

MsgBox(4096, "CustomProperties - ERROR", "Error occurred, Could not find " & $sCurrentFile & @CRLF & "The program will abort.")



$oDocument = $oPropertyReader.GetDocumentProperties($sCurrentFile)

If Not $odocument.IsReadOnly Then

$oCustomProperties = $odocument.CustomProperties

For $ia = 1 to $aFileProperties[0][0]

$sProperty = $aFileProperties[$ia][1]

For $strProperty in $oCustomProperties

If $strProperty.Name = $sProperty Then

_ExcelNumberFormat($oExcel, "@", $sCurrentRow, $ia + 1, $sCurrentRow, $ia + 1)

_ExcelWriteCell($oExcel, $strProperty.Value, $sCurrentRow, $ia + 1) ;<-- This gives ø32x220 for some af the values

$testFile = FileOpen(@ScriptDir & "\test.txt", 1+8)

FileWriteLine($testFile, $strProperty.Value) ;<--- This give ø32x220 for the same values






MsgBox(4096, "CustomProperties - ERROR", "Error occurred, the file : " & @CRLF & $sCurrentFile & @CRLF & " is readonly and will be skipped.")



I hope some one can help me find out why this is happening.



Edited by Prozac

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.