+ Reply to Thread
Results 1 to 4 of 4

VBA Runtime error 9 when closing opened workbook

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    5

    VBA Runtime error 9 when closing opened workbook

    Hello,
    this is my 1st call for help in years. Usually i managed to find solution by searching WWW.
    I have this SUB witch just opens file A, copy data to file B (to ThisWorkbook) and close file A.
    When i made this Macro it worked well, but when I created UserForm and launch it from this Form it started to break here:
    Please Login or Register  to view this content.
    showing "Runtime error 9 Subscript out of range"

    When Debugging conFileName holds files name as String.

    The full code of Macros if it helps to understand:
    Please Login or Register  to view this content.
    I have more Macros very similar to this one (main changes: conFileName and ranges) and they are working like a charm!
    Any ideas?

    If you see that there may be any other modifications to this macro, please, Your suggestions are very welcome.
    Thank you for reading all this!
    Last edited by Deryl; 10-24-2012 at 08:57 AM. Reason: Solved

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Runtime error 9 when closing opened workbook

    perhaps
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    10-05-2012
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: VBA Runtime error 9 when closing opened workbook

    Wow, that was quick! It works.
    Thank you a lot You saved my evening

    Can You explain why in previously posted Macro it did not worked but here it works just great?
    Please Login or Register  to view this content.
    Concept is the same, isn't it?

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Runtime error 9 when closing opened workbook

    I reckon the [] in the file name were the problem-Excel won't let you save a workbook with those characters in the name

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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