excel中的VB编写怎么编写超链接?

excel中的VB编写怎么编写超链接?,第1张

比如要链接到与Book1xls同目录下的Book2xls的sheet2的B2单元格,链接标记是"ABC"
1)选中Book1中的单元格
2)输入公式=HYPERLINK("[Book2xls]sheet2!B2","ABC")
如果不同目录下,则要写出路径,比如:
=HYPERLINK("[e:\excel函数示例\Book2xls]sheet2!B2","ABC")

在click事件里面加
Try
SystemDiagnosticsProcessStart(">Private Sub yourlabel_Clik()
‘ 在这里写打开、显示图表的代码
End Sub
要看起来像超链接,还需要些修饰:
Private Sub yourlabel_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If yourlabelForeColor <> RGB(0, 0, &HFF) Then
yourlabelForeColor = RGB(0, 0, &HFF)
yourlabelFontUnderline = True
yourlabelFontBold = True
End If
End Sub
Private Sub yourlabel背景窗体_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If yourlabelForeColor = RGB(0, 0, &HFF) Then
yourlabelForeColor = &HC0C0C0 ' 灰色。什么颜色随你了。
yourlabelFontUnderline = False
yourlabelFontBold = False
End If
End Sub

给你个例子:
Private Declare Function ShellExecute Lib "shell32dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Form_Load()
Label1Caption = ">

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/yw/13376744.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-24
下一篇 2023-07-24

发表评论

登录后才能评论

评论列表(0条)

保存