I have a snippet of VBA code that I’ve been working with where I want to press a button in Excel that will open an Outlook template. But for some reason, when I press the button, I get an error for “Invalid path or URL”. Would anybody know why this happens? I’ve put a snippet of my code below.
Sub emailBugReport()
Dim myoutapp As Object
Dim myitem As Object
Set myoutapp = CreateObject("Outlook.Application")
Set myitem = myoutapp.Session.OpenSharedItem("C:UserskaibaOneDriveDesktoptest.eml")
myitem.Display
End Sub
I made sure that the filepath is correct as well.
Any help would be appreciated 🙂
When I tried running it, I was expecting the code to open the Outlook template, but for some reason, it kept giving me an error message. I thought it had to do with the OneDrive, but when I removed it, it gave me another error saying that VBA couldn’t find the file.