Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,572 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,926 people online right now. Registration is fast and FREE... Join Now!




Quiting Outlook from VB6

 
Reply to this topicStart new topic

Quiting Outlook from VB6, I am using Outlook from a VB6 application but when I close Outlook fro

Pppiukala
12 May, 2008 - 08:29 PM
Post #1

New D.I.C Head
*

Joined: 12 May, 2008
Posts: 1

Private Sub cmdEmailLetter_Click()

Dim result As Integer
Dim displaymessage As Boolean
Dim strSql As String
Dim rsEmailAdd As Recordset
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment


strSql = "SELECT ProvEmail,SupEmail,LOEmail FROM Providers " & _
"WHERE ProvCode = " & Val(mid(Trim(Me.cmbProviders.Text), 1, 4))

Set rsEmailAdd = dbAtlas.OpenRecordset(strSql, dbOpenDynaset)

displaymessage = True

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

With objOutlookMsg
' Add the To recipient(s) to the message.
If rsEmailAdd.Fields("ProvEmail") <> "" Then
Set objOutlookRecip = .Recipients.Add(rsEmailAdd.Fields("ProvEmail"))
Else
Set objOutlookRecip = .Recipients.Add(rsEmailAdd.Fields("SupEmail"))
End If
objOutlookRecip.Type = olTo

' Set the Subject, Body, and Importance of the message.
.Subject = "RE: " & (mid(Trim(Me.cmbSubject.Text), 3, 30)) & " IA Program"
' .Body = "This is a testing email from Atlas Software to see if we can automate sending the attachement files." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
'If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(sOutput)
'End If

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

' Should we display the message before sending?
If displaymessage Then
.Display
Else
' .Save
.sEnd
End If
End With

objOutlook.Quit
Set objOutlookMsg = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
Set objOutlook = Nothing


fraDetails.Visible = True
fraData.Visible = False
txtSklInformMethod.Visible = False
txtCorrespondenceDate.Visible = False
Label6.Visible = False
Label7.Visible = False
txtSklInformMethod.Text = "Emailed Letter"
txtCorrespondenceDate.Text = Date


End Sub
User is offlineProfile CardPM
+Quote Post

RodgerB
RE: Quiting Outlook From VB6
12 May, 2008 - 11:37 PM
Post #2

D.I.C Lover
Group Icon

Joined: 21 Sep, 2007
Posts: 2,131



Thanked: 17 times
Dream Kudos: 2200
Expert In: Dot Net Technologies

My Contributions
Welcome to </dream.in.code>. Please post your question and your code in the appropriate forum on the navigation bar to the left. Please ensure you give an in-depth description of the problem you are receiving.

Thanks. smile.gif
User is offlineProfile CardPM
+Quote Post

Pppiukala
RE: Quiting Outlook From VB6
13 May, 2008 - 05:40 PM
Post #3

New D.I.C Head
*

Joined: 12 May, 2008
Posts: 1

Hello there,

Sorry I still trying to find my way around this forum.

I am developing a VB6 application and have develop interface for microsoft application too. I used word and excel fine but when its come to outlook, I kept running into problems. what I found out that the outlook process is not quiting. So everytime I send an email using the code posted its create another process of outlook but when I quit ,it didn't quit. Any clue of why? or is it a microsoft outlook problems?

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 11:59PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month