View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Koppel Greg Koppel is offline
external usenet poster
 
Posts: 79
Default 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

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...02feb99/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