![]() |
![]() |
|
|||||||
| 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: Apr 2002
Posts: 53
|
I have the following code in the "Workbook" of "ThisWorkbook". It works if I open the file directly, i.e., it does the job and closes. But, if I open the file via another Excel file, it doe the job but doesn't close. What's wrong?
Private Sub Workbook_Open() Application.EnableCancelKey = xlDisabled Range("a5").Select Application.CommandBars("Worksheet Menu Bar").Enabled = True Sheets("Sheet1").Activate ActiveWorkbook.Activate ActiveWorkbook.Close End Sub Thanks Michael |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Change ActiveWorkbook to ThisWorkbook.
__________________
Kind regards, Al Chara |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|