(Msg. 1) Posted: Thu Apr 05, 2007 2:16 am
Post subject: include document from hyperlink Archived from groups: microsoft>public>word>docmanagement (more info?)
I have many docs, created from Robohelp output, which contains links to other
docs. Is there a solution to find each hyperlink, and include the doc in the
document. On a tight deadline, and am doing each in turn Insert\Hyperlink etc.
(Msg. 2) Posted: Thu Apr 05, 2007 7:01 am
Post subject: Re: include document from hyperlink [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
If your document hyperlinks when toggled (Alt+F9) look like
the following macro will change all the Hyperlink fields to IncludeText
fields and display the content. If you want them hard coded Select the
document and Press CTRL+Shift+F9 to fix the texts (or remove the apostrophe
from the start of the line
..Unlink
Sub ChangeHyperlinkField()
Dim iFld As Integer
Dim strCodes As String
Selection.HomeKey
strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
.Code.Text = replace(.Code.Text, "HYPERLINK", "INCLUDETEXT")
.Update
'.Unlink
End With
Next iFld
ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
End Sub
If you have a lot of documents then the following version will perform the
same task on all the Word document files in a folder. Test it with
*COPIES!!!*
Sub BatchChangeField()
Dim iFld As Integer
Dim strCodes As String
Dim FirstLoop As Boolean
Dim strFileName As String
Dim strPath As String
Dim oDoc As Document
Dim i As Long
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
strPath = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
FirstLoop = True
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFileName = Dir$(strPath & "*.doc")
While Len(strFileName) <> 0
Set oDoc = Documents.Open(strPath & strFileName)
Selection.HomeKey
strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
.Code.Text = replace(.Code.Text, "HYPERLINK", "INCLUDETEXT")
.Update
.Unlink
End With
Next iFld
ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
oDoc.Close SaveChanges:=wdSaveChanges
Set oDoc = Nothing
GetNextDoc:
strFileName = Dir$()
Wend
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Brian wrote:
> I have many docs, created from Robohelp output, which contains links
> to other docs. Is there a solution to find each hyperlink, and
> include the doc in the document. On a tight deadline, and am doing
> each in turn Insert\Hyperlink etc.
>
> Thanks
(Msg. 3) Posted: Thu Apr 05, 2007 7:01 am
Post subject: Re: include document from hyperlink [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Magic, Works a treat.
Thanks for your help.
--
Brian McCaffery
"Graham Mayor" wrote:
> If your document hyperlinks when toggled (Alt+F9) look like
>
> { HYPERLINK "D:\\My Documents\\Test\\And data.doc" }
>
> the following macro will change all the Hyperlink fields to IncludeText
> fields and display the content. If you want them hard coded Select the
> document and Press CTRL+Shift+F9 to fix the texts (or remove the apostrophe
> from the start of the line
>
> ..Unlink
>
> Sub ChangeHyperlinkField()
> Dim iFld As Integer
> Dim strCodes As String
> Selection.HomeKey
> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
> For iFld = ActiveDocument.Fields.Count To 1 Step -1
> With ActiveDocument.Fields(iFld)
> .Code.Text = replace(.Code.Text, "HYPERLINK", "INCLUDETEXT")
> .Update
> '.Unlink
> End With
> Next iFld
> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
> End Sub
>
> If you have a lot of documents then the following version will perform the
> same task on all the Word document files in a folder. Test it with
> *COPIES!!!*
>
> Sub BatchChangeField()
> Dim iFld As Integer
> Dim strCodes As String
> Dim FirstLoop As Boolean
> Dim strFileName As String
> Dim strPath As String
> Dim oDoc As Document
> Dim i As Long
>
> With Dialogs(wdDialogCopyFile)
> If .Display <> 0 Then
> strPath = .Directory
> Else
> MsgBox "Cancelled by User"
> Exit Sub
> End If
> End With
>
> If Documents.Count > 0 Then
> Documents.Close SaveChanges:=wdPromptToSaveChanges
> End If
> FirstLoop = True
> If Left(strPath, 1) = Chr(34) Then
> strPath = Mid(strPath, 2, Len(strPath) - 2)
> End If
> strFileName = Dir$(strPath & "*.doc")
> While Len(strFileName) <> 0
> Set oDoc = Documents.Open(strPath & strFileName)
>
> Selection.HomeKey
> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
> For iFld = ActiveDocument.Fields.Count To 1 Step -1
> With ActiveDocument.Fields(iFld)
> .Code.Text = replace(.Code.Text, "HYPERLINK", "INCLUDETEXT")
> .Update
> .Unlink
> End With
> Next iFld
> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
> oDoc.Close SaveChanges:=wdSaveChanges
> Set oDoc = Nothing
> GetNextDoc:
> strFileName = Dir$()
> Wend
> End Sub
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> Brian wrote:
> > I have many docs, created from Robohelp output, which contains links
> > to other docs. Is there a solution to find each hyperlink, and
> > include the doc in the document. On a tight deadline, and am doing
> > each in turn Insert\Hyperlink etc.
> >
> > Thanks
>
>
>
(Msg. 4) Posted: Thu Apr 05, 2007 7:01 am
Post subject: Re: include document from hyperlink [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
You are welcome
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Brian wrote:
> Magic, Works a treat.
>
> Thanks for your help.
>
>> If your document hyperlinks when toggled (Alt+F9) look like
>>
>> { HYPERLINK "D:\\My Documents\\Test\\And data.doc" }
>>
>> the following macro will change all the Hyperlink fields to
>> IncludeText fields and display the content. If you want them hard
>> coded Select the document and Press CTRL+Shift+F9 to fix the texts
>> (or remove the apostrophe from the start of the line
>>
>> ..Unlink
>>
>> Sub ChangeHyperlinkField()
>> Dim iFld As Integer
>> Dim strCodes As String
>> Selection.HomeKey
>> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
>> For iFld = ActiveDocument.Fields.Count To 1 Step -1
>> With ActiveDocument.Fields(iFld)
>> .Code.Text = replace(.Code.Text, "HYPERLINK", "INCLUDETEXT")
>> .Update
>> '.Unlink
>> End With
>> Next iFld
>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
>> End Sub
>>
>> If you have a lot of documents then the following version will
>> perform the same task on all the Word document files in a folder.
>> Test it with *COPIES!!!*
>>
>> Sub BatchChangeField()
>> Dim iFld As Integer
>> Dim strCodes As String
>> Dim FirstLoop As Boolean
>> Dim strFileName As String
>> Dim strPath As String
>> Dim oDoc As Document
>> Dim i As Long
>>
>> With Dialogs(wdDialogCopyFile)
>> If .Display <> 0 Then
>> strPath = .Directory
>> Else
>> MsgBox "Cancelled by User"
>> Exit Sub
>> End If
>> End With
>>
>> If Documents.Count > 0 Then
>> Documents.Close SaveChanges:=wdPromptToSaveChanges
>> End If
>> FirstLoop = True
>> If Left(strPath, 1) = Chr(34) Then
>> strPath = Mid(strPath, 2, Len(strPath) - 2)
>> End If
>> strFileName = Dir$(strPath & "*.doc")
>> While Len(strFileName) <> 0
>> Set oDoc = Documents.Open(strPath & strFileName)
>>
>> Selection.HomeKey
>> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
>> For iFld = ActiveDocument.Fields.Count To 1 Step -1
>> With ActiveDocument.Fields(iFld)
>> .Code.Text = replace(.Code.Text, "HYPERLINK",
>> "INCLUDETEXT") .Update
>> .Unlink
>> End With
>> Next iFld
>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
>> oDoc.Close SaveChanges:=wdSaveChanges
>> Set oDoc = Nothing
>> GetNextDoc:
>> strFileName = Dir$()
>> Wend
>> End Sub
>>
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> Brian wrote:
>>> I have many docs, created from Robohelp output, which contains links
>>> to other docs. Is there a solution to find each hyperlink, and
>>> include the doc in the document. On a tight deadline, and am doing
>>> each in turn Insert\Hyperlink etc.
>>>
>>> Thanks
(Msg. 5) Posted: Thu Nov 20, 2008 7:45 am
Post subject: Re: include document from hyperlink [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
If I had an index listing documents and with hyperlinks to their file
locations. How would I do a similar macro which would allow me to pick and
choose individual hyperlinked document I wanted to insert into a Word
document?
"Graham Mayor" wrote:
> You are welcome
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> Brian wrote:
> > Magic, Works a treat.
> >
> > Thanks for your help.
> >
> >> If your document hyperlinks when toggled (Alt+F9) look like
> >>
> >> { HYPERLINK "D:\\My Documents\\Test\\And data.doc" }
> >>
> >> the following macro will change all the Hyperlink fields to
> >> IncludeText fields and display the content. If you want them hard
> >> coded Select the document and Press CTRL+Shift+F9 to fix the texts
> >> (or remove the apostrophe from the start of the line
> >>
> >> ..Unlink
> >>
> >> Sub ChangeHyperlinkField()
> >> Dim iFld As Integer
> >> Dim strCodes As String
> >> Selection.HomeKey
> >> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
> >> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
> >> For iFld = ActiveDocument.Fields.Count To 1 Step -1
> >> With ActiveDocument.Fields(iFld)
> >> .Code.Text = replace(.Code.Text, "HYPERLINK", "INCLUDETEXT")
> >> .Update
> >> '.Unlink
> >> End With
> >> Next iFld
> >> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
> >> End Sub
> >>
> >> If you have a lot of documents then the following version will
> >> perform the same task on all the Word document files in a folder.
> >> Test it with *COPIES!!!*
> >>
> >> Sub BatchChangeField()
> >> Dim iFld As Integer
> >> Dim strCodes As String
> >> Dim FirstLoop As Boolean
> >> Dim strFileName As String
> >> Dim strPath As String
> >> Dim oDoc As Document
> >> Dim i As Long
> >>
> >> With Dialogs(wdDialogCopyFile)
> >> If .Display <> 0 Then
> >> strPath = .Directory
> >> Else
> >> MsgBox "Cancelled by User"
> >> Exit Sub
> >> End If
> >> End With
> >>
> >> If Documents.Count > 0 Then
> >> Documents.Close SaveChanges:=wdPromptToSaveChanges
> >> End If
> >> FirstLoop = True
> >> If Left(strPath, 1) = Chr(34) Then
> >> strPath = Mid(strPath, 2, Len(strPath) - 2)
> >> End If
> >> strFileName = Dir$(strPath & "*.doc")
> >> While Len(strFileName) <> 0
> >> Set oDoc = Documents.Open(strPath & strFileName)
> >>
> >> Selection.HomeKey
> >> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
> >> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
> >> For iFld = ActiveDocument.Fields.Count To 1 Step -1
> >> With ActiveDocument.Fields(iFld)
> >> .Code.Text = replace(.Code.Text, "HYPERLINK",
> >> "INCLUDETEXT") .Update
> >> .Unlink
> >> End With
> >> Next iFld
> >> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
> >> oDoc.Close SaveChanges:=wdSaveChanges
> >> Set oDoc = Nothing
> >> GetNextDoc:
> >> strFileName = Dir$()
> >> Wend
> >> End Sub
> >>
> >>
> >> --
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >> Graham Mayor - Word MVP
> >>
> >> My web site www.gmayor.com > >> Word MVP web site http://word.mvps.org > >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>
> >>
> >> Brian wrote:
> >>> I have many docs, created from Robohelp output, which contains links
> >>> to other docs. Is there a solution to find each hyperlink, and
> >>> include the doc in the document. On a tight deadline, and am doing
> >>> each in turn Insert\Hyperlink etc.
> >>>
> >>> Thanks
>
>
>
(Msg. 6) Posted: Fri Nov 21, 2008 3:02 am
Post subject: Re: include document from hyperlink [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I am not sure what you are asking for here. If you click a hyperlink to a
Word document that document opens?
The macro in the thread you posted into batch converts Hyperlink fields to
include text fields and thus inserts the documents at the hyperlink
positions.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Dixie Folzenlogen wrote:
> If I had an index listing documents and with hyperlinks to their file
> locations. How would I do a similar macro which would allow me to
> pick and choose individual hyperlinked document I wanted to insert
> into a Word document?
>
> "Graham Mayor" wrote:
>
>> You are welcome
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>> Brian wrote:
>>> Magic, Works a treat.
>>>
>>> Thanks for your help.
>>>
>>>> If your document hyperlinks when toggled (Alt+F9) look like
>>>>
>>>> { HYPERLINK "D:\\My Documents\\Test\\And data.doc" }
>>>>
>>>> the following macro will change all the Hyperlink fields to
>>>> IncludeText fields and display the content. If you want them hard
>>>> coded Select the document and Press CTRL+Shift+F9 to fix the texts
>>>> (or remove the apostrophe from the start of the line
>>>>
>>>> ..Unlink
>>>>
>>>> Sub ChangeHyperlinkField()
>>>> Dim iFld As Integer
>>>> Dim strCodes As String
>>>> Selection.HomeKey
>>>> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
>>>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
>>>> For iFld = ActiveDocument.Fields.Count To 1 Step -1
>>>> With ActiveDocument.Fields(iFld)
>>>> .Code.Text = replace(.Code.Text, "HYPERLINK",
>>>> "INCLUDETEXT") .Update
>>>> '.Unlink
>>>> End With
>>>> Next iFld
>>>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
>>>> End Sub
>>>>
>>>> If you have a lot of documents then the following version will
>>>> perform the same task on all the Word document files in a folder.
>>>> Test it with *COPIES!!!*
>>>>
>>>> Sub BatchChangeField()
>>>> Dim iFld As Integer
>>>> Dim strCodes As String
>>>> Dim FirstLoop As Boolean
>>>> Dim strFileName As String
>>>> Dim strPath As String
>>>> Dim oDoc As Document
>>>> Dim i As Long
>>>>
>>>> With Dialogs(wdDialogCopyFile)
>>>> If .Display <> 0 Then
>>>> strPath = .Directory
>>>> Else
>>>> MsgBox "Cancelled by User"
>>>> Exit Sub
>>>> End If
>>>> End With
>>>>
>>>> If Documents.Count > 0 Then
>>>> Documents.Close SaveChanges:=wdPromptToSaveChanges
>>>> End If
>>>> FirstLoop = True
>>>> If Left(strPath, 1) = Chr(34) Then
>>>> strPath = Mid(strPath, 2, Len(strPath) - 2)
>>>> End If
>>>> strFileName = Dir$(strPath & "*.doc")
>>>> While Len(strFileName) <> 0
>>>> Set oDoc = Documents.Open(strPath & strFileName)
>>>>
>>>> Selection.HomeKey
>>>> strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
>>>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
>>>> For iFld = ActiveDocument.Fields.Count To 1 Step -1
>>>> With ActiveDocument.Fields(iFld)
>>>> .Code.Text = replace(.Code.Text, "HYPERLINK",
>>>> "INCLUDETEXT") .Update
>>>> .Unlink
>>>> End With
>>>> Next iFld
>>>> ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
>>>> oDoc.Close SaveChanges:=wdSaveChanges
>>>> Set oDoc = Nothing
>>>> GetNextDoc:
>>>> strFileName = Dir$()
>>>> Wend
>>>> End Sub
>>>>
>>>>
>>>> --
>>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>> Graham Mayor - Word MVP
>>>>
>>>> My web site www.gmayor.com >>>> Word MVP web site http://word.mvps.org >>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>>>
>>>>
>>>> Brian wrote:
>>>>> I have many docs, created from Robohelp output, which contains
>>>>> links to other docs. Is there a solution to find each hyperlink,
>>>>> and include the doc in the document. On a tight deadline, and am
>>>>> doing each in turn Insert\Hyperlink etc.
>>>>>
>>>>> Thanks
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum