Hello, could you somebody help me with really hard vba code for me? Im beginner and I need to do replace an email with date ...and copy multiple ranges from excel to the body of reply email. Why my macro doesnt work? do you know it? thank you very much.... i tried RangetoHTML for first time, but it doesnt work..my excel doesnt work with it..
could you help me please?
Sub ReplyMail()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim objMessage As Object
Dim i As Integer
Dim Rng As Range
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
i = 1
Set Rng = Range("A1:H3").value
On Error Resume Next
For Each olMail In Fldr.Items
If olMail.SenderEmailAddress = "xsedk1@gmail.com" Then
With olMail.Reply
.To = "test"
.CC = "test"
.Body = Hello. & Rng & Chr(10) & Chr (10) & "we agree with your portfolio here attached and according to it we see no move for today." & _
Chr (10) & " Best Regards." & _
Chr(10) & _
Chr(10) & Signature
.Display
End With
i = i + 1
End If
Next olMail
For Each objMessage In Fldr.Items
objMessage.UnRead = False
Next
End Sub
thak you very much for your help.
could you help me please?
Sub ReplyMail()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim objMessage As Object
Dim i As Integer
Dim Rng As Range
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
i = 1
Set Rng = Range("A1:H3").value
On Error Resume Next
For Each olMail In Fldr.Items
If olMail.SenderEmailAddress = "xsedk1@gmail.com" Then
With olMail.Reply
.To = "test"
.CC = "test"
.Body = Hello. & Rng & Chr(10) & Chr (10) & "we agree with your portfolio here attached and according to it we see no move for today." & _
Chr (10) & " Best Regards." & _
Chr(10) & _
Chr(10) & Signature
.Display
End With
i = i + 1
End If
Next olMail
For Each objMessage In Fldr.Items
objMessage.UnRead = False
Next
End Sub
thak you very much for your help.