Combobox on an Outlook form with VBscript

A

atwork

I am new to outlook and to programming so i am struggiling. I have had one VB
class about 2 years ago. I am trying to fill a combobox with vbscript code.
After reading a few articles and trying to peice everything together this is
what i have done.

Option Explicit
dim Control

Sub cbosubject_click()
Set Page = Item.GetInspector.ModifiedFormPages("PickOne")
Set Control = Page.Controls("cbosubject")
Control.additem "Marketing"
Control.additem "Sales"
End sub

PickOne is the name of the form and
cbosubject is the name of the combobox

The question or problem is when I run the form there is nothing in the
combobox

Thanks in advance
 
A

atwork

More info
When i run the form nothing appears in the combobox. I have saved the form
and posted the form. Is there something wrong with my code or am i missing a
step regarding the form?
 
A

atwork

I modified my code to look like this:

Option Explicit
dim Control
function Item_Open()
dim Page
Set Page = Item.GetInspector.ModifiedFormPages("PickOne")
Set Control = Page.Controls("cbosubject")
'Set Control = Nothing
call subject
end function
sub subject()
Control.additem "Marketing"
Control.additem "Sales"

It is now working
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top