PDA

View Full Version : create hyperlink using macro



reza_doang
05-05-2011, 03:02 AM
hi all,

just wondering, but hope someone can help me.

i want to have hyperlink for all files in one folder.
i have many files in one folder, using excel macro, can be do automatically.
i.e
in folder ABC i have 10 files from A - J
so in excel it will create
File Link
A.xlsx D:\ABC\A.xlsx
B.xlsx D:\ABC\A.xlsx
C.docx D:\ABC\C.docx
D.pdf D:\ABC\D.pdf
etc

many thanks for your help

reza

reza_doang
05-05-2011, 03:49 AM
hi all,

i think i already get the macro from this forum. but i got some error, can someone fix it.
link:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=232

error:
Unable to get Match property of the WorksheetFunction class

when i press bug, error go to:
NumPos = Application.WorksheetFunction.Match(Ext, X, 0)

thanks

Kenneth Hobs
05-05-2011, 05:43 PM
I can not duplicate your problem. What Excel version are you using?

Are you sure that there are files in the selected folder?

reza_doang
05-06-2011, 12:40 AM
sorry not mentioned early
i'm using Office Excel 2010 and yes, i already select the correct folder.

the macro work/run but i should delete
On Error Resume Next
NumPos = Application.WorksheetFunction.Match(Ext, X, 0)
If NumPos > 0 Then Excludes = True
On Error Goto 0

Another request, hope someone can modify this vba.
in that vba, it can only read only Master Folder, for sub folder this macro can't read it.
sample
i have Folder ABC, in ABC folder i have 5 files and 2 sub Folder (which contain some files) and so on.
when i run that macro, it only read 5 files and 2 sub folder can't be read.

many thanks
reza