# [SOLVED] Link a Cell in Excel to Outlook Calendar Appointment (2007)



## HeatherBlack (Jul 13, 2010)

I have an excel file and I would like to create a column that will allow the user to click in the cell and open up an appointment in an outlook calendar. Is this possible to do? I am not familiar with VBA so if I have to go that route it would be very helpful if I could get some code examples.

thank you!

Heather


----------



## Smilinsue (Aug 3, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

I am looking for the same question and wonder why you have not been asnwered yet.


----------



## RSpecianjr (Jan 20, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

Hey all,

It can be done with VBA. Its just a matter of designing it. You say you want to click on a cell in a particular column and open an appointment in Outlook. How are you pointing that cell to the specific appointment?

Are you looking to search based off date? Specific name of the appointment? etc

What information is in your Excel file?

Pointing Excel and Outlook at each other is not very complicated, but getting into the nitty gritty can be. If you can be more specific we can likely figure something out.

HTH,

Robert D. Specian Jr.


----------



## Smilinsue (Aug 3, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

I want to have a cell in excel that has a hyperlink that opens up an outlook invite to the person who clicks on it. I have seen it happen but don't know how they did it. The row explains what the class is about and that cell's hyperlink invites you to attend it. Is that a macro?


----------



## HeatherBlack (Jul 13, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

Hi Robert,

I will link to the OUTLOOK appointment based on (1) Date and (2) Subject.

My excel file has a bunch of columns that describe classes, including Date and Subject (which is the name of the class). 

The point is to allow the user to click on a cell containing class date and then the OUTLOOK appointment for that date (and subject=class name) will automatically open up.

Please let me know if I have given you enough information.

I appreciate your help with this project very much!

Heather


----------



## RSpecianjr (Jan 20, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

Hey,

Both of these things can be done using a macro, I have a busy day at work today because a mayorial candidate is coming around to see how/what we are doing. I should have something for both of you this weekend. If anyone else would like to write it, feel free = )

Thanks,

Robert D. Specian Jr.


----------



## HeatherBlack (Jul 13, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

Hi Robert

Thank you for your help with this problem. I look forward to reading your next post!


----------



## RSpecianjr (Jan 20, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

Thanks for your patients! I had a lot come up this weekend and hadn't had the time to get back to it. Here is a macro that should work for you Heather:


```
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim OutApp As Object
Dim OutNameSpace As Namespace
Dim Appt As AppointmentItem
Dim col As Integer
Dim rw As Integer

col = Target.Column
rw = Target.Row

'this denotes which column the link is in 3=C
If col = 3 Then
If Len(ActiveSheet.Cells(rw, col - 1)) > 1 Then
If Len(ActiveSheet.Cells(rw, col - 2)) > 1 Then
 
Set OutApp = New Outlook.Application
Set OutNameSpace = OutApp.GetNamespace("MAPI")

Set Appt = OutApp.CreateItem(olAppointmentItem)

Appt.Subject = ActiveSheet.Cells(rw, col - 1).Value
Appt.Start = Appt.Start = ActiveSheet.Cells(rw, col - 2).Text
Appt.Duration = 60
'Appt.Save
Appt.Display

End If
End If
End If
End Sub
```
This will go in the Worksheet you want to use to create the Appointment. The information it is based off off is Date and Subject... I set the Duration to 1 hour. 
The date should be in this formate: 8/11/2010 9:00:00 AM
This is all also based on the link being in column C, Subject the column prior (B), Date/Time the column before Subject (A).


Smilinsue,

You can use this:


```
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim OutApp As Object
Dim OutNameSpace As Namespace
Dim Appt As AppointmentItem
Dim col As Integer
Dim rw As Integer

col = Target.Column
rw = Target.Row

If col = 3 Then
 
Set OutApp = New Outlook.Application
Set OutNameSpace = OutApp.GetNamespace("MAPI")

Set Appt = OutApp.CreateItem(olAppointmentItem)

Appt.Subject = "My Subject here."
Appt.Start = #8/11/2010  9:00:00 AM#
Appt.Duration = 60
'Appt.Save
Appt.Display

End If
End Sub
```
HTH,

Robert D. Specian Jr.


----------



## Smilinsue (Aug 3, 2010)

*Re: Link a Cell in Excel to Outlook Calendar Appointment (2007)*

Thank you! Much appreciated!


----------

