Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Run-time error '4160' Bad file name on opening hyperlink

$
0
0

I'm trying to open a word template from my Personal add-in. In this add-in I've listed an hyperlink with the address below.
The macro works fine if I have the Personal.dotm (with UI) open as a document. I've stored this add-in in my startup so it's loaded during opening of WORD. If I press the button to load the file it gives me the error message.

Code & Hyperlink used:

Sub OpenDoc(control As IRibbonControl)
If Documents("Personal.dotm").Hyperlinks.Count >= 1 Then
    Documents("Personal.dotm").Hyperlinks(1).Follow
End If
End Sub
C:\syncplicity\Ruis000a\Documents\Office\Template\TC_AddDocProp.dotm

Worked initially fine, but now returns the error message.

Idea was to list number of links in the document and not VBA to allow easy update and adding of Templates.






Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>