sht.Activate
appExcel.Application.Visible = TrueErrorHandlerExit:
Exit SubErrorHandler:
If Err = 429 ThenExcel is not running; open Excel with CreateObject:Set appExcel = CreateObject(“Excel.Application”)
Resume Next
Else
MsgBox “Error No: “ & Err.Number & “; Description: “ &
Err.Description
Resume ErrorHandlerExit
End IfEnd SubIf Excel is open, the workbook will be opened in the same window, as shown in Figure 7.6.FIGURE 7.6
Opening a saved workbook in an existing Excel window.Part II Writing VBA Code to Exchange Data between Office Components