That was my next step. Although this step would look
more like writing a script (I like to use Word VBA with
Outlook Reference for these one-time things) that goes
through 3,000 contacts and copies the Item.body over to
the textbox for the existing contacts. Fun! Be so much
more fun though if Outlook would dump VBscript and use
full blown VBA. That's my only quibble.
Is it possible though to refer to the control
programmatically (even if you can't lock it)? Just for
future reference in case something else comes along.
Thanks,
Malcolm
No, ho, no, that's not what it does at all. You would put that code in
Item_Open event handler of your custom form. In other words, the code would
run only when the user opens such an item.
The code you originally posted is correct for referring to the control if
you've renamed it EditNote.

Signature
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
> That was my next step. Although this step would look
> more like writing a script (I like to use Word VBA with
[quoted text clipped - 27 lines]
> > TextBox1.Text = Item.Body
> > TextBox1.Visible = True
> >"Malcolm" <anonymous@discussions.microsoft.com> wrote in
> message
[quoted text clipped - 48 lines]
> >
> >.
Malcolm - 21 Jul 2004 16:37 GMT
It's all working now, here's the final code. I changed
the code slightly to check against user names stored in
an olNoteItem in a subfolder of the contact folder. This
note item looks like:
Administrative:
John;
Jill;
Jack;
The controls I am using:
"Notes" = the Note/Message standard object
"EditNotes" = checkbox to lock/unlock it
Here is the code:
Sub EditNotes_Click()
dim MyValue, curUser, objPage, Notes, i,
boolFlag, NoteCheckBox
dim curFolder, fld, Allow_Users, User_String,
User_Position, User_Array
curUser = Application.GetNameSpace
("MAPI").CurrentUser
Set objPage = Item.GetInspector.ModifiedFormPages
("General")
MyValue = objPage.Controls("EditNotes")
Set curFolder = Item.Parent
Set fld = curFolder.Folders("CompanyNotes")
Set Allow_Users = fld.items("Administrative:")
User_String = Allow_Users.body
User_Position = instr(1, User_String, ":")
User_String = Mid(User_String, User_Position + 1,
len(User_String))
User_String = Replace(replace(User_String, Chr
(13) , ""), Chr(10), "")
User_Array = Split(Cstr(User_String), ";")
for i = 0 to Ubound(User_Array)
if (curUser = User_Array(i)) then
set Notes = objPage.Controls
("Notes")
Notes.ReadOnly = Not MyValue
boolFlag = true
Exit For
end if
next
if (Not boolFlag) then 'invalid user clicked,
make sure the checkbox is off
set NoteCheckBox = objPage.Controls
("EditNotes")
NoteCheckBox.Value = false
end if
End Sub
Thanks for the help Sue!
Malcolm