FindControl Number ID to enable Digital Signature and Encryption

  • Thread starter Thread starter LEH
  • Start date Start date
L

LEH

Our company has added two icons to the commandbar to expedite the selection
of Digital Signature and Encryption. I am using some code (see below) from
MS that should "Select" or depress the Digital Signature icon / button.
Unfortunately nothing happens when the code runs. Could the id number be
wrong? If so how do I determine the id?

This code is launched from an Access form:

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(Me!emailaddress)
objOutlookRecip.Type = olTo

' Add the CC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.Add("Michael Suyama")
'objOutlookRecip.Type = olCC

' Add the BCC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.Add("Andrew Fuller")
'objOutlookRecip.Type = olBCC

' Set the Subject, Body, and Importance of the message.
.Subject = "Timecard for Period Ending " & Me!Date1
.Body = strBody
.Importance = olImportanceHigh 'High importance
.VotingOptions = "Approved;Disapproved"
retVal = Item_Send(objOutlookMsg)


' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
.Display
' Should we display the message before sending?
'If DisplayMsg Then
' .Display
'Else
'.Save
'.Send
'End If
End With
Set objOutlook = Nothing

This is the function called above:

Function Item_Send(item)

Dim oDigSignctl
Dim oCBs

On Error Resume Next
Set oDigSignctl = item.GetInspector.CommandBars.FindControl(, 719)

If oDigSignctl Is Nothing Then
' Add the toolbar button to the item.
Set oCBs = item.GetInspector.CommandBars
Set oDigSignctl = oCBs.item("Standard").Controls.Add(, 719, , , True)
End If

' Check to make sure the button is not dimmed.
If oDigSignctl.Enabled = True Then
' Check to make sure the button is not depressed.
If oDigSignctl.State = 0 Then oDigSignctl.Execute
Else
MsgBox "You do not have a digital signature! " & _
"This mail will not be sent."
' Cancel the send to only allow sending of signed mail.
Item_Send = False
Exit Function
End If

Set oCBs = Nothing
Set oDigSignctl = Nothing

End Function

Thanks for taking the time to respond!
 
To clarify a little - The icons are on the standard Outlook form used to send
a new email.
 

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

Back
Top