We have a VBA macro in Outlook for printing emails to a file using a printer that displays a very simple dialog with only a caption, a text box into which to type the filename, an OK and Cancel button.
Using the .Printout method brings up this dialog and we want to type a filename and hit the OK button with the macro. For some reason the SendKeys function makes the Outlook/this printer lock up on certain emails and we've not figured out why. It seems to have something to do with the email size as emails with many pictures in them are problematic.
Instead of SendKeys we've worked out using the FindWindow API to find the text box on the dialog, and the SendMessage API which is filling in the filename just fine. But we've been unsuccessful to using SendMessage to send an Enter key to "click" the OK button.
We were able to get the PostMessage API working to send an Enter key but it has the same problem on certain emails as SendKeys.
Is there a way to use SendMessage to "click" the OK button or can someone suggest an alternative?
Thanks a bunch,
Ken