Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / March 2008

Tip: Looking for answers? Try searching our database.

Dropdown data list in view

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SubSeaGuy - 25 Feb 2008 01:56 GMT
I have added a custom field in my task form.  Data is selected via a dropdown
menu.  I have tested it and the data is retained with no problems.  I have
also included my custom field in a list view.  When I try to enter data in
this field via in-cell editing, my dropdown is not available.  I can enter
data and it is retained but I would like the same dropdown menu available for
in-cell editing in the list view as is available on the form.  Can this be
done and if so, how would I go about doing it?
Sue Mosher [MVP-Outlook] - 25 Feb 2008 14:29 GMT
No, that cannot be done. Outlook does not support custom drop-down lists in folder views.

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

>I have added a custom field in my task form.  Data is selected via a dropdown
> menu.  I have tested it and the data is retained with no problems.  I have
[quoted text clipped - 3 lines]
> in-cell editing in the list view as is available on the form.  Can this be
> done and if so, how would I go about doing it?
SubSeaGuy - 25 Feb 2008 14:59 GMT
Thanks Sue.  How about a drop down in the toolbar to select from the list?  
Any guidance on the best way to do that?

> No, that cannot be done. Outlook does not support custom drop-down lists in folder views.
>
[quoted text clipped - 5 lines]
> > in-cell editing in the list view as is available on the form.  Can this be
> > done and if so, how would I go about doing it?
Sue Mosher [MVP-Outlook] - 25 Feb 2008 15:24 GMT
Depends on whether this is for your personal use or something that needs to be distributed to other people.

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> Thanks Sue.  How about a drop down in the toolbar to select from the list?  
> Any guidance on the best way to do that?
[quoted text clipped - 8 lines]
>> > in-cell editing in the list view as is available on the form.  Can this be
>> > done and if so, how would I go about doing it?
SubSeaGuy - 25 Feb 2008 17:45 GMT
Personal use only.

> Depends on whether this is for your personal use or something that needs to be distributed to other people.
>
[quoted text clipped - 10 lines]
> >> > in-cell editing in the list view as is available on the form.  Can this be
> >> > done and if so, how would I go about doing it?
Sue Mosher [MVP-Outlook] - 26 Feb 2008 17:10 GMT
This VBA code sample creates a new button on the Standard toolbar when Outlook starts up and runs code when the button is clicked to update a custom property with the value the user selects from a dropdown list:

Dim WithEvents objCBC As Office.CommandBarComboBox

Private Sub Application_Startup()
   Dim objExpl As Outlook.Explorer
   Dim objCB As Office.CommandBar
   On Error Resume Next
   Set objExpl = Application.ActiveExplorer
   Set objCB = objExpl.CommandBars("Standard")
   Set objCBC = objCB.Controls.Add(Type:=msoControlComboBox, _
                                   Temporary:=True)
                                   
   ' adapted from Help file
   With objCBC
       .AddItem "Get Stock Quote", 1
       .AddItem "View Chart", 2
       .AddItem "View Fundamentals", 3
       .AddItem "View News", 4
       .DescriptionText = "View Data For Stock"
       .text = "Select option here"
       .Width = 200
       .Style = msoComboNormal
   End With
   Set objCB = Nothing
   Set objExpl = Nothing
End Sub

Private Sub objCBC_Change(ByVal Ctrl As Office.CommandBarComboBox)
   Dim objExpl As Outlook.Explorer
   Dim objTask As Outlook.taskItem
   Dim objProp As Outlook.UserProperty
   Dim strPropName As String
   On Error Resume Next
   ' set the name of the custom property here
   strPropName = "My Custom Property Name"
   Set objExpl = Application.ActiveExplorer
   For Each objTask In objExpl.Selection
       Set objProp = objTask.UserProperties(strPropName)
       ' if the property doesn't exist, create it
       If objProp Is Nothing Then
           Set objProp = _
             objTask.UserProperties.Add(Name:=strPropName, _
                                        Type:=olText)
       End If
       objProp.Value = objCBC.text
       objTask.Save
   Next
   objCBC.text = "Select option here"
   Set objProp = Nothing
   Set objExpl = Nothing
   Set objTask = Nothing
End Sub

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> Personal use only.
>
[quoted text clipped - 12 lines]
>> >> > in-cell editing in the list view as is available on the form.  Can this be
>> >> > done and if so, how would I go about doing it?
SubSeaGuy - 28 Feb 2008 07:50 GMT
Thanks a lot Sue.  Does this run from within the form or from an Outlook VBA
module?

