Hello -
disclaimer - I'm a super-novice at VBA -
I have VBA code that I found on the internet to create a calendar appointment entry in Outlook. I'm trying to modify this code so that the date of the calendar entry is obtained from cell D3 in my Excel spreadsheet - instead of being hard coded into the VBA. Initiatlly cell D3 was formatted as a date, but since I couldn't get that to work, I converted it to text (#12/2/2012#)
Can anyone help me find a way to getthe date value for the calendar entry from Excel?
Here is my code:
disclaimer - I'm a super-novice at VBA -
I have VBA code that I found on the internet to create a calendar appointment entry in Outlook. I'm trying to modify this code so that the date of the calendar entry is obtained from cell D3 in my Excel spreadsheet - instead of being hard coded into the VBA. Initiatlly cell D3 was formatted as a date, but since I couldn't get that to work, I converted it to text (#12/2/2012#)
Can anyone help me find a way to getthe date value for the calendar entry from Excel?
Here is my code:
Code:
Dim objOL 'As Outlook.Application
Dim objAppt 'As Outlook.AppointmentItem
Dim nDate As String
Const olAppointmentItem = 1
Const olMeeting = 1
Const olFree = 0
Range("d3").Select
nDate = ActiveCell
Set objOL = CreateObject("Outlook.Application")
Set objAppt = objOL.CreateItem(olAppointmentItem)
objAppt.Subject = "Holiday 1"
objAppt.Start = nDate
objAppt.AllDayEvent = True
objAppt.BusyStatus = 3
objAppt.Save
Set objAppt = Nothing
Set objOL = Nothing
Comment