如何在VBA中更改相对超链接到绝对超链接

编程入门 行业动态 更新时间:2024-10-10 08:21:28
本文介绍了如何在VBA中更改相对超链接到绝对超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用CDO.Message从MS Access发送几个附加文件。 当我使用objMessage.AddAttachment时我需要指出文件的完整路径,但是所有文件的超链接都存储在我的查询(记录集)的单独列中,但仅作为相对链接。如何将其更改为绝对超链接? 完整代码如下:

I want to send several attached files from MS Access using CDO.Message. When I use "objMessage.AddAttachment" I need to indicate full path to the file, but all hyperlinks to files stored in separate column of my query (recordset) but as relative links only. How to change it to absolute hyperlinks? Full code as below:

展开 | 选择 | 换行 | 行号 推荐答案

请您提供相关链接的示例?我很确定你在做什么;但是,有这个例子可以确认。 Would you please provide an example of the relative link? I am fairly certain what you are doing; however, having that example would confirm.

当我在表中添加超链接时,我将其视为Folder1 \ testfile.txt, 使用VBA code Trim(rst(8))我把它作为 "#Folder1 \ testfile.txt#", 但是实际路径是C:\ DOCUMENTS \ File1 \\\ testfile.txt 似乎我得到了超链接属性的这个链接。 我只需要完整路径(绝对)没有# - 标志和任何其他信息。 我的基地位于C:\ DOCUMENTS When I add the hyperlink in table I see it as "Folder1\testfile.txt", using VBA code Trim(rst(8)) I get it as "#Folder1\testfile.txt#", but actual path is C:\DOCUMENTS\Folder1\testfile.txt It seems that I get this link with Hyperlink properties. I need only full path (absolute) without #-signs and any other info. My base is located in C:\DOCUMENTS

CostasM: 我只需要完整路径(绝对)而不需要#-signs和任何其他信息。 CostasM: I need only full path (absolute) without #-signs and any other info.

我担心这不是真的。没有没有哈希(#)字符的超链接。请参阅错误7980:HyperlinkAddress或HyperlinkSubAddress read-仅适用于超链接,了解有关超链接如何工作以及如何在需要时在代码中设置它们的更多信息。 对于您的情况,您需要提取相对的地址(除非你已经在某处获得了这些信息)。修复地址。除非它每次运行时都是相同的,否则只需要使用知识。最后,重做超链接,如链接线程中所述。请记住,任何电子邮件的收件人都必须能够从超链接中的任何内容访问该文件,因此如果驱动器号在其PC上必须相同,则它们才足够。否则你需要考虑UNC( \\Server \Share \ folders ... \ File )。

I''m afraid that is just not true. There is no hyperlink without the hash (#) characters. See Error 7980: HyperlinkAddress or HyperlinkSubAddress read-only for Hyperlink for more about how hyperlinks work and how to set them in code when you need to. For your situation you will need to extract the address that is relative (unless you have that information somewhere already). Fix the address. Unless it is the same every time it''s run rou will need to use knowledge only you have. Lastly, redo the hyperlink as explained in the linked thread. Remember, the recipient of any email must be able to access the file from whatever is in the hyperlink, so drive letters are only adequate if they are necessarily the same on their PC. Otherwise you need to consider UNCs (\\Server\Share\folders...\File).

更多推荐

如何在VBA中更改相对超链接到绝对超链接

本文发布于:2023-11-28 08:40:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641700.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:超链接   如何在   VBA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!