How do I open a Word document from a Base macro?

Button Actions on a Base form include opening a document using a “file:/// . . .” URL. How can I perform the same function within a Base macro?

Sub OpenDoc
	Dim Doc as Object
	Dim Url As String
	Url = "file:///YOUR_DOC_LOCATION_NAME_HERE"
	Dim FileProperties(0) As New com.sun.star.beans.PropertyValue
	FileProperties(0).Name = "MacroExecutionMode"
	FileProperties(0).Value = 1
	Doc = StarDesktop.loadComponentFromURL(Url, "_blank", 0, FileProperties())
End Sub

If the answer solves your question please tick the :heavy_check_mark:.

Perfect solution!