kelliott14
New Member
- Joined
- Feb 2, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hello,
I've followed a tutorial online to create meeting invites in Outlook from Excel. As far as I can tell, I've followed the tutorial exactly (besides changing the details to my spreadsheet). Currently, it's working. I run the macro and it creates all the meeting invites with the correct details, everything is good. However, it still throws an error in Excel. I've had someone else test it on their laptop and same thing, it works but it throws an error. Hoping someone might be able to help please?
Here's the table it's pulling from:
Note: the cells here are populated by formulas. I've tried swapping the formulas for actual data and it's the same error.
Here's my code:
In the debugger it shows
Error message:
Run-time error'13':
Type mismatch.
I've confirmed the value I'm putting into .Start is a date (according to the debugger print).
I've followed a tutorial online to create meeting invites in Outlook from Excel. As far as I can tell, I've followed the tutorial exactly (besides changing the details to my spreadsheet). Currently, it's working. I run the macro and it creates all the meeting invites with the correct details, everything is good. However, it still throws an error in Excel. I've had someone else test it on their laptop and same thing, it works but it throws an error. Hoping someone might be able to help please?
Here's the table it's pulling from:
Note: the cells here are populated by formulas. I've tried swapping the formulas for actual data and it's the same error.
Here's my code:
VBA Code:Option Explicit Sub CalendarBuild() Dim OutApp As Outlook.Application, Outmeet As Outlook.AppointmentItem Dim I As Long, setupsht As Worksheet Set setupsht = Worksheets("Calendar Link") For I = 6 To Range("M" & Rows.Count).End(xlUp).Row Set OutApp = Outlook.Application Set Outmeet = OutApp.CreateItem(olAppointmentItem) With Outmeet .Subject = "Shift: " & setupsht.Range("O" & I).Value .Start = setupsht.Range("M" & I).Value .End = setupsht.Range("N" & I).Value .Body = setupsht.Range("P" & I).Value & vbLf & vbLf & "Email to request to change this shift" .BusyStatus = olFree .ReminderMinutesBeforeStart = 30 .Display End With Next I Set OutApp = Nothing Set Outmeet = Nothing End Sub
In the debugger it shows
as the line with the error..Start = setupsht.Range("M" & I).Value
Error message:
Run-time error'13':
Type mismatch.
I've confirmed the value I'm putting into .Start is a date (according to the debugger print).