Hi,
I need a code that lets me send a workbook that's active on my screen without saving it, as the clients will fill it and send it back to me.
I need to be able to type in the addresses that it's being sent to.
I tried the code below but it doesn't send my excel workbook with the new data into it for some reason, it send the older version back.
Code:Private Sub BoutonEnvoiEmail_Click() 'Working in 2000-2010 'This example send the last saved version of the Activeworkbook Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = TextBoxEnvoiEmail.Text .Subject = "Bon de Travaux" & Format(Date, "dd/mmm/yy") & Format(Time, "hh:mm") .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing ActiveWorkbook.Close SaveChanges:=False End Sub




Reply With Quote