Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Prompt for Account (2003)

    How would I set it up so each time I created a new message, I would be prompted to choose which account first, rather than having to remember to change accounts? I have 2 different business accounts and a personal account I send mail from and need to use the correct one. Would that be done by putting an autoexect type macro in the mail form?

    Thanks!

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Prompt for Account (2003)

    For years I have used a procedure to intercept new replies and forwards to set criteria and insert standard text for "client messages" if applicable. This is a bit messy, for reasons to arcane to discuss, but I, too, would like to specify that they go out on our new mail server, not the one we had up until last year.

    Here's the problem: Outlook's "object model," which lets you easily specify message settings, does not have the account as one of the options. You can access it through the toolbars. The second problem is how to "hook it up." Because it is complicated to hook it up when you first open the message compose window, and easy when you hit send, I've created the following one which works with send. You can copy it and paste it into a Word document (this prevents HTML mess-up) and then copy and paste from there into the ThisOutlookSession module in the VB Editor in Outlook.
    Code:
    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    ' Account Chooser version 1.0, Jefferson Scher, 25 April 2005
    ' This should run only for mail items...
    If Item.Class <> olMail Then Exit Sub
    ' Check the number of accounts
    With ActiveInspector.CommandBars("Standard").Controls("Accounts")
        If .Controls.Count > 2 Then
            ' There is more than one account (first control always is the
            ' name of the account Outlook has selected for this message)
            Dim intcount As Integer, strAccounts() As String, strSendOn As String, _
                strTemp As String
            ReDim strAccounts(2 To .Controls.Count)
            ' Build a list of the captions from the drop-down
            For intcount = 2 To .Controls.Count
                strAccounts(intcount) = Mid(.Controls(intcount).Caption, 2) 'drop leading "&"
            Next
            Do
                ' Get user's selection of the account "number"
                strSendOn = Trim(InputBox("Choose number of account to send on - " & _
                            vbCrLf & vbCrLf & Join(strAccounts, vbCrLf), , "1"))
                ' Quit procedure if user leaves a blank or space
                If strSendOn = vbNullString Then Exit Do
                ' Check whether user has chosen a valid account and, if so, choose it
                '  and return control to Outlook to send the message
                For intcount = 2 To UBound(strAccounts)
                    strTemp = strTemp & CStr(intcount - 1) & "|"
                Next
                If InStr(1, strTemp, strSendOn & "|") > 0 Then
                    .Controls(CInt(strSendOn) + 1).Execute
                    Exit Do
                Else
                    ' Not a valid selection, loop back to the dialog
                    MsgBox "Try again. Blank to exit.", vbExclamation + vbOKOnly
                End If
            Loop
        End If
    End With
    End Sub
    Hope this helps! (Obviously, if there are errors, please let me know. I tested under extremely simplified conditions, in Outlook 2003.)
    Last edited by jscher2000; 2011-10-20 at 20:07. Reason: Repaired [code] tags.

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Prompt for Account (2003)

    Jefferson, Brilliant! Thank you so much! I finally had time to set this up on my system and it is great. This will save me from embarassing mistakes by sending from the wrong account. I have 1 client who even though I am a consultant for them, I need to send from their e-mail address and I routinely end up sending from the wrong address.

    You moderators and WMVPs are inspiring, patient and quite selfless IMHO. My thanks again to all of you!

  4. #4
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Prompt for Account (2003)

    Once I exited Outlook and closed my system down, restarted and opened Outlook it is no longer prompting when I send, even though the code is still there in the ThisOutlookSession module. Any ideas?

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Prompt for Account (2003)

    Did you get the Enable macros prompt? If not, check your security level under Tools>Macro>Security. I find that Medium generally works. If you already have Medium, then I'm not sure what else would need to be set...

  6. #6
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Portland, Maine, USA
    Posts
    296
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prompt for Account (2003)

    This is somewhat built into Outlook 2003 - though not with a prompt. If you have multiple accounts configured in Outlook, there is an "Accounts" drop-down right next to the send button in a new email message. Just click the button and choose the account from which to send.

Posting Permissions

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