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 and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

What is wrong with drop-down box?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 30th 08, 06:41 PM posted to microsoft.public.outlook.program_vba
cinnamngrl
external usenet poster
 
Posts: 28
Default What is wrong with drop-down box?

I have been trying to create a userform with a simple dropdown combo
box. I have tried to follow the examples I have found and I just
plain pasted the example for combobox2 from the help file.

Below is the code for userform dropkids with two combo boxs and
matching command buttons.


Sub CommandButton1_Click()
ComboBox1.DropDown
End Sub

Sub Item_Open()

Set olApp = New Outlook.Application
Set olns = olApp.GetNamespace("MAPI")
Set contactsFolder = olns.GetDefaultFolder(olFolderContacts)
Set allcontactitems = contactsFolder.Items
Set kids = allcontactitems.Restrict("[Categories]= ""caseload""")
kids.Sort "[LastName]"
Debug.Print kids.Count
For Each itm In kids
Debug.Print itm
ComboBox1.AddItem itm.FileAs
Next
End Sub

Sub CommandButton2_Click()
ComboBox2.DropDown
End Sub

Sub Item_OpenA()

ComboBox2.AddItem "Turkey"
ComboBox2.AddItem "Chicken"
ComboBox2.AddItem "Duck"
ComboBox2.AddItem "Goose"
ComboBox2.AddItem "Grouse"
End Sub

Private Sub UserForm_Click()

End Sub


If someone just pointed me to some no-fail sample code that would be
great!
Ads
  #2  
Old October 31st 08, 01:12 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default What is wrong with drop-down box?

Provide more information.

Where is this code running, is it in the Outlook VBA project? If so don't
use New Outlook.Application, use the intrinsic Application object.

What's not working? What fails, what gets put into the drop-down. What
problem are you seeing?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"cinnamngrl" wrote in message
...
I have been trying to create a userform with a simple dropdown combo
box. I have tried to follow the examples I have found and I just
plain pasted the example for combobox2 from the help file.

Below is the code for userform dropkids with two combo boxs and
matching command buttons.


Sub CommandButton1_Click()
ComboBox1.DropDown
End Sub

Sub Item_Open()

Set olApp = New Outlook.Application
Set olns = olApp.GetNamespace("MAPI")
Set contactsFolder = olns.GetDefaultFolder(olFolderContacts)
Set allcontactitems = contactsFolder.Items
Set kids = allcontactitems.Restrict("[Categories]= ""caseload""")
kids.Sort "[LastName]"
Debug.Print kids.Count
For Each itm In kids
Debug.Print itm
ComboBox1.AddItem itm.FileAs
Next
End Sub

Sub CommandButton2_Click()
ComboBox2.DropDown
End Sub

Sub Item_OpenA()

ComboBox2.AddItem "Turkey"
ComboBox2.AddItem "Chicken"
ComboBox2.AddItem "Duck"
ComboBox2.AddItem "Goose"
ComboBox2.AddItem "Grouse"
End Sub

Private Sub UserForm_Click()

End Sub


If someone just pointed me to some no-fail sample code that would be
great!


  #3  
Old November 6th 08, 06:41 PM posted to microsoft.public.outlook.program_vba
cinnamngrl
external usenet poster
 
Posts: 28
Default What is wrong with drop-down box?

On Oct 31, 9:12 am, "Ken Slovak - [MVP - Outlook]"
wrote:
Provide more information.

Where is this code running, is it in the Outlook VBA project? If so don't
use New Outlook.Application, use the intrinsic Application object.

What's not working? What fails, what gets put into the drop-down. What
problem are you seeing?

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm

"cinnamngrl" wrote in message

...

I have been trying to create a userform with a simple dropdown combo
box. I have tried to follow the examples I have found and I just
plain pasted the example for combobox2 from the help file.


Below is the code for userform dropkids with two combo boxs and
matching command buttons.


Sub CommandButton1_Click()
ComboBox1.DropDown
End Sub


Sub Item_Open()


Set olApp = New Outlook.Application
Set olns = olApp.GetNamespace("MAPI")
Set contactsFolder = olns.GetDefaultFolder(olFolderContacts)
Set allcontactitems = contactsFolder.Items
Set kids = allcontactitems.Restrict("[Categories]= ""caseload""")
kids.Sort "[LastName]"
Debug.Print kids.Count
For Each itm In kids
Debug.Print itm
ComboBox1.AddItem itm.FileAs
Next
End Sub


Sub CommandButton2_Click()
ComboBox2.DropDown
End Sub


Sub Item_OpenA()


ComboBox2.AddItem "Turkey"
ComboBox2.AddItem "Chicken"
ComboBox2.AddItem "Duck"
ComboBox2.AddItem "Goose"
ComboBox2.AddItem "Grouse"
End Sub


Private Sub UserForm_Click()


