Opening another file in background

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.
 
P

Peter T

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
 

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