How to Restrict Multiple Instance of VBA?

VBA VBA

Posted by admin on 2022-11-02 18:30:00 |

Share: Facebook | Twitter | Whatsapp | Linkedin Visits: 1236


How to Restrict Multiple Instance of VBA?

At times we set/reset registry settings/environment variables as part of the program logic. If another instance of the application uses this concurrently it would become a mess. The best is to prevent the application from being loaded for the second time. The easy way to do is to use App.PrevInstance method as shown below.

If App.PrevInstance = True Then

MsgBox “An instance of this tool is running in this machine! Requested instance will be terminated”, vbExclamation

Exit Sub End If Find out Upcoming Excel VBA Batch nearby to learn VB Coding and automate your routine Excel Reports, processes and tasks with ease.

WWW.ScriptsKart.com

Leave a Comment:
Dipanshi
at 2022-11-03 14:06:06
Very helpful