ANSWERS: 1
  • You can always cause each running instance of Excel to close when you are done with it by calling the Excel.Application.Quit() method. But what if it is already running? To allow for the reuse of existing instances of objects, VBA provides the GetObject() method. Calling GetObject with the name of an object or application as its second parameter (the first argument PATH NAME is optional) will return the instance of the object that is already running, into your object variable. For example: Public Sub GetExcel() On Error Resume Next Dim objExcel As Excel.Application Set objExcel = GetObject(, "Excel.Application") objExcel.Quit End Sub [ Source: VBA Programmer's Reference, Wrox Books ]

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy