Hi all,
I have an Excel WorkBook with VBA macros, There is no problem with it on Excel.
As I try to open it on LO Calc, I got a lot of compatibility problems, I fixed them all but 1.
I fixed problems like conditional compilation (#If ... #End If) incompatibility.
I use Libre Office 6.1 Calc.
I use Libre Office 6.3 Calc.
I got 1 remaining error on this code:
Function Extract(Chaine, Optional Pos = 1, Optional Balise)
If IsNumeric(Chaine) Then
Extract = Chaine
Exit Function
End If
Set re = CreateObject("VBScript.RegExp")
re.Global = True
If IsMissing(Balise) Then
re.pattern = "[0-9,.]+"
Set A = re.Execute(Chaine)
If A.Count >= Pos Then Extract = val(Replace(A(Pos - 1), ",", "."))
Else
re.pattern = Balise
B = Strings.Split(re.Replace(Chaine, vbNullChar), vbNullChar)
If B.Count >= Pos Then Extract = val(Replace(B(Pos - 1), ",", "."))
End If
End Function
Error Message:
Erreur d'exécution BASIC.
'1'
Type: com.sun.star.script.CannotConvertException
Message: [automation bridge]UnoConversionUtilities<T>::anyToVariant
Cannot convert the value of type :"com.sun.star.uno.XInterface" to the expected Automation type of VARTYPE: 8
The
execute
is supposed to return collection of object.
Usage:
A1= "100x10x150"
A2= Extract(A1) => 100
A3= Extract(A1,2) => 10
A4= Extract(A1,3) => 150
What I have tried:
This code works perfectly in Excel, but fail to compil in Calc.
What did I missed?