send file by mail VBA (1 Viewer)

bhelmy

Registered User.
Local time
Today, 06:00
Joined
Dec 6, 2015
Messages
62
Hi my friends
the following code to attaches all file in folder and send it by mail auto

I need to make the code not to sent mail auto but preview the mail and I will send it manual



[ Dim mess_body As String, StrFile As String, StrPath As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem

Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)

'~~> Change path here
StrPath = "C:\Access"

With MailOutLook
.BodyFormat = olFormatRichText
.To = "test@testss.orwg"
.Subject = "test"
.HTMLBody = "test"
.NoAging = False

'~~> *.* for all files
StrFile = Dir(StrPath & "*.*")

Do While Len(StrFile) > 0
.Attachments.Add StrPath & StrFile
StrFile = Dir
Loop

'.DeleteAfterSubmit = False
.Send
End With

MsgBox "Reports have been sent", vbOKOnly
End Sub]
 

bhelmy

Registered User.
Local time
Today, 06:00
Joined
Dec 6, 2015
Messages
62
when I removed it
Didn't work and didn't open or sent email
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:00
Joined
Sep 21, 2011
Messages
14,221
Replace .Send with .Display
 

Users who are viewing this thread

Top Bottom