Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-30-2021, 09:37 AM
chrscote chrscote is offline OLE Error when trying to run a macro Windows 7 64bit OLE Error when trying to run a macro Office 2010 64bit
Novice
OLE Error when trying to run a macro
 
Join Date: Aug 2016
Posts: 12
chrscote is on a distinguished road
Exclamation OLE Error when trying to run a macro

I am trying to run a MS Word macro from DOORS. In the past, I was able to do this, but now I am getting the following error message when I try to run the macro. I just don't know what the actual problem is:


Error running macro:


OLE problem: , OLE error code -2147352562


As I said, I don't know what this error code means. I've tried to look it up in Google, but it doesn't find this specific error code. Does anyone know what this error is saying?


Chris
Reply With Quote
  #2  
Old 06-30-2021, 05:09 PM
Guessed's Avatar
Guessed Guessed is offline OLE Error when trying to run a macro Windows 10 OLE Error when trying to run a macro Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I have colleagues that run DOORS but macros I've done for them all run in Word and DOORS then imports the result. So I don't know how you are running the macro.

From the information you haven't provided, I can't tell if the issue is connecting to Word or actually an issue within your code. I would try creating a dead simple macro to run and see if the same error occurs with that. Maybe just a Hello World line to test that for starters.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 07-07-2021, 10:23 AM
chrscote chrscote is offline OLE Error when trying to run a macro Windows 7 64bit OLE Error when trying to run a macro Office 2010 64bit
Novice
OLE Error when trying to run a macro
 
Join Date: Aug 2016
Posts: 12
chrscote is on a distinguished road
Exclamation

The problem I'm having is coming from DOORS when I try to run the macro. Here is the code I'm using to run the macro that needs 2 inputs:

Code:
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);

//infoBox("Document saved.");
oleMethod(objWord, "quit");
The macro starts out with:
Code:
Sub SaveHTMLAsDoc(sPath As String, sBaseline As String)
Am I adding the macroArgs in the wrong order or is it something else?

Chris
Reply With Quote
  #4  
Old 07-07-2021, 07:25 PM
Guessed's Avatar
Guessed Guessed is offline OLE Error when trying to run a macro Windows 10 OLE Error when trying to run a macro Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I don't know what the programming language is in DOORS but it isn't VBA - to me it appears like it could be a Javascript although a search online shows people talking about DOORS DXL.

In terms of code, your initial test appears to return an error box if objWord is not created but it doesn't exit the script after that so if you saw the error message the rest of the code won't work.

The rest of your code doesn't align with what I know of VBA so you would need to find someone who understands the language and what these functions do. You might have more luck posting your questions to a DOORS specific forum.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word template with Macro keeps getting an error ''Run-time error 5941'' Marcel Word VBA 3 12-17-2019 04:55 PM
OLE Error when trying to run a macro Error with exit macro brent chadwick Word VBA 5 01-28-2017 01:49 PM
OLE Error when trying to run a macro Help with Macro error jar208 Excel Programming 2 12-06-2016 03:57 PM
Simple VBA macro error Formulayeti PowerPoint 1 12-09-2011 10:02 PM
Macro Error 5174 muster36 Word VBA 0 08-12-2011 03:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft