Outlook & Excel

0 Agios

Well-known Member
Joined
Feb 22, 2004
Messages
570
Office Version
  1. 365
I have this script
and it automatically opens new emails
is there a way to link to the email mesage boddy with the contents of an excel page ? also can the RE: mesage link to a label ?
Private Sub Label630_Click()
Dim link As String

link = TextBox8
On Error GoTo NoCanDo1
ActiveWorkbook.FollowHyperlink Address:="mailto:chuck@advfireonline.com; & ', NewWindow:=True"
ActiveWorkbook.FollowHyperlink Address:="mailto:cahernandez@simplexgrinnell.com; & ', NewWindow:=True"
ActiveWorkbook.FollowHyperlink Address:="mailto:lambert@ddcfire.com; & ', NewWindow:=True"
ActiveWorkbook.FollowHyperlink Address:="mailto:mike@alarmandelectronics.com; & ', NewWindow:=True"
ActiveWorkbook.FollowHyperlink Address:="mailto:mikeh@alarmandelectronics.com; & ', NewWindow:=True"




Exit Sub
NoCanDo1:
MsgBox "Cannot open " & link



End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I found this code but it gives me an error pointing out in this section
.HTMLBody = RangetoHTML(rng)
how can I fix this ?




Sub Mail_Selection_Range_Outlook_Body()
' You need to use this module with the RangetoHTML subroutine.
' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, and Outlook 2010.
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object

Set rng = Nothing
On Error Resume Next
' Only send the visible cells in the selection.
Set rng = Selection.SpecialCells(xlCellTypeVisible)
' You can also use a range with the following statement.
' Set rng = Sheets("YourSheet").Range("D4:D12").SpecialCells(xlCellTypeVisible)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected. " & _
vbNewLine & "Please correct and try again.", vbOKOnly
Exit Sub
End If

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

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

On Error Resume Next
With OutMail
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng)
' In place of the following statement, you can use ".Display" to
' display the e-mail message.
.Send
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 
Upvote 0
How about

Code:
ActiveWorkbook.FollowHyperlink Address:="mailto:chuck@advfireonline.com&body="&Range("A1").Value, NewWindow:=True
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top