Access denied Error 70

G

Gordo

I have developed a Word VBA solution that is being used by about 50
individuals. The code in question does the following:
1) captures the current filename into a variable
2) Does a Save as to a new file name
3) Does a Kill on the old file name

This code works for most of the individuals, however a feew get Access
Denied error 70. If they move to a differnet computer it will work for them.

Any ideas as to why they might the error message, and what should I try?

I have added a Delay function that allows windows to DoEvents, thinking it
might be that the file has not completly closed.

I have added code to test to determine if the file is open, and the code
thinks it is closed, but when th eKill command is executed the error occurs.
 
R

Robert Paulsen

This issue sounds vaguely familiar to me. I would check that the Office
Service Pack of the users that are having the problem. They may need to be
upgraded to the version of the users that are able to delete the file. I
remember when I've run across this it wasn't just programmatically that I had
the problem. If I put a Stop in my code and went to Windows Explorer I was
still unable to delete the file. Word had a lock on it, even though the Save
As should have freed it.
 
G

Gordo

Good thought, however our environment is controled, so every desktop is at
the same level of software. I also did the same test in Explorer and
experienced the same issue, unable to delete the file, even thought it was
not open. Sounds like this is actually a Windows issue.
 
R

Robert Paulsen

Not sure if this will help, but maybe you can try a different approach.

1. Store filename to a variable.
2. Close the document.
3. Rename it.

Dim originalDoc As String
originalDoc = ActiveDocument.FullName
ActiveDocument.Close savechanges:=wdSaveChanges
Name originalDoc As "c:\newpath\newname.doc"
 

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