gpt4 book ai didi

vba - 超链接屏幕提示导致工作簿需要修复

转载 作者:行者123 更新时间:2023-12-02 21:26:56 26 4
gpt4 key购买 nike

我正在使用 VBA 创建指向 Excel 中不同工作表中单元格的超链接,当我添加屏幕提示时,一切正常,直到我关闭工作簿。

重新打开后,Excel 会进行修复并强制我以只读方式打开。去掉屏幕提示可以解决问题,但有屏幕提示非常方便。

有谁知道这可能是什么原因造成的吗?

Hyperlinks.Add wb.Sheets("Summary").Cells(j, i + 2), "", "'" & i & "'!" & wb.Sheets(i + 1).Cells(3, col).Address, scrTip

编辑:

这是我用来创建 scrTip 的代码。

scrTip = ""

For indx = 0 To 4

If TopCost(indx) <= 0 Then Exit For

If indx > 0 Then scrTip = scrTip & vbCrLf
scrTip = scrTip & strTopCost(indx) & " - " & Round(TopCost(indx))

Next indx

数组strTopCost包含可以包含“、-、&、/、#等符号的描述,而topcost数组包含数字。当scrTip为空时,屏幕提示显示超链接的位置。

最佳答案

请尝试以下操作:

wb.Sheets("Summary").Hyperlinks.Add _
AnchorAnchor:=Cells(j, i + 2), _
Address:="", _
SubAddress:="'" & i & "'!" & wb.Sheets(i + 1).Cells(3, col).Address, _
ScreenTip:=scrTip

此外,请确保在创建新超链接之前删除所有现有超链接:

Dim hyp As Hyperlink
For Each hyp In ThisWorkbook.Sheets("Summary").Hyperlinks
hyp.Delete
Next hyp

关于vba - 超链接屏幕提示导致工作簿需要修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42795868/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com