xsharp.eu • COMException when trying to start Ms Word through COM Interop - Page 2
Page 2 of 2

COMException when trying to start Ms Word through COM Interop

Posted: Wed May 20, 2020 11:21 am
by robert
Peter,

A quick workaround would be (for the document load):

Code: Select all

LOCAL oDoc := docxPfad AS OBJECT
wdApp:Documents:Open( REF oDoc ) 

Robert

COMException when trying to start Ms Word through COM Interop

Posted: Wed May 20, 2020 2:32 pm
by robert
Peter,
The issue is found and fixed in the next build.
When running in a non core dialect we are handling default parameters a bit different, since VO and Vulcan allowed to define default parameter values "in the middle", such as

Code: Select all

FUNCTION Test(par1 AS  STRING, par2 := "test" AS STRING,  par3 as LONG) AS LONG
..
RETURN 123

FUNCTION Start AS VOID
? Test("Foo",,345)

This is not allowed in C# / Roslyn.
And the code in which we take care of replacing missing parameters was somehow messing things up for "COM calls".

Robert

COMException when trying to start Ms Word through COM Interop

Posted: Fri May 22, 2020 1:36 pm
by pemo18
Hello Robert,

That is very good.

I know from my past as a VB- and C++ developer in the 90ties that COM interfaces ara ugly (to many pointers) and that the Office interop assemblies and the C# compiler do some tricks to make method calls with many default parameters as simple as possible.

In the meantime wil we use a C# class lib as a workaround.

Kind regards,
Peter