ActiveX currency type (MAPI)

Andrew Henshaw andrew.henshaw at gtri.gatech.edu
Mon Jun 16 05:31:50 EDT 2003


Bradley Schatz wrote:

> I am accessing through MAPI.Session, custom properties of outlook forms
> that reside in Exchange.
> 
> I am using the methods described comprehensively on the CDOLive site
> http://www.cdolive.com/cdo10.htm , specifically the Fields interface.
> 
> My problem is that for a Field that is of type Currency (the equivalent
> type of vbCurrency) I am getting a return of a tuple - for example for a
> price of $ 21,000,000 I get the tuple [4, -474836480]
> 
> According to the CDOlive documentation, the value should be an 8byte
> integer scaled by 1000.
> 
> Has anyone any suggestions on how to coerce win32com to unmarshal this
> type correctly?
> 
> Thanks,
> 
> Bradley

Not sure if this is the best way, but it should work.

import struct

hi, lo = (4, -474836480)
value = struct.unpack('q', struct.pack('II', lo, hi))
print value

>>
21000000000





More information about the Python-list mailing list