+ Reply to Thread
Results 1 to 8 of 8

Save code stopped working

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Save code stopped working

    Don't really know how to make a line of code red to highlight so sorry.

    The line of code
    Please Login or Register  to view this content.
    has suddenly stopped working and I have no idea why, can anyone point out the more than likely glaringly obvious error I am missing please?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Save code stopped working

    Hi, Sc0tt1e,

    you can愒 use a string for that you would need to set an object or use Workbooks for it (I悲 set a workbook object to the file when it愀 opened and refer to that)
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

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

    Re: Save code stopped working

    You imply that this code used to work, but I don't see how it's possible. FPath is declared as a String, but you are trying to call methods (Save, Close) as though it were an object. It doesn't even compile. Is FPath the name of an Excel file? Even if we fix all that, you are saving a file that was never opened in the first place. So there are several problems to address.

    BTW to color code red, highlight the code, then click on the "A" icon above the edit area to select a color.
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Save code stopped working

    Quote Originally Posted by HaHoBe View Post
    Hi, Sc0tt1e,

    you can愒 use a string for that you would need to set an object or use Workbooks for it (I悲 set a workbook object to the file when it愀 opened and refer to that)
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger
    I tried changing the code to the former (below) but I didn't work. Not sure how to approach this to make it work still
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Save code stopped working

    Forgot to mention, Sheets("Tyrant").Range("BA1") contains the following

    Please Login or Register  to view this content.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Save code stopped working

    Hi, Sc0tt1e,

    if both folder and name of the workbook are included in one cell the code can愒 work as Workbooks would expect the name of the workbook as well as the extension only. Maybe try and give the way of setting an object a try.

    And please do not quote full posts, only the relevant parts.

    Ciao,
    Holger

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

    Re: Save code stopped working

    Have you tried this?
    Please Login or Register  to view this content.
    Or even this.
    Please Login or Register  to view this content.
    By the way, I would suggest opening the workbook and then setting a reference to the sheet rather than this.
    Please Login or Register  to view this content.
    For example.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  8. #8
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Save code stopped working

    Norie, there are days when I genuinely love you.

    I had it originally set but someone else told me to change the code to just a string. The last option worked a charm

+ 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. Save code stopped working
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2014, 11:35 AM
  2. [SOLVED] Code stopped working, can no longer copy and save a worksheet
    By Oracle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2012, 07:56 PM
  3. Save As stopped working after Save As csv
    By pokeyarw in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-28-2010, 10:18 PM
  4. Code stopped working
    By kinleyr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2010, 12:25 PM
  5. Code stopped working
    By chris46521 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2006, 10:05 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