Saving files with names entered via InputBox

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
 
M

Matthew McManus

Thanks for that - it works fine. I think I was missing a spac
somewhere.

Matthe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top