Deleting a file using VBA in Word

L

LizMc

I am using Word 2002 SP3 on an XP Professional 5.1.2600 SP2 PC.

VBA code that worked previously is now not working.

Code -

SetAttrib FileToDelete, vbNormal
Kill FileToDelete

This now returns an error of Permission Denied. I need to find a way round
this problem.
 
J

Jonathan West

Hi LizMac

Is the file on a local drive or a network drive? Has anything recently
changed about your system> If the file is on the network, have your system
administrators changed anything about file permissions?

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
J

Jonathan West

Hi Liz,

OK, if you have the ability to delete the file by other means, then it may
be a timing issue that has arisen as a result of the network changes. Try
inserting a few DoEvents commands between the SetAttrib line and the Kill
line.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top