ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how disable macro that uses FnSetForegroundWindow (https://www.excelbanter.com/excel-discussion-misc-queries/230501-how-disable-macro-uses-fnsetforegroundwindow.html)

Ian Elliott

how disable macro that uses FnSetForegroundWindow
 
Thanks in advance for any help.
I have a macro that controls another application by using the function
FnSetForegroundWindow and also FnFindWindowLike, and then sending keys to it.
It seems I have a very hard time canceling my macro. I think it has something
to do with these functions I mentioned. I have a:
On Error GoTo handleCancel
Application.EnableCancelKey = xlErrorHandler
and a section for that:
handleCancel:
If Err = 18 Then
MsgBox "You cancelled"
End If
But this doesn't help. Does anyone have an idea on how I can stop my program
easily? It is a little long (30 seconds-1 minute) and I don't want the user
frustrated. And it might mess up there program if they can't stop it.
thanks again


All times are GMT +1. The time now is 04:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com