FindControl Number ID to enable Digital Signature and Encryption

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!
 
L

LEH

To clarify a little - The icons are on the standard Outlook form used to send
a new email.
 
M

Michael Bauer [MVP - Outlook]

You would add your own button with a unique name; pass that as the third
parameter to the Add function. Also, use FindControl with that name for the
third paramter.

If you want to know button IDs, Outlook Spy from www.dimastr.com is very
useful.

--
Best regards
Michael Bauer - MVP Outlook
Synchronize Outlook Categories:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Thu, 17 Jan 2008 20:48:00 -0800 schrieb LEH:
 

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

Top