I open a Outlook Meeting template and want to associate the appointment created to a non default calendar in Outlook. The attached code saves to the default calendar.
Sub Whatever()
Dim olApp As Object
Set olApp = GetObject(, "Outlook.Application")
Dim oApt As Outlook.AppointmentItem
Dim myTemplate As Object
Dim ns As Outlook.Namespace
Dim nsOther As Outlook.Recipient
Dim oFolder As Outlook.Folder
Dim template As String
template = "C:\Users\Some User\Meeting.oft"
Set myTemplate = olApp.CreateItemFromTemplate(template)
myTemplate.Recipients.Add ("someuser@contoso.com")
myTemplate.Start = "16/04/2019 10:30"
myTemplate.Display
myTemplate.Send
End Sub
This question is similar but saves a new meeting, not created from a template, to a non default calendar.
This approach stores the html in an Excel cell.
Application.CreateItemFromTemplate
function takes a second (optional) parameter - MAPIFolder
where the appointment must be created.
Your script must initialize the oFolder
variable and pass it to CreateItemFromTemplate
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.