Kill
Hi Michael,
Try this
Sub Michael()
FileSaveName = ActiveWorkbook.Path
FileSaveNameEnd = FileSaveName & "\Arkiv\"
varName = ActiveSheet.Name
varDir = FileSaveNameEnd
varYear = Format(Date, "yyyy")
varNr = ReportNumber
ActiveSheet.SaveAs Filename:=varDir & varName & varNr & varYear
With ActiveWorkbook
If .Path < "" Then
.Saved = True
.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
End If
End With
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Michael" wrote in message
...
Hi again..
I need more help. Sorry!
When the workbook is opened ( 1 sheet called VT) its saved back to the
original location with a new report number, and then saved to a temp
folder
where it is while the user work on it. After the user is finished the
sheet
is duplicated to a new workbook in a new location.
Everything is ok with that, but then i want to delete the workbook that is
in the temp folder by the macro in that workbook.
The temp location is:
FileSaveName = ActiveWorkbook.Path
FileSaveNameEnd = FileSaveName & "\Arkiv\"
varName = ActiveSheet.Name
varDir = FileSaveNameEnd
varYear = Format(Date, "yyyy")
varNr = ReportNumber
On Error GoTo xlErrorHandler:
ActiveSheet.SaveAs Filename:=varDir & varName & varNr & varYear
at the end of the sub i have this code:
Kill "varDir & varName & varNr & varYear"
End Sub
Is it possible to "kill" the workbook while its still running or should i
"kill" it from another location (program)?
Michael
--
Nil Satis Nisi Optimum
|