David the following routine creates an instance
of an excel file.....hidden....is this what you
are after ??
Option Explicit
Dim xlApp As Excel.Application
Dim sFile As String
Sub OpenWorkBook()
sFile = "D:\xl_useful\14-wilcox.xls"
'Check to see if the file name passed in to
'the procedure is valid
If Dir(sFile) = "" Then
MsgBox sFile & " isn't a valid path!"
Exit Sub
Else
Set xlApp = CreateObject("Excel.Application")
xlfile.Visible = False
xlApp.Workbooks.Open sFile
End If
End Sub
Sub Show()
xlApp.Visible = True
xlApp.Quit
Set xlApp = Nothing
End Sub
Ivan
No I just want it to open but not to see it opening. I want the focus to remain on the current workbook while another workbook is being open through a macro from the first.
The focus needs to stay on the initial workbook.
David
If you want to open it without hiding it but not have it activated, you could open it minimized :-
Application.ScreenUpdating = False
Workbooks.Open ("C:\MyFile.xls")
ActiveWindow.WindowState = xlMinimized
ActiveWindow.WindowState = xlMaximized
The last line is to make sure that the window that was active before "MyFile" was opened is maximized.
Celia
Yep that took care of it thank you both.