¿Podría pasar con Visual Basic una base de datos de direcciones web al programa Microsoft Outlook?

Hola buenas tardes!!!!!!!!!!
La verdad es que quiero hacer una cosa un poco rara y no se ni siquiera si se puede hacer.
El hecho es que tengo una base de datos con unos clientes --> nombre, direccion, apellidos, ciudad, email, etc etc.
Quisiera saber si con visual basic podría pasar todos estos datos a la libreta de direcciones de outlook.
No se si se puede.........
muchas gracias.
gorbasio

1 Respuesta

Respuesta
1
Hay dos formas, en referencias puedes poner la libreria de objetos (la 10.0 uso yo) de Outlook o declararlo con create object... :
De este modo :
Dim objOutlook As Object
Dim objMailItem
Dim NumOfPath As Integer, i As Integer
Dim AtachPath As String
On Error GoTo 10
NumOfPath = 0
For i = 1 To Len(AllPath)
If Mid(AllPath, i, 1) = "," Then
NumOfPath = NumOfPath + 1
End If
Next i
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(olMailItem)
Me.MousePointer = vbHourglass
With objMailItem
.To = EmailAddress
.Subject = MSubject
.Body = MBody
If AllPath <> "" Then
For i = 1 To NumOfPath
AtachPath = PartOfPath(i)
.Attachments.Add AtachPath
Next i
End If
.Send
End With
Set objMailItem = Nothing
Set objOutlook = Nothing
Me.MousePointer = vbDefault
Exit Sub
exit10:
Exit Sub
10:
If Err.Number = 429 Then
MsgBox "Error on connecting with Outlook"
Else
MsgBox "error Description is " & Err.Description & " err number is " & Err.Number
End If
Set objMailItem = Nothing
Set objOutlook = Nothing
Me.MousePointer = vbDefault
AllPath = ""
List1.Clear
Me.Text2.Text = ""
Me.Text3.Text = ""
Resume exit10
End Sub

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas