VBA Excel Setting Outlook Appointments From Spreadsheet Data

Status
Not open for further replies.

Sbar47

New Member
Joined
Mar 31, 2018
Messages
3
I'm trying to create a Macro to create Outlook appointments based on words in Column B. For some reason, my code to create appointments is creating each item in the subfolder twice.
Also, I'm trying to get the appointment date to be column F -30 days.

I tried <code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; background-color: rgb(239, 240, 241); white-space: pre-wrap;">oAppt.Start = cell(0, 6).value -30.

</code>
My code right now is below.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">
Sub
CreateAppointment()

Dim ws As Worksheet
Dim subfolders()AsString
Dim cell As Range, i AsInteger
Dim oAppt As AppointmentItem

subfolders
= Split("UGD GAS,FOUNDATION REDESIGN",",")

Application
.ScreenUpdating =False

ForEach ws In ActiveWorkbook.Worksheets
ForEach cell In ws.Range("B1:B100")
For i = LBound(subfolders)To UBound(subfolders)
If cell.Value = subfolders(i)Then
Set oAppt = Outlook.Application.CreateItem(olAppointmentItem)

oAppt
.Subject = cell.Value
oAppt
.Start =Date-30
oAppt
.Save
EndIf
Next i
Next cell
Next

Application.ScreenUpdating = True


End Sub


</code>Link to sample of my spreadsheet data
https://drive.google.com/open?id=1o74ZFwL4IbXt_U45dRp38Kj_DTFqp3B7

Any help would be much appreciated!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Duplicate https://www.mrexcel.com/forum/excel...ng-outlook-appointments-spreadsheet-data.html

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

Note that sometimes posts from new users require Moderator approval before you can see them on the public forums. When this happens, you should see a message to that effect when you try to post it. Please be patient and do not attempt to post the question again.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top