+ Reply to Thread
Results 1 to 6 of 6

Possible permission error

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Possible permission error

    I have an excel macro that will open, edit and save and close a word document. The problem is I am getting this error when the code is ran.

    Permission denied (Error 70)

    This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

    An attempt was made to write to a write-protected disk or to access a locked file. This error has the following causes and solutions:

    ##You tried to open a write-protected file for sequential Output or Append. Open the file for Input or change the write-protection attribute of the file.


    ##You tried to open a file on a disk that is write-protected for sequential Output or Append. Remove the write-protection device from the disk or open the file for Input.


    ##You tried to write to a file that another process locked. Wait to open the file until the other process releases it.


    ##You attempted to access the registry, but your user permissions don't include this type of registry access.

    On 32-bit Microsoft Windows systems, a user must have the correct permissions for access to the system registry. Change your permissions or have them changed by the system administrator.
    As far as I can tell, there are no sort of permission restrictions on the word document. This document is something that is on my personal hard drive, as is the excel document so there shouldn't be any sort of network restrictions at play. Any suggestions?

    Edit: This is the line that is causing the error message.
    Please Login or Register  to view this content.
    Last edited by Butcher1; 09-09-2014 at 10:10 PM.

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Possible permission error

    The error message gives you the range of possible reasons for the error. Have you eliminated all of those?
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Possible permission error

    No, it is over my head. I was hoping the answer would be as simple as clicking an option box.

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Possible permission error

    The obvious place to start looking is to see whether the file "C:\Users\Eli\Desktop\Journal2.docx" is still open. You can't delete an open Word file.

  5. #5
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Possible permission error

    Ok, maybe this isn't a Word issue then. This is the end of the code, I cut out the first huge chunk as it doesn't deal with closing and saving the doc.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Possible permission error

    You still haven't answered the question, though, as to whether the Word file is open or closed. Nothing you've posted so far gives any indication one way or the other. To work, the code to close the file (if you have any) would have to occur before the code that deletes it. In any event, trying to delete a file you're about to save over (that's what your SaveAs does) is pointless. Equally, unless the document you're already working with is in fact "C:\Users\Eli\Desktop\Journal.doc", your SaveAs will fail and, if it is that file, you may as well just use an ordinary Save unless you also want to change the file's creation date metadata.

  7. #7
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Possible permission error

    The file is closed prior to executing the macro. The macro will open, edit, save and close the document. I took out some of the code and it will now function as I want it to. Thanks for letting me know that it was basically trying to delete the file. Here is the entire code.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error 70 'Permission Denied' when Pasting
    By Contigo1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-05-2013, 03:46 AM
  2. Run time error 70 Permission denied.
    By sagar.rajula in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-10-2013, 11:50 AM
  3. Permission and Saving Error
    By aohagan in forum Excel General
    Replies: 3
    Last Post: 03-27-2007, 11:38 PM
  4. [SOLVED] error 70 - Permission denied
    By MT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2005, 03:06 AM
  5. Run-time error '70': Permission denied
    By Maury Markowitz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2005, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1