Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / January 2008

Tip: Looking for answers? Try searching our database.

Sending Calendar Appointment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy - 25 Jan 2008 13:16 GMT
Hi,

I am simply trying to create an appointment, invite someone and send it. The
code below does most of this. It creates the appointment for 4 days time
between 08:00 and 09:00 I get promted that a program is trying to send an
item so click Yes (once the Yes button appears) but the appointment does not
get sent. It is created in the Calendar though. Any ideas?

SD = Date + 4
SD = DateAdd("h", 8, SD)
ED = DateAdd("h", 1, SD)

 Set olApp = New Outlook.Application
 Set olNS = olApp.GetNamespace("MAPI")  ' open the MAPI Namespace
 
 Set olFolder = olNS.GetDefaultFolder(olFolderCalendar)
                       
 Set objAppointment = olFolder.Items.Add
 
 With objAppointment
     .RequiredAttendees = "fred@companyx.com"
     .Subject = "Event"
     .Start = SD
     .End = ED
     .Recipients.ResolveAll
     If .Recipients.ResolveAll Then
       .Send
       .Close olSave
     End If
 End With
Ken Slovak - [MVP - Outlook] - 25 Jan 2008 15:38 GMT
Try setting MeetingStatus. The order in which things are set can also be
important. Usually you set MeetingStatus first and then Location, Subject,
Start, Duration (or End), then recipients. Also add each Recipient object
separately and set the Recipient.Type to whatever you want (required =
olRequired).

See the help in the Outlook VBA in the Object Browser for MeetingStatus to
see a VBA code example.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Hi,
>
[quoted text clipped - 28 lines]
>      End If
>  End With
Andy - 28 Jan 2008 13:11 GMT
Excellent - Thanks Ken.

One subsidiary question - that promt that a program is trying to send an
item (which you have to click Yes to once the Yes button appears). I
recognise the need for this to protect use from malicious macros but if we
have written the code ourselves and it is running on our own machine - can't
that warning message be suppressed?

Thanks again.

> Try setting MeetingStatus. The order in which things are set can also be
> important. Usually you set MeetingStatus first and then Location, Subject,
[quoted text clipped - 37 lines]
> >      End If
> >  End With
Ken Slovak - [MVP - Outlook] - 28 Jan 2008 15:53 GMT
In Outlook 2003 and later if you write VBA code in the Outlook VBA project
and derive all of your Outlook objects from the intrinsic Application object
the code is trusted usually.

External code on Outlook 2007 is trusted if the machine has an up-to-date
A-V and has the settings set to allow external trusted code.

Otherwise you have to use one of the workarounds listed at
http://www.outlookcode.com/article.aspx?id=52.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Excellent - Thanks Ken.
>
[quoted text clipped - 6 lines]
>
> Thanks again.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.