Crear Cita en calendario de Outlook desde Excel
Tengo una macro que al ejecutarse me crea una cita en el calendario de mi cuenta personal en Outlook. Ahora bien, en mi ordenador tengo configurada otra cuenta a la que tenemos acceso varias personas y me gustaría que la cita se creara en dicho calendario para que le saliera a todas las personas con acceso a dicha cuenta de Outlook.
He probado con .SendUsingAccount y no me realiza nada.
Adjunto código de la macro.
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
Dim Oficina As String
Titulo = "Seguimiento ScrowAccount"
'---------------------------------------------------------------------
FechaInicio = ScrowAccount.TextBox2.Value
FechaFin = ScrowAccount.TextBox5.Value
Oficina = ScrowAccount.TextBox6.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, 5).Value = ScrowAccount.TextBox4.Value
.Cells(NewRow, 6).Value = ScrowAccount.TextBox6.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 = 180 'cambiar este parámetro si queremos que dure más o menos la cita
.Body = ScrowAccount.TextBox4.Value
.Importance = olImportanceHigh
.Location = "Ordinal oficina:" + " " + Oficina
'.SendUsingAccount = "[email protected]"
.Save
End With
Else
End If
MsgBox "Aviso creado con éxito.", vbInformation, Titulo
Unload ScrowAccount
Exit Sub
End Sub
1 respuesta
Respuesta de Sebas Torres
1