Page 1 of 1

N_Disconnect Crashes when Rules are open

Posted: Tue Oct 23, 2012 12:45 pm
by Darkhorse
Hi all

is there a way to check to see if the Rules editor is open and to close the rules editor first before using the command N_Disconnect in a macro?

currently the N_Disconnect works perfectly if its just cubes open and will close them down and log off the servers, however if i have a rule editor open at the same time it causes my Tm1 to hang and i need to crash out.

thanks all

Re: N_Disconnect Crashes when Rules are open

Posted: Wed Oct 24, 2012 2:38 am
by rmackenzie
Darkhorse wrote:is there a way to check to see if the Rules editor is open and to close the rules editor first before using the command N_Disconnect in a macro?
You can use the FindWindow function in the Windows API from Excel VBA. Using this function will allow you to identify if a Rules Editor window is open, then you can alert the user to close it before running the disconnect logic. This is, at least, an intermediate exercise, but you can get the result you want. There are examples:

Good ol' Daily Dose of Excel (from 2004!)
Good ol' Chip Pearson
Good ol' Mr Excel