Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: OLE DOORS ->Word
Topic Summary: Problems executing VBA Macro by DOORS OLE
Created On: 15-Aug-2006 15:49
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 15-Aug-2006 15:49
User is offline View Users Profile Print this message


Darius Dolnik

Posts: 16
Joined: 13-Jul-2004

Hi DOORS programmers

I want to start a VBA macro implemented in a word-DOT using the 'oleMethod' command. The following syntax:

clear(objArgBlock)
put(objArgBlock, "C:\\template.dot!ThisDocument.FormatHeader")

string s
s = oleMethod(objDoc, "Application.Run", objArgBlock)
print s

generates the error

"Problem with OLE Argument names".

This message is not really detailed and I can not find out why the code does not work.
Does anybody have any idea?

Regards
Darius Dolnik
Report this to a Moderator Report this to a Moderator
 15-Aug-2006 16:58
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

-

Edited: 15-Aug-2006 at 21:07 by ron lewis
Report this to a Moderator Report this to a Moderator
 15-Aug-2006 18:53
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

Darius,

The following should help, I haven't checked it so ther might be slight syntax issues.

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
 16-Aug-2006 16:18
User is offline View Users Profile Print this message


Darius Dolnik

Posts: 16
Joined: 13-Jul-2004

Hi Richard,

thanks for your answer. The hint was to use 'objWord' instead of 'objDoc' as 'oleMethod' parameter. Now the code runs well

To give you some details please take a look at these few lines below

clear(objArgBlock)
put(objArgBlock, "C:\\template.dot!FormatHeader")

oleMethod(objWord, "Run", objArgBlock)

Take care
Darius Dolnik
Report this to a Moderator Report this to a Moderator
 18-Aug-2006 15:55
User is offline View Users Profile Print this message


Darius Dolnik

Posts: 16
Joined: 13-Jul-2004

The DXL programming is a little bit tricky. To run a WORD macro using oleMethod succeeded but now I want to call the macro and put a parameter to it.

In VBA the following header exists:

Sub FormatHeader(ByVal sAuthor As String)
....
End Sub

In DXL the code looks like:

...
clear(objArgBlock)
sCurrentString = "C:\\template.dot!FormatHeader"
put(objArgBlock, sCurrentString)

sCurrentString = "Darius"
put(objArgBlock, sCurrentString)

sCurrentString = oleMethod(objWord, "Run", objArgBlock)
print sCurrentString
...

oleMethod returns the error "OLE problem:" and the macro does not run.

I tried a lot of possibilities to put the parameter to objArgBlock (macro name & parameter in one 'put' call, parameter first and macro name after it in two 'put' calls and so on) and I also used the DXL debugger but no one works.

What is wrong with this code?

Regards
Darius Dolnik

Report this to a Moderator Report this to a Moderator
 18-Aug-2006 16:44
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

Darius,
I had exactly the same problem, think the comment in my code says it all! If I remember correctly its a lot easier to run macros from a document rather than a template (no need for the addin install!) hope it helps!

-------------------------
Regards,

Richard Good

Edited: 18-Aug-2006 at 16:56 by Richard Good
Report this to a Moderator Report this to a Moderator
 21-Aug-2006 10:53
User is offline View Users Profile Print this message


Darius Dolnik

Posts: 16
Joined: 13-Jul-2004

Hi Richard,

I am really impressed The code runs well and the macro call works fine Could you tell me where will I find the documentation of all these quirks? I suppose that is not a part of Telelogic's well written DOORS manual.

Take care
Darius
Report this to a Moderator Report this to a Moderator
 21-Aug-2006 12:24
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

I think the trick is to write the code in VBA first, (well if you can't figure it out fairly quickly) debug it then translate it to DXL. I agree that the DXL manual could be better, but on the other hand it allows self taught consultants like me to keep ahead of the hordes who don't know or don't want to know how to debug things without watch windows and break points etc. It's all a little bit primitive in DXL land but it has lots of good points.

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
 21-Aug-2006 13:21
User is offline View Users Profile Print this message


Darius Dolnik

Posts: 16
Joined: 13-Jul-2004

You are right. DXL is a really simple language and the potentials it offers are very basic for somebody who comes from the windows world. I think it could be a challenge to implement a game like CALL OF DUTY or FEAR in DXL only )

By the way, what kind of structure is the OleAutoArgs type? Is it a dynamic array, a container, a record?

Regards
Darius Dolnik
Report this to a Moderator Report this to a Moderator
 21-Aug-2006 16:42
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

Darius,

I think you're right!! but there are some dxl games around, why not join Mr Goodman on the dark side by checking out this link

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.