![]() |
|
|
|
#1
|
|||
|
|||
|
I have an appt every year, for 10 days, that only last an hour.
I can do 1 appt for all day for 10 days every year, but I would like for it to show just 1 hour. In the past I would make 10 appts that occur every year. Just wondering if there is already a way to do it? Thanks |
|
#2
|
||||
|
||||
|
I don't believe that is possible - stick with the 10 appointments. If the occur on the same day each year make them repeating. Otherwise enter the start date and start time of the appointment in the following macro when prompted and it will create 10 appointments:
Code:
Sub CreateTenAppts()
Dim i As Integer
Dim vDate As Variant
Dim sDate As String, sTime As String
Const sSubject As String = "Strategy Meeting" 'appointment subject
Const sLocation As String = "Conference Room" 'appointment location
Const sBody As String = "" 'The body text of the appointment
Const lMinutes As Integer = 60 'the length in minutes of the appointment
sDate = InputBox("Enter start date 'mm/dd/yyyy' :")
vDate = Split(sDate, "/")
sTime = InputBox("Enter start time 'hh:mm' :")
For i = 0 To 9
sDate = CStr(vDate(0)) & "/" & CStr(Val(vDate(1) + i)) & "/" & CStr(vDate(2))
CreateAppointment sSubject, sLocation, sBody, sDate, sTime, lMinutes, False
Next i
lbl_Exit:
Exit Sub
End Sub
Private Sub CreateAppointment(strSubject As String, _
strLocation As String, _
strBodyText As String, _
strDate As String, _
strTime As String, _
Optional iMinutes As Integer, _
Optional bAllDay As Boolean = True, _
Optional strName1 As String, _
Optional strName2 As String, _
Optional lngStatus As Long = olNonMeeting)
Dim olItem As AppointmentItem
Dim rRequiredAttendee As Recipient
Dim rOptionalAttendee As Recipient
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
Set olItem = CreateItem(olAppointmentItem)
With olItem
.MeetingStatus = lngStatus
.Subject = strSubject
.Location = strLocation
.Start = strDate & Chr(32) & strTime ' & strAMPM
.Duration = iMinutes
.AllDayEvent = bAllDay
'Set rRequiredAttendee = .Recipients.Add(strName1)
'rRequiredAttendee.Type = olRequired
'Set rOptionalAttendee = .Recipients.Add(strName2)
'rOptionalAttendee.Type = olOptional
.Display
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range
oRng.Text = strBodyText
End With
olItem.Close olSave
Set olItem = Nothing
Set rRequiredAttendee = Nothing
Set rOptionalAttendee = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
lbl_Exit:
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
Thanks, Phil.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How can I count per year and per week the total number of times a code occurs
|
Stefan_Deckers | Excel | 3 | 09-19-2020 02:36 PM |
Creating a formula that will determine if a code type occurs within 90 days of anotherspecific type
|
wheddingsjr | Excel | 7 | 10-16-2018 12:13 PM |
| converting a return of days in a formula to year 1, 2, 3 ect. | bonth123 | Excel | 4 | 06-09-2017 07:00 AM |
| How to search for a specific year from a table with year range? | Wii | Excel | 0 | 05-05-2015 12:40 PM |
| How to calculate a rolling year-to-date percentage by quarter as the year progresses | sleake | Excel Programming | 2 | 04-23-2015 11:51 AM |