actuall no error but an idea -hyperlink

W

Wasif Khan

today i was trying to make word based database , in my
folder there are many word documents, so everytime it
takes minutes to browse through them , so i opened a word
file ( working in Word 2000 ) and started to copy file
names and then link them by Insert hyperlink , but it took
me quite a time . My question is can MS(Microsoft) add
a "short cut" through "Right Click window" when we are in
that "folder" going through "my computer window" which
directly adds the document link to the word file instead
of conventional method other wise it take ages to put copy
filename and then link it individually, instead all files
should be selected and then by command key all hyperlinks
be posted into the word or excel file . May be you have
incorportated this in later versions which i will check
today.
ok thanks again

Wasif M khan ( Course Facilitator)
Iqra University Islamabad
www.iqraisb.edu.pk
[email protected]
please tell me about it by email thanks again wasif
 
B

Beth Melton

Hi Wasif,

Here's a macro that should accomplish what you want:

Sub InsertFolderContentsHyperlinks()
'Macro created by Beth Melton, MS Office MVP
Dim docNew As Document
Dim DocList As String, DocDir As String
Dim Msg As String, Msg2 As String, Title As String
Msg = "Please change Document Path if necessary"
Msg2 = "No documents found in selected folder"
Title = "Folder Information"

Set docNew = Documents.Add

DocDir = InputBox(Msg, Title, CurDir)
If DocDir = "" Then
Exit Sub
End If

DocList = Dir(DocDir & "\*.*", vbNormal)
Do While DocList <> ""
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, _
Address:=DocDir & "\" & DocList
Selection.TypeParagraph
DocList = Dir
Loop
If docNew.Characters.Count = 1 Then
MsgBox Msg2, vbInformation, Title
Exit Sub
End If
End Sub


If you do not know how to use this macro then take a look at:
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacroContent.htm
--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
Top