【发布时间】:2015-12-14 12:40:01
【问题描述】:
我有两个工作簿“UI.xlsm”和“Gas_Insulated_MV_Circuit.xlsm”,在第一个工作簿 (UI.xlsm) 中,我在特定列中维护了一个超链接列表,单击该链接将带我到a 相应的其他工作簿。
任务是从“UI.xlsm”工作簿中捕获单击的超链接的文本,我必须在“Gas_Insulated_MV_Circuit.xlsm”中使用相同的值
以下是 UI.xlsm 工作簿中的代码,我在其中捕获单击的超链接单元格文本并将其存储为字符串
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim BR as String
BR = Target.Range.Text 'Here i'm storing the clicked cell text
End Sub
现在我需要在另一个工作簿“Gas_Insulated_MV_Circuit.xlsm”中使用 BR 字符串值
Public BR as String ' I have declared BR as a public variable
Private Sub CommandButton27_Click()
Dim WbUI as Workbook
Dim WsUI as Worksheet
Dim File1 as string
Set WbUI = Workbooks ("UI.xlsm")
Set WsUI = WbUI.Sheets("Sheet1")
File1 = BR ' I want something like this, where i can assign BR value from
UI.xlsm workbook to File 1 of the current workbook
End Sub
谁能帮我实现它。
【问题讨论】: