运行时错误'4160'打开超链接时文件名错误 [英] Run-time error '4160' Bad file name on opening hyperlink

查看:301
本文介绍了运行时错误'4160'打开超链接时文件名错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的个人加载项中打开一个单词模板。在这个加载项中,我列出了一个带有以下地址的超链接。

如果我将Personal.dotm(带有UI)作为文档打开,宏工作正常。我已经将这个加载项存储在我的启动中,因此它在打开WORD时被加载。如果我按下按钮加载文件,它会给我错误信息。

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&使用超链接:

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.

想法是列出文档中的链接数而不是VBA,以便轻松更新和添加模板。

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

推荐答案

为什么使用 超链接 关注而不是Documents.Open - 或Documents.Add(如果您尝试根据模板创建新文档
)?
Why are you using Hyperlinks.Follow instead of Documents.Open - or Documents.Add (if you're trying to create a new document based on the template)?


这篇关于运行时错误'4160'打开超链接时文件名错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