I work out of my home office and I've just returned a short time ago. I've taken time to skim through your code. I think that if I fully understood what you've done, I could fill the entire page with WOW's. Thank you Leith.
Let me state the application briefly so you know where I am coming from.
As an Example:
Let's say I have 4 different Instances of Excel Workbooks open.
I will call them Wb1, Wb2, Wb3 and Wb4.
Wb3 is displayed. I want to close Wb3 and make Wb1 (or any other choice) be displayed when Wb3 is closed.
Now, your code is so far beyond me, that I don't know where to start to use your code.
In my code, I try to do the following: But, it doesn't handle closing Wb3 and displaying Wb1.
My code checks:
To see if Wb1 is open or not.
If not, it opens Wb1
Then it closes Wb3
If Wb1 is open, then I want to close Wb3 and display Wb1.
As you know, my code can not display Wb1 whenever Mb3 is closed.
LEITH . . .
I am sure your code will work, but I don't know how to incorporate it into my code. It looks to me as though I would have to go to your code at 2 different places, all depending on the IF Statement. Problem being I don't understand your code at all.
If this is too much to ask, I truly will understand.
I promise you the very 1st copy of my Menu System. It probably won't do you much good as a programmer, but I've had some very good comments from individuals and business users.
Below is my code: . . . Followed by a Function
'THIS MACRO IS ACTIVATED FROM "Kb3.XLS" WHICH IS DISPLAYED.
'The following 3 lines of code are used to go to cell A1 with "Freeze Panes" turned on so that when Kb3 is closed & saved, the cursor will be at A1 when re-opened later. Should not have any bearing on your code.
'This is needed to open a new instance of Excel.
'Without it, the file is only opened as a new Window
'First I need to check to see if "Kb1xls" is open or not
'If "Kb1.XLS" is not open, then I have to open it in a NEW INSTANCE of Excel.
'This line of code opens the NEW INSTANCE of Excel
'This line of code makes the NEW INSTANCE of Excel visible.
'This line of code opens "Kb1.xls"
'PROBLEM 1
'HERE I NEED TO ACTIVATE (DISPLAY) "Kb3.XLS" SO THAT IT CAN BE CLOSED.
'THE PROBLEM HERE IS THAT IT DOES NOT DISPLAY "Kb3.xls" and therefore,
'the following closing code closes the wrong workbook.
'END PROBLEM 1
'This closing code works fine
'PROBLEM 2
'MY PROBLEM HERE IS THAT THE MACRO IS CLOSED, DUE TO THE WORKBOOK BEING CLOSED.
'What I need here is some way of always displaying "Kb1.xls" which is
'impossible since the macro is terminated. 3 or 4 workbooks could be open.
'WITH CORRECTED CODE, THEN, WHEN "Kb1.xls" IS DISPLAYED, THE MACRO IS FINISHED.
'END PROBLEM 2
'HERE THE WORKBOOK "Kb1.xls" WAS OPEN, SO
'THE PROGRAM AUTOMATICALLY CLOSES "Kb3.xls"
'The following code works properly for closing the workbook.
'Here is one of the ideas I tried, but failed. IT DOESN'T WORK.
'PROBLEM 3
'And again here, I need the the workbook "Kb1.xls" displayed
'after the workbook "Kb3.xls" has been closed.
Can this code be called from different sheets, as Kb1 will always be open and possibly the code could reside there ?
Leith, I think I taxed my brain in just trying to explain this procedure. I hope this has made sence.
Many thanks in advance if you choose to take this assignment. If you choose not to, this message will self destruct in 7 seconds.
A poor attempt to Quote: "Mission Impossible"
Bookmarks