+ Reply to Thread
Results 1 to 2 of 2

Macro Needs Debug, but worked previously

Hybrid View

JennOlsen Macro Needs Debug, but worked... 03-11-2020, 12:22 PM
6StringJazzer Re: Macro Needs Debug, but... 03-11-2020, 12:56 PM
  1. #1
    Forum Contributor
    Join Date
    11-13-2013
    Location
    California
    MS-Off Ver
    Excel 365 Apps for enterprise
    Posts
    180

    Macro Needs Debug, but worked previously

    I have a section of code that is hanging up my macro. I think it's because the file already exists where we want it to save. Can anyone confirm and perhaps suggest how to rewrite the code to overwrite any existing files?

    ActiveWorkbook.SaveAs Filename:="\\fs-stor-a\AdminServ\AdminServ-Depts\Pay-Shared\PEOPLESOFT-T&L\RECON\048 Reformatted.xls" _
    , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=False, CreateBackup:=False

    I should mention I have a nearly identical macro the runs for a different set of criteria but off the same parent file and the code is identical, with there being an existing file and it seems to be working fine. Is it possible that although the Debug points to this string of code that the problem is actually before this?
    Last edited by JennOlsen; 03-11-2020 at 12:29 PM.

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

    Re: Macro Needs Debug, but worked previously

    All the parameters on this line of code are static values so it is 99% certain the problem is right here.

    What error code and message are shown when you get the debug dialog box?

    Is there a possibility that the target file is already open by another user?

    Is the ActiveWorkbook when this code is executed the same as the file containing the code?

    What is the type of the file being saved? Is the file a .xls file? You might need to use xlExcel8 instead of xlNormal. (I would recommend you save as .xlsx anyway.)
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Macro to store previously selected cell
    By Smorgan88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2016, 08:35 PM
  2. Runtime Error 1004, code previously worked fine
    By Eatmybrain in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2015, 08:13 AM
  3. For Next Loop not incrementing, had worked previously...
    By Mike_bee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2013, 04:32 PM
  4. Pivot Table code that has previously worked now returns an error
    By brgr4u in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2013, 02:24 PM
  5. Issue with range macro that previously worked
    By kerrold1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2012, 06:26 AM
  6. Formula Worked previously and now shows #value!
    By spencerf_iii in forum Excel General
    Replies: 3
    Last Post: 04-26-2011, 02:20 PM
  7. DONKEYOTE - IRR Previously worked on
    By a.mack123 in forum Excel General
    Replies: 2
    Last Post: 08-31-2010, 12:25 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