• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Save as File with Same File Name

webmax

Member
Hi,

I am trying to put one macro which would open the excel file by path name and save as the excel file in the same name in the different folder.

I am attaching the file for your reference.

The File to be Save as in the below Path with the Same excel file. i tried but it is not working.

"C:\Users\Desktop\consolidated\

Kindly do the needful.

Regards
Shahul
 

Attachments

  • saveasmacro.xls
    36 KB · Views: 8

Hi,

easy with Name property of Workbook !

Otherwise post your code with tags …

Regards !
 
Try and change the line to
ActiveWorkbook.SaveAs Filename:="C:\Users\Shahul\Desktop\consolidated\" & ActiveWorkbook.Name
 
Hi Shahul,
Is it working? The updated code would look like this.
Code:
Sub test()
xx = Selection.Address
For x = 1 To Range(xx).Cells.Count
Workbooks.Open Filename:=Range(xx).Cells(x).Value
ActiveWorkbook.SaveAs Filename:="C:\Users\Shahul\Desktop\consolidated\" & ActiveWorkbook.Name
ActiveWorkbook.Close (1)
Next x
End Sub
 
Back
Top