Outlook Appointment Item: Set the "Label" - vba

In Outlook 2003, when you have a calendar event, it has an option to set its Label to Important, Business, Personal, etc, each having a different colour. This colour will be the colour of the scheduled event on your calendar.
My problem is I have no idea how to change it using an AppointmentItem. I've looked through the object browser and see nothing that looks like it relates to changing the label/colour. I'm accessing Outlook through an Access module, and have code set up to change the object's subject etc.
So what I want to know is, is there a way to change the events label/colour through an appointmentItem? And if so, how?

The term you are looking for is the item's Category. You can modify it using the Categories property on the AppointmentItem object. It's a string, so you can simply put the value you want in there.
The color displayed is customizable by the user, so you are better off just setting the label name and not try to put a specific color for the appointment.

VBA has no way to set the label color. You would need CDO for this. See http://www.outlookcode.com/codedetail.aspx?id=139 for sample code.

Related

VSTO Outlook Add-in Set a short note/info on Mailitem

I need to set a short note or info on mail item programmatically.
As shown below for instance.
I tried with setting a custom mail item category but it doesn't appear on mail item when it is opened. I can only see it in preview.
Setting something like label or tag also works for me. How do I achieve this?
Thanks in Advance.
That area is not accessible for customization and it does not show any particular property of the selected message,

Text selected / right click event (Outlook 2007 VBA)

I'm looking for an event that's raised when a user selects text in the preview pane of an email. E.g. you're viewing an email in the preview pane and select some text. I didn't see anything in the object reference to this effect, but the namespace is so large, it seems like there's always some object somewhere that does exactly what I need, which I'm not aware of.
Overall, what I'd like to do is see if the selected text matches a pattern and if so, insert a sub-menu in the right click menu (the one that says Copy, Who Is, Synonyms, Translate..). Help with this would be appreciated too. I believe the CommandBar is "text", but I'm unsure how to go about accessing this via name.
The Outlook object model doesn't provide anything for that.

Accessing control events of email form

I am trying to develop an add-on for outlook which requires handling control changes.
For instance I need to do some stuff when email subject is changed. To do this, I need to access text change event of subject texbox.
I was just wondering whether anyone has done such thing or not?
Thanks
Check the PropertyChange event:
Occurs when a standard property (for example, Subject or To) of a
Microsoft Outlook item is changed. The property name is passed to the
event so that you can determine which property was changed.

Setting Lotus Notes section border using VBA

Friends,
I'm using VBA to create Lotus emails populated from an Excel spreadsheet, and I'm stuck on a really silly point.
When I create a new section in the note, business rules require me to give it a border. They've been doing this manually for years and are used to doing this from the Notes UI. They create a new section, then go to its properties and then change it to have a border (please see the border and style part in the properties window in this screenshot).
I can't figure out how to add this border through VBA. Any ideas? I've tried changing the TitleStyle, but that only affects things like fonts and color. I have everything else done, just stuck on the border!
Thanks!
Mike
The NotesRichTextSection class doesn't give you any way to change the border, unfortunately. Rich text items in Lotus Notes aren't supported very well via the API, so often you'll find a mismatch between what you can do on the client vs. what you can do in code.
There might be a workaround if you're up for trying it. First you need to create a simple form in Notes that has a rich text field, let's call it Body, surrounded by a section. Setup the section to appear however you want, with the border set, etc. You'll also need another hidden text field, called Title, and you'll set the section's title to be computed based on that Title field.
Then in your VBA code you're going to create a new NotesDocument based on that form. You'll set the Title field, and you'll add content into the Body rich-text item. Then you'll need to call the ComputeWithForm method followed by the Save method. Finally, you can use the RenderToRTItem method on the document to put the entire document into your original note's rich text field. Make sense?
No guarantees that will work from VBA, but I've done similar things in the past using LotusScript and it did the trick.
You could just set the borders of the cells you are copying using the Borders() property.
Example:
Range("B2:C4").Borders.LineStyle = xlDash
Range("B2:C4").Borders(xlEdgeBottom) = RGB(255,0,0)

How do I check programmatically if any document properties of a MS Word 2007 document has changed?

For example, I want the Title fields in the body and the page headers of the document to be updated automatically whenever the Title field in the document properties panel is changed. I know how to update the fields, but I want to know the name of the event that will tell me when the document properties have changed.
Your help will be appreciated. Thanks.
I also asked it on the MSDN Forums.
You can certainly check for these kinds of things in some of the events, such as DocumentBeforeClose or WindowSelectionChange, but this may be overkill. Instead, you could just use fields - they will update automatically. For example, go to Insert and then click on Quick Parts and then Field... Go to the Document Information section in the dropdown on the left and choose Title. Then, insert that and go back to the Home tab on the Ribbon and set its style to Title.
You also mention you also want page headers - are those properties you're setting in the Document Panel?
Word doesn't have any events like that. The best you might be able to do is use the selection change event, which will happen fairly often, but then you have to check all the propertiers of all the documents.
I think you're trying to do something that Word doesn't normally do. There are certain times when fields are updated and that's it. Teach you users how it works.