Excel VBA Macro: Send Email with Hyperlink (that has Spaces in the File Name)
Excel VBA Macro: Send Email with Hyperlink (that has Spaces in the File Name). In this video, we go over how to ensure that a hyperlink with spaces in the filename does not get cut off after the first space.
Code (YouTube doesn't allow brackets; so LT and GT are used for less than and greater than, respectively):
Sub send_hyperlink_with_spaces()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim link As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
link = Replace(ThisWorkbook.Sheets("Sheet1").Cells(1, 1).Text, " ", "%20")
MsgBox link
strbody = "LT BODY style = font-size:14pt; font-family:Arial GT" & _
"Hello Team, LT p GT Please see the link for today: " & _
"LT a href= " & link & "GT here LT / GT LTp GT" & _
"Best regards, LT br GT Greg"
On Error Resume Next
With OutMail
.to = "abc@123.com"
.CC = "me@me.com"
.BBC = ""
.Subject = "Morning Link " & Format(Date, "mm-dd-yyyy")
.display
.HTMLBody = strbody & .HTMLBody
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
#ExcelVBA #ExcelMacro
Видео Excel VBA Macro: Send Email with Hyperlink (that has Spaces in the File Name) канала greggowaffles
Code (YouTube doesn't allow brackets; so LT and GT are used for less than and greater than, respectively):
Sub send_hyperlink_with_spaces()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim link As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
link = Replace(ThisWorkbook.Sheets("Sheet1").Cells(1, 1).Text, " ", "%20")
MsgBox link
strbody = "LT BODY style = font-size:14pt; font-family:Arial GT" & _
"Hello Team, LT p GT Please see the link for today: " & _
"LT a href= " & link & "GT here LT / GT LTp GT" & _
"Best regards, LT br GT Greg"
On Error Resume Next
With OutMail
.to = "abc@123.com"
.CC = "me@me.com"
.BBC = ""
.Subject = "Morning Link " & Format(Date, "mm-dd-yyyy")
.display
.HTMLBody = strbody & .HTMLBody
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
#ExcelVBA #ExcelMacro
Видео Excel VBA Macro: Send Email with Hyperlink (that has Spaces in the File Name) канала greggowaffles
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![Excel VBA Macro: Open Newest Files (from Multiple Folders) and Save Them in Another Folder](https://i.ytimg.com/vi/a9CZy2xu79M/default.jpg)
![Comment Out Blocks of Code 🤓 #excelmacro #excelvba #msexcel](https://i.ytimg.com/vi/INk8RoBiA28/default.jpg)
![Excel VBA Macro: Delete All Sheets that Contain a Certain Text (String) Value](https://i.ytimg.com/vi/XbgpRws7VBQ/default.jpg)
![Excel VBA Macro: Resize Range (Table) Pasted As Image In Email Body](https://i.ytimg.com/vi/MEi1m9h9L58/default.jpg)
![Excel VBA Macro: Count and List the Number of (Conditonally Formatted) Cells at the End of Each Row](https://i.ytimg.com/vi/PmdyyEFCJFU/default.jpg)
![Excel VBA Macro: Save File As Previous Work/Business Day (Excluding Holidays)](https://i.ytimg.com/vi/WYSahXeCkFU/default.jpg)
![Excel VBA Macro: Right Align Image in Email Body (and Resize)](https://i.ytimg.com/vi/rSSaSCMTOxo/default.jpg)
![Excel VBA Macro: List Time Last Saved (For All Files In Folder)](https://i.ytimg.com/vi/7qnO37TsojE/default.jpg)
![Excel VBA Macro: Delete Rows If Any Cell in Those Rows (Across All Columns) Contains a Certain Value](https://i.ytimg.com/vi/H2jM1m0zNkk/default.jpg)
![Excel VBA Macro: Autofilter And Copy/Paste To Multiple Sheets (Dynamic Range)](https://i.ytimg.com/vi/unUgUlEBvu4/default.jpg)
![Excel VBA Macro: Resize Large Table Ranges After Pasting (As Image) In Email Body](https://i.ytimg.com/vi/rQPfwhurY1s/default.jpg)
![Excel VBA Macro: Export Selected Range as Image (Save Range as Picture)](https://i.ytimg.com/vi/vRNctWgrtxc/default.jpg)
![Excel VBA Macro: Send Email with Attachments from a List (Dynamic Range)](https://i.ytimg.com/vi/7imUc0YhfV0/default.jpg)
![Excel VBA Macro: Remove Special Characters (in List of Strings) & Post New Strings Next to Old Ones](https://i.ytimg.com/vi/po_1Cl3suAw/default.jpg)
![Excel VBA Macro: Capitalize First Letter of Every Word in a (Static/Dynamic) Range of Strings](https://i.ytimg.com/vi/I6IquFv6pN8/default.jpg)
![Excel VBA Macro: Find Sheet in Another (User Selected) Workbook and Copy Data Over](https://i.ytimg.com/vi/TBPPa_RPCHk/default.jpg)
![Excel VBA Macro: Create Word Document & Add Table (Static Range)](https://i.ytimg.com/vi/z9l5OySTpCQ/default.jpg)
![Excel VBA Macro: List All Sheet/Tab Names (From Another User Selected Workbook)](https://i.ytimg.com/vi/g1ylVtdUxOc/default.jpg)
![Excel VBA Macro: Add New Sheets To Beginning Or End of Workbook (With Names)](https://i.ytimg.com/vi/ejWJaiwZOAs/default.jpg)
![Excel VBA Macro: Save Selected Range as PDF (and Center on Page)](https://i.ytimg.com/vi/d-st754vi44/default.jpg)