DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Exit and do not save from Excel

Solved!
Go to solution

Hi,

 

I run DIAdem from Excel to do some calculations. I then want to close DIAdem from Excel. With DIAdem 2012 I used:

Sub EndDiadem()
   If Process > 0 Then TaskEnd = Shell("C:\Windows\System32\taskkill.exe /PID " & Process)
End Sub

 

Now with DIAdem 2017 I get the prompt asking me whether to save or not.

Is there a way to ignore that and close DIAdem without saving anything? TDR & TDM.

 

Thank you!

0 Kudos
Message 1 of 5
(2,590 Views)

Hi,

 

You can try to run this script:

 

Call DataChangedClear()
View.NewLayout
Report.NewLayout

ProgramExit

 

Greetings

Walter

0 Kudos
Message 2 of 5
(2,544 Views)

Thanks! I need a little more help though since that is not executable directly from the excelmacro or?

This is what I have in excel:

Sub kill_diadem()
Set IDIACommand = CreateObject("diadem.tocommand") ' Initialization of the TOCommand-Interface Diadem
AutoDrvLibr = "C:\temp\norgemall\diadem\"
DiademLibr = "C:\temp\norgemall\diadem\"
iDiaVarGet = IDIACommand.TextVarSet("AutoDrvLibr", DiademLibr)
iDiaCmd = IDIACommand.CmdExecuteSync("ScriptStart('620d', 'ulf')")
End Sub

 

620d.VBS looks like this:

Option Explicit 'Forces the explicit declaration of all the variables in a script.

sub ulf
Call DataChangedClear()
View.NewLayout
Report.NewLayout

ProgramExit
end sub

 

From DIAdem I get the error:

ulfsoderberg_0-1591791826310.png

 

Any idea what to do?

Thanks!

0 Kudos
Message 3 of 5
(2,509 Views)
Solution
Accepted by topic author ulfsoderberg

Please try this here:

 

dim IDIACommand, iDiaCmd, DIAdemApp

Set IDIACommand = CreateObject("diadem.tocommand") ' Initialization of the TOCommand-Interface Diadem

call IDIACommand.VariantVarget("Application",DIAdemApp)
call DIAdemApp.View.NewLayout
call DIAdemApp.Report.NewLayout

iDiaCmd = IDIACommand.CmdExecuteSync("Wndshow('REPORT','maximize')")
iDiaCmd = IDIACommand.CmdExecuteSync("DataChangedClear")
iDiaCmd = IDIACommand.CmdExecuteSync("ProgramExit")

 

Please also have a look at the example you find in the help when you search for "TOCommand".

 

Walter

0 Kudos
Message 4 of 5
(2,482 Views)

Hi!

This works!

I get a short message saying something about DIAdem opened by an external program... but it closes automatically after a few tenth of a second so I can live with that.

0 Kudos
Message 5 of 5
(2,468 Views)