Bug 81003 - BASIC runtime error. '380' Incorrect property value
Summary: BASIC runtime error. '380' Incorrect property value
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.3.3 release
Hardware: Other Windows (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
 
Reported: 2014-07-07 12:46 UTC by Bob
Modified: 2022-12-04 03:51 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Very simple excel spreadsheet with VB macro (18.00 KB, application/vnd.ms-excel)
2014-07-07 12:46 UTC, Bob
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bob 2014-07-07 12:46:42 UTC
Created attachment 102371 [details]
Very simple excel spreadsheet with VB macro

Problem description: 
I get BASIC runtime error. '380' Incorrect property value when a simple spreadsheet calls this function in an xls spreadsheet (using LO 4.2.5.2 on Win7 Home Prem)

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Option Explicit


Global Const DAYS_PER_YEAR As Double = 365.25
Global Const MONTHS_PER_YEAR As Double = 12#


Public Function getCompound(initValue As Double, initDate As Date, finalDate As Date, intRate As Double) As Double
    Dim adjPeriod As Double
    adjPeriod = (finalDate - initDate) / DAYS_PER_YEAR
    getCompound = initValue * (1 + intRate) ^ adjPeriod
End Function

The macro works if I change VBASupport to 0 but the VBASupport line is added by LO and it is impractical to expect users to change code every time they open a Spreadsheet.

What is it actually objecting to?

The same spreadsheet works fine in OO 4.1.0 with Option VBASupport 1

Steps to reproduce:
Open attached spreaheet with LO Calc

Current behavior:
BASIC runtime error. '380' Incorrect property value


Expected behavior:
Correct execution of function as on Excel and OO calc 4.1
              
Operating System: Windows 7
Version: 4.2.5.2 release
Comment 1 tommy27 2014-07-21 18:30:57 UTC
I got that error message in each LibO version I tested, the oldest being LibO 3.3.3 and the newer being 4.4.0.0.alpha0+ (*)

(*) Build ID: b9dca968c6fd0ab5ca140c65b0e54d153cd34986
TinderBox: Win-x86@42, Branch:master, Time: 2014-07-18_22:51:20

I add BASIC expert to CC list to hear his opinion.

that file loads fine in MS Excel Viewer
Comment 2 Noel Power 2014-07-21 19:44:49 UTC
(In reply to comment #1)
> I got that error message in each LibO version I tested, the oldest being
> LibO 3.3.3 and the newer being 4.4.0.0.alpha0+ (*)
> 
> (*) Build ID: b9dca968c6fd0ab5ca140c65b0e54d153cd34986
> TinderBox: Win-x86@42, Branch:master, Time: 2014-07-18_22:51:20
> 
> I add BASIC expert to CC list to hear his opinion.
> 
> that file loads fine in MS Excel Viewer

the problem seems related to handling of the Date type (and specifically when that type is passed as a param to a formula) iirc there is some special handling or conversion for Dates in VBA mode (or something... tbh it's a long time since I looked at that stuff) If you rewrite the macro signature without the type specifier for the Date types it should work in both excel and libreoffice

e.g.

Public Function getCompound(initValue As Double, initDate, finalDate, intRate As Double) As Double

so initDate & finalDate are treated as Variant types
Comment 3 Bob 2014-07-22 15:24:36 UTC
Thanks,

The work around solves the problem in my test case and in my real, much more complicated spreadsheet.

I can now suggest LO as valid alternative to excel for my users who dont have MS Office.

Of course it would be good for the underlying problem to to be fixed so that others don't experience the same problem
Comment 4 QA Administrators 2015-09-04 02:49:44 UTC Comment hidden (obsolete)
Comment 5 Buovjaga 2015-11-30 13:55:38 UTC
Still confirmed.

Minor due to workaround.

Win 7 Pro 64-bit Version: 5.2.0.0.alpha0+
Build ID: a7c3a2a9be83686657c06f37d521f9f6d2004ddd
Threads 4; Ver: Windows 6.1; Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2015-11-28_04:39:18
Locale: fi-FI (fi_FI)
Comment 6 QA Administrators 2017-01-03 19:36:43 UTC Comment hidden (obsolete)
Comment 7 tommy27 2017-01-03 23:01:24 UTC
bug still present in LibO 5.2.4.2
Comment 8 QA Administrators 2018-01-04 03:34:47 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2020-01-05 03:48:29 UTC Comment hidden (obsolete)
Comment 10 himajin100000 2020-01-06 05:57:35 UTC
When I changed the given code as follows,

Public Function getCompound(initValue As Double, initDate, finalDate, intRate As Double) As String' Calculate and apply compound interest for the period specified
    Dim adjPeriod As Double
    adjPeriod = (finalDate - initDate) / DAYS_PER_YEAR
    getCompound = TypeName(initDate)
    
End Function

I mean,

1. Removed the type declaration from initDate and finalDate
2. I changed the returned value to TypeName of initDate
3. Changed the return type to String

The returned value on the cell where this function is used was "Range"

https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr4.cxx?r=6873e0a9#3304
Comment 11 Finch. A 2020-12-03 11:33:21 UTC Comment hidden (spam)
Comment 12 QA Administrators 2022-12-04 03:51:31 UTC
Dear Bob,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug