Opening another file in background

  • Thread starter Thread starter Patrick Simonds
  • Start date Start date
P

Patrick Simonds

I have an Auto_Open macro in which I want to have
O:\PT_DRIVER_SCHED\Templates\EmployeeList.xls open in the background
without losing focus on the current workbook.
 
Sub test()
Dim wb As Workbook, wn As Window
Dim sFile As String
sFile = "path_and_filename.xls"
Application.ScreenUpdating = False
On Error Resume Next
Set wb = Workbooks.Open(sFile)
If Not wb Is Nothing Then
For Each wn In wb.Windows
wn.Visible = False
Next
End If
On Error GoTo 0
Application.ScreenUpdating = True
End Sub

Perhaps it would be better if you save your file as 'hidden' in the first
place

Regards,
Peter T
 
Back
Top