创建从Excel FlowChart到MS Word标题的超链接 [英] Creating hyperlink from Excel FlowChart to MS Word Heading
问题描述
我正在MS Excel 2007中构建一个流程图。它是一个工作流程。我想能够引用一个单词文档,该文档详细说明了流程图中的每个步骤。
I am building a flowchart in MS Excel 2007. It's for a work flow. I want to be able to reference a word document which has detailed instructions about each step in the flow chart.
在流程图的每个部分,我想创建一个超级链接/按钮,用户可以点击并打开该单词的特定部分(标题)文件。我试图创建一个形状(矩形)并设置一个到文档的超链接。这很好,但它只是开头的文件。我想要矩形按钮在特定的标题上打开。我不知道你是否可以超链接。如果没有,我想我需要创建一个按钮控件。我不知道按钮控件是否也可以这样做。
At each section of the flow chart, I want to create a hyperlink/button that the user can click on and open up to that specific portion (heading) of the word document. I've tried to create a shape (rectangle) and set a hyperlink to the document. That works fine, but it just opens the document at the beginning. I want the rectangle button to open at a specific heading. I am not sure if you can hyperlink this way. If not, I'm think I need to create a button control. I'm not sure if a button control can do this either.
任何人都可以建议
1)a超链接到标题的方法,如果不是,
1) a way to hyperlink to a heading, and if not,
2)也许有一个建议如何使用按钮控件来执行此操作。
2) maybe a suggestion on how to use a button control to do this.
谢谢,
Mike
Thanks, Mike
推荐答案
编辑:由VISQL打败) / strong>
Beaten by VISQL :)
是的,可以做你想要的。请执行以下步骤。
Yes, it is possible to do what you want. Follow these steps.
打开您的单词文档并在相关位置插入书签。说,我们在标题2中插入一个名为Mike的书签。
Open your word document and insert bookmarks at the relevant location. Say, we insert a bookmark called `Mike' at Heading 2.
将此代码粘贴到Excel中的一个模块中。
Paste this code in a module in Excel.
Sub Sample()
Dim oWordApp As Object, oWordDoc As Object, bMark As Object
Dim FlName As String
FlName = "C:\Sample.Docx"
'~~> Establish an Word application object
On Error Resume Next
Set oWordApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set oWordApp = CreateObject("Word.Application")
End If
Err.Clear
On Error GoTo 0
oWordApp.Visible = True
Set oWordDoc = oWordApp.Documents.Open(FlName)
Set bMark = oWordDoc.Bookmarks("Mike")
bMark.Select
End Sub
右键单击该按钮并将其分配给上述宏。
Right click the button and assign it to the above macro.
你完成了下次用户点击该按钮时,代码将打开word文档,并将转到相关的书签。对其他按钮重复相同的步骤。
And you are done. Next time the user click on that button, the code will open the word document and will go to the relevant bookmark. Repeat the same steps for other buttons.
HTH
这篇关于创建从Excel FlowChart到MS Word标题的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!