Re: random signature vba assistance

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: bschanba (bschanba_at_esu10.org)
Date: 12/06/04


Date: 6 Dec 2004 13:05:56 -0800

Thanks (one post too late) to Eric Legault for his code in his update
to "Insert random signature" on 2/10/03. I used selfcert.exe as
instructed in other posts to keep outlook macro security on high with
my own certificate. But I didn't find a way to not have the warning
pop up when I am going to send an email. I did't want to use an addon
that will remove the warning completely (even for other programs trying
to access outlook), rather just remove the warning when I've clicked on
compose/reply/forward. For now I'm just clicking on yes, allow access
(annoying but tolerable.)...at least until I find out more details
about the intrinsic Application object. :)

bschanba wrote:
> I want to have a random quote included in my signature file, and
> included the code below in Outlook 2003 ThisOutlookSession class. It
> works, but it is still causing the "A program is trying to access
> e-mail addresses..." Huge thanks to Sue Mosher for all the info
> posted. But I need clarification on this snippet:
>
> However, Outlook 2003 does not show security prompts on three
specific
> types
> of applications:
> -- VBScript code in published, non-oneoff Outlook forms
> -- Outlook VBA code that uses the intrinsic Application object
> -- Outlook COM add-ins properly constructed to derive all objects
> from the Application object passed by the OnConnection event
>
> The vba code uses the intrinsic Application object, so it shouldn't
be
> showing the security prompt for that reason. Is this not correct, or
> is there another reason this code gives the security prompt? Or if
> anyone has another way of doing this same thing, I'd appreciate it.
> Thanks in advance!
>
>
> Option Explicit
> Dim intQuotes As Integer
> Dim strTop, strBottom, aryQuotes() As String
> Dim WithEvents objInspectors As Outlook.Inspectors
> Dim WithEvents objEmail As Outlook.MailItem
>
> Private Sub Application_Startup()
> Set objInspectors = Application.Inspectors
>
> 'top (consistant) part of signature
> strTop = "My name and company here" & vbCrLf
> 'number of quotes in array below
> intQuotes = 12
> 'random quotes in signature in zero-based array
> ReDim aryQuotes(intQuotes) As String
> aryQuotes(0) = "quote here"
> '...
> aryQuotes(11) = "another quote here"
> 'top (consistant) part of signature
> strBottom = "bottom of signature here" & vbCrLf
>
> End Sub
>
> Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
> If Inspector.CurrentItem.Class <> olMail Then Exit Sub
> Set objEmail = Inspector.CurrentItem
> End Sub
>
> Private Sub objEmail_Open(Cancel As Boolean)
> If objEmail.LastModificationTime <> "1/1/4501" Then Exit Sub
> Dim intRandom As Integer, strSignature As String
> intRandom = Int(intQuotes * Rnd())
> strSignature = strTop & aryQuotes(intRandom) & strBottom
> objEmail.Body = strSignature & objEmail.Body
> End Sub
>
> Private Sub Application_Quit()
> Set objInspectors = Nothing
> End Sub



Relevant Pages

  • random signature vba assistance
    ... Outlook 2003 does not show security prompts on three specific ... Dim strTop, strBottom, aryQuotesAs String ... 'top part of signature ... Private Sub objInspectors_NewInspector ...
    (microsoft.public.outlook.program_vba)
  • Re: random signature vba assistance
    ... to "Insert random signature" on 2/10/03. ... > showing the security prompt for that reason. ... > Dim strTop, strBottom, aryQuotesAs String ... > Private Sub objInspectors_NewInspector ...
    (microsoft.public.outlook.program_vba)
  • Re: random signature vba assistance
    ... to "Insert random signature" on 2/10/03. ... > showing the security prompt for that reason. ... > Dim strTop, strBottom, aryQuotesAs String ... > Private Sub objInspectors_NewInspector ...
    (microsoft.public.outlook.program_vba)
  • Re: Modules not Known
    ... Dim pCode$ ... Dim pCodeModule As CodeModule ... Private Sub VBIDEReference() ... Option Compare Database ...
    (comp.databases.ms-access)
  • A VB6 program to generate CONSTants for a user defined gradient
    ... EndProperty ... It may be used for amy moral purpose. ... Dim mGreen1 As Long ... Private Sub ColorDisplay_MouseDown(Button As Integer, Shift As Integer, _ ...
    (comp.lang.basic.visual.misc)