Results 1 to 3 of 3

Thread: Outlook Voting Buttons

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Location
    North West
    Posts
    3

    Outlook Voting Buttons

    Can anyone tell me how to add and control voting buttons on a custom form using VBScript? What I want to do is to automatically add voting buttons to my form when it is sent but dynamically because the button options may vary.

    E.g. If the user selects "A" from the combo box on my form I want two voting buttons added to the e-mail when sent, if the user selects "B" from the combo box I want to add three voting buttons.

    I have been using VBScript with the form not VBA.


    Thanks

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Outlook Voting Buttons

    Outlook Form or Outlook UserForm?

    If you add them at design time you can set the .Visible property via code to make them appear or not. Same with the text.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Location
    North West
    Posts
    3

    Re: Outlook Voting Buttons

    Hi RobDog,

    It is an Outlook form. Here is the code I have behind it at the moment:

    VB Code:
    1. Public strFile
    2.  
    3. Function Item_Send()
    4.  
    5.     Dim strVersion
    6.  
    7.     Set cmbType = _
    8.         Item.GetInspector.ModifiedFormPages.Item("Message").Controls("cmbType")
    9.     Set txtVersion = _
    10.         Item.GetInspector.ModifiedFormPages.Item("Message").Controls("txtVersion")
    11.     strVersion = txtVersion.Value
    12.     [Subject] = "Document " & cmbType.Value & " - " & strFile & " v" & strVersion
    13.    
    14. End Function
    15.  
    16. Sub cmdBrowseFile_Click()
    17.  
    18.     Dim strFilePath
    19.     Dim fso, f
    20.     Dim strOrigBody
    21.  
    22.     Set objDialog = CreateObject("UserAccounts.CommonDialog")
    23.  
    24.     objDialog.Filter = "All Files|*.xls;*.doc"
    25.     objDialog.InitialDir = "Y:\Comshare\Procedures and Guides\Review\"
    26.     intResult = objDialog.ShowOpen
    27.  
    28.     If intResult <> 0 Then
    29.         strFilePath = "<file://" & objDialog.FileName & ">"
    30.         Set fso = CreateObject("Scripting.FileSystemObject")
    31.         Set f = fso.GetFile(objDialog.FileName)
    32.         strFile = f.Name
    33.         strOrigBody = [Body]
    34.         [Body] = strFilePath & vbNewLine & _
    35.                vbNewLine & strOrigBody
    36.     End If
    37.  
    38. End Sub
    39.  
    40. Function Item_CustomAction(ByVal Action, ByVal NewItem)
    41.  
    42.     'Dim oRecipient
    43.     'Dim olCc
    44.  
    45.     'olCc = 2
    46.     'Set oRecipient = Item.Recipients.Add
    47.     'oRecipient.Address = "DMS"
    48.     'oRecipient.Type = olCc
    49.     'oRecipient.ResolveAll
    50.  
    51.     Msgbox Action.Name
    52.  
    53. End Function

    One of the things I also cannot get to work is the Item_CustomAction function so any help you can give with this would also be appreciated!

    Thanks
    David
    Last edited by RobDog888; May 4th, 2006 at 01:52 AM. Reason: Added [vbcode] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width