06-04-2020 01:54 AM
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!
Solved! Go to Solution.
06-05-2020 01:13 AM
Hi,
You can try to run this script:
Call DataChangedClear()
View.NewLayout
Report.NewLayout
ProgramExit
Greetings
Walter
06-10-2020 07:24 AM
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:
Any idea what to do?
Thanks!
06-15-2020 01:54 AM
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
06-16-2020 06:34 AM
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.