Hi Espen,
Thanks for using Microsoft products and posting in the community, I'm glad to offer help.
According to your description, you can open the OneDrive app settings > go to the Office tab > untick "Use Office applications tosync Office files that I open", then reopen your workbook.
Based on my test, it will make =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1) return a local path instead of a URL.
However, since VBA is beyond our support scope, I'm not sure if it will affect "ThisworkBook.path" in VBA, it would be great if it works in VBA. But if it doesn't work, to avoid providing any incorrect information, you can post a new thread in Excel / Microsoft OfficeProgramming / Microsoft 365 Family, this is the category dedicated to solving the related issues, and there will be professional can further assist you.
Besides, you can vote for the following idea in UserVoice to solve the problem from the root, it is the best way to let the relevant team hear your needs, anyone's suggestion could have a chance to be adopted by Microsoft, your understanding and contribution will be highly appreciated: Add option to avoid OneDrive from changing Excel references to other files
Hope the above information can be helpful.
Best Regards,
Arck