0

I'm trying to save all .xlsm files in a folder path as .xlsx and although the script works successfully each workbook becomes corrupt. Could someone explain how i can overcome this issue

Thank you in advance.

Set fso = CreateObject("scripting.filesystemobject")
Set fils = fso.GetFolder("LOCATION\").Files

fldrname2 = Worksheets("Applications").Range("A2").Value

For Each fil In fils
    fldrname2 = Worksheets("Applications").Range("A2").Value
    n = fil.Name
    d = fil.DateLastModified
    fso.CopyFile fil.Path, fil.ParentFolder & fldrname2 & "-" & fil.Name & ".xlsx"
Next fil
Paul
  • 53
  • 1
  • 8
  • If each file becomes corrupt I wouldn't describe that by saying that it "works successfully". You probably need to open the files and then use a `saveas` to resave them as ".xlsx". Just changing the file extension doesn't change the file. The file itself needs to be changed if you strip away macros. – John Coleman Oct 13 '16 at 15:28
  • 1
    You're just changing the file extension (but the file still is a xlsm), that's why excel think it's corrupted. You have to open each file and save as xlsx – Magnetron Oct 13 '16 at 15:29

0 Answers0