Using a macro in excel to hyperlink files

D

davidolone

I would like a macro to do the following:

Refer to a list of files in a folder (all with the suffix .htm)
Create a list of the files in excel using their filename as the info
to enter into the cell
Finally hyperlink each filename in excel to its repective file

It would be better if the data in the cell did not have the file's
suffix at the end of the filename e.g. car.htm

Any help would be very much appreciated.

Regards,
David
 
J

Jim Cone

Glad to send along the trial version of my Excel add-in "List Files".
You can specify the file extension and folder or folder/sub-folders.
You get hyperlinked files with a grouping option.
Send an email to james.coneXXX at comcast.netXXX (remove the xxx).
Please include your real name and geographic location.
--
Jim Cone
Portland, Oregon USA



<[email protected]>
wrote in message
I would like a macro to do the following:
Refer to a list of files in a folder (all with the suffix .htm)
Create a list of the files in excel using their filename as the info
to enter into the cell
Finally hyperlink each filename in excel to its repective file

It would be better if the data in the cell did not have the file's
suffix at the end of the filename e.g. car.htm
Any help would be very much appreciated.
Regards,
David
 
C

Chris Bode via OfficeKB.com

You can follow following steps:-
1.Enable macro in your excel sheet
2.Right click on toolbar>add Control Toolbox
3.Add a command button from control toolbox on the sheet
4.Give the caption, the file name you want to browse
5.Right click on command button> view code
6.In CommandButton1_Click() add following code:-


Private Sub CommandButton1_Click()
Const url As String = "d:/forum.txt" ' this depicts the file path

Dim ie As Object

Set ie = CreateObject("internetexplorer.application") ' this opens the
file in IE

With ie

.Visible = True

.navigate url

End With

Set ie = Nothing

End Sub


Enjoy.......



Chris
------
Convert your Excel spreadsheet into online calculator.
http://www.spreadsheetconverter.com

--
Chris
------
Convert your Excel spreadsheet into online calculator.
http://www.spreadsheetconverter.com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/ms-excel/200901/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top