Hello,
I have this code in VBA for sending invoices via outlook:
Sub EmailAsPDF()
Dim EApp As Object
Set EApp = CreateObject("Outlook.Application")
Dim EItem As Object
Set EItem = EApp.CreateItem(0)
Dim invno As Long
Dim custname As String
Dim amd As Currency
Dim dt_issue As Date
Dim path As String
Dim fname As String
invno = Range("F4")
custname = Range("A10")
amt = Range("C19")
dt_issue = Range("F3")
path = "C:\Users\User\Desktop\Fakture\"
fname = invno & " - " & custname
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, IgnorePrintAreas:=False, Filename:=path & fname
With EItem
.To = Range("A12")
.Subject = "Faktura broj: " & invno
.Body = "Faktura se nalazi u prilogu."
.Attachments.Add (path & fname & ".pdf")
.Display
End With
End Sub
It works perfectly fine on one PC and on the other it shows an error and I have no idea why.
I have this code in VBA for sending invoices via outlook:
Sub EmailAsPDF()
Dim EApp As Object
Set EApp = CreateObject("Outlook.Application")
Dim EItem As Object
Set EItem = EApp.CreateItem(0)
Dim invno As Long
Dim custname As String
Dim amd As Currency
Dim dt_issue As Date
Dim path As String
Dim fname As String
invno = Range("F4")
custname = Range("A10")
amt = Range("C19")
dt_issue = Range("F3")
path = "C:\Users\User\Desktop\Fakture\"
fname = invno & " - " & custname
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, IgnorePrintAreas:=False, Filename:=path & fname
With EItem
.To = Range("A12")
.Subject = "Faktura broj: " & invno
.Body = "Faktura se nalazi u prilogu."
.Attachments.Add (path & fname & ".pdf")
.Display
End With
End Sub
It works perfectly fine on one PC and on the other it shows an error and I have no idea why.