Adding dropdown list using custom form

zulhairi

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
#1
I'm trying to add project codes dropdown at custom form. Once user selected the project codes, it will display it at the end of the subject.
This is the code that I have right now. Everthing working fine untill when I received the sent email. The email wont automatically open like normal message, instead it will display it as attached file.

This is the custom form.
1.png



I'm trying to send the email.

2.png



received email will need to click it before can read it. I want to display it as normal message instead of attachement.
3.png


This is my current code :

Dim ComboBox1
Dim TextBox1
Dim Subject

Sub ComboBox1_Click()
ProjectCodes = ComboBox1.Text
Select Case ProjectCodes

Case "999999"
TextBox1.Text = "General"
Case "2017004"
TextBox1.Text = "IMW Waste based Biogas Power Plant at Sg Bakap, Penang"
Case "3116008"
TextBox1.Text = "OE Upgradation of Sirajganj Power Plant 3rd Unit Dual Fuel"
Case "1317023"
TextBox1.Text = "C&S Cadangan Pembangunan Springhill Clubhouse, Port Dickson"
Case "GDS0132"
TextBox1.Text = "Airborne LiDAR and Imagery Survey by Matrix System"
Case "2518004"
TextBox1.Text = "Proposed Campus Masterplan in Mangalore, India for Nitte University"
Case "1517007"
TextBox1.Text = "RAPID Environmental Audit"
Case "3114003-VO.2"
TextBox1.Text = "OE Manjung 5 Coal Fired Plant for the IF Works"
Case "3117009"
TextBox1.Text = "OE Kedah 1200MW Combined Cycle Power Plant"
Case "3911014-VO2"
TextBox1.Text = "Airasia House - Roof Enhancement Works"
Case "3216W01"
TextBox1.Text = "Design Review and Construction Supervision for Balochistan Highway"
Case "1213019"
TextBox1.Text = "C&S Mixed Development at Lot 12, Section 52, PJ"
Case "3915026"
TextBox1.Text = "C&S M&E Rapid UIO EPCC Of Substation Packages"
Case "7016001"
TextBox1.Text = "LRT 3 - Eastern"
Case "1217026"
TextBox1.Text = "C&S Springhill Port Dickson"
Case Else
MsgBox "Please Select Project Code"
End Select

End Sub

Sub CommandButton2_Click()

ProjectCodes = ComboBox1.Text
Select Case ProjectCodes

Case "999999"

TextBox1.Text = "General"
Item.Subject = Subject.Text + "[999999]"+ "[" + TextBox1.Text + "]"
Stop

Case "2017004"

TextBox1.Text = "IMW Waste based Biogas Power Plant at Sg Bakap, Penang"
Item.Subject = Subject.Text + "[2017004]"+ "[" + TextBox1.Text + "]"

Case "3116008"

TextBox1.Text = "OE Upgradation of Sirajganj Power Plant 3rd Unit Dual Fuel"
Item.Subject = Subject.Text + "[3116008]"+ "[" + TextBox1.Text + "]"

Case "1317023"

TextBox1.Text = "C&S Cadangan Pembangunan Springhill Clubhouse, Port Dickson"
Item.Subject = Subject.Text + "[1317023]"+ "[" + TextBox1.Text + "]"

Case "GDS0132"

TextBox1.Text = "Airborne LiDAR and Imagery Survey by Matrix System"
Item.Subject = Subject.Text + "[GDS0132]"+ "[" + TextBox1.Text + "]"

Case "2518004"

TextBox1.Text = "Proposed Campus Masterplan in Mangalore, India for Nitte University"
Item.Subject = Subject.Text + "[2518004]"+ "[" + TextBox1.Text + "]"

Case "1517007"

TextBox1.Text = "RAPID Environmental Audit"
Item.Subject = Subject.Text + "[1517007]"+ "[" + TextBox1.Text + "]"

Case "3114003-VO.2"

TextBox1.Text = "OE Manjung 5 Coal Fired Plant for the IF Works"
Item.Subject = Subject.Text + "[3114003-VO.2]"+ "[" + TextBox1.Text + "]"

Case "3117009"

TextBox1.Text = "OE Kedah 1200MW Combined Cycle Power Plant"
Item.Subject = Subject.Text + "[3117009]"+ "[" + TextBox1.Text + "]"

Case "3911014-VO2"

TextBox1.Text = "Airasia House - Roof Enhancement Works"
Item.Subject = Subject.Text + "[3911014-VO2]"+ "[" + TextBox1.Text + "]"

