Asociar cita de Excel a un calendario específico en Outlook.
Tengo una macro que me recoge los valores almacenados en un UserForm y me crea una cita en mi calendario de Outlook. Ahora bien, necesito que esa cita me la cree en un calendario especifico asociado a otra cuenta de Outlook, es decir, yo tengo esas dos cuentas abiertas en mi equipo, y quiero que en vez de crearme la cita en mi cuenta ([email protected]) me la cree en el calendario de esta otra cuenta ([email protected])
Adjunto macro para crear la cita:
Sub CrearCita()
Dim oAPP As New Outlook.Application
Dim ns As Outlook.Namespace
Dim cita As Outlook.AppointmentItem
Dim Titulo As String
Dim TransRowRng As Range
Dim NewRow As Integer
Dim FechaInicio As Date
Dim FechaFin As Date
Titulo = "Seguimiento ScrowAccount"
'---------------------------------------------------------------------
FechaInicio = ScrowAccount.TextBox2.Value
FechaFin = ScrowAccount.TextBox5.Value
'---------------------------------------------------------------------
Set TransRowRng = ThisWorkbook.Worksheets("Tareas").Cells(1, 1).CurrentRegion
NewRow = TransRowRng.Rows.Count + 1
With ThisWorkbook.Worksheets("Tareas")
.Cells(NewRow, 1).Value = ScrowAccount.Asunto.Value
.Cells(NewRow, 2).Value = ScrowAccount.TextBox2.Value
.Cells(NewRow, 3).Value = ScrowAccount.TextBox5.Value
.Cells(NewRow, 4).Value = ScrowAccount.TextBox3.Value
.Cells(NewRow, 5).Value = ScrowAccount.TextBox4.Value
End With
If ScrowAccount.CheckBox1 = False Then
Set oAPP = GetOutlookApp
If oAPP Is Nothing Then
MsgBox "No se puede iniciar Outlook.", vbInformation, Titulo
Unload ScrowAccount
Exit Sub
End If
Set ns = oAPP.GetNamespace("MAPI")
Set cita = oAPP.CreateItem(olAppointmentItem)
With cita
.Subject = ScrowAccount.Asunto.Value
.Start = FechaInicio
.Duration = 720 'cambiar este parámetro si queremos que dure más o menos de un día la cita
.Body = ScrowAccount.TextBox4.Value
.Importance = olImportanceHigh
.Save
End With
Else
End If
MsgBox "Aviso creado con éxito.", vbInformation, Titulo
Unload ScrowAccount
Exit Sub
End Sub
1 respuesta
Respuesta de Dante Amor
1
