Activeworkbook.saveas And Error Handling...

  • i'm using the following code to force saving a file into a predetermined path and folder...


    sometimes, the user accidentally uses a "special character" in one of the cells and the file won't save...


    i would like to have an error message, alerting the user to this problem (and ask them to rename and save again...)...


    ???



    thank you...

  • Re: Activeworkbook.saveas And Error Handling...


    Try some nested Replace functions. Insert the following line of code after you populate the myfilename variable but before you populate the newfile variable:


    Code
    myfilename = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(myfilename, "\", ""), "/", ""), "?", ""), "<", ""), ">", ""), "*", ""), "|", ""), ":", ""), Chr(34), "")
  • Re: Activeworkbook.saveas And Error Handling...


    thank you...


    and if i would like to test for these initially (rather than just replace) and send a message to the user...how would i do this...?


    (nested ifs...?)


    ???


    thank you...

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!