Saving files with names entered via InputBox

  • Thread starter Thread starter Matthew McManus
  • Start date Start date
M

Matthew McManus

Hi,

Would someone be able to tell me what I am doing wrong in the cod
below? I need my users to open files, called, 1.xls, 2.xls,... an
resave them with their own unique code which they enter via an Inpu
Box. So if they enter "abc", the files will be saved as "abc1.xls"
"abc2.xls", etc.


stranswer = InputBox("enter file name")
Workbooks.Open Filename:="C:\1.xls"
ActiveWorkbook.SaveAs Filename:= "C:\stranswer1.xls"
FileFormat:=xlNormal, Password:="", WriteResPassword:=""
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
Workbooks.Open Filename:="C:\2.xls"
ActiveWorkbook.SaveAs Filename:= "C:\stranswer2.xls"
FileFormat:=xlNormal, Password:="", WriteResPassword:=""
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close

Thanks
Matthe
 
Back
Top