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

I want to take the value of a cell and use it as the address for a hyperlink.
I created Day1 as a variable and to pull the address from the excel document
using Set Day1 = ActiveSheet.Range("M184"). I run into problems once i try
to use Day1 in the href tag in Format(Range("E4") - 2, "mm/dd") & " ECCR (<A
HREF=Day1Daily<A, MTD)<br<br" & _. Any ideas how i can do this
correctly? I have included the entire code that i have. Thanks



Sub Mail_workbook_Outlook_1_Weekly()

Dim OutApp As Object
Dim OutMail As Object
Dim Attach1 As Range
Dim Attach2 As Range
Dim Attach3 As Range
Dim Day1 As Range
Dim Day2 As Range
Dim Day3 As Range

Set Attach1 = ActiveSheet.Range("I184")
Set Attach2 = ActiveSheet.Range("I185")
Set Attach3 = ActiveSheet.Range("I186")
Set Day1 = ActiveSheet.Range("M184")
Set Day2 = ActiveSheet.Range("M185")
Set Day3 = ActiveSheet.Range("M186")

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

strbody = "" & _
Format(Range("E4") - 2, "mm/dd") & " ECCR (<A
HREF=Day1Daily<A, MTD)<br<br" & _
Format(Range("E4") - 1, "mm/dd") & " ECCR (<A
HREF=Day2Daily<A, MTD)<br<br" & _
Format(Range("E4"), "mm/dd") & " ECCR (<A HREF=Day3Daily<A,
MTD)<br" & _
""

On Error Resume Next
With OutMail
.To = "Daily DP Report"
.CC = ""
.BCC = ""
.Subject = Format(Range("E4") - 2, "mm/dd") & " - " &
Format(Range("E4"), "mm/dd") & " ECCR (Daily, MTD) Prepay DP"
.htmlBody = strbody
.attachments.Add (Attach1)
.attachments.Add (Attach2)
.attachments.Add (Attach3)
.Display
.ReadReceiptRequested = False
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Hyperlink from cell value

It is hard to tell what you are doing. Not familar with the ECCR function

Day1 is a variable and if you want it to be replaced it has to be outside a
double quoted string. try the statement below.


strbody = Format(Range("E4") - 2, "mm/dd") & _
" ECCR (<A HREF=" & Day1 & "Daily<A, MTD)<br<br" & _
Format(Range("E4") - 1, "mm/dd") & _
" ECCR (<A HREF=" & Day2 & "Daily<A, MTD)<br<br" & _
Format(Range("E4"), "mm/dd") & _
" ECCR (<A HREF=" & Day3 & "Daily<A, MTD)<br"

"Greg H." wrote:

I want to take the value of a cell and use it as the address for a hyperlink.
I created Day1 as a variable and to pull the address from the excel document
using Set Day1 = ActiveSheet.Range("M184"). I run into problems once i try
to use Day1 in the href tag in Format(Range("E4") - 2, "mm/dd") & " ECCR (<A
HREF=Day1Daily<A, MTD)<br<br" & _. Any ideas how i can do this
correctly? I have included the entire code that i have. Thanks



Sub Mail_workbook_Outlook_1_Weekly()

Dim OutApp As Object
Dim OutMail As Object
Dim Attach1 As Range
Dim Attach2 As Range
Dim Attach3 As Range
Dim Day1 As Range
Dim Day2 As Range
Dim Day3 As Range

Set Attach1 = ActiveSheet.Range("I184")
Set Attach2 = ActiveSheet.Range("I185")
Set Attach3 = ActiveSheet.Range("I186")
Set Day1 = ActiveSheet.Range("M184")
Set Day2 = ActiveSheet.Range("M185")
Set Day3 = ActiveSheet.Range("M186")

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

strbody = "" & _
Format(Range("E4") - 2, "mm/dd") & " ECCR (<A
HREF=Day1Daily<A, MTD)<br<br" & _
Format(Range("E4") - 1, "mm/dd") & " ECCR (<A
HREF=Day2Daily<A, MTD)<br<br" & _
Format(Range("E4"), "mm/dd") & " ECCR (<A HREF=Day3Daily<A,
MTD)<br" & _
""

