Dear all
My excel sheet has list of invoices in Word format with their server addresses on Column D which is coming from SQL server. This is the location of the one invoice
"\\svr-storage3\Accounts_Data\Docs\H\H\A\HHA6\62\Bill ref 223615_458254_1.doc"
I have a macro that sends automatic email to my clients if their invoices unpaid over 35 days.
Is there a way that I can pull the invoice from the server with the above location address and converi it to PDF then attache to the email?
Here is my auto email code
Sub datesexcelvba()
Dim myApp As Outlook.Application, mymail As Outlook.MailItem
Dim mydate1 As Date
Dim mydate2 As Long
Dim datetoday1 As Date
Dim datetoday2 As Long
Dim Ref1 As Integer
'Dim Ref2 As Long
Dim x As Long
lastrow = Sheets("Rapor").Cells(Rows.Count, 1).End(xlUp).Row
For x = 2 To lastrow
Ref1 = Cells(x, 5).Value
'Ref2 = Ref1
mydate1 = Cells(x, 4).Value
mydate2 = mydate1
Cells(x, 19).Value = mydate2
datetoday1 = Date
datetoday2 = datetoday1
Cells(x, 20).Value = datetoday2
If mydate2 - datetoday2 > 35 Then
Set myApp = New Outlook.Application
Set mymail = myApp.CreateItem(olMailItem)
mymail.To = Cells(x, 21).Value
With mymail
.Subject = "Payment Reminder" _
.Body = "Dear Sir" _
& vbCrLf & "" _
& vbCrLf & "Our records is showing that we havent recived payment for our Invoice No: " & Ref1 _
& vbCrLf & "" _
& vbCrLf & "I will be greatful if you arrange payment aginst this invoice" _
& vbCrLf & "" _
& vbCrLf & "Kind Regards" _
& vbCrLf & "John Smith"
.Display
'.Send
End With
Cells(x, 23) = "Yes"
Cells(x, 23).Interior.ColorIndex = 3
Cells(x, 23).Font.ColorIndex = 2
Cells(x, 23).Font.Bold = True
Cells(x, 24).Value = mydate2 - datetoday2
End If
Next
Set myApp = Nothing
Set mymail = Nothing
End Sub
Bookmarks