Previous  Home  Next

Get the Link Source of a Link

In some cases, an image or sound may report itself as a linked shape but it's actually an oddball "linked+embedded" link.

If you attempt to check the LinkSource of one of these, it causes your code to error.

Instead of writing a bunch of code to protect against this each time you need to get the LinkSource of a linked shape, call this function.

It eats the error and returns blank if there's a problem, the LinkSource otherwise.

Function GetSourceLink(pShape As Shape) As String
' Returns source link for shape if any, blank if not

	Dim strTemp As String
	strTemp = ""

	On Error Resume Next

	' Attempt to grab sourcefullname
	strTemp = pShape.LinkFormat.SourceFullName

	' we either have the LinkFormat.Source or a blank if it's a linked+embedded job
	GetSourceLink = strTemp

End Function

Previous  Home  Next