A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Cant Send a displayed message without explorer open. Eric Legault & et al



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old January 17th 06, 08:22 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 4
Default Cant Send a displayed message without explorer open. Eric Legault & et al

Further top my last Post I'm still having problems getting the user
edited meassge to send

1. My code generates an email message which is displayed to the user

2.They edit the message add a recipient & hit send

3.It sits in the outbox italicized, not bold, and wont sent

So I wrapped the code with the following to force the sent (-Outlook
2003 with Exchange & redemption).It works but leaves an outlook
window open at the end

Set objInbox = NS.GetDefaultFolder(olFolderInbox)
Set objExplorer = objOutlook.Explorers.Add(objInbox,
olFolderDisplayNormal)
objExplorer.Display
objExplorer.WindowState = olMinimized
..
..
..Other code here
..


'Need to force the send at times outlook explorer needs to be visible
Set btn = objExplorer.CommandBars.FindControl(1, 7095)
btn.Execute


4. If I add
ObjExplorer.close
Set objexplorer = nothing

This will close outlook nicely but then the message wont sent

The next time I open outlook the message sends after a couple of
minutes.I assume by some exchange process


Questions

Is it possible to sent the email & still close down outlook
At the moment I can only sent it if an outlook window remains open

My code finishes before the user has clicked sent tho the force sent
click still seems to work

Do I open the wrong explorer window?

Many Thanks

Tony

The full code is as follows

Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim objOutlookRecip As Object
Dim NS As Object
Dim objInbox As Object
Dim objExplorer As Object
Dim objRedempMsg As Object
Dim btn As Object


' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

'Logon to MAPI
Set NS = objOutlook.GetNamespace("MAPI")
NS.Logon

'this is required to get Outlook to send else it sits in the outbox
after the users hits send
'need to expose the explorer window before doing a sendkey later
Set objInbox = NS.GetDefaultFolder(olFolderInbox)
Set objExplorer = objOutlook.Explorers.Add(objInbox,
olFolderDisplayNormal)
objExplorer.Display
objExplorer.WindowState = olMinimized


' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)


'Create Redemption Safe Mail - library Redemption.dll
Set objRedempMsg = CreateObject("Redemption.SafeMailItem")

'Point the message to Redemption
objRedempMsg.Item = objOutlookMsg




Dim MyName As String

strTo = "


Dim strBody As String

strBody = "Attached please find a Memo which initiates a Non
Conformance". objRedempMsg

Set objOutlookRecip = .Recipients.Add(strTo )


objOutlookRecip.Type = olTo

'Send the email to DCC
' Add the CC recipient(s) the DCC .
Set objOutlookRecip = .Recipients.Add("DCC")
objOutlookRecip.Type = olCC

.Subject = "A New Non Conformance has been raised - OUTLOOK TEST
ONLY "
.Body = strBody

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objRedempMsg.Display
End If
Next


.Display

End With



'Need to force the send at times outlook explorer needs to be
visible
Set btn = objExplorer.CommandBars.FindControl(1, 7095)
btn.Execute

'objExplorer.Close



ExitProc:

Set objExplorer = Nothing
Set objOutlook = Nothing



'The word document running the code
Documents(SrcFile).Close False


Exit Sub

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
send a message to email 2 & 3 when selecting multiple contacts Karen NZ Outlook - Using Contacts 9 September 4th 06 04:04 PM
Open EML file from Internet Explorer Nathan Outlook Express 0 March 8th 06 05:42 AM
The Form Required to View this Message Can Not Be Displayed..somet Angyl Outlook - Using Forms 4 March 4th 06 12:23 AM
How do I get OFFICE 97 to OPEN Internet explorer Lost Outlook - Installation 1 February 12th 06 06:22 AM
Denied Outlook "Send" access via Explorer when DSL Yahoo service Ken Steen-Olsen steen-olsen@sbcglobal Outlook - Installation 0 January 11th 06 11:17 PM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.