Microsoft Excel cannot access the file. There are several possible reasons:

Dennis Hancy 1 Reputation point
2022-04-13T15:11:58.657+00:00

Hello,

I have an Excel macro workbook stored on our SharePoint site. It copies data from that workbook to a separate .xlsx file also on SharePoint.

Once the data is copied, it does an "ActiveWorkbook.Save". When I run this on my local drive, it all works well. But when I run from SharePoint, that's where the problems arise.

It returns this message:

192764-image.png

The problem appears to be that the destination workbook is read-only. So I modified my initial "open" statement to this:

Workbooks.Open myFileName, , False, , , , True ' where False is the "ReadOnly" parameter and True is the "IgnoreReadOnlyRecommended" parameter.

But this didn't work. I saw the same error message above.

So this brings me to my laundry list of questions:

  1. Why does this work flawlessly when I run it on my local drive?
  2. What is this file, 'C:\WINDOWS\system32\D5F95B10'. that it refers to on the error message when running from SharePoint?
  3. Why does the file still open in read-only mode when the Open statement says "don't use read-only"?
  4. And just to further complicate matters - a co-worker ran this from SharePoint, and it saved it to her desktop.

Thanks in advance for any insight, advice, and/or guidance you can provide!

Dennis

Developer technologies | Visual Basic for Applications
{count} votes

1 answer

Sort by: Most helpful
  1. Ceasar Chen_MSFT 4,486 Reputation points
    2022-04-14T07:28:37.793+00:00

    Hi, @Dennis Hancy
    Welcome to the Q&A forum, your questions are mainly related to VBA and SharePoint. It is recommended that you find relevant content under the office-vba-dev tag and tag your posts with SharePoint.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.