none
Outlook custom form - select all checkbox not working help RRS feed

  • Question

  • Hi,

    I am a newbie to vba in Outlook and having a few problems.  I have designed a form that uses checkboxes.  I have one that is supposed to check all of the other checkboxes if it is checked.  I have been searching online for any resolution and cannot find one.  I think I am putting the code in the correct location but not sure.  I am in Design Form, select the option to view code.  This is the code that I am using.  I have tried .value as well as .checked and neither work

    private Sub ckbxSelectAll_Click()
    ckbx1.Value=ckbxSelectAll.Value
    ckbx2.Value=ckbxSelectAll.Value
    ckbx3.Value=ckbxSelectAll.Value
    ckbx4.Value=ckbxSelectAll.Value
    ckbx5.Value=ckbxSelectAll.Value
    ckbx6.Value=ckbxSelectAll.Value
    ckbx7.Value=ckbxSelectAll.Value
    End Sub

    Can someone help me?

    Tuesday, November 28, 2017 3:09 PM

All replies

  • Hello,

    You don't need "private" for the function and you could not get the checkbox object via its name. You need get the form page object and then get the checkbox object.

    Here is the code example. I add a msgbox to check if the sub is called. You could remove it after debugging.

    Sub ckbxSelectAll_Click()
    msgbox "Sub is triggered"
    dim ckbxSelectAll,ckbx1,ckbx2,ckbx3
    set ckbxSelectAll=Item.GetInspector.ModifiedFormPages("Message").ckbxSelectAll
    set ckbx1=Item.GetInspector.ModifiedFormPages("Message").ckbx1
    set ckbx2=Item.GetInspector.ModifiedFormPages("Message").ckbx2
    set ckbx3=Item.GetInspector.ModifiedFormPages("Message").ckbx3
    ckbx1.Value=ckbxSelectAll.Value
    ckbx2.Value=ckbxSelectAll.Value
    ckbx3.Value=ckbxSelectAll.Value
    End Sub
    

    If the msgbox does not show, it maybe that your custom script is disabled due to Office Update in September 12, 2017(16.0.8431.2079). You could refer to below link to re-enable it and then restart the outlook to debug again.

    Fixes or workarounds for recent issues in Outlook for Windows-Outlook known issues in the Sep 2017 updates

    Best Regards,

    Terry


    MSDN Community Support<br/> Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.

    Wednesday, November 29, 2017 5:28 AM