ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete files with VBA (https://www.excelbanter.com/excel-programming/361356-delete-files-vba.html)

BEEJAY

Delete files with VBA
 
Have two files that need to be deleted once the Workbook open macro is
(almost) done.
NOTE: These files are in the exact same directory, on each of the computers.

1: File: QCNUM.xls - Regular working file.
Contains Salesmans code number and
Seqential number generator (on hidden
sheet)
2: File: QCNUM_1.xls -is the new file I send out to each salesman
3: File: QCNUM_OLD.xls -to be a "back-up" of QCNUM.xls
4: File: Updater.xls: Strictly a file used to "manipulate the other
files
ONE time use only

Updater Operations:
Take pertinent info from QCNUM and put in identical sheets/cells in QCNUM_1
QCNUM Save as QCNUM_OLD
QCNUM_1 Save As QCNUM

Now I have no need for QCNUM_1 anymore. How can it be deleted?

I also need to get rid of Updater.
BUT, that's the one with the macro in it.
Is the windows temp file always in the same tree? If so, could I rename the
file as Junk.tmp, and have windows delete the file when it closes?
OR .......................??
I want this file deleted, somehow, so it can't be "activated" a 2nd time.

Thanks in advance


Bob Phillips[_14_]

Delete files with VBA
 
Look at Kill in VBA help.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"BEEJAY" wrote in message
...
Have two files that need to be deleted once the Workbook open macro is
(almost) done.
NOTE: These files are in the exact same directory, on each of the

computers.

1: File: QCNUM.xls - Regular working file.
Contains Salesmans code number and
Seqential number generator (on

hidden
sheet)
2: File: QCNUM_1.xls -is the new file I send out to each salesman
3: File: QCNUM_OLD.xls -to be a "back-up" of QCNUM.xls
4: File: Updater.xls: Strictly a file used to "manipulate the

other
files
ONE time use only

Updater Operations:
Take pertinent info from QCNUM and put in identical sheets/cells in

QCNUM_1
QCNUM Save as QCNUM_OLD
QCNUM_1 Save As QCNUM

Now I have no need for QCNUM_1 anymore. How can it be deleted?

I also need to get rid of Updater.
BUT, that's the one with the macro in it.
Is the windows temp file always in the same tree? If so, could I rename

the
file as Junk.tmp, and have windows delete the file when it closes?
OR .......................??
I want this file deleted, somehow, so it can't be "activated" a 2nd time.

Thanks in advance





All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com