473,385 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

outlook object library - choose a category

135 100+
I am using the following code I found online to send an appointment to Outlook:
Expand|Select|Wrap|Line Numbers
  1. Private Sub AddAppt_Click()
  2. ' Save record first to be sure required fields are filled.
  3. DoCmd.RunCommand acCmdSaveRecord
  4. ' Exit the procedure if appointment has been added to Outlook.
  5. If Me!AddedToOutlook = True Then
  6. MsgBox "This appointment already added to Microsoft Outlook"
  7. Exit Sub
  8. ' Add a new appointment.
  9. Else
  10. Dim outobj As Outlook.Application
  11. Dim outappt As Outlook.AppointmentItem
  12. Set outobj = CreateObject("outlook.application")
  13. Set outappt = outobj.CreateItem(olAppointmentItem)
  14. With outappt
  15. .Start = Me!ApptDate & " " & Me!ApptTime
  16. .Duration = Me!ApptLength
  17. .Subject = Me!Appt
  18. If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
  19. If Not IsNull(Me!ApptLocation) Then .Location = _
  20. Me!ApptLocation
  21. If Me!ApptReminder Then
  22. .ReminderMinutesBeforeStart = Me!ReminderMinutes
  23. .ReminderSet = True
  24. End If
  25. .Save
  26. End With
  27. End If
  28. ' Release the Outlook object variable.
  29. Set outobj = Nothing
  30. ' Set the AddedToOutlook flag, save the record, display a message.
  31. Me!AddedToOutlook = True
  32. DoCmd.RunCommand acCmdSaveRecord
  33. MsgBox "Appointment Added!"
  34. Exit Sub
  35. AddAppt_Err:
  36. MsgBox "Error " & Err.Number & vbCrLf & Err.Description
  37. Exit Sub
  38. End Sub
What do I need to add to be able to set the category (or categorize) the appointment? I need to be able to categorize the appointment as "Important"... Ideas?

Thanks
Jun 18 '10 #1
6 4346
patjones
931 Expert 512MB
In the section where Start, Duration and Subject are assigned you should also be able to do .Importance = ...

There are a large number of different properties that you can assign to an Outlook object. See the MS support page here for a list of all the object members.

Also bear in mind that you will need to set the reference to the Microsoft Outlook object library in order to use this code. Go to Tools > References...

Pat
Jun 18 '10 #2
MyWaterloo
135 100+
Pat, thank you for the reply. I am currently using this code with success I am just not familiar enough with using the Microsoft Outlook object library to know what was need to add this additional feature. Thanks again and I'll give it a try!
Jun 18 '10 #3
MyWaterloo
135 100+
OK,I need the .Categories as apposed to .Importance. What do I put after this?

.Categories = ???

I would like my new appointment to be "categorized" as "Important" which then makes the appointment red on my calendar in Outlook. Do I just insert the word or is it a number?
Expand|Select|Wrap|Line Numbers
  1. 'example:
  2. .categories = Important
  3. 'or
  4. .categories = 3 
Help?
Jun 18 '10 #4
patjones
931 Expert 512MB
I think there are a couple of different things you can do. One is to bring up the dialog that will allow you to pick the category, using outappt.ShowCategoriesDialog.

Otherwise, I think you need to pick the color(s) by saying .Categories = "Red Category".

Pat
Jun 18 '10 #5
MyWaterloo
135 100+
That did it! I used .Categories = "Important" where "Important" is the name of a category I created in outlook already. Thanks so much!
Jun 19 '10 #6
patjones
931 Expert 512MB
@MyWaterloo
You're welcome!
Jun 19 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Job Lot | last post by:
I am retrieving message from the Inbox as follows: (MS Article ID 310258: How to use the Microsoft Outlook Object Library to retrieve a message from the Inbox by using Visual C# .NET) Try Dim...
3
by: Girish NS | last post by:
Hi, I'm trying to store appointment data to outlook appointments from a c# application. So I'm using outlook object model thru COM interop. But in the applicaton some of the methods like...
2
by: John Davis | last post by:
In VB.NET, sounds like we no longer can use Microsoft Outlook Object Library (MSOUTL.OLB)?? But Microsoft Excel and Word object library still exist. In VB6, we can just add outlook library...
0
by: Mads Westen | last post by:
Hi, I'm trying to code a application that can create a new email in Outlook I have coded my project in VS 2003, but now I have upgraded to VS 2005. I can not build my project anymore, I get a...
0
by: alwayssmiling | last post by:
hi all, i want to open a outlook pst file. And i need to check whether that file is already opened or not. you can add oulook pst file using namespace. addstore(object store) ...
4
by: fniles | last post by:
I am using VB.NET 2008 and in the COM Tab I add a reference to "Microsoft Outlook 11.0 Object Library". When I send an email, a window with the following message (and buttons Yes, No, Help) always...
1
by: Sylfelin | last post by:
Hello, If I use Microsoft Outlook 12.0 Object Library (Outlook 2007) COM Object in my application, the custommer must have the outlook 2007 on his computer ? But if i use Microsoft Outlook...
0
by: ram1927 | last post by:
Here is my platform: .net framewrok 1.1 Windows Xp Propfessional MS Office 2007. Visual Studio 2003. Window based application. I did below mentioned steps: 1. Right click on C#...
3
by: James Bowyer | last post by:
I need to enable the Outlook object library (MSOUTL.olb) to enable my database to send emails (I have tried many methods, this seems to be the only method that doesn't fall fowl of the computers...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.