Case "3216W01"

TextBox1.Text = "Design Review and Construction Supervision for Balochistan Highway"
Item.Subject = Subject.Text + "[3216W01]"+ "[" + TextBox1.Text + "]"

Case "1213019"

TextBox1.Text = "C&S Mixed Development at Lot 12, Section 52, PJ"
Item.Subject = Subject.Text + "[1213019]"+ "[" + TextBox1.Text + "]"

Case "3915026"

TextBox1.Text = "C&S M&E Rapid UIO EPCC Of Substation Packages"
Item.Subject = Subject.Text + "[3915026]"+ "[" + TextBox1.Text + "]"

Case "7016001"

TextBox1.Text = "LRT 3 - Eastern"
Item.Subject = Subject.Text + "[7016001]"+ "[" + TextBox1.Text + "]"

Case "1217026"

TextBox1.Text = "C&S Springhill Port Dickson"
Item.Subject = Subject.Text + "[1217026]"+ "[" + TextBox1.Text + "]"


Case Else
MsgBox "Please Select Project Code"
End Select
End Sub


Sub Item_Open()

Set FormPage = Item.GetInspector.ModifiedFormPages("Message")
Set ComboBox1 = FormPage.Controls("ComboBox1")
Set TextBox1 = FormPage.Controls("TextBox1")
Set Subject = FormPage.Controls("Subject")

ComboBox1.AddItem "999999"
ComboBox1.AddItem "2017004"
ComboBox1.AddItem "3116008"
ComboBox1.AddItem "1317023"
ComboBox1.AddItem "GDS0132"
ComboBox1.AddItem "2518004"
ComboBox1.AddItem "1517007"
ComboBox1.AddItem "3114003-VO.2"
ComboBox1.AddItem "3117009"
ComboBox1.AddItem "3911014-VO2"
ComboBox1.AddItem "3216W01"
ComboBox1.AddItem "1213019"
ComboBox1.AddItem "3915026"
ComboBox1.AddItem "7016001"
ComboBox1.AddItem "1217026"

End Sub

Sub Label3_Click()
Set objWeb = CreateObject("InternetExplorer.Application")
objWeb.Navigate Item.GetInspector.ModifiedFormPages _
("Message").Controls("Label3").Caption
objWeb.Visible = True

End Sub


Sub CommandButton1_Click()
TextBox1.Text = ""
ComboBox1.Text= ""
Item.Subject = ""
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#2
I'm trying to add project codes dropdown at custom form. Once user selected the project codes, it will display it at the end of the subject.
This is the code that I have right now. Everthing working fine untill when I received the sent email. The email wont automatically open like normal message, instead it will display it as attached file.
It might be something the disclaimer is doing - the disclaimr is plain text. Can you test the code with an account that doesn't get the disclaimer added?

(I'm going to delete the other duplicate thread- this one is easier to read and review.)
 

zulhairi

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
#3
Hi Diane,

Thanks for the reply, is there other way for me to do this. I'm just trying to display project codes + description at the end of subject field based on the dropdown selection. I'm still new to this outlook custom glad if u can help.

[You can delete the other duplicate post, sry for any inconvenience caused]
 

zulhairi

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
#4
Hi Diane,

Thanks for the reply, is there other way for me to do this. I'm just trying to display project codes + description at the end of subject field based on the dropdown selection. I'm still new to this outlook custom glad if u can help.

[You can delete the other duplicate post, sry for any inconvenience caused]
Is there any way to populate combobox with textbox without using any code. Only use custom form
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#5
Is there any way to populate combobox with textbox without using any code. Only use custom form
As long as the values won't change, yes - on the properties page.


The instructions on Display a person's age in the subject of a custom form show how to use a field to set the subject field - no code needed to update the subject.

FWIW, if you need to use a macro, i think a userform would be better, but its not practical if you are distributing it to other users.

2018-06-07_0-04-40.png
 

zulhairi

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
#6
As long as the values won't change, yes - on the properties page.


The instructions on Display a person's age in the subject of a custom form show how to use a field to set the subject field - no code needed to update the subject.

FWIW, if you need to use a macro, i think a userform would be better, but its not practical if you are distributing it to other users.

View attachment 2397
I'm thinking to use userform also instead of macro,

Can I populate each value of combobox with description without adding any codes.

For example :

If the user choose the value 1 at the combobox, it will display description of value 1 at the textbox.
If user choose value 2 at combobox, description of value 2 will display at combobox and so on.

1.png
 
Top