How do I grab a field property (like .value) so I can modify it via OL code?

Status
Not open for further replies.
C

cmonroe21

I am creating a custom OL2007 task form with coding in Outlook. I saw the

outlookcode.com page "Syntax for outlook property and form control values and

events" and got the PropertyChange fucntion to work with a case statement

(see first two lines of case statement). But when I want to change the value

of the field that I want to it doesn't work. A little background, I have a

text box named txtTestBox bound to a user-defined field "TestBox". I know my

function and case statement works, but how do I grab my user-defined field to

manipulate it like I could the message box and the task.subject? I tried

SEVERAL different syntaxes, as you can see below, but I think it's obvious

I'm clueless. (Note-- I thought I would use the PropertyChange function

rather than the CustomPropertyChange because I did not create a custom

property... I created a custom field but not a custom property... but it will

only work with CustomPropertyChange??) (And yes, I only try the lines in the

case statements one at a time.)

Any input??

Sub Item_CustomPropertyChange(ByVal Name)

on error resume next

Select Case Name

Case "Field1"

'MsgBox "You changed Field1" 'works

'Item.subject = "Works!" 'works

'Item.TestBox.text = "works!" 'doesn't work??

'Item.TestBox.value= "works!" 'doesn't work??

'TestBox.text = "works!" 'doesn't work??

'TestBox.value = "works!" 'doesn't work??

'Item.TestBox = "works!" 'doesn't work??

'TestBox = "works!" 'doesn't work??

End Select

End Sub

 
A custom field and a custom property are the same thing. "Field" is a

synonym for "property" in the Outlook code context. If you go back to the

page you cited, at http://www.outlookcode.com/article.aspx?ID=38, the

section on custom properties shows how to access custom field/property

values. It also shows how to work with unbound controls, in case you have

some of those, too.

Sue Mosher

"cmonroe21 " <u48566@uwe> wrote in message

news:9710fdc23ba0d@uwe...
> I am creating a custom OL2007 task form with coding in Outlook. I saw the
> outlookcode.com page "Syntax for outlook property and form control values
> and
> events" and got the PropertyChange fucntion to work with a case statement
> (see first two lines of case statement). But when I want to change the
> value
> of the field that I want to it doesn't work. A little background, I have
> a
> text box named txtTestBox bound to a user-defined field "TestBox". I know
> my
> function and case statement works, but how do I grab my user-defined field
> to
> manipulate it like I could the message box and the task.subject? I tried
> SEVERAL different syntaxes, as you can see below, but I think it's obvious
> I'm clueless. (Note-- I thought I would use the PropertyChange function
> rather than the CustomPropertyChange because I did not create a custom
> property... I created a custom field but not a custom property... but it
> will
> only work with CustomPropertyChange??) (And yes, I only try the lines in
> the
> case statements one at a time.)
> Any input??

> Sub Item_CustomPropertyChange(ByVal Name)
> on error resume next
> Select Case Name
> Case "Field1"
> 'MsgBox "You changed Field1" 'works
> 'Item.subject = "Works!" 'works
> 'Item.TestBox.text = "works!" 'doesn't work??
> 'Item.TestBox.value= "works!" 'doesn't work??
> 'TestBox.text = "works!" 'doesn't work??
> 'TestBox.value = "works!" 'doesn't work??
> 'Item.TestBox = "works!" 'doesn't work??
> 'TestBox = "works!" 'doesn't work??
> End Select
> End Sub

> >
>
 
Thank you! Item.UserProperties("TestBox").Value = "works!" worked!!

I thought that TestBox was a field that had properties, but was not a

property itself... obviously my train of thought was not correct! Got my

head wires crossed! Thank you for your help!

Sue Mosher [MVP] wrote:
> A custom field and a custom property are the same thing. "Field" is a
> synonym for "property" in the Outlook code context. If you go back to the
> page you cited, at http://www.outlookcode.com/article.aspx?ID=38, the
> section on custom properties shows how to access custom field/property
> values. It also shows how to work with unbound controls, in case you have
> some of those, too.
>
> >I am creating a custom OL2007 task form with coding in Outlook. I saw the
> > outlookcode.com page "Syntax for outlook property and form control values

> [quoted text clipped - 33 lines]
> > End Select
> > End Sub



 
No, your first instinct was correct. A look at the object browser (F2 in

VBA) would show you that the UserProperty object itself has properties, such

as the Value property in your code snippet.

Sue Mosher

"cmonroe21 " <u48566@uwe> wrote in message

news:971188b125ec1@uwe...
> Thank you! Item.UserProperties("TestBox").Value = "works!" worked!!

