Good day,
At the moment i'm writing a macro to send an email with an attachment.
What i would like is for the macro to delete the first row of the file and then shift the row up and then send the email , this is what i have so far :
Private Sub CommandButton1_Click()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim objOutlookRecip As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "Body content" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2"
On Error Resume Next
With xOutMail
.To = "testemaill"
.CC = ""
.BCC = ""
.Subject = "Test email send by button clicking"
.Body = xMailBody
.Display 'or use .Send
'Add attachments to the message [some code]
.Attachments.Add "C:\Users\user\Desktop\Test\testfile.xlsx"
End With
Set objOutlook = Nothing
End Sub
The above successfully attaches the file to the email.
i know the line to delete the first row is
, but i'm not sure how to refer it to that specific file and have it run before attaching it to the email.
There's about 20 files that i want to do this with and run it every first day of the month , are there any macros that would make this task easier?
Any help would be appreciated.
Kind regards
Rynhardt
Bookmarks