A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Get text from keyword Listbox



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 4th 06, 08:48 PM posted to microsoft.public.outlook.program_forms
Michael Anderson
external usenet poster
 
Posts: 19
Default Get text from keyword Listbox

Hi,

i am working on a customised contact form. I have a keyword type ListBox
"ListBox3" with a field called "mxzNCRL2". It has 3 possible values:
Bunnings;Forklift;First Aid. I am trying to get the selected value or values
onto a text variable.

Dim txtmxzNCRL2
Dim objInspector

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)

Set objInspector = Item.GetInspector

txtmxzNCRL2 = Item.UserProperties("mxzNCRL2").Value

MyFile.WriteLine(txtmxzNCRL2)

MyFile.Close

Set fso = Nothing
Set objInspector = Nothing

I am told that I have a type mismatch and it doesn't read in the selected
value or values.

Any suggestions?
--
Thank You in Advance,

Michael Anderson
  #2  
Old February 5th 06, 08:03 PM posted to microsoft.public.outlook.program_forms
Hollis D. Paul
external usenet poster
 
Posts: 66
Default Get text from keyword Listbox

In article ,
=?Utf-8?B?TWljaGFlbCBBbmRlcnNvbg==?= wrote:
txtmxzNCRL2 = Item.UserProperties("mxzNCRL2").Value

That line doesn't make a bit of sense to me.

Take a look at these pages and look for coding examples on
www.outlook-code.com and www.slipstick.com concerning listboxes.

To populate a combo box on a Microsoft Outlook form 8/9/2005
Microsoft Outlook VBScript code sample to populate a combo or list box
on an Outlook form using an ADO disconnected recordset
http://www.outlookcode.com/d/code/popcombobox.htm - 21 KB


TIP: To get help with Microsoft Outlook programming objects
8/9/2005
Tip on how to use the Object Browser as an index to get more
information on Outlook model objects
http://www.outlookcode.com/d/tips/gethelp.htm - 15 KB


Microsoft Outlook Developer Tips 8/9/2005
Tips for developing applications with Microsoft Outlook
http://www.outlookcode.com/d/tips.htm - 19 KB


Controls on Microsoft Outlook Custom Forms 8/18/2005
Tips, tricks and other resources for using controls on Microsoft
Outlook forms
http://www.outlookcode.com/d/formcontrols.htm - 34 KB

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA



  #3  
Old February 6th 06, 09:38 AM posted to microsoft.public.outlook.program_forms
Michael Anderson
external usenet poster
 
Posts: 19
Default Get text from keyword Listbox

Sorry if my original code wasn't clear. I have slightly modified this but
still no joy:

As I said, I am working on a customised contact form. I have a keyword type
ListBox "ListBox3" with a field called "mxzNCRL2". It has 3 possible values:
Bunnings;Forklift;First Aid. I am trying to get the selected value or values
onto a text variable, "txtmxzNCRL2". No selected keyword prints out.
Supporting documentation doesn't discuss this.

Dim txtmxzNCRL2
Dim objInspector
Dim objPage

Set txtmxzNCRL2 = objPage.Controls("ListBox3")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)
Set objInspector = Item.GetInspector

MyFile.WriteLine(txtmxzNCRL2.Value)

MyFile.Close

--
Thank You in Advance,

Michael Anderson


"Hollis D. Paul" wrote:

In article ,
=?Utf-8?B?TWljaGFlbCBBbmRlcnNvbg==?= wrote:
txtmxzNCRL2 = Item.UserProperties("mxzNCRL2").Value

That line doesn't make a bit of sense to me.

Take a look at these pages and look for coding examples on
www.outlook-code.com and www.slipstick.com concerning listboxes.

To populate a combo box on a Microsoft Outlook form 8/9/2005
Microsoft Outlook VBScript code sample to populate a combo or list box
on an Outlook form using an ADO disconnected recordset
http://www.outlookcode.com/d/code/popcombobox.htm - 21 KB


TIP: To get help with Microsoft Outlook programming objects
8/9/2005
Tip on how to use the Object Browser as an index to get more
information on Outlook model objects
http://www.outlookcode.com/d/tips/gethelp.htm - 15 KB


Microsoft Outlook Developer Tips 8/9/2005
Tips for developing applications with Microsoft Outlook
http://www.outlookcode.com/d/tips.htm - 19 KB


Controls on Microsoft Outlook Custom Forms 8/18/2005
Tips, tricks and other resources for using controls on Microsoft
Outlook forms
http://www.outlookcode.com/d/formcontrols.htm - 34 KB

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA




  #4  
Old February 6th 06, 05:44 PM posted to microsoft.public.outlook.program_forms
Hollis D. Paul
external usenet poster
 
Posts: 66
Default Get text from keyword Listbox

In article ,
=?Utf-8?B?TWljaGFlbCBBbmRlcnNvbg==?= wrote:
MyFile.WriteLine(txtmxzNCRL2.Value)

That makes more sense, as you are now referencing the control. As far
as I recall, the list options are an array, and you have use the index
value of the control to pick the value out of the array. I don't
remember at all how they do multi-values.

Historically, VBScript is a cut down version of VB4. You really need
to look up, in a VB4 book, how such a control is used. It isn't always
the same, because VBScript is a cut down version. But that is where
you should start. I would suggest asking in a VBA newsgroup, like
public.VB.Controls, if that still exists, or
public.office.developer.vba.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA



  #5  
Old February 6th 06, 08:25 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Get text from keyword Listbox

You cannot access the value of a custom keywords property directly. Instead, you must go through the control: To get the selected values from a multi-select list box, you cannot use ListIndex. Instead, you need to loop through all the items in the list and check the Selected property for each one. Form with sample code at http://www.outlookcode.com/files/FormControlsDemo.zip

For more info on working with list boxes, see http://www.outlookcode.com/d/formcontrols.htm#listcombo
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Michael Anderson" wrote in message ...
Hi,

i am working on a customised contact form. I have a keyword type ListBox
"ListBox3" with a field called "mxzNCRL2". It has 3 possible values:
Bunnings;Forklift;First Aid. I am trying to get the selected value or values
onto a text variable.

Dim txtmxzNCRL2
Dim objInspector

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)

Set objInspector = Item.GetInspector

txtmxzNCRL2 = Item.UserProperties("mxzNCRL2").Value

MyFile.WriteLine(txtmxzNCRL2)

MyFile.Close

Set fso = Nothing
Set objInspector = Nothing

I am told that I have a type mismatch and it doesn't read in the selected
value or values.

Any suggestions?
--
Thank You in Advance,

Michael Anderson

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to view all text in calendar Sharon Outlook - Calandaring 1 February 21st 06 02:42 AM
Print pictures and text Joegrane Outlook - Using Contacts 0 February 13th 06 09:40 PM
Problems saving text in a text box Dave Haymes Outlook - Using Contacts 1 February 7th 06 01:58 PM
Unexpected Text Insertion [email protected] Outlook - General Queries 3 February 5th 06 02:13 AM
Why are some messages missing it's text? chanin111 Outlook - General Queries 0 January 8th 06 04:04 AM


All times are GMT +1. The time now is 08:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.