Discussion Locked

Outlook 2000 and Command line switches

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a application written in VB6 that needs to email an excel spreadsheet to a group unattended. The application resides on a server. Outlook is not opened.

I know how to open Outlook and send the mail, but I can't figure out how to close Outlook when the file has been sent.

Any ideas on how to do this with Command line or VB would be great.

4 replies

by d4m0cl3s

I've posted this under VB and Notes, but it should work just as well here. It only calls on the mapi component that sends the mail so you don't need the proogram to open. Outlook express flashes up the sending mail dialog but doesn't open the program.
========================================
If you don't need to use Notes then you may find this useful. It works with all MAPI compliant mail programs. Just make sure your prefered mail client is set up as your default MAPI host - Outlook Express5 does it automatically.

Private Sub start_session()
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
End Sub

Private Sub end_session()
MAPISession1.SignOff
End Sub

Private Sub Command1_Click()
start_session
'Create new message
MAPIMessages1.Compose
'set the recipient info
MAPIMessages1.RecipDisplayName = SendToRealName
MAPIMessages1.RecipAddress = SendToEmailAddress
'set the subject line
MAPIMessages1.MsgSubject = Subject
'set the message
MAPIMessages1.MsgNoteText = Me.Body
'add an attatchment
MAPIMessages1.AttachmentPathName = AttatchmentFilePath
'You can add more files by repeating the statement
MAPIMessages1.Send False
end_session
End Sub
========================================

by tylon_2000

Let me re-phrase. I was not very clear before.

I have a VB application that is writing to a Access database. After the inserts to the database are complete, the VB application is done.

What I need is a way to have the command line open andthen close Outlook. I can open Outlook, I just cannot find any information on closing the program.

This discussion is closed to new replies.