Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
Sub amendOutbox() Dim olkApp As Object Dim mai As Object Dim acct As Long acct = getAccount If acct = 0 Then acct = 1 Set olkApp = CreateObject("outlook.application") For Each mai In olkApp.Session.GetDefaultFolder(4).items If mai.Class = 43 Then With mai .Importance = 2 .ReadReceiptRequested = True .OriginatorDeliveryReportRequested = True .Attachments.Add "e:\0\Access - (001) 042307.ADA Fee Proposal.pdf", 5 .SendUsingAccount = olkApp.Session.Accounts.Item(acct) .SentOnBehalfOfName = olkApp.Session.Accounts.Item(acct) ' Need to establish the account required ... but once set can be hard coded. .Send MsgBox acct & vbNewLine & olkApp.Session.Accounts.Item(acct) End With End If Next End Sub Function getAccount() As Long Dim olkApp As Object Dim i As Long ' Accounts only valid for 2007 and on! 'can embed it as Access call if required via: ' acct = getaccount() Set olkApp = CreateObject("outlook.application") For i = 1 To olkApp.Session.Accounts.Count If (MsgBox("Use Account " & olkApp.Session.Accounts.Item(i).SmtpAddress, vbYesNo)) = vbYes Then 'olkApp.Session.accounts.item(i) getAccount = i Exit For End If Next ' MsgBox "account selected as :> " & getAccount End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.