G
GregCost
The automation code below only loads and makes visible a standard
untitled.msg form. The main form of Outlook is not loaded (I think). In the
..msg form I can load the contents of the Clipboard, change it, add text, etc.
Clicking the Send Key from the .msg form toolbar works except the message
queues until the next time I’m in Outlook’s main form and I hit the
“SEND/RECEIVE†key.
For Outlook mail setup the following is set:
Send immediately when connected
On the Mail Setup tab the following is set for both online and offline
Include this group in Send/Receive(F9)
Schedule an Automatic Send/Receive every 1 minute
Perform an automatic send/recieve when exiting
It’s possible (I think) to open an abcd.msg form completely independent of
the Outlook main form where the actual Send/Receive code resides. That’s why
the message gets queued.
Since the email abcd.msg is external to the .NET project I have no concrete
way to know when they will hit the send key on the msg form. I was hoping
that there was an option somewhere (on the Outlook main form or msg form)
that invoked some level of communication and initiated the main form
Send/Revieve)
I’m trying to avoid launching the msg form on a thread and using a timer
randomly detecting the IsAlive state of the thread. When the thread was
inactive launch the outlook main form hidden and closing it which would trip
the automatic send/receive. … Any ideas?
Dim olApp As Outlook.Application
Dim olmailitem As Object Dim olNs As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Try
olApp = CreateObject("Outlook.Application")
olNs = olApp.GetNamespace("MAPI")
olNs.Logon()
olMail = olApp.CreateItem(olmailitem)
olMail.Display()
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("^v")
System.Threading.Thread.Sleep(50)
Catch ex As COMException
MessageBox.Show("Error accessing Word document.")
End Try
untitled.msg form. The main form of Outlook is not loaded (I think). In the
..msg form I can load the contents of the Clipboard, change it, add text, etc.
Clicking the Send Key from the .msg form toolbar works except the message
queues until the next time I’m in Outlook’s main form and I hit the
“SEND/RECEIVE†key.
For Outlook mail setup the following is set:
Send immediately when connected
On the Mail Setup tab the following is set for both online and offline
Include this group in Send/Receive(F9)
Schedule an Automatic Send/Receive every 1 minute
Perform an automatic send/recieve when exiting
It’s possible (I think) to open an abcd.msg form completely independent of
the Outlook main form where the actual Send/Receive code resides. That’s why
the message gets queued.
Since the email abcd.msg is external to the .NET project I have no concrete
way to know when they will hit the send key on the msg form. I was hoping
that there was an option somewhere (on the Outlook main form or msg form)
that invoked some level of communication and initiated the main form
Send/Revieve)
I’m trying to avoid launching the msg form on a thread and using a timer
randomly detecting the IsAlive state of the thread. When the thread was
inactive launch the outlook main form hidden and closing it which would trip
the automatic send/receive. … Any ideas?
Dim olApp As Outlook.Application
Dim olmailitem As Object Dim olNs As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Try
olApp = CreateObject("Outlook.Application")
olNs = olApp.GetNamespace("MAPI")
olNs.Logon()
olMail = olApp.CreateItem(olmailitem)
olMail.Display()
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("{TAB}")
System.Threading.Thread.Sleep(50)
SendKeys.SendWait("^v")
System.Threading.Thread.Sleep(50)
Catch ex As COMException
MessageBox.Show("Error accessing Word document.")
End Try