Share via

Unable to use VBA Macros in Excel if document is in a OneDrive folder

Anonymous
2025-04-19T14:26:25+00:00

I have a macro-enabled workbook with one custom VBA function. The file is located in a OneDrive folder that is shared between myself and my husband. The file is sync'd to my hard drive using the OneDrive sync client. The file does not have the mark of the web. In properties, there's no checkbox to unblock the file. VBA macros are enabled in Excel. I've added the local folder where the file is sync'd to the list of trusted locations in Excel. Even added https://onedrive.live.com/ to the Trusted Sites zone in internet options.

Despite doing all of those things, I still get the Macros blocked warning, and the formulas that use the custom function do not work.

If I copy the same file to a different folder on my hard drive that is not under OneDrive control, the macros are enabled just fine. But if I then copy that same file back to the OneDrive folder and re-open it, the macros are again disabled.

Also, my husband, who created the VBA function, and is opening the same file in the same OneDrive location, but from his laptop, is able to use the macros without any issue.

Opening the file from OneDrive online folder in the browser and then choosing menu to open in desktop app has the same result.

It seems the OneDrive sync'd folder is the distinguishing factor in this case.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2025-04-20T14:42:18+00:00

Finally got it working after finding another similar post. The solution was to add this path to the trusted locations and checking the box to include sub-folders:

https://d.docs.live.net/

But this should not be this difficult - Documentation should include this!

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2025-04-19T16:48:41+00:00

    Thanks, yes double and triple checked the path. Removed it from the list and re-added as well.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2025-04-19T15:54:33+00:00

    The only help I can provide is to make certain all paths are verified. Too many times I had a path in my macro that did not include OneDrive and the macro would not run.

    Was this answer helpful?

    0 comments No comments