It's all about the answers!

Ask a question

Calling Word OLE method with multiple arguments

Christopher Cote (153) | asked Jul 07 '21, 2:51 p.m.
edited Jul 08 '21, 7:19 a.m. by Fariz Saracevic (814613)

 I am writing a script in DXL which needs to send 2 arguments to a Word function.  I assume that the arguments need to be sent (or "put") in the order they appear in the function's definition.  When I run the OLE method, however, I keep getting the following error message:

OLE problem: , OLE error code: -2147352562
I have been trying to figure out what this error code means, but have yet to find this exact error number.  Here is the DXL code I'm using to run the macro:
objWord = oleCreateAutoObject("Word.Application");

if(null objWord)
     errorBox("Unable to open word application");

//Open the docm file, insert contents of newly created HTML file and save as .doc
olePut(objWord, "Visible", true);
oleGet(objWord, "Documents", objDocs);
put(autoArgs, sHTMLFileName);
oleMethod(objDocs, "Open", autoArgs, objDoc);

put(macroArgs, nameOfMacro);
put(macroArgs, CMG_USER_DESKTOP);
put(macroArgs, sLastBL);

sErrorMess = oleMethod(objWord, "Run", macroArgs);
if (!null sErrorMess) infoBox(sErrorMess);

And the function in Word is:
Sub SaveHTMLAsDoc(sPath As String, sBaseline As String)

Am I adding the arguments in the wrong order? It would be GREATLY appreciated if someone knows how to fix this problem I've had for quite some time.


One answer

permanent link
Ralph Schoon (60.7k33643) | answered Jul 08 '21, 2:38 a.m.

I am reasonably sure that this is not a question that this forum can answer.

Your answer

Register or to post your answer.