Macro to delete files (1 Viewer)

hmongie

Registered User.
Local time
Today, 10:17
Joined
May 17, 2003
Messages
99
Hi, hope someone can help.

I have a process and needs to find a short cut.

I have many users (about ten to twenty people). These folks uses a custom crystal reports to export field from a database into excel files. All the excel files are saved in their own local machine.

Ex.
C:\company1.xls
C:\company2.xls
C:\company3.xls

From here they open the excel sheets and do what they need to. Data modifications, corrections and etc. Exactly at 2pm in the afternoon a custom application is ran and searches through all of the defined user machines, it merges all the datas into an online database. The other thing that the application does is it opens a custom word document and saves it into each user's desktop that tells tell how many company they had processed for the day.

I need a macro that is embedded into the word document so that at 3pm when they open the word document, the macro will clean out all the excel sheets from their c drive. If the document is not created on the user's desktop, no files should be deleted. Yes, I tried running a batch file but it wasn't working out.

This process cannot change since it was developed by a contracted developer.

Any help? Thanks.
 

Sorryaboutthemess

New member
Local time
Today, 05:17
Joined
Oct 25, 2007
Messages
2
I won't pretend to be an expert in Word Macros. But maybe I can be of some help.
I'm not sure how you would cause the macro to activate at 3 PM, and I don't entirely understand your post. But I believe that if you want to delete a file, you use the Kill command i.e.
Kill C:\Program Files\File123.xls
to delete File123.xls.
Hope that helps.
Josh
 

pidmand

New member
Local time
Today, 12:17
Joined
May 18, 2012
Messages
1
I tried to use "Kill (PathName)" command but it gives me an error:
"Run-time error '70': Permission denied"

What should I do?

Thanks..
 
Last edited:

Users who are viewing this thread

Top Bottom