You would use the GetObjects command to get an opened version of excel. However, this will take the first opened instance of excel, so if there is more then one version opened, then you might run into problems.
Code:Private Sub Command2_Click() Dim objExcel As Excel.Application Dim objWorkSheet As Excel.Workbook Dim objSheet As Excel.Worksheet Set objExcel = GetObject(, "Excel.Application") Set objSheet = objExcel.ActiveWorkbook.ActiveSheet objSheet.Range("A1").Value = "hi" DoEvents objExcel.Quit End Sub




Reply With Quote