End Sub


If someone just pointed me to some no-fail sample code that would be
great!


The problem is that I don't know what the intrinsic Application object
would be. I am trying to put this on a userform. All of the examples
in help seem to apply to Page 2 of existing outlook forms
(contactforms?). You can see I don't know much about what i'm
doing.

I am trying to create simple userforms to enter data about certain
contacts. For my two other user forms it is two step process where I
type in the last name and it presents a balloon with up to five
possible contacts. I can show you that code if you want . As you can
imagine it is cumbersome to write and ends up being a two step process
to enter data. I somewhat understand that correct object, but I only
have the help file to learn from.
  #4  
Old November 7th 08, 03:07 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default What is wrong with drop-down box?

Again, where is this code running? If it's in the Outlook VBA project
Application is always the Outlook.Application object.

Also again, what's not working? What fails, what gets put into the
drop-down. What problem are you seeing?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"cinnamngrl" wrote in message
...
snip
The problem is that I don't know what the intrinsic Application object
would be. I am trying to put this on a userform. All of the examples
in help seem to apply to Page 2 of existing outlook forms
(contactforms?). You can see I don't know much about what i'm
doing.

I am trying to create simple userforms to enter data about certain
contacts. For my two other user forms it is two step process where I
type in the last name and it presents a balloon with up to five
possible contacts. I can show you that code if you want . As you can
imagine it is cumbersome to write and ends up being a two step process
to enter data. I somewhat understand that correct object, but I only
have the help file to learn from.


  #5  
Old November 7th 08, 05:58 PM posted to microsoft.public.outlook.program_vba
cinnamngrl
external usenet poster
 
Posts: 28
Default What is wrong with drop-down box?

This is in Outlook VBA Project and nothing makes it into the
dropdown.

On Nov 7, 10:07 am, "Ken Slovak - [MVP - Outlook]"
wrote:
Again, where is this code running? If it's in the Outlook VBA project
Application is always the Outlook.Application object.

Also again, what's not working? What fails, what gets put into the
drop-down. What problem are you seeing?

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm

"cinnamngrl" wrote in message

...
snip

The problem is that I don't know what the intrinsic Application object
would be. I am trying to put this on a userform. All of the examples
in help seem to apply to Page 2 of existing outlook forms
(contactforms?). You can see I don't know much about what i'm
doing.


I am trying to create simple userforms to enter data about certain
contacts. For my two other user forms it is two step process where I
type in the last name and it presents a balloon with up to five
possible contacts. I can show you that code if you want . As you can
imagine it is cumbersome to write and ends up being a two step process
to enter data. I somewhat understand that correct object, but I only
have the help file to learn from.


  #6  
Old November 7th 08, 06:49 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default What is wrong with drop-down box?

Do you get the messages about the count and about each item in the Immediate
window? Assuming the code is actually running it doesn't look bad. You do
use AddItem to add each item to the list as you are doing. However, if you
don't click on the arrow in the drop-down you won't see the list that's been
created, even with the DropDown() method call. If you want to show an item
from the list as you start use the ComboBox.ListIndex property and set it to
an integer value based on your list.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"cinnamngrl" wrote in message
...
This is in Outlook VBA Project and nothing makes it into the
dropdown.


  #7  
Old November 13th 08, 07:43 PM posted to microsoft.public.outlook.program_vba
cinnamngrl
external usenet poster
 
Posts: 28
Default What is wrong with drop-down box?

when i click on the dropdown arrow, the list is empty.

On Nov 7, 2:49 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
Do you get the messages about the count and about each item in the Immediate
window? Assuming the code is actually running it doesn't look bad. You do
use AddItem to add each item to the list as you are doing. However, if you
don't click on the arrow in the drop-down you won't see the list that's been
created, even with the DropDown() method call. If you want to show an item
from the list as you start use the ComboBox.ListIndex property and set it to
an integer value based on your list.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm

"cinnamngrl" wrote in message

...

This is in Outlook VBA Project and nothing makes it into the
dropdown.


  #8  
Old November 13th 08, 08:56 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default What is wrong with drop-down box?

Did you set the ComboBox.ListIndex property to a valid index value?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"cinnamngrl" wrote in message
...
when i click on the dropdown arrow, the list is empty.


 




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
drop down box pattis Outlook - Using Forms 0 October 22nd 08 05:41 PM
Drag & Drop Email Message to Appt Doesn't Drop Attachment veejaycee Outlook - Calandaring 2 October 9th 08 01:49 PM
Drag-Drop Bill Board Outlook - General Queries 0 July 8th 08 03:34 PM
Drop down menus Paul Martin Outlook - General Queries 10 October 18th 07 05:36 PM
Calendar drop-down box? CQ Outlook - Using Forms 2 June 19th 06 05:19 PM


All times are GMT +1. The time now is 03:32 PM.


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