> I thought that TestBox was a field that had properties, but was not a
> property itself... obviously my train of thought was not correct! Got my
> head wires crossed! Thank you for your help!

> Sue Mosher [MVP] wrote:
> >A custom field and a custom property are the same thing. "Field" is a
> >synonym for "property" in the Outlook code context. If you go back to the
> >page you cited, at http://www.outlookcode.com/article.aspx?ID=38, the
> >section on custom properties shows how to access custom field/property
> >values. It also shows how to work with unbound controls, in case you have
> >some of those, too.
> >
> >>I am creating a custom OL2007 task form with coding in Outlook. I saw
> >>the
> >> outlookcode.com page "Syntax for outlook property and form control
> >> values

> >[quoted text clipped - 33 lines]
> >> End Select
> >> End Sub


> >
>
>
 
Thank you Sue. I think you are my new hero :)

Sue Mosher [MVP] wrote:
> No, your first instinct was correct. A look at the object browser (F2 in
> VBA) would show you that the UserProperty object itself has properties, such
> as the Value property in your code snippet.
> > Thank you! Item.UserProperties("TestBox").Value = "works!" worked!!
> >

> [quoted text clipped - 16 lines]
> >>> End Select
> >>> End Sub



 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Grab info from attachment and put into SQL db Outlook VBA and Custom Forms 1
S Using copy paste to grab email addresses from the TO: address fiel Using Outlook 14
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
D Outlook VBA forward the selected email to the original sender’s email ID (including the email used in TO, CC Field) from the email chain Outlook VBA and Custom Forms 2
D Outlook 365 Custom forms field limit? Outlook VBA and Custom Forms 4
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
S Combination Field (Date Format) Outlook VBA and Custom Forms 0
Witzker Add a text line at the end of the note field in all selected Contacts Outlook VBA and Custom Forms 7
M copy field value to custom field Outlook VBA and Custom Forms 0
J images on note field display fraction of size Using Outlook 5
C Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 4
J How to create a drop down user defined field that will appear on an inbox view Outlook VBA and Custom Forms 8
C Move or copy from field to field Outlook VBA and Custom Forms 0
O Filter-Query Builder-Description - what field name to use? Using Outlook 4
J VBA Cannot programmatically input or change Value for User Defined field Using Outlook 1
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
N Contact Form Notes Field Touch vs Mouse Using Outlook 0
S CONTACT FIELD PRINT ORDER Outlook VBA and Custom Forms 1
V Checking for empty field Outlook VBA and Custom Forms 2
V Update new custom field Outlook VBA and Custom Forms 5
HappyDaddy007 "Size" on field chooser/column displaying incorrect value Using Outlook 3
A Is there an ID field you can use to pair a reply to the sent email? Outlook VBA and Custom Forms 4
H Information from user defined field into Excel Outlook VBA and Custom Forms 7
I Outlook 2003 shows html code when To: field is empty Using Outlook 7
Terry Sullivan Sender's Name Doesn't Appear in the From Field on Outlook 365/IMAP Using Outlook 2
D Outlook Contacts Notes Field Photos to Smartphone Using Outlook 0
S Custom Field Cannot Be Displayed In Views Outlook VBA and Custom Forms 2
Terry Sullivan Sender Field Displays My E-Mail Address, Not My Name Using Outlook 1
S Create a clickable custom column field Outlook VBA and Custom Forms 0
B User defined field for messages with 'me' in the [To], [Cc] line Using Outlook 0
V Limiting text length in free text field Outlook VBA and Custom Forms 2
C Outlook 2016 Conditional Format for User Defined Field Using Outlook 1
C Copy Outlook contact field value to another field Outlook VBA and Custom Forms 1
A new labeled phone field Using Outlook 4
V Making a Date field mandatory in outlook form Outlook VBA and Custom Forms 2
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
BretAB Is it possible to add a lookup field to a Message form? Outlook VBA and Custom Forms 4
N Exporting IM Address field Using Outlook 2
M Using field names to capture a data element Using Outlook 0
J How to restore field no longer visible in field chooser? Using Outlook 1
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
R What's supposed to appear when just clicking into the search field? Using Outlook 7
A Missing context menu on Location field Using Outlook 2
G Entered data in custom field goes in card and does not stay in list view Outlook VBA and Custom Forms 1
C Changed By field not displaying individual user's name in O365 Shared Mailbox Using Outlook 9
M Making Subject field writable (disable Read Only) Outlook VBA and Custom Forms 2
C Import Outlook 2016 contacts into to: field Using Outlook 1
T Source of Outlook 2016 Address field dropdown "Other Suggestions" Using Outlook 3
S BCM Compulsory field, New opportunity Outlook VBA and Custom Forms 0

Similar threads

Back
Top