Thread: Offsetting
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Offsetting

Dan,

You could simply use code like

.Body = Range("C1").Value & " - Annual Leave."

or, to be flexible and pick up the top of the current column:

.Body = Cells(1,Activecell.Column).Value & " - Annual Leave."

instead of

.Body = "Annual Leave."


HTH,
Bernie
MS Excel MVP


"Dan Wood" wrote in message
...
I have a macro to create an appointment in the outlook calender via a form
on
excel. What i would now like to do it add some offsetting for the text in
the
appoinment to show the name at the top of the form.

Within my spreadsheet i have names across from c1, d1, e1 and f1. Below
these headings will be what area somebody is working, for example from c3
to
c14 someone may be on annual leave. I want this to create a note saying
'Name
- Annual Leave'

My code can put the Annual Leave part but not he name:-

Sub Add_Appointment()
Dim myOlapp As Object
Dim myitem As Object

Set myOlapp = CreateObject("Outlook.Application")
Set myitem = myOlapp.createitem(1)

With myitem
.Body = "Annual Leave."
'.Duration = dur'
.AllDayEvent = True
.Subject = "A/L"
.Save

End With

Set myitem = Nothing
Set myOlapp = Nothing

End Sub

I need to update the 'Body' part of the text to look to c1 to get the
column
title.

All help is much appreciated, and if any more detail is needed im happy to
provide