Extension VBA-expression by WS Garcia is not work in libreoffice v25.2.3

Hello Team

Hoping for your good health and safety.

As the subject shows, I have installed the extension as per the VBAExprManual.pdf provided by the author.

The extension is installed and present in the library sections see below snapshot.

However, when I run the demo examples it shows the following error.

I tried the latest version of Libreoffice v26, and the error remained the same.
The guide says it for ver 7.5 and above so it should work, but this is unfortunate.

Please provide guidance in this regards, I may have been making mistakes here.

Thanks for your time and efforts.

Yours Sincerely
Muhammad Ali

The second line should work.

Dear Villeroy

Much Thanks for your input in this regards.

However, please note that second line is not working also, refer the following snapshot.

Please guide me in this regards.

Yours Sincerely
Muhammad Ali

Based on the second image, you placed the macro text in Module1 of the Standard library of the Testing.ods document.
Problems:

  1. The operator for loading the VBAExpressions library is missing.
  2. The New construct in LO Basic doesn’t assume (as far as I know) that the class module definition is contained in another library (this is also true in VBA). You need a proxy function in the VBAExpressions library (in a regular module) that will return a new class instance.

One solution.
Place in the TestRunner module of VBAExpressionsLib:

Public Function New_VBAExpressions()
 New_VBAExpressions = New VBAExpressions
End Function

Your macro:

Sub Test()
  Dim expr As Object
  GlobalScope.BasicLibraries.LoadLibrary("VBAExpressionsLib") 
  expr = New_VBAexpressions()
End Sub

Dear Sokol92

As per your input, unfortunately the results are same. I have modified the macro as shown below:

Anyways, this is issue with extension and not the LibreOffice Calc. Other extension are working OK.

So, lets wait for someone else to review and provide feedback.

Again, much thanks for your time and efforts in this regards. Much Appreciated.

the code lines are stated below for reference.

Private Sub VBAexpressionsDemo() 
 GlobalScope.BasicLibraries.LoadLibrary("VBAExpressionsLib")
 Dim expr As VBAexpressions
 Set expr = New VBAexpressions 
 With expr
 .Create "cos(pi)+sin(pi/2)"
 .Eval
 Debug.Print .expression & " = "; .result; " for "; .CurrentVarValues
 End With
 Set expr = Nothing 
End Sub
  1. Did you do it?

  2. You should check the functionality of my macro (Test), not yours, which contains incorrect constructions:

Dim expr As VBAexpressions
Set expr = New VBAexpressions 

Here is the corrected version of your macro:

Private Sub VBAexpressionsDemo() 
   Dim expr As Object
   GlobalScope.BasicLibraries.LoadLibrary("VBAExpressionsLib") 
   expr = New_VBAexpressions()
   With expr
    .Create "cos(pi)+sin(pi/2)"
    .Eval
     Msgbox .expression & " = " & .result
   End With
   expr = Nothing
 End Sub

2026-06-26 172251

Dear Solol92

Much Thanks for input and instructions. It was very helpful.

My mistake I was unable to understand that point earlier. So, this time I tried again and it worked. :sweat_smile:

I am really sorry in this regard. :cry:

This is what I did, as per your instructions.

01 I placed following code under TestRunner.

Public Function New_VBAExpressions()
 New_VBAExpressions = New VBAExpressions
End Function

see below snapshot.

02 Then I placed the corrected code under the standard module.

Private Sub VBAexpressionsDemo() 
   Dim expr As Object
   GlobalScope.BasicLibraries.LoadLibrary("VBAExpressionsLib") 
   expr = New_VBAexpressions()
   With expr
    .Create "cos(pi)+sin(pi/2)"
    .Eval
     Msgbox .expression & " = " & .result
   End With
   expr = Nothing
 End Sub

see below snapshot, with execution results. :smiley:

Much Thanks to you I was able to solve my issues.
I pray to GOD for the better health and safety for you and your family.

Yours Sincerely
Muhammad Ali

1 Like