+ Reply to Thread
Results 1 to 11 of 11

Subscription out of error

  1. #1
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Subscription out of error

    Hi,
    I got error , it says "Subscription out of range", run time error.
    I was doing copying and paste in another workbook from Master workbook.

    Please Login or Register  to view this content.
    End Sub

    How can I solve the Subscription out of range error?

    Thanks

  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: Subscription out of error

    The error is "Subscript out of range".

    GetSaveFileName doesn't exist. Did you copy and paste this code, or type it into your post?

    On the hunch that your code really says GetSaveAsFileName, I ran this code and it ran perfectly. I suggest you post all of your code.

    This error would be caused by fname not being a valid Excel workbook path. Run your code, and when it stops on that line, hit CTRL-G, type
    print fname
    and then copy the result and paste it here so we can see what the value of fname is at that point in the code.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    02-24-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Subscription out of error

    Chances are that fname is not declared or named properly. Look further up in the code and hover your cursor over fname as you step through the code. Is the directory / path correctly set?

    You will probably need to post your entire code if you can't figure it out. Then we can help.
    If I helped in any way, please click the star

  4. #4
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Subscription out of error

    Please Login or Register  to view this content.
    This is my code and please help me.
    Thanks
    Last edited by Goodstart14; 10-20-2014 at 10:18 PM.

  5. #5
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Subscription out of error

    Thanks, I posted my code and I think I got '\' because I used GetSaveAsFilename.
    I don't know how to fix this.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Subscription out of error

    If you cancel the second GetOpenFilepath, it will error. you need to add a line

    Please Login or Register  to view this content.
    I'm also puzzled by the "Do you want to see" message box. As written the only button available is OK, but the prompt suggests that No should be an option.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Subscription out of error

    Quote Originally Posted by mikerickson View Post
    If you cancel the second GetOpenFilepath, it will error. you need to add a line

    Please Login or Register  to view this content.
    I'm also puzzled by the "Do you want to see" message box. As written the only button available is OK, but the prompt suggests that No should be an option.
    Yes, you are right. I was hurry.
    Thanks.
    I fix my code.

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Subscription out of error

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    EDIT: Thanks for marking the thread as solved.

    Good luck.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  9. #9
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Subscription out of error

    No, my question was about error 'Runtime 9, subscription out of range'.
    Thanks

  10. #10
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Subscription out of error

    Is there I can error handle 'Run time error 9'?

    Thanks

  11. #11
    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: Subscription out of error

    The error is Subscript out of Range.

    The code you posted is quite different than what you put in your first post. You are getting a filename from GetOpenFilename. sFilename should be declared as Variant, not String, because the function can return FALSE if the user cancels the operation. In that case you will get a subscript error. However, you did not do what I suggested, which is to check the value of sFilename when the error occurs and tell us what it is. So this is the best I can suggest:

    Please Login or Register  to view this content.

+ 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. subscription revenue
    By brotherwo in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-09-2013, 05:03 PM
  2. Subscription not working?
    By warakawa in forum The Water Cooler
    Replies: 4
    Last Post: 10-23-2010, 03:52 AM
  3. How to set up subscription due notice
    By slindon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-09-2006, 07:51 AM
  4. [SOLVED] Sorting a subscription list
    By Marzban J. Hathiram in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-25-2006, 04:20 AM

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