嵌入式word文档字段中的父文件地址是绝对的

问题描述 投票:0回答:1

怎么能让它相对?

我在"WB1.xlsm""E:\Administration\Salary"

word文档嵌入在Sheet1中:( Microsoft Word启用宏的文档对象)

我在嵌入式文字doc中复制并粘贴Cells(2,1)作为Paste Special> Paste Link

在字段的代码中生成了一个绝对父文件地址:

LINK Excel.SheetMacroEnabled.12 "E:\Administration\Salary\\WB1.xlsm" "Sheet1!R2C1" \a \f 4 \r  \* MERGEFORMAT

所以我无法移动Excel文件。

如何制作与父文档的application.path相关的链接字段中的父文件地址?父文档是Excel工作簿。

excel vba ms-word embedded-documents word-field
1个回答
1
投票

不能使LINK字段保留相对地址。您可以通过设置超链接库来解决此问题,MS错误地将其称为设置相对超链接。看到:

https://support.microsoft.com/en-au/help/903163/how-to-create-absolute-hyperlinks-and-relative-hyperlinks-in-word-docu

或者,对于使用LINK字段以外的字段的字段代码解决方案以及适用于所有字段的宏,请参阅:

http://windowssecrets.com/forums/showthread.php/154379-Word-Fields-and-Relative-Paths-to-External-Files

© www.soinside.com 2019 - 2024. All rights reserved.