Bug 167189 - Error LibreOffice Writer Form - Macro
Summary: Error LibreOffice Writer Form - Macro
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.2.4.3 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-06-24 16:34 UTC by Emiliano A. González
Modified: 2025-06-24 20:38 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Document macro error (13.10 KB, application/vnd.oasis.opendocument.text)
2025-06-24 16:34 UTC, Emiliano A. González
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emiliano A. González 2025-06-24 16:34:05 UTC
Created attachment 201446 [details]
Document macro error

An error occurred in a Writer form when executing a macro.
This macro is not new. I have been using it since OpenOffice, quite a few years. It has never shown an error before.
LibreOffice Writer.
When running in LibreOffice 25.2.0.1 and following the following comes up:
The date is changed in the control: "Fecha de inicio - Start date"

"Tipo de datos o valor indamisible. Discrepancia del tipo de datos."

"Error de ejecución de BASIC. Variable de objeto no establecida."

"Data type or indamisible value. Data type discrepancy."

"BASIC execution error. Object variable not set."


Reason for the bug is the date control, which won't work. It will save the right value in LO 24.8.4.2, fails to save the choosen value in LO 25.2.0.1 y and following.
So it's a regression.

MACRO
-----------
Sub ActualizarFechaAnterior( Event )

   obj = Event.Source.Model
   fecha_seleccionada = obj.Text
   fecha_anterior = DateAdd("d", -1, fecha_seleccionada)
   frm = obj.Parent
   obj_fecha_seleccionada = frm.getByName("fecha_inicial")
   obj_fecha_seleccionada.BoundField.UpdateString(Format(fecha_seleccionada,"YYYY-MM-DD"))
   obj_fecha_anterior = frm.getByName("fecha_anterior")
   obj_fecha_anterior.BoundField.UpdateString(Format(fecha_anterior,"YYYY-MM-DD"))
   frm.UpdateRow
   
End Sub

-------------

Version: 25.2.4.3 (X86_64) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 8; OS: Linux 6.15; UI render: default; VCL: kf5 (cairo+wayland)
Locale: es-ES (es_ES.UTF-8); UI: es-ES
Calc: threaded
Fedora 42
Comment 1 Mike Kaganski 2025-06-24 18:55:39 UTC
The macro fails the same way in OOo 3.3, AOO 4.1, LO 5.0, LO 24.8, and LO 25.2: the obj_fecha_seleccionada.BoundField is null. And that indicates, that something is missing in your example: where is the data set?
Comment 2 Mike Kaganski 2025-06-24 19:40:17 UTC
And it seems to me, that your initial "Data type or indamisible value. Data type discrepancy" is bug 166342, fixed in 25.2.4 - which message I indeed don't see in my 25.2.4.
Comment 3 Emiliano A. González 2025-06-24 20:13:33 UTC
This macro also gives error in LibreOffice Base, in a form.
For that reason I have made the proof of concept to see if it is an error only in Base or also in Writer. In the end it has given in both.
I published this bug some time ago for Base.

https://bugs.documentfoundation.org/show_bug.cgi?id=164465
Comment 4 Mike Kaganski 2025-06-24 20:38:26 UTC
(In reply to Emiliano A. González from comment #3)
> I published this bug some time ago for Base.
> 
> https://bugs.documentfoundation.org/show_bug.cgi?id=164465

... and it was already resolved duplicate, of that exact same bug. The bug was fixed, as mentioned; and version 25.2.4 with the fix is released; but you file this bug again.

OK, you report it in Version: 25.2.4.3; but your example does *not* show the error "Data type or indamisible value. Data type discrepancy" in it; and the "Object variable not set" is not a bug, but the matter of fact. How can the bug be reproduced? Is the "obj_fecha_seleccionada" and its "BoundField" relevant at all? Will a simple MsgBox, or another built-in function, be enough?