Arkadaslar merhaba
Excel dosyamda invoce sayfasinda kolon E'de faturalarin SQL serverden gelen hyperlink adresleri var. Bu adrese tilakladigimda sistemde olan faturayi WORD formatinda aciyor.
Yapmak istedigim bir textbox'a fatura numarsi girdigimde, fatura numarasina ait hyperlink adresini calistirmak ve faturayi WORD formatindan PDF formatina cevirerek bir emaile eklemek.
Asagidaki kod sayfada listelenen butun Hyperlinkleri emaile WORD formatinda ekliyor ve textbox opsiyonu yok.
Bu koda textbok opsuyonunu eleyip , faturayida nasil WORD den PDF e cevirip emaile ekleyebiliriz?
Sub WordtoPDF()
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 Long
Dim example As Range
Set example = Range("T:T,U:U,W:W,X:X")
Dim fnd As Range
Dim attachment As String
Dim x As Long
example.ClearContents
LastRow = Sheets("Rapor").Cells(Rows.Count, 1).End(xlUp).Row
For x = 2 To LastRow
attachement = Sheets("invoice").Cells(x, 5).Value
Ref1 = Cells(x, 5).Value
mydate1 = Cells(x, 4).Value
mydate2 = mydate1
Cells(x, 20).Value = mydate2
datetoday1 = Date
datetoday2 = datetoday1
Cells(x, 21).Value = datetoday2
If mydate2 - datetoday2 < 3 Then
Set myApp = New Outlook.Application
Set mymail = myApp.CreateItem(olMailItem)
mymail.To = Cells(x, 22).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" _
& vbCrLf & "" _
& vbCrLf & ""
.Attachments.Add attachement
.Display
'.Send
Set mymail = Nothing
End If
End If
Next
Set myApp = Nothing
Set mymail = Nothing
End Sub
Excel dosyamda invoce sayfasinda kolon E'de faturalarin SQL serverden gelen hyperlink adresleri var. Bu adrese tilakladigimda sistemde olan faturayi WORD formatinda aciyor.
Yapmak istedigim bir textbox'a fatura numarsi girdigimde, fatura numarasina ait hyperlink adresini calistirmak ve faturayi WORD formatindan PDF formatina cevirerek bir emaile eklemek.
Asagidaki kod sayfada listelenen butun Hyperlinkleri emaile WORD formatinda ekliyor ve textbox opsiyonu yok.
Bu koda textbok opsuyonunu eleyip , faturayida nasil WORD den PDF e cevirip emaile ekleyebiliriz?
Sub WordtoPDF()
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 Long
Dim example As Range
Set example = Range("T:T,U:U,W:W,X:X")
Dim fnd As Range
Dim attachment As String
Dim x As Long
example.ClearContents
LastRow = Sheets("Rapor").Cells(Rows.Count, 1).End(xlUp).Row
For x = 2 To LastRow
attachement = Sheets("invoice").Cells(x, 5).Value
Ref1 = Cells(x, 5).Value
mydate1 = Cells(x, 4).Value
mydate2 = mydate1
Cells(x, 20).Value = mydate2
datetoday1 = Date
datetoday2 = datetoday1
Cells(x, 21).Value = datetoday2
If mydate2 - datetoday2 < 3 Then
Set myApp = New Outlook.Application
Set mymail = myApp.CreateItem(olMailItem)
mymail.To = Cells(x, 22).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" _
& vbCrLf & "" _
& vbCrLf & ""
.Attachments.Add attachement
.Display
'.Send
Set mymail = Nothing
End If
End If
Next
Set myApp = Nothing
Set mymail = Nothing
End Sub
