+ Reply to Thread
Results 1 to 2 of 2

Attempts to automate closing workbook without saving changes results in run-time error 9

  1. #1
    Registered User
    Join Date
    05-18-2018
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    11

    Attempts to automate closing workbook without saving changes results in run-time error 9

    The program fails on the last line where it's supposed to close the workbook (without saving changes) that it previously opened at the user's specification. The only purpose in opening the workbook is copying over data from yesterday's report into today's workbook so a vlookup function can be utilized. I tried declaring the variables as Dim within the procedure, I tried using double quotes in the parenthesis in the last line, I tried using a String instead of Variant, which is the version I'm sharing here; previously I wasn't trying to use 'wbName' at all, only tried to call 'FileName' when attempting to close the workbook. The error that always comes up on the last line in the procedure is:

    Run-time error 9 -- Subscript out of Range

    The variable has been declared so I can't understand what they're talking about.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Attempts to automate closing workbook without saving changes results in run-time error

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

+ 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. [SOLVED] Getting a saving error when closing workbook. Keeps asking to save again and again
    By Nitro2481 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-01-2016, 09:23 AM
  2. [SOLVED] Run-time error '1004' on closing workbook
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-20-2014, 09:47 AM
  3. macro to automate the opening , saving and closing the work in another program
    By emymeeky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2014, 09:40 AM
  4. Creating new workbook, saving as csv and then closing - but closing always fails.
    By ella626 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2014, 10:05 PM
  5. [SOLVED] Saving and closing workbook after idle time
    By bigmantitus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-04-2012, 12:11 PM
  6. Allow saving upon closing a workbook even when saving is disabled.
    By Tino XXL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-13-2011, 09:09 AM
  7. closing a workbook without saving and closing a workbook with saving enabled
    By stanigator in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2007, 02:15 PM

Tags for this Thread

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