EXCEL won't open

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
 
S

Sandro

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
 
D

David C. Holley

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top