columbo1977
Programmer
Hi All
Hope you can help :
I have the following code and although it works first time it will not work after that as it cannot overwrite the file that is already in the temp folder, so I need to be able to let excel choose the filenames or check to see if there is a file in the temp folder with the same name first.
Thansk for looking
Graham
Hope you can help :
I have the following code and although it works first time it will not work after that as it cannot overwrite the file that is already in the temp folder, so I need to be able to let excel choose the filenames or check to see if there is a file in the temp folder with the same name first.
Code:
Sub Send1Sheet_ActiveWorkbook()
Workbook.Copy
Dim sTemp As String
sTemp = Environ("TEMP")
ActiveWorkbook.SaveAs Filename:=sTemp & "\test.xls", FileFormat:= _
xlNormal, Password:="1234", WriteResPassword:="x", ReadOnlyRecommended:= _
True, CreateBackup:=False
With ActiveWorkbook
.SendMail Recipients:="xxx@cc.co.uk", _
Subject:="Test of Protect"
.Close SaveChanges:=False
End With
End Sub
Thansk for looking
Graham