On Error Resume Next
With OutMail
.To = "Daily DP Report"
.CC = ""
.BCC = ""
.Subject = Format(Range("E4") - 2, "mm/dd") & " - " &
Format(Range("E4"), "mm/dd") & " ECCR (Daily, MTD) Prepay DP"
.htmlBody = strbody
.attachments.Add (Attach1)
.attachments.Add (Attach2)
.attachments.Add (Attach3)
.Display
.ReadReceiptRequested = False
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Hyperlink from cell value

That worked perfect. Thanks

As for ECCR, its not a function, its the name of an application I use. For
this email its just text describing what the link is for. Thanks again.

"Joel" wrote:

It is hard to tell what you are doing. Not familar with the ECCR function

Day1 is a variable and if you want it to be replaced it has to be outside a
double quoted string. try the statement below.


strbody = Format(Range("E4") - 2, "mm/dd") & _
" ECCR (<A HREF=" & Day1 & "Daily<A, MTD)<br<br" & _
Format(Range("E4") - 1, "mm/dd") & _
" ECCR (<A HREF=" & Day2 & "Daily<A, MTD)<br<br" & _
Format(Range("E4"), "mm/dd") & _
" ECCR (<A HREF=" & Day3 & "Daily<A, MTD)<br"

"Greg H." wrote:

I want to take the value of a cell and use it as the address for a hyperlink.
I created Day1 as a variable and to pull the address from the excel document
using Set Day1 = ActiveSheet.Range("M184"). I run into problems once i try
to use Day1 in the href tag in Format(Range("E4") - 2, "mm/dd") & " ECCR (<A
HREF=Day1Daily<A, MTD)<br<br" & _. Any ideas how i can do this
correctly? I have included the entire code that i have. Thanks



Sub Mail_workbook_Outlook_1_Weekly()

Dim OutApp As Object
Dim OutMail As Object
Dim Attach1 As Range
Dim Attach2 As Range
Dim Attach3 As Range
Dim Day1 As Range
Dim Day2 As Range
Dim Day3 As Range

Set Attach1 = ActiveSheet.Range("I184")
Set Attach2 = ActiveSheet.Range("I185")
Set Attach3 = ActiveSheet.Range("I186")
Set Day1 = ActiveSheet.Range("M184")
Set Day2 = ActiveSheet.Range("M185")
Set Day3 = ActiveSheet.Range("M186")

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

strbody = "" & _
Format(Range("E4") - 2, "mm/dd") & " ECCR (<A
HREF=Day1Daily<A, MTD)<br<br" & _
Format(Range("E4") - 1, "mm/dd") & " ECCR (<A
HREF=Day2Daily<A, MTD)<br<br" & _
Format(Range("E4"), "mm/dd") & " ECCR (<A HREF=Day3Daily<A,
MTD)<br" & _
""

On Error Resume Next
With OutMail
.To = "Daily DP Report"
.CC = ""
.BCC = ""
.Subject = Format(Range("E4") - 2, "mm/dd") & " - " &
Format(Range("E4"), "mm/dd") & " ECCR (Daily, MTD) Prepay DP"
.htmlBody = strbody
.attachments.Add (Attach1)
.attachments.Add (Attach2)
.attachments.Add (Attach3)
.Display
.ReadReceiptRequested = False
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

End Sub

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
Hyperlink from one.xlsx cell to another two.xlxs cell & click back Bobbi-Joe Excel Worksheet Functions 1 August 7th 09 07:18 PM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
script to hyperlink and reference a cell value in the hyperlink Natasha D. Excel Programming 5 May 17th 06 07:43 PM
How make hyperlink refer to cell content rather than cell address. Omunene Excel Discussion (Misc queries) 3 March 2nd 06 01:07 AM
Copy hyperlink from one cell to/as hyperlink in another cell YogS Excel Worksheet Functions 6 January 12th 06 11:57 PM


All times are GMT +1. The time now is 05:19 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"