Longhair4277
11-11-2008, 10:39 AM
Thank you for reading this, my first post here.
This is the code (at bottom of the message) I have, with the "IsXLBookOpen" code borrowed from an article I read here yesterday. The following is code I have in a workbook (lets call it "MASTER") that needs the workbook mentioned ( lets call it "P&S") in it opened to look up data in it. So what happens now, I open MASTER and the file P&S is automatically opened, but the "focus" stays with the newly opened P&S. I realize I could use
Windows("MASTER.xls").Activate
but I copy and rename this file quite often so I do not want to have to edit the code each time. Is there a way to make this "generic"? meaing, that when I open up MASTER (after it has say been copied and renamed for the umpteenth time to say MASTER333) that it will automatically open the P&S workbook and then have focus go back to the workbook that called for the file to be opened.
Private Sub Workbook_Open()
If IsXLBookOpen("-=Products&Suppliers 2008=-.xls") = False Then Workbooks.Open "C:\NORCAP\-=Products&Suppliers 2008=-.xls"
End Sub
This is the code (at bottom of the message) I have, with the "IsXLBookOpen" code borrowed from an article I read here yesterday. The following is code I have in a workbook (lets call it "MASTER") that needs the workbook mentioned ( lets call it "P&S") in it opened to look up data in it. So what happens now, I open MASTER and the file P&S is automatically opened, but the "focus" stays with the newly opened P&S. I realize I could use
Windows("MASTER.xls").Activate
but I copy and rename this file quite often so I do not want to have to edit the code each time. Is there a way to make this "generic"? meaing, that when I open up MASTER (after it has say been copied and renamed for the umpteenth time to say MASTER333) that it will automatically open the P&S workbook and then have focus go back to the workbook that called for the file to be opened.
Private Sub Workbook_Open()
If IsXLBookOpen("-=Products&Suppliers 2008=-.xls") = False Then Workbooks.Open "C:\NORCAP\-=Products&Suppliers 2008=-.xls"
End Sub