ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open another file (https://www.excelbanter.com/excel-programming/348185-open-another-file.html)

Rossy

Open another file
 
How do I open another file and set it as the active window??

Mike Fogleman

Open another file
 
This will open another workbook from the same folder and run a procedure
that resides in it. As soon as it opens, it is the active workbook.

Sub RunTracking()
Dim cdir As String
Dim wb As Workbook

For Each wb In Workbooks
If wb.name = "NCP Tracking.xls" Then
MsgBox ("NCP Tracking.xls is already open.")
Exit Sub
End If
Next wb
cdir = ActiveWorkbook.Path
Workbooks.Open cdir & "\NCP Tracking.xls", password:="NCP"
Application.Run ("'NCP Tracking.xls'!RunUpdate")
End Sub

Mike F
"Rossy" wrote in message
...
How do I open another file and set it as the active window??





All times are GMT +1. The time now is 12:33 PM.

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