Combine word documents in hyperlink list

%3CLINGO-SUB%20id%3D%22lingo-sub-1601413%22%20slang%3D%22en-US%22%3ECombine%20word%20documents%20in%20hyperlink%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1601413%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20new%20in%20VBA%20and%20would%20look%20for%20help%20for%20my%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20list%20of%20file%20in%20range%20B3%3A40.%20In%20each%20cells%2C%20hyperlink%20to%20specific%20word%20document%20(.docx)%20file%20in%20the%20communal%20server.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20I%20would%20like%20to%20combine%20all%20documents%20in%20the%20hyperlink%20list%20in%20that%20range%20to%20become%20one%20new%20word%20document%20that%20contain%20all%20documents%20in%20the%20list%20using%20VBA%20excel.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBelow%20is%20my%20code%3CSPAN%3E%2C%20it%20return%20for%20me%20%22run%20time%20error%2091%22%3C%2FSPAN%3E.%3C%2FP%3E%3CP%3E%3CSPAN%3EThank%20you%20in%20advance%20for%20any%20help%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EDim%20olink%20as%20hyperlink%0Adim%20olinkrange%20as%20range%0A%0Aset%20olinkrange%20%3D%20sheet1.range.(%22B3%3AB40%22)%0Aset%20oword%20%3D%20createobject(%22Word.Application%22)%0A%0Afor%20each%20olink%20in%20olinkrange.hyperlinks%0Aoword.selection.insertfile%20(olink.address)%0Anext%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1601413%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Visitor

I am new in VBA and would look for help for my problem.

 

I have list of file in range B3:40. In each cells, hyperlink to specific word document (.docx) file in the communal server.

 

Now, I would like to combine all documents in the hyperlink list in that range to become one new word document that contain all documents in the list using VBA excel.

 

Below is my code, it return for me "run time error 91".

Thank you in advance for any help

 

 

 

 

Dim olink as hyperlink
dim olinkrange as range

set olinkrange = sheet1.range.("B3:B40")
set oword = createobject("Word.Application")

for each olink in olinkrange.hyperlinks
oword.selection.insertfile (olink.address)
next

 

 

 

 

0 Replies