Hi,
I am trying make 11 copies of an Excel workbook, AE1.xls, into a directory. At the end, I'd like to have AE1.xls through AE12.xls. All are exact duplicates of the AE1.xls file in the folder.
Is there a simple way to do this?
This is the VB I've tried so far (resused code from Microsoft site - I admit it):
Application.DisplayAlerts = False
filename = Dir(*.xls)
Do While Len (filenam) > 0
newnam = Left (filename, InStr(1,filenam, ".") -1) & ".xls"
ActiveWorkbook.SaveAs Filename:=newnam, FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyReconnmended:=False, CreateBackup=False
ActiveWorkbook.Close
Else
MsgBox "Not Able to Open File: " & CurDir () & "\" & filenam
Err=0
End If
Filenam = Dir ( )
Loop
End Sub
This is not really working. I'm not a good programmer. Anyone out there that can help, your assistance is greatly appreciated. I'm going to have to do this about 40 times in 40 directories. Doing it by copying the file and renaming it is not an option.
Thanks,
Terry
I am trying make 11 copies of an Excel workbook, AE1.xls, into a directory. At the end, I'd like to have AE1.xls through AE12.xls. All are exact duplicates of the AE1.xls file in the folder.
Is there a simple way to do this?
This is the VB I've tried so far (resused code from Microsoft site - I admit it):
Application.DisplayAlerts = False
filename = Dir(*.xls)
Do While Len (filenam) > 0
newnam = Left (filename, InStr(1,filenam, ".") -1) & ".xls"
ActiveWorkbook.SaveAs Filename:=newnam, FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyReconnmended:=False, CreateBackup=False
ActiveWorkbook.Close
Else
MsgBox "Not Able to Open File: " & CurDir () & "\" & filenam
Err=0
End If
Filenam = Dir ( )
Loop
End Sub
This is not really working. I'm not a good programmer. Anyone out there that can help, your assistance is greatly appreciated. I'm going to have to do this about 40 times in 40 directories. Doing it by copying the file and renaming it is not an option.
Thanks,
Terry