cs_benedict
Messages postés187Date d'inscriptionmercredi 25 septembre 2002StatutMembreDernière intervention 7 mai 2009
-
17 avril 2005 à 09:54
cs_benedict
Messages postés187Date d'inscriptionmercredi 25 septembre 2002StatutMembreDernière intervention 7 mai 2009
-
17 avril 2005 à 12:55
Bonjour,
Je voudrais ouvrir Outlook pour pouvoir ensuite créer des objets.
greg38bj
Messages postés83Date d'inscriptionjeudi 11 mars 2004StatutMembreDernière intervention17 novembre 2008 17 avril 2005 à 10:39
voici le code dont je me sers pour les contacts, rendez-vous, et calendrier :
Dans un module :
Option Explicit
Public outapp As New Outlook.Application
Public space As Outlook.NameSpace
Public calendar As Outlook.MAPIFolder
Public contact As Outlook.MAPIFolder
Public itemcal As Outlook.Items
Public itemcont As Outlook.Items
Public Mail As Outlook.MailItem
Public rdv As Outlook.AppointmentItem
Public cont As Outlook.ContactItem
Public visu As String
Sub Main()
Dim i As Integer
Set space = outapp.GetNamespace("MAPI")
Set itemcal = calendar.Items
Set rdv = itemcal.GetFirst
For i = 1 To itemcal.Count
MsgBox rdv.Subject
Set rdv = itemcal.GetNext
Next
End Sub
Dans ma page de démarrage :
Set space = outapp.GetNamespace("MAPI")
Set contact = space.GetDefaultFolder(olFolderContacts)
Set calendar = space.GetDefaultFolder(olFolderCalendar)
Dans la forme concernée :
Option Explicit
Dim out As String
Private Sub Envoi_Click()
Set Mail = outapp.CreateItem(olMailItem)
If Not Adresse.Text = "" Then
Mail.Recipients.Add Adresse
End If
If Not Sujet.Text = "" Then
Mail.Subject = Sujet
End If
If Not Message.Text = "" Then
Mail.Body = Message
End If
If Not PiecesJointes.Text = "" Then
Mail.Attachments.Add PiecesJointes.Text
End If
Mail.Send
DoEvents
Unload Me
End Sub
Private Sub ParcourirPiecesJointes_Click()
With cmd
.CancelError = False
.DialogTitle = "Joindre un fichier ..."
.InitDir = "BUREAU"
.Filter = "Tous les fichiers (*.*)|*.*|"
.FilterIndex = 1
Err.Clear
.ShowOpen
PiecesJointes.Text = cmd.FileName
End With
End Sub
Ps: N'oublie pas de référencer Outlook dans ton projet ...
@ +
greg38bj2005@free.fr