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

 
S

Sue Mosher [MVP]

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

> >
>
 
C

cmonroe21

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



 
S

Sue Mosher [MVP]

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


> >
>
>
 
C

cmonroe21

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
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
M Sudden change in From field - now very short Using Outlook 4
L Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 33
J Assess content of User Defined Field in Rule Using Outlook 3
K Contact notes field replicating Using Outlook 6
G Copy Contact field to Appointment Custom Form Field Outlook VBA and Custom Forms 2
Caio "From" field doesn't show extra email addresses in Outlook 2016. Using Outlook.com accounts in Outlook 6
T "From" field font size in table list of emails Using Outlook 0
skyfox VBA to search email subject field for a certain string Outlook VBA and Custom Forms 3
E Inbox field customization Using Outlook 1
A How to get rid of Contacts field when printing emails? Using Outlook 0
George Simpson "Switch to HTML" in Outlook 2016 notes field Using Outlook 1
S Outlook User defined date field (UDF) not syncing Using Outlook 2
I Locating an email after search - Field Chooser Using Outlook 2
Diane Poremsky Create a custom field for Outlook messages Using Outlook 0
Diane Poremsky Create a Custom Numbering Field for Outlook messages Using Outlook 0
T Uploading Outlook 2016 Contacts to Exchange Server Drops "Company" field data in 30% of records Exchange Server Administration 4

Similar threads

Top