I have written a macro that sends a sheet as a csv file to an email address. What if I want to send it to an FTP site instead? Not sure how I would change my code. Any advice would be appreciated.
Sub Mail_small_Text_Outlook2()
If Range("c157").Value = "" Or Range("c159").Value = "" Then
MsgBox "Please complete all required fields"
Exit Sub
End If
Sheets("iCIMS").Visible = True
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim CSVfileName As String
CSVfileName = ActiveWorkbook.Path & "\ICIMS.csv"
ActiveWorkbook.Worksheets("ICIMS").Copy
ActiveWorkbook.SaveAs CSVfileName, FileFormat:=xlCSV
ActiveWorkbook.Close False
Sheets("Icims").Visible = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Title: " & Sheet1.Range("A4") & vbNewLine & _
"Department: " & Sheet1.Range("C4") & vbNewLine & _
"SBU: " & Sheet1.Range("B5") & vbNewLine & _
"Level: " & Sheet1.Range("B6") & vbNewLine & _
"Manager: " & Sheet1.Range("B145")
On Error Resume Next
With OutMail
.To = "bill.jones@college.edu"
.cc = ""
.BCC = ""
.Subject = "Successful Submission: " & Sheet1.Range("a4")
.Body = strbody
.Attachments.Add CSVfileName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Sub Mail_small_Text_Outlook2()
If Range("c157").Value = "" Or Range("c159").Value = "" Then
MsgBox "Please complete all required fields"
Exit Sub
End If
Sheets("iCIMS").Visible = True
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim CSVfileName As String
CSVfileName = ActiveWorkbook.Path & "\ICIMS.csv"
ActiveWorkbook.Worksheets("ICIMS").Copy
ActiveWorkbook.SaveAs CSVfileName, FileFormat:=xlCSV
ActiveWorkbook.Close False
Sheets("Icims").Visible = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Title: " & Sheet1.Range("A4") & vbNewLine & _
"Department: " & Sheet1.Range("C4") & vbNewLine & _
"SBU: " & Sheet1.Range("B5") & vbNewLine & _
"Level: " & Sheet1.Range("B6") & vbNewLine & _
"Manager: " & Sheet1.Range("B145")
On Error Resume Next
With OutMail
.To = "bill.jones@college.edu"
.cc = ""
.BCC = ""
.Subject = "Successful Submission: " & Sheet1.Range("a4")
.Body = strbody
.Attachments.Add CSVfileName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub