![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
Hi all, One more question. I have a excel workbook that is linked to anouther excel workbook. When I Hit the Cmd button to go to the other workbook It opens fine, but when I want to end and close the work book it goes to the next (window app) I have open. Anyway to "on closing" to make it go back to the workbook that it is linked to ? Thx Dan
|
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
|
What was the question?
|
|
|
|
|
|
#3 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Dantb
In the Workbook that is closing place this code in the Private Module of the Workbook, and change Book1.xls to the name of the Workbook you want to activate. Code:
Option Explicit
Dim bClose As Boolean
Private Sub Workbook_BeforeClose(Cancel As Boolean)
bClose = Not Cancel
End Sub
Private Sub Workbook_Deactivate()
On Error Resume Next
If bClose = True Then Workbooks("Book1.xls").Activate
On Error GoTo 0
End Sub
_________________ Kind Regards Dave Hawley OzGrid Business Applications Microsoft Excel/VBA Training ![]() [ This Message was edited by: Dave Hawley on 2002-04-01 21:25 ] |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
Thanks again for your Help Dave. Have a good day. Dan
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|