> This VBA code sample creates a new button on the Standard toolbar when Outlook starts up and runs code when the button is clicked to update a custom property with the value the user selects from a dropdown list:
>
[quoted text clipped - 66 lines]
> >> >> > in-cell editing in the list view as is available on the form.  Can this be
> >> >> > done and if so, how would I go about doing it?
Sue Mosher [MVP-Outlook] - 28 Feb 2008 14:41 GMT
Toolbar buttons are always VBA. (You might want to reread my initial sentence, "This VBA code sample ....")
Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> Thanks a lot Sue.  Does this run from within the form or from an Outlook VBA
> module?
[quoted text clipped - 69 lines]
>> >> >> > in-cell editing in the list view as is available on the form.  Can this be
>> >> >> > done and if so, how would I go about doing it?
SubSeaGuy - 28 Feb 2008 19:56 GMT
Sue.. I did see that.  I am VERY new at this.  I am sometimes still not clear
about where the code goes.  From your response, I assume I would place this
code in the same place where I put macro's.  Correct?

> Toolbar buttons are always VBA. (You might want to reread my initial sentence, "This VBA code sample ....")
> > Thanks a lot Sue.  Does this run from within the form or from an Outlook VBA
[quoted text clipped - 70 lines]
> >> >> >> > in-cell editing in the list view as is available on the form.  Can this be
> >> >> >> > done and if so, how would I go about doing it?
Sue Mosher [MVP-Outlook] - 28 Feb 2008 20:16 GMT
Yes, macros are one type of VBA procedure. Event handlers, such as that to handle the Click event of a CommandBarButton, are another type of VBA procedure. The sample code I posted needs to go in the built-in ThisOutlookSession module.

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> Sue.. I did see that.  I am VERY new at this.  I am sometimes still not clear
> about where the code goes.  From your response, I assume I would place this
[quoted text clipped - 72 lines]
>> >> >> >> > in-cell editing in the list view as is available on the form.  Can this be
>> >> >> >> > done and if so, how would I go about doing it?
SubSeaGuy - 28 Feb 2008 20:28 GMT
Thanks Sue.  I have no idea how you provide so much feedback to so many
people.  You're awsome.

> Yes, macros are one type of VBA procedure. Event handlers, such as that to handle the Click event of a CommandBarButton, are another type of VBA procedure. The sample code I posted needs to go in the built-in ThisOutlookSession module.
>
[quoted text clipped - 74 lines]
> >> >> >> >> > in-cell editing in the list view as is available on the form.  Can this be
> >> >> >> >> > done and if so, how would I go about doing it?
SubSeaGuy - 28 Feb 2008 20:58 GMT
OK.. the menu bar is working fine.  When I open a new task though, the
selection is not available.  I have tried to locate it in the standard menu
bar but I guess it is not retained there.  I have tried using the script
within the form but get errors. Any suggestions?

> Thanks Sue.  I have no idea how you provide so much feedback to so many
> people.  You're awsome.
[quoted text clipped - 77 lines]
> > >> >> >> >> > in-cell editing in the list view as is available on the form.  Can this be
> > >> >> >> >> > done and if so, how would I go about doing it?
Sue Mosher [MVP-Outlook] - 28 Feb 2008 21:20 GMT
None of the code I posted has anything to do with VBScript behind a custom form or with an item opened in its own custom form window. The whole point of this toolbar button is to provide functionality in a table view for a folder that is similar to what the control on your custom form does. In other words, the toolbar button is designed to be there only in the folder window. If you want something other functionality, please provide a description.
Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> OK.. the menu bar is working fine.  When I open a new task though, the
> selection is not available.  I have tried to locate it in the standard menu
[quoted text clipped - 5 lines]
>>
>> > Yes, macros are one type of VBA procedure. Event handlers, such as that to handle the Click event of a CommandBarButton, are another type of VBA procedure. The sample code I posted needs to go in the built-in ThisOutlookSession module.

>> > > Sue.. I did see that.  I am VERY new at this.  I am sometimes still not clear
>> > > about where the code goes.  From your response, I assume I would place this
[quoted text clipped - 72 lines]
>> > >> >> >> >> > in-cell editing in the list view as is available on the form.  Can this be
>> > >> >> >> >> > done and if so, how would I go about doing it?
SubSeaGuy - 29 Feb 2008 03:51 GMT
I would be looking for the same functionality with an open task form
(dropdown menu) to fill a user-defined field within the form.

> None of the code I posted has anything to do with VBScript behind a custom form or with an item opened in its own custom form window. The whole point of this toolbar button is to provide functionality in a table view for a folder that is similar to what the control on your custom form does. In other words, the toolbar button is designed to be there only in the folder window. If you want something other functionality, please provide a description.
> > OK.. the menu bar is working fine.  When I open a new task though, the
[quoted text clipped - 83 lines]
> >> > >> >> >> >> > in-cell editing in the list view as is available on the form.  Can this be
> >> > >> >> >> >> > done and if so, how would I go about doing it?
Sue Mosher [MVP-Outlook] - 02 Mar 2008 20:22 GMT
The event to use to add a toolbar to an Inspector window is Inspectors.NewInspector. In the Outlook VBA code below, note how the common operations of filling the combo box and processing a task are broken out into separate procedures that can be called for the combo box on either type of window:

' place all code in the built-in ThisOutlookSession module in Outlook VBA
Option Explicit
Dim WithEvents objCBC_E As Office.CommandBarComboBox
Dim WithEvents objCBC_I As Office.CommandBarComboBox
Dim WithEvents colInsp As Outlook.Inspectors

Private Sub Application_Startup()
   Dim objExpl As Outlook.Explorer
   Dim objCB As Office.CommandBar
   On Error Resume Next
   Set colInsp = Application.Inspectors
   Set objExpl = Application.ActiveExplorer
   Set objCB = objExpl.CommandBars("Standard")
   Set objCBC_E = objCB.Controls.Add(Type:=msoControlComboBox, _
                                         Temporary:=True)
   Call FillCombo(objCBC_E)
   Set objCB = Nothing
   Set objExpl = Nothing
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
   Dim objCB As Office.CommandBar
   On Error Resume Next
   Set objCB = Inspector.CommandBars("Standard")
   Set objCBC_I = objCB.FindControl(msoControlComboBox, , "MyCombo")
   If objCBC_I Is Nothing Then
       Set objCBC_I = objCB.Controls.Add(Type:=msoControlComboBox, _
                                         Temporary:=True)
       Call FillCombo(objCBC_I)
   End If
   Set objCB = Nothing
End Sub

Private Sub objCBC_E_Change(ByVal Ctrl As Office.CommandBarComboBox)
   Dim objExpl As Outlook.Explorer
   Dim objTask As Outlook.taskItem
   Dim objProp As Outlook.UserProperty
   On Error Resume Next
   Set objExpl = Application.ActiveExplorer
   For Each objTask In objExpl.Selection
       Call UpdateTask(objTask, objCBC_E.text)
   Next
   objCBC_E.text = "Select option here"
   Set objProp = Nothing
   Set objExpl = Nothing
   Set objTask = Nothing
End Sub

Private Sub objCBC_I_Change(ByVal Ctrl As Office.CommandBarComboBox)
   Dim objTask As Outlook.taskItem
   Dim objProp As Outlook.UserProperty
   On Error Resume Next
   Set objTask = Application.ActiveInspector.CurrentItem
   Call UpdateTask(objTask, objCBC_I.text)
   objCBC_I.text = "Select option here"
   Set objProp = Nothing
   Set objTask = Nothing
End Sub

Sub FillCombo(cbc As Office.CommandBarControl)
   ' adapted from Help file
   With cbc
       .AddItem "Get Stock Quote", 1
       .AddItem "View Chart", 2
       .AddItem "View Fundamentals", 3
       .AddItem "View News", 4
       .DescriptionText = "View Data For Stock"
       .text = "Select option here"
       .Tag = "MyCombo"
       .Width = 200
       .Style = msoComboNormal
   End With
End Sub

Sub UpdateTask(task As Outlook.taskItem, choice As String)
   Dim objProp As Outlook.UserProperty
   Dim strPropName As String
   ' set the name of the custom property here
   strPropName = "My Custom Property Name"
   Set objProp = task.UserProperties(strPropName)
   ' if the property doesn't exist, create it
   If objProp Is Nothing Then
       Set objProp = _
         task.UserProperties.Add(Name:=strPropName, _
                                    Type:=olText)
   End If
   objProp.Value = choice
   task.Save
   Set objProp = Nothing
End Sub

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

>I would be looking for the same functionality with an open task form
> (dropdown menu) to fill a user-defined field within the form.
[quoted text clipped - 87 lines]
>> >> > >> >> >> >> > in-cell editing in the list view as is available on the form.  Can this be
>> >> > >> >> >> >> > done and if so, how would I go about doing it?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.