How to get the process ID of the current Excel instance, through VBA, without using the caption?

前端 未结 3 2153
无人共我
无人共我 2021-02-20 03:38

How can I get the process ID of the current Excel instance that my VBA code is running in? I don\'t want to asking for it by the name in the caption, which causes problems when

3条回答
  •  别那么骄傲
    2021-02-20 03:54

    You can use this method to get the current process id.

    Declare Function GetCurrentProcessId Lib "kernel32" () As Long
    

    This page has a good overview of exactly how you can do it in various versions of excel.

提交回复
热议问题