ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using a macro in excel to hyperlink files (https://www.excelbanter.com/excel-discussion-misc-queries/218185-using-macro-excel-hyperlink-files.html)

[email protected]

Using a macro in excel to hyperlink files
 
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

Jim Cone[_2_]

Using a macro in excel to hyperlink files
 

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




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

Chris Bode via OfficeKB.com

Using a macro in excel to hyperlink files
 
You can follow following steps:-
1.Enable macro in your excel sheet
2.Right click on toolbaradd 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.a...excel/200901/1



All times are GMT +1. The time now is 01:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com