Issue 10780 - Basic Currency type not implemented / not fully supported
Summary: Basic Currency type not implemented / not fully supported
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.0.1
Hardware: PC All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2003-01-19 22:26 UTC by mortoray
Modified: 2013-02-07 22:32 UTC (History)
1 user (show)

See Also:
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description mortoray 2003-01-19 22:26:14 UTC
In a Basic Macro the type "Currency" is not supported in basic operations, such as addition, multiplication, etc.  Additionally in standard spreadsheet functions the Currency type is not recognized correctly.

A straight forward example shows one case I can definitely reproduce (run this an the "Object variable not set error" appears on "a = a * ..." :

Sub Main
	Dim a as double
	a = 15
	a = a * SampleCurrency()
End Sub

Function SampleCurrency( ) As Currency
	SampleCurrency = 47.50
End Function

However, it appears that Currency doesn't involve itself with standard conversions and I had a lot of difficult getting it to work (eventually I gave up and switch my macros to Double and everything worked fine).  That is, in some situations multiplying a value by a Currency will equal 0, other times it will fail, other times it will work.

Here is one more case I found with the SUM function which indicates a problem.  Using these two macro functions:

Function CurrencyArray( ) As Variant
	Dim result( 2, 0 ) As Currency
	result( 0, 0 ) = 5.0
	result( 1, 0 ) = 7.5
	result( 2, 0 ) = 20
	CurrencyArray = result()
End Function

Function DoubleArray( ) As Variant
	Dim result( 2, 0 ) As Double
	result( 0, 0 ) = 5.0
	result( 1, 0 ) = 7.5
	result( 2, 0 ) = 20
	DoubleArray = result()
End Function

And then the following two formulas in the spreadsheet and their resulting displayed amount:
=SUM( CurrencyArray() )   // = 0  (Incorrect)
=SUM( DoubleArray() )     // = 32.5 (Correct)

In the end I decided to use Double instead, but it has precision problems not being decimal (for our company and our profits this doesn't appear to cause a big impact at the moment though :)

BTW, I almost went insane trying to figure out how to pass ranges of data back and forth between Macros and the Spreadsheet, the syntax is extremely picky and has about 100 pitfalls (all of which I fell in at some point).  So if perhaps I did something obviously wrong I'm not surprised...
Comment 1 frank 2003-01-20 11:20:54 UTC
Hi Bettina,

1 4 u I think.

Comment 2 ace_dent 2008-05-16 02:38:36 UTC Issue Tracker - Feedback Request.

The Issue you raised has the status 'New' pending further action, but has not
been updated within the last 4 years. Please consider re-testing with one of the
latest versions of OOo, as the problem(s) may have already been addressed.
Either use the recent stable version:
or consider trying the new OOo 3 BETA (still in testing):
Please report back the outcome so this Issue may be Closed or Progressed as
necessary - otherwise it may be Resolved as Invalid in the future. You may also
wish to search for (and note) any duplicates of this Issue that may have
advanced further by checking the Issue Tracker:
Many thanks,
Cleaning-up and Closing old Issues as part of:
~ The Grand Bug Squash, pre v3 ~
Comment 3 bettina.haberer 2010-05-21 14:45:15 UTC
To grep the issues easier via "requirements" I put the issues currently lying on
my owner to the owner "requirements".