Sub Run Function() On Error Resume Next Dim OutApp As Object Dim OutMail As Object Dim objNsp As Object Dim colSyc As Object Dim objSyc As Object Dim i As Integer Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) Set objNsp = OutApp.Application.GetNamespace("MAPI") 'CORRECTION to Refer to the OutLook Application correctly Set colSyc = objNsp.SyncObjects On Error Resume Next With OutMail .To = "firstname.lastname@example.org" .Subject = "Vetting Report - " & TBFileName.Text .Body = "For Your Information .." .Attachments.Add BFld1 & TBFileName.Text .Send ' to send in background ' .Display ' to open a mail window with a normal 'SEND' icon available End With For i = 1 To colSyc.Count Set objSyc = colSyc.Item(i) objSyc.Start Next On Error GoTo 0 OutApp.Quit Set OutMail = Nothing Set objNsp = Nothing Set colSyc = Nothing Set objSyc = Nothing Set OutApp = Nothing aa: End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE