WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

include document from hyperlink

 
   Home -> Office -> Document Management RSS
Next:  Main program overides slide show  
Author Message
Brian

External


Since: Mar 31, 2006
Posts: 477



(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.

Thanks
--
Brian McCaffery
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 8122



(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

{ 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
Back to top
Login to vote
Brian

External


Since: Mar 31, 2006
Posts: 477



(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
>
>
>
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 8122



(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

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
Back to top
Login to vote
Dixie Folzenlogen

External


Since: Dec 14, 2006
Posts: 1



(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
>
>
>
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 8122



(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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
..

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
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Document Management 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
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET