Page 1 of 1

I need a excel marco to close XNote

Unread postPosted: Mon May 28, 2018 12:28 pm
by bluefeather8989
I need a excel marco to close XNote. I have this one to open and start it. but how to close it?
Code: Select all
 Shell "C:\Program Files (x86)\XNote Stopwatch\xnsw.exe start", vbNormalFocus

Re: I need a excel marco to close XNote

Unread postPosted: Tue May 29, 2018 8:24 am
by Stopwatch
Currently there is no command to close XNote Stopwatch externally. Howhever if it is really important we could devise something. Is it possible for you to call Win32 API from MS Excel macros?

Re: I need a excel marco to close XNote

Unread postPosted: Tue May 29, 2018 10:08 pm
by bluefeather8989
..."Is it possible for you to call Win32 API from MS Excel macros?"
that's beyond me.

Re: I need a excel marco to close XNote

Unread postPosted: Wed May 30, 2018 12:42 pm
by Stopwatch
I'm not familiar with VBA, so here is a pseudocode after googling and guessing:
Code: Select all
Declare Function RegisterWindowMessageA Lib "user32" (ByVal lpString As String) As Long
Declare Function PostMessageA Lib "user32" (ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Msg_CloseAll = RegisterWindowMessageA("Close All XNote Stopwatches")
PostMessageA &HFFFF&, Msg_CloseAll, 0, 0

Re: I need a excel marco to close XNote

Unread postPosted: Wed May 30, 2018 11:23 pm
by bluefeather8989
And where do I put this?? I tried adding this into a modules but it don't work.

Re: I need a excel marco to close XNote

Unread postPosted: Thu May 31, 2018 8:18 am
by Stopwatch
bluefeather8989 wrote:And where do I put this?? I tried adding this into a modules but it don't work.

that's beyond me.

You should put it somewhere where you want to close running XNote Stopwatch.

Does it generate errors or run smoothly and just does nothing?

Try to seek advice from MS Excel forums. Show them that pseudocode and explain what you want. Any expert should understand an idea and help you with working code. Let me know of results.