Help!

How do I grab a field property (like .value) so I can modi..

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Forms RSS
Next:  "Remove from My Contacts"  
Author Message
cmonroe21 via OfficeKB.co
External


Since: May 26, 2009
Posts: 5



PostPosted: Wed Jun 03, 2009 7:10 pm    Post subject: How do I grab a field property (like .value) so I can modify it via OL code?
Archived from groups: microsoft>public>outlook>program_forms (more info?)

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

--
Message posted via http://www.officekb.com
Back to top
Sue Mosher [MVP]
External


Since: Mar 19, 2009
Posts: 41



PostPosted: Wed Jun 03, 2009 7:10 pm    Post subject: Re: How do I grab a field property (like .value) so I can modify it via OL code? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"cmonroe21 via OfficeKB.com" <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
>
> --
> Message posted via http://www.officekb.com
>
Back to top
cmonroe21 via OfficeKB.co
External


Since: May 26, 2009
Posts: 5



PostPosted: Wed Jun 03, 2009 8:10 pm    Post subject: Re: How do I grab a field property (like .value) so I can modify it via OL code? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/outlook-prog-forms/200906/1
Back to top
Sue Mosher [MVP]
External


Since: Mar 19, 2009
Posts: 41



PostPosted: Wed Jun 03, 2009 8:10 pm    Post subject: Re: How do I grab a field property (like .value) so I can modify it via OL code? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"cmonroe21 via OfficeKB.com" <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
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.aspx/outlook-prog-forms/200906/1
>
Back to top
cmonroe21 via OfficeKB.co
External


Since: May 26, 2009
Posts: 5



PostPosted: Thu Jun 04, 2009 6:10 pm    Post subject: Re: How do I grab a field property (like .value) so I can modify it via OL code? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thank you Sue. I think you are my new hero Smile

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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/outlook-prog-forms/200906/1
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum