ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cannot reactivate workbook after sending email in VBA (https://www.excelbanter.com/excel-programming/382650-cannot-reactivate-workbook-after-sending-email-vba.html)

Phrank

Cannot reactivate workbook after sending email in VBA
 
Hi,

I've got code running/working that does its thing and then sends an
email to a designated recipient. Of course, there is a warning
message telling the user that a program is trying to send an email,
and it asks for approval. That's fine, and the user simply clicks on
Yes. The problem is the remaining code. I've got it set to
re-activate the Excel workbook, but the code only works when Outlook
is not open. When my Outlook is open, the active window switches from
the Excel workbook to Outlook when the email is going out, then the
warning message, and then it stays on Outlook. If I manually click
back over to my Excel workbook, I can see the message box I have
programmed in. This all works fine when Outlook is closed. Currently,
my code is:

Windows("PDF Portal.xls").Activate.

Would this work if I used

Workbook("PDF Portal.xls").Activate?

Thanks for any help.

Frank


All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com