+ Reply to Thread
Results 1 to 2 of 2

Can't close an inactive Workbook - result in error 9

  1. #1
    Registered User
    Join Date
    12-29-2011
    Location
    San Diego, Ca.
    MS-Off Ver
    Excel 2007
    Posts
    60

    Unhappy Can't close an inactive Workbook - result in error 9

    I have one WB open (ThisWorkbook) and the code bellows opens a 2nd one (cg.xlsm).
    It copies cells A1:A1000 and pastes them into ThisWorkbook starting at L1500 on sheet Target Sheet.
    This all works except for line above Sub , closing the captain_WB. How do I fix this?

    Additionally, if I want to open the WB I use "Workbooks.Open captain_WB" but I tried to close the WB using "Workbooks.Close captain_WB" as it would seem to mirror the open WB line but that didn't work either. Help is appreciated.

    Please Login or Register  to view this content.
    Last edited by gototcm; 01-23-2014 at 10:59 PM. Reason: typo

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Can't close an inactive Workbook - result in error 9

    captain_WB includes the path and filename, when you use Workbooks you ony need the filename.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA to Close Workbook if BOTH Workbook is inactive and VBA is Not Open
    By teblowtime in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2013, 10:09 AM
  2. Close inactive Workbook without workbook name
    By chrismann85 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-30-2009, 10:08 AM
  3. Data Consolodation VBA - close inactive workbook
    By grahadw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2009, 12:38 PM
  4. Auto Close Workbook if inactive 5min
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2008, 01:36 PM
  5. [SOLVED] Option in Excel to save a close a workbook inactive for 5 minutes
    By Patricia Peterson in forum Excel General
    Replies: 4
    Last Post: 01-05-2006, 01:00 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1