VBA macro doesnt run after data import via DXL

Hello,

I have VBA macro which import data from DOORS via DXL

Set objDOORS = CreateObject("DOORS.Application")
objDOORS.runFile ("<link to file>")

and then supposes to do some further actions.

Unfortunately after import the macro doesnt run further. Any ideas why does this happen?

I tried also the workaround: the further macro steps I've put in additional macro and tried to start the macro out of DXL Import file

string nameOfMacro = "mdlMain.MainFurther"
OleAutoArgs macroArgs = create
put(macroArgs, nameOfMacro)
oleMethod(oleExcel, "Run", macroArgs)
delete(macroArgs)

but this also doesnt help.

In case I first import data and the run macro with further actions everything works as intended.


Anta_st - Tue Nov 08 08:26:46 EST 2016

Re: VBA macro doesnt run after data import via DXL
DOORSHAM - Tue Nov 08 12:24:13 EST 2016

There is more that you didn't tell us than what you did tell us.

For example is the macro in the normal.dotm file or does the macro have any arguments.  etc.

Plus you showed no evidence that you logged into doors.

And how do we know that your macro would do anything.

 

Re: VBA macro doesnt run after data import via DXL
Mathias Mamsch - Wed Nov 09 04:28:21 EST 2016

It seems to me, that the call may not be returning.

To rule out problems with the DXL script, replace it by a a print "Hello World!" and try again.

You should also check if the VBA macro ends or hangs inside the runFile call (invoke the vba debugger)

Since you say you are doing an import - There are known problems with external processes calling into DOORS during a running DXL, i.e. if from a DXL script you run an external process, that will call back to DOORS over the COM interface. Since DXL can only run in one thread, in situations like this you run in a deadlock.

As DOORSHAM said, you need to give a little bit more information to come to the cause of the problem. Maybe this helps, Regards, Mathias

Re: VBA macro doesnt run after data import via DXL
Anta_st - Tue Nov 15 05:11:35 EST 2016

Pre condition: DOORS is open and running.

I have .xlsb File containing my VBA macros.

What I am doing in VBA macro ist:

- Set chartSheet = ... (to adapt range of the chart after all other macro actions)

- Run .DXL file with the command described in my request,

- further actions in macro.

Import is running well -> means .dxl is running as expected. After the run has been completed VBA macro doesnt run further, it is stopped, the Excel is released. So directly after the dxl run I do not see in debugger "Debug.Print" message.

Current workaround I trigger the .dxl run via button1 and the trigger remain macro with button2 :(.

First I thought may be macro starts .dxl, does not wait for the execution and runs further, but it is not the case.

May be I do not release a process in dxl file?

I tried to release all my objects at the end of the .dxl code, but without success

oleCloseAutoObject(oleCell)

oleCloseAutoObject(oleExcelWorkbooks)
oleCloseAutoObject(oleExcelSheet)
oleCloseAutoObject(oleExcel)

 

I've tested the proposal with print "Hello World". Everything works as expected, macro is running firther.

Re: VBA macro doesnt run after data import via DXL
Mathias Mamsch - Tue Nov 15 07:44:27 EST 2016

Anta_st - Tue Nov 15 05:11:35 EST 2016

Pre condition: DOORS is open and running.

I have .xlsb File containing my VBA macros.

What I am doing in VBA macro ist:

- Set chartSheet = ... (to adapt range of the chart after all other macro actions)

- Run .DXL file with the command described in my request,

- further actions in macro.

Import is running well -> means .dxl is running as expected. After the run has been completed VBA macro doesnt run further, it is stopped, the Excel is released. So directly after the dxl run I do not see in debugger "Debug.Print" message.

Current workaround I trigger the .dxl run via button1 and the trigger remain macro with button2 :(.

First I thought may be macro starts .dxl, does not wait for the execution and runs further, but it is not the case.

May be I do not release a process in dxl file?

I tried to release all my objects at the end of the .dxl code, but without success

oleCloseAutoObject(oleCell)

oleCloseAutoObject(oleExcelWorkbooks)
oleCloseAutoObject(oleExcelSheet)
oleCloseAutoObject(oleExcel)

 

I've tested the proposal with print "Hello World". Everything works as expected, macro is running firther.

Well if "Hello World" works and your DXL File doesn't then something must be inside your DXL script, that triggers the problem. 

When you write, that you are doing OLE calls it seems to me, this is not a good idea. Let me guess, your DXL script tries to change the excel sheet from which it was called? That would not be reliable. I had good success with returning CSV from the DXL, that the Excel Macro would get as a result of the DXL script, paste it somewhere, format it and be fine. 

First problem with modifying Excel from a DXL called by Excel is, that you can never be sure to get the right Excel Instance from DXL. You use oleGetAutoObject but you will always get the first Excel instance started, not necessarily the one you wanted. You also need to take care that you get the right workbook, etc. Why would the DXL script to gather data, need to know about all that? 

Regards, Mathias

Re: VBA macro doesnt run after data import via DXL
Anta_st - Tue Dec 06 11:04:06 EST 2016

I had to work on another high prio topics last weeks.

Today I've reworked my architecture fully. In the Excel containing my macros I call DXL file which gets data from DOORS and put it in extra Excel which is then saved in temp folder.

After the export my macros are running further, taking the exports and import them into the Excel with macros. And then all other evaluations running.

All this works also with several open Excel files.

 

Thank you guys for your inputs.

Re: VBA macro doesnt run after data import via DXL
ChitraUTAS - Fri Oct 27 05:55:27 EDT 2017

Hi

Can you please elaborate how to call macro? put(args,...) doesnt accept filename as macro name.

Thanks

Chitra