Marți, 20 iunie 2023
  0 Răspunsuri
  1.8K vizite
0
Voturi
Anula
I found a code that lets me send due dates in an email. I am trying alter it, so that I link the excel file along with this. It turns blue; however, I cannot click on it to open. Does anyone know how i can fix it. Please help. Thank you so much! I have marked the part that I added myself in bold.

Iată codul:

Public Sub CheckAndSendMail()
„Actualizat de Extendoffice 2018/11/22
Dim xRgDate As Range
Dim xRgSend As Range
Dim xRgText As Range
Dim xRgDone As Range
Dim xOutApp ca obiect
Dim xMailItem As Object
Dim xLastRow As Long
Dim vbCrLf As String
Dim xMailBody ca șir
Dim xRgDateVal As String
Dim xRgSendVal As String
Dim xMailSubject As String
Dim i As Long
La data de eroare CV următoare
Set xRgDate = Application.InputBox("Please select the due date column:", "KuTools For Excel", , , , , , 8)
If xRgDate Is Nothing Then Exit Sub
Set xRgSend = Application.InputBox("Please select the recipients?email column:", "KuTools For Excel", , , , , , 8)
If xRgSend Is Nothing Then Exit Sub
Set xRgText = Application.InputBox("Select the column with reminded content in your email:", "KuTools For Excel", , , , , , 8)
If xRgText Is Nothing Then Exit Sub
xLastRow = xRgDate.Rows.Count
Set xRgDate = xRgDate(1)
Set xRgSend = xRgSend(1)
Set xRgText = xRgText(1)
Setați xOutApp = CreateObject("Outlook.Application")
For i = 1 To xLastRow
xRgDateVal = ""
xRgDateVal = xRgDate.Offset(i - 1).Value
If xRgDateVal <> "" Then
Dacă CDate(xRgDateVal) - Data <= 7 și CDate(xRgDateVal) - Data > 0, atunci
xRgSendVal = xRgSend.Offset(i - 1).Value
xMailSubject = xRgText.Offset(i - 1).Value & " on " & xRgDateVal
vbCrLf = "<br><br>"
xMailBody = "<HTML><BODY>"
xMailBody = xMailBody & " Hello, You have new items added" & vbCrLf
xMailBody = xMailBody & "Text : " & xRgText.Offset(i - 1).Value & vbCrLf
xMailBody = xMailBody & "<A href=" & fpath & ">L:\Public\23-Plant PDCA\2023\KACI Master 5S PDCA trail2.xlsm" & fpath & "</A>"
xMailBody = xMailBody & "</BODY></HTML>"
Set xMailItem = xOutApp.CreateItem(0)
With xMailItem
.Subject = xMailSubject
.To = xRgSendVal
.HTMLBody = xMailBody
.Afişa
'.Send
Se termina cu
Set xMailItem = Nothing
Final, dacă
Final, dacă
Pagina Următoare →
Setați xOutApp = Nimic
End Sub
Nu există răspunsuri făcute pentru acest post.