ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening another file in background (https://www.excelbanter.com/excel-programming/377676-opening-another-file-background.html)

Patrick Simonds

Opening another file in background
 
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.









Peter T

Opening another file in background
 
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

"Patrick Simonds" wrote in message
...
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.






All times are GMT +1. The time now is 07:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com