Copying current workbook to new folder

  • Hi.

    I have been trying to copy a workbook to a new folder with the name and extension specified but I keep saving the current workbook with a new name to the folder I need, I have a code before that updates a page with new information from different departments so the excels need to be named something different


    I have tried changing the code multiple times and googled different methods but can't seem to get what I want.


    Any help we be great


    Thank you


  • This line sets the name, so is it getting it's value from the correct cell?


    Code
    1. FName = ThisWorkbook.Worksheets("BCS").Range("G4").Value & "-" & "Period" & "-" & ThisWorkbook.Worksheets("Dates").Range("I1").Value
  • Hi royUK ,


    I cant set a hardcoded path or name as I would need to save for about 12+ files, the code which pulls in export111 updates the workbook with the department information and then I call export111 to save that version so the path I have chosen. If that makes sense.


    I need to be able to create an exact copy of the workbook with the current updated data and save with FPath and FName.


    Currently, the code I have saves the current workbook to the new destination and then it errors as it cant find the range.

    Thank you for your help

  • royUK Because this saves the current workbook as the new name it just saves over and over again with the new name but doesn't give a different version.

    I want it to output to file like:

    example not actual file names:
    dept1.xlsx
    dept2.xlsx
    dept3.xlsx


    while keeping the original filename the same and intact. all I basically need is a version of the excel copied and saved when the code is called, the FName will change the file name.

  • This will add a unique identifier based on the time it is saved. Note that you must reset DisplayAlerts as well


    It would help to see your file

  • Tried running the code and it is basically a dead duck