Im sending an email from an excel VBA and our internal IT guys have instigated a security classifycation requirement for all emails.
When you Send you get a box with a list and you have to choose a level of security. (I work in a big govt dept).
I am trying to set that with "Sendkeys" but I only get error message "Object doesnt support this property or code." Should Outlook support Sendkeys?
When running it the box has focus and you only need to hit DOWN DOWN ENTER to get what I want. then it continues. This code is mostly from this forum.
This all works fine appart from needing to set the security. It comes up and you can manually select it and then it proceeds.Code:Private Sub CommandButton3_Click() 'Add a reference to MS Outlook xx.0 Object Library Dim oApp As Outlook.Application Dim oEmail As Outlook.MailItem Set oApp = New Outlook.Application Set oEmail = oApp.CreateItem(olMailItem) With oEmail .To = "[email protected]" .Subject = "What ever your subject is" .BodyFormat = olFormatPlain .Body = "...text here..." .Importance = olImportanceHigh '.ReadReceiptRequested = True .Recipients.ResolveAll .Save .Display 'Show the email message and allow for editing before sending .SendKeys "{DOWN}{DOWN}{ENTER}", True .Send 'You can automatically send the email without displaying it. End With Set oEmail = Nothing 'oApp.Quit Set oApp = Nothing End Sub
If I put the .Sendkeys line after .Send it doesnt get that far before needing input to the security box.
any ideas




Reply With Quote