Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert to Hyperlink


Basically I Push a Macro Button on Sheet 1 which creates a copy of
Sheet1 in a specified folder. It then adds a record to my Record
listing (at the bottom of the list) on Sheet2. What I’m trying to do is
when I update the record on Sheet2 I want the macro to include a link
(hyperlink would work) to the newly created file (the file path is
being specified as “FileName” for the macro). This will allow me to
link to the file from my records list which is great for archiving.
Since the cell is not static I don’t know how to work it into the
formula.

..Offset(0, 4) = FileName '**** I want it to turn this data into a
hyperlink ****

Here is most of the code

s_Database = "Sheet2"


' This defines and pulls my data from Sheet1
Dim indexnr As Integer
Dim name As String
Dim mtype As String
Dim totalvalue As Double

indexnr = ActiveSheet.Range("A3")
name = ActiveSheet.Range("B2")
mtype = ActiveSheet.Range("C3")
totalvalue = ActiveSheet.Range("D4")

With Sheets(s_Database).Range("A" & indexnr + 1)
If Val(.Value) 0 Then
MsgBox "A record with number " & indexnr & " already exists!"
Else

'This creates the file name = "FileName"
Dim FileName As String
FileName = "c:\test\" & Range("A3") & Range("B2")

..Value = indexnr
..Offset(0, 1) = name
..Offset(0, 2) = mtype
..Offset(0, 3) = totalvalue
..Offset(0, 4) = FileName '**** I want it to turn this into a hyperlink
****


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=528621

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert to Hyperlink


This should work for you; replace your code:

Code:
--------------------
.Offset(0, 4) = FileName '**** I want it to turn this into a hyperlink ****
--------------------


With this:

Code:
--------------------
.Offset(0, 4).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"file:" & FileName, SubAddress:="A1"
--------------------


Hope this helps,
theDude


--
theDude
------------------------------------------------------------------------
theDude's Profile: http://www.excelforum.com/member.php...o&userid=16550
View this thread: http://www.excelforum.com/showthread...hreadid=528621

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert text to hyperlink Ryer Excel Discussion (Misc queries) 3 September 9th 09 04:59 PM
Convert to hyperlink EllenM Excel Worksheet Functions 0 February 4th 09 01:00 AM
convert text to hyperlink se7098 Excel Worksheet Functions 2 February 2nd 09 10:54 PM
Convert hyperlink function into hyperlink Pai Excel Worksheet Functions 4 November 10th 08 03:29 PM
Convert Hyperlink into URL HarryNYC Excel Discussion (Misc queries) 3 February 9th 06 08:01 PM


All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"