Getting the active window in outlook model

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've created the following code in Outlook 2003 for automatically forwarding
email's to a specific person. It selects the first email in the list.
However, I would like to assign it to a toolbar and have it send the email
opened in the active window rather than the first in the list of emails in
the In Box.

Do you have an example of code I can use to modify my code.

Public Sub DSchmidt()
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myForward = myFolder.Items(1).Forward
myForward.Recipients.Add "DSchmidt"
myForward.Send
End Sub
 
Hi Dennis,

the current opened window is accessable via the ActiveInspector object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top