ajetrumpet
Banned for being rude
- Joined
- Apr 12, 2008
- Messages
- 569
- Office Version
-
- 365
- 2016
- 2007
- Platform
-
- Windows
Hello all,
I have 2 workbooks on a CD, and what I want to do is this:
If the user opens the 97-2003 workbook with their version of 2007 Excel, I want to automatically close that book and open the correct workbook that is stored on the CD. I know how to check the drive for whatever it is set to as their CD drive, but what I don't know how to do is close a workbook as a procedure is being used in the process. Ideas please anyone?
(The procedure is being used in the 97-2003 version with the WORKBOOK_OPEN event, so it's even in the process of opening too!)
I have tried application.quit, and workbooks("workbook name").close, and both of these are not recognized. The procedure just runs through and ends accordingly.
Here is the code I am currently experimenting with:
I have 2 workbooks on a CD, and what I want to do is this:
If the user opens the 97-2003 workbook with their version of 2007 Excel, I want to automatically close that book and open the correct workbook that is stored on the CD. I know how to check the drive for whatever it is set to as their CD drive, but what I don't know how to do is close a workbook as a procedure is being used in the process. Ideas please anyone?
(The procedure is being used in the 97-2003 version with the WORKBOOK_OPEN event, so it's even in the process of opening too!)
I have tried application.quit, and workbooks("workbook name").close, and both of these are not recognized. The procedure just runs through and ends accordingly.
Here is the code I am currently experimenting with:
Rich (BB code):
Private Sub workbook_open()
If Application.Version > 11 Then
MsgBox "The correct version will now open."
Workbooks.Open "ADDRESS OF CORRECT FILE"
I WANT TO CLOSE THIS WORKBOOK RIGHT HERE (set focus to the other one)
Exit Sub
Else