Excel 2010 to OutLook 2010 Meeting Request Problems
Hello Everyone
I have managed to get the code below to work but I have some issues:
When I run this code I get the following in the Meeting request:
Issues:
• Instead of the true content for line 6 it chooses date Fri 29/12/1899
• Instead of the true content for line 7 it chooses date Sat 30/12/1899
• I am trying get the code to choose the all day event IN Line 8
• In the Body [Line 9] it simply adds the word “True” instead of actual content
• In the Subject [Line 16] it simply adds the word “True” instead of actual content
Any help with this would be very gratefully received
[CODE]
1. Sub app()
2. Dim olApp As Outlook.Application
3. Dim a As Outlook.AppointmentItem
4. Dim wk As Worksheet
5. Set a = Outlook.CreateItem(olAppointmentItem)
6. a.Start = Range("B7").Copy ‘ALSO TRIED .SELECT FOR EACH
7. a.End = Range("B9").Copy
8. a.Duration = "1440" ‘LOOKING FOR IT TO CHOOSE ALL DAY EVENT
9. a.Body = Range("B13").Copy
10. a.Location = ""
11. a.ReminderSet = False
12. a.RequiredAttendees = ""
13. a.OptionalAttendees = ""
14. a.MeetingStatus = olMeeting
15. a.ResponseRequested = 1
16. a.Subject = Range("B5").Copy 'NEED NAME IN CELL PLUS ABSENCE REQUEST
17. 'Call AddToOutlookCalendar("Absence") 'this calls an error
18. If False Then
19. a.Close olSave
20. a.Send
21. Else
22. a.Save
23. a.Display
24. End If
25. Set a = Nothing
26. Set wk = Nothing
27. End Sub
[/CODE]
Attachment | Size |
---|---|
Meeting Request Errors.doc | 115 KB |
Meeting Request Problems
Hi,
Replace all Copy methods of Range object with Value property. For example:
Range("B7").Copy become Range("B7").Value
Do the same for the rest.
The Duration property returns or sets values of type Long. In your example "1440" must be just 1440 without quotes.
There is an AllDayEvent property which you can use if you need as set it to True or False.
If there is something else - ask it.
Best regards.