+ Reply to Thread
Results 1 to 8 of 8

assistance on vba file remains opened getting runtime error 9

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    assistance on vba file remains opened getting runtime error 9

    The code below opens a special format sheet "c:\\sample\INTERMARTFORMAT.xlsx" copy to my actual workings sheets
    The code works but INTERMARTFORMAT.xlsx file remains opened so I tried to add(close without saving)

    Workbooks("intermartformat.xlsx").Close False

    but getting runtime error 9

    script out range

    however the opened workbook remains opened as intermartformat1.xlsx while the actual file is named INTERMARTFORMAT.xlsx on c:\sample


    Please Login or Register  to view this content.
    Last edited by JEAN1972; 07-02-2017 at 01:52 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: assistance on vba file remains opened getting runtime error 9

    You have a couple of problems. Try this:
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: assistance on vba file remains opened getting runtime error 9

    It needs to be all in caps:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: assistance on vba file remains opened getting runtime error 9

    Thank you both guys

    Working now

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: assistance on vba file remains opened getting runtime error 9

    You're welcome and thanks for the rep!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: assistance on vba file remains opened getting runtime error 9

    @xladept:
    It needs to be all in caps
    Can I ask why? As far as I am aware, file names are case insensitive.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: assistance on vba file remains opened getting runtime error 9

    Hi Trevor,


    There was a subscript out if range error Maybe its a case preserving thing But it worked!

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: assistance on vba file remains opened getting runtime error 9

    I only have my iPad at the moment so I can't test it ... but I wouldn't have thought so. And yes, the op has a working solution

+ 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] VBA assistance with Runtime error 1004 Method ShowAllData of Object WorkSheet Failed
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2016, 01:14 PM
  2. [SOLVED] Runtime error 1004 VBA Coding assistance
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2016, 02:31 AM
  3. Replies: 0
    Last Post: 11-22-2013, 07:28 AM
  4. Runtime error: File could not be found...even though I just opened it
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2013, 03:41 PM
  5. Replies: 4
    Last Post: 01-25-2013, 12:59 PM
  6. [SOLVED] VBA Runtime error 9 when closing opened workbook
    By Deryl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2012, 09:18 AM
  7. Runtime Error: Overflow assistance
    By BCITgirl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2010, 11:42 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