Close Open Excel Instance

后端 未结 3 1851
离开以前
离开以前 2020-12-12 02:36

Could someone please let me know if the following simple VBScript is correct? It is supposed to close Excel after other processes have run (and left Excel open), but it does

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 03:12

    CreateObject creates a COM object, so your

    Set MyApp = CreateObject("Excel.Application") 
    

    starts a new Excel process. Use GetObject to "retrieve an existing object with the specified ProgID". See this for theory and praxis.

提交回复
热议问题