How do I delete a workbook after the vba has run?
You can delete it from within itself because the are deleting the HDD image
Kill Thisworkbook.FullName
but the workbook still exists in memory, so you will need to close it and
make sure it does ask to be saved
ThisWorkbook.Close SaveChanges:=False
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Patrick" wrote in message
...
Situation: I have written a purchase order expediting system. It goes and
grab data from my mainframe and populates a spreadsheet. After populating
the
code sorts and cleans the data. It them looks at each row of data and if
it
is a new (different) vendor it will open a template spreadsheet and
populate
that vendor's specific lines. It then saves the template as a unique name
associated to that vendor. The template contains VBA that allows me to
upload
the data that the vendor supplies back into the mainframe onc they return
the
spreadsheet to me.
Problem: After I update my mainframe I need to delete the spreadsheet...
since its job is now done. This is also important because there can be
hundreds of sheets generated by the main program and after I get the
vendor
sheets back and uploaded I need to clean them out so I do not duplicate
the
work (I cannot keep track of 100s of sheets anymore... could be old age).
Questions: Is there a way to code the deletion of a sheet with VBA code
that
exists IN that same sheet? Would I have to capture the sheet name, save it
as
something else, then delete the original sheet name? Does anyone have any
suggestions for how I could do it differently?
Sincerely appreciated,
patrick
|