ActiveWorkbook.Close
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: ActiveWorkbook.Close

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Posts
    53
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Change ActiveWorkbook to ThisWorkbook.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com