EXCEL won't open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am attempting to open an Excel spreadsheet from an Event procedure.

The code I am using seems to open the spreadsheet but only in the "back round"

How do I adjust my code to get it to open the Excel spredsheet so I can work
in EXCEL.

Code below:
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click

Dim appExcel As Excel.Application
Dim wbExcelFile As Excel.Workbook

Set appExcel = CreateObject("Excel.Application")
Set wbExcelFile = appExcel.Workbooks.Open("C:\Analysis.xls")
wbExcelFile.Sheets("Sheet1").Activate

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub
 
James said:
I am attempting to open an Excel spreadsheet from an Event procedure.

The code I am using seems to open the spreadsheet but only in the "back round"

How do I adjust my code to get it to open the Excel spredsheet so I can work
in EXCEL.

Code below:
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click

Dim appExcel As Excel.Application
Dim wbExcelFile As Excel.Workbook

Set appExcel = CreateObject("Excel.Application")
Set wbExcelFile = appExcel.Workbooks.Open("C:\Analysis.xls")
wbExcelFile.Sheets("Sheet1").Activate

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub


Hi James,

try with this code :

Dim appExcel As Object
Set appExcel = CreateObject("excel.Application")
appExcel .Application.Workbooks.Open ("C:\Analysis.xls")
appExcel .Visible = True
Set oApp = Nothing

I prefer Late Bindig instead Early Binding.

Ciao, Sandro
 
Try adding appExcel.display that SHOULD display the EXCEL application
window. Otherwise check the HELP for the APPLICATION OBJECT in the EXCEL
OBJECT MODEL. There should be a method that displays the window.
 
Back
Top