Send Outlook Meeting Invitation using Excel

后端 未结 3 1841
无人共我
无人共我 2021-01-22 05:27

I am looking to send meeting invitations for each row in a worksheet.

I am able to create an item that when displayed shows as an appointment, not a meeting request that

相关标签:
3条回答
  • 2021-01-22 06:09

    I realized the issue. The cell I was linking to for the emails contained a formula instead of the email address text. Once I changed the email addresses to text instead of a formula my VBA worked perfectly.

    0 讨论(0)
  • 2021-01-22 06:12

    I had the same problem as the OP but rather than resort to send keys I used the inspector to access the Invite Attendees ribbon command. Here are excerpts from the code:

    Dim oApp As Object
    Dim OutMail As Object
    Dim oCommandBar As Object 'Office.CommandBars
    Dim oInsp As Object 'Outlook.inspector
            
    Set outMail = oApp.CreateItem(1)
    
    'then these in the loop to get access to the ribbon:
    
    Set oInsp = OutMail.GetInspector
    Set oCommandBar = oInsp.CommandBars
    
    'Show the mail item
    outMail.display
    
    'Press the Invite attendees ribbon item
    oCommandBar.ExecuteMso ("InviteAttendees")
    
    0 讨论(0)
  • 2021-01-22 06:19

    Try this?

    Sub SendAction()

    Dim OutApp As Object
    Dim OutMail As Object
    Dim cell As Range
    
    Application.ScreenUpdating = False
    Set OutApp = CreateObject("Outlook.Application")
    
    For Each cell In Worksheets("Action Log").Range("H5:H50").Cells
        Set OutMail = OutApp.CreateItem(1)
        If cell.Value Like "*@*" Then      'try with less conditions first
            With OutMail
                .MeetingStatus = olMeeting
                .RequiredAttendees = Cells(cell.Row, "H").Value
                .RequiredAttendees.Type = olRequired
                .Subject = Cells(cell.Row, "I").Value
                .Body = Cells(cell.Row, "I").Value
                .Start = Cells(cell.Row, "E").Value & " " & TimeValue("8:00 AM")
                .Location = "Your Office"
                .Duration = 15 ' 15 minute meeting
                .BusyStatus = 0 ' set as free
                .ReminderSet = True 'reminder set
                .ReminderMinutesBeforeStart = "20160" 'reminder 2 weeks before
                .display
                .send
    
            End With
    
            Cells(cell.Row, "K").Value = "sent"
            Set OutMail = Nothing
        End If
    Next cell
    
    Application.ScreenUpdating = True
    

    End Sub

    0 讨论(0)
提交回复
热议问题