![]() |
Opening New Email On top of Excel / SetForegroundWindow
I am certainly no programer. I simply use VB to make my life easier in my
Job. I use the below code to Open a new email from within Excel and get the address from the spreadsheet and send it out to the customer. It all works fine accept that now that I have switched from Windows NT and office 97 to windows 2000 and office 2000. Now when I run this code instead of the email opening up it just blinks at the bottom in my task bar telling me its there for me to click on. I have found some good explanations on why this takes place in Office 2000 and even some code to solve the problems on the net & on in the news groups. Unfortunetely I can't seem to figure out how to use it. There is a great explanation at www.vbpj.com Feb 1999 "Is SetForegroundWindow Broken" http://www.ftponline.com/Archives/pr...b99/ap0299.pdf And even some great looking code. Unfortunetely its way over my head, I cant figure out how to use it and indeed might be more than I need. Can anyone provide me with the code that would simply open a new email on top of my current running app which is XL and then when I send it simply revert back to XL like it use to be in Office 97. I'm hopefull that if someone can provide this I can do the rest and tweak it for my situation. Thank you Stacy (7willie) Dim objOL As Outlook.Application Dim msg As Outlook.MailItem Set objOL = New Outlook.Application Set msg = objOL.CreateItem(olMailItem) With msg .To = CustEmailAddr .Subject = "Your info: " & Time() .Body = "Here is the file you were looking for" .Attachments.Add AttachFile '.Send .Display End With |
Opening New Email On top of Excel / SetForegroundWindow
Hello Stacy,
Change the first set statement to Set objOL = CreateObject("Outlook.Application") HTH, Greg "Stacy" wrote in message .rogers.com... I am certainly no programer. I simply use VB to make my life easier in my Job. I use the below code to Open a new email from within Excel and get the address from the spreadsheet and send it out to the customer. It all works fine accept that now that I have switched from Windows NT and office 97 to windows 2000 and office 2000. Now when I run this code instead of the opening up it just blinks at the bottom in my task bar telling me its there for me to click on. I have found some good explanations on why this takes place in Office 2000 and even some code to solve the problems on the net & on in the news groups. Unfortunetely I can't seem to figure out how to use it. There is a great explanation at www.vbpj.com Feb 1999 "Is SetForegroundWindow Broken" http://www.ftponline.com/Archives/pr...02feb99/ap0299. And even some great looking code. Unfortunetely its way over my head, I cant figure out how to use it and indeed might be more than I need. Can anyone provide me with the code that would simply open a new email on top of my current running app which is XL and then when I send it simply revert back to XL like it use to be in Office 97. I'm hopefull that if someone can provide this I can do the rest and tweak it for my situation. Thank you Stacy (7willie) Dim objOL As Outlook.Application Dim msg As Outlook.MailItem Set objOL = New Outlook.Application Set msg = objOL.CreateItem(olMailItem) With msg .To = CustEmailAddr .Subject = "Your info: " & Time() .Body = "Here is the file you were looking for" .Attachments.Add AttachFile '.Send .Display End With |
Opening New Email On top of Excel / SetForegroundWindow
Greg,
Thanks for you advice. Wow it all seems to simple. Your suggestion seems to work only some of the time. In particular if I close Excel and then open a new copy the first email will only flash at the bottom of the screen (same old thing). It appears that subesquent runs of the VB script open new email on top. Do you know what causes this and how to make it open first time every time on top. Ps thank you for moving eions forward in such a simple way. Stacy. "Greg Koppel" wrote in message ... Hello Stacy, Change the first set statement to Set objOL = CreateObject("Outlook.Application") HTH, Greg "Stacy" wrote in message .rogers.com... I am certainly no programer. I simply use VB to make my life easier in my Job. I use the below code to Open a new email from within Excel and get the address from the spreadsheet and send it out to the customer. It all works fine accept that now that I have switched from Windows NT and office 97 to windows 2000 and office 2000. Now when I run this code instead of the opening up it just blinks at the bottom in my task bar telling me its there for me to click on. I have found some good explanations on why this takes place in Office 2000 and even some code to solve the problems on the net & on in the news groups. Unfortunetely I can't seem to figure out how to use it. There is a great explanation at www.vbpj.com Feb 1999 "Is SetForegroundWindow Broken" http://www.ftponline.com/Archives/pr...02feb99/ap0299. And even some great looking code. Unfortunetely its way over my head, I cant figure out how to use it and indeed might be more than I need. Can anyone provide me with the code that would simply open a new email on top of my current running app which is XL and then when I send it simply revert back to XL like it use to be in Office 97. I'm hopefull that if someone can provide this I can do the rest and tweak it for my situation. Thank you Stacy (7willie) Dim objOL As Outlook.Application Dim msg As Outlook.MailItem Set objOL = New Outlook.Application Set msg = objOL.CreateItem(olMailItem) With msg .To = CustEmailAddr .Subject = "Your info: " & Time() .Body = "Here is the file you were looking for" .Attachments.Add AttachFile '.Send .Display End With |
All times are GMT +1. The time now is 10:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com