Automate in Outlook 2007 to fill the user-define column TYPE with same data info

We are trying to create a macro or VBA where we fill a user-define column labeled TYPE with "PROYECTONE".

We have configure the specific Inbox folder so the user-define column TYPE can be edited.  That is what we do at any given time; we click the row and the column TYPE once and it becomes editable, then we type the word PROYECTONE.

What's the best to go about it?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rayluvsAuthor Commented:
FYI, to make the column editable:

    1. We first create the User-Define Field
    2. Then inserted the column on the InBox folder
    3. Went to  View | Current View | Customize Current View | Other Settings
    4. Checkmark  Allow on in-cell editing
David LeeCommented:
Hi, Ramante.

Sorry, but I don't understand the question.  Are you asking for a way to click a button and have a value entered in the user-defined column?
rayluvsAuthor Commented:
Yes.  A button or just running the Macro name, be executed and have that column or where the mouse is click on the column.  

FYI, the entry ID: 36914936 is only to show how we make a column editable manually.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

David LeeCommented:
I'm still not clear on what you're asking for, so this is a bit of a shot in the dark.

The code below adds a user-defined property named "PROYECTONE" to each selected item and populates it with the value "Enter a value".  Once you've added the property to at least one item in the folder you can modify the view to show the property in a column.
Sub FillInColumn()
    Dim olkMsg As Outlook.MailItem, olkProp As Outlook.UserDefinedProperty
    For Each olkMsg In Application.ActiveExplorer.Selection
        Set olkProp = olkMsg.UserProperties.Item("PROYECTONE")
        If TypeName(olkProp) = "Nothing" Then
            Set olkProp = olkMsg.UserProperties.Add("PROYECTONE", olText, True)
            olkProp.Value = "Enter a value"
        End If
    Set olkMsg = Nothing
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rayluvsAuthor Commented:
Strange, we're are not getting an email from EE when an answer has been registered here.

Anyways, we'll check your recommendation.
rayluvsAuthor Commented:
Just FYI: we think that you have a good grasp of what we want.  

Attached is a pic of the inbox before and after with the column PROYECTONE status.

We ran the script and is giving an error (see pic attached).  We though it was becuase it was already existed the column, so we place another name just in case and same error.

Please advice
rayluvsAuthor Commented:
We've been googling, trying to get this script running but no success.

We found 2 EE question you assisted on and that looks related to ours; we reviewed it and tried to compare and learn any differences but still no success:
(ID: 17528213)

(ID: 24685326)

Also, we have commented out the following line because it keeps creating it when already created the first time:

Set olkProp = olkMsg.UserProperties.Item("PROYECTONE")

Nevertheless, please advice o our problem... Thanx
David LeeCommented:
Try changing this line

    Dim olkMsg As Outlook.MailItem, olkProp As Outlook.UserDefinedProperty


    Dim olkMsg As Outlook.MailItem, olkProp As Object
rayluvsAuthor Commented:
Yes it Worked!!!

rayluvsAuthor Commented:
Please see the the question related to this project (I place another question because this one has been completely answered).  Goto:
rayluvsAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.