Bug 117739 - Malfunction in com.sun.star.bridge.OleObjectFactory
Summary: Malfunction in com.sun.star.bridge.OleObjectFactory
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2018-05-22 08:05 UTC by joesch04
Modified: 2018-07-27 13:42 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
error message (38.49 KB, image/png)
2018-05-27 09:50 UTC, raal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description joesch04 2018-05-22 08:05:22 UTC
Description:
I cannot access the contents of a variable created by executing a VBScript via the'automation bridge'. The error message (in line "rueck = WSH.CodeObject.x") is (german LO):

"BASIC-Laufzeitfehler.
 Es ist eine Ausnahme aufgetreten 
 Type: com.sun.star.uno.RuntimeException
Message: [automation bridge] Could not get FUNCDESC for x."

My code is:

Sub WSH_test()
	'kopiert Adressen aus Kontakte-Ordner von Outlook in eine Tabellendatei
	'und meldet diese Tabellendatei als Datenbank namen "Outlook_Kontakte" in OO an
	
	Dim OleService As Object
	Dim WSH As Object
	Dim vbs
	Dim i, j
	
	Dim rueck
	
	If getGuiType() <> 1 Then
		Msgbox "Dieses Makro funktioniert nur unter dem Betriebssystem MS Windows.", 16, "Abbruch"
		Exit Sub
	End If

	OleService = CreateUnoService("com.sun.star.bridge.OleObjectFactory")
	WSH = OleService.CreateInstance("MSScriptControl.ScriptControl")
	WSH.Language = "VBScript"
	
	vbs = vbs & "x = Array(1,2,3)" + CHR(10)
	vbs = vbs & "Msgbox 3+4" 

	WSH.ExecuteStatement(vbs)

	rueck = WSH.CodeObject.x
	
	For i = 0 To UBOUND(rueck)
		j = j & rueck(i) & CHR(13)
	Next i
	
	Msgbox j
	
End Sub


Notice:
The code works fine in AOO (tested in AOO 4.1.2)

Steps to Reproduce:
run the code:

Sub WSH_test()
	'kopiert Adressen aus Kontakte-Ordner von Outlook in eine Tabellendatei
	'und meldet diese Tabellendatei als Datenbank namen "Outlook_Kontakte" in OO an
	
	Dim OleService As Object
	Dim WSH As Object
	Dim vbs
	Dim i, j
	
	Dim rueck
	
	If getGuiType() <> 1 Then
		Msgbox "Dieses Makro funktioniert nur unter dem Betriebssystem MS Windows.", 16, "Abbruch"
		Exit Sub
	End If

	OleService = CreateUnoService("com.sun.star.bridge.OleObjectFactory")
	WSH = OleService.CreateInstance("MSScriptControl.ScriptControl")
	WSH.Language = "VBScript"
	
	vbs = vbs & "x = Array(1,2,3)" + CHR(10)
	vbs = vbs & "Msgbox 3+4" 

	WSH.ExecuteStatement(vbs)

	rueck = WSH.CodeObject.x
	
	For i = 0 To UBOUND(rueck)
		j = j & rueck(i) & CHR(13)
	Next i
	
	Msgbox j
	
End Sub

Actual Results:  
I get an error message

Expected Results:
the content of variable x is returned


Reproducible: Always


User Profile Reset: Yes



Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
Comment 1 raal 2018-05-27 09:50:12 UTC
Created attachment 142308 [details]
error message

Tested with Version: 6.1.0.0.alpha1+ (x64)
Build ID: e1a8338876bd161de4e9d9a4b22d4bc5335f7cee
CPU threads: 1; OS: Windows 6.1; UI render: default; 
and I get error message: BASIC runtime error.
Object variable not set.
Comment 2 Xisco Faulí 2018-05-29 09:48:37 UTC
Reproduced in

- Versión: 6.0.4.2
Id. de compilación: 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf
Subprocs. CPU: 1; SO: Windows 6.1; Repres. IU: predet.; 
Configuración regional: es-ES (es_ES); Calc: group

- Versión: 4.4.0.3
Id. de compilación: de093506bcdc5fafd9023ee680b8c60e3e0645d7
Configuración regional: es_ES

- LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

but not in Apache OpenOffice 4.1.3. weird....