Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA and different accounts (Outlook 2000 SR1)

    I have Outlook 2000 installed in Internet Only Mode and I have two or three different email accounts setup in it.

    I also have a VBA module that, when run, creates an email based on certain criteria and sends the email.

    My question is, how can I tell my VBA code to send the email using one of the other emails accounts instead if using the default email account?

    James

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and different accounts (Outlook 2000 SR1)

    In VBA you can set the from property, but I'm pretty sure you don't have access to the account. At least it doesn't show up in any of my object model documentation.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and different accounts (Outlook 2000 SR1)

    I know I can set the From property, but that is not what I am wanting.

    I am needing to actually send it from the other account.

    James

  4. #4
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and different accounts (Outlook 2000 SR1)

    Yeh, you can't do that in OL2K, either programmatically or via the UI. XP lets you choose an account in the user interface; I assume that's exposed in the object model, but we're not there yet so I don't know it for a fact. Not much help...

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and different accounts (Outlook 2000 SR1)

    FWIW, in IMO, this should bring up the Send Using dialog:<pre>Sub SendUsing()
    Dim cbtnSU As CommandBarButton
    Set cbtnSU = ActiveInspector.CommandBars.FindControl(, 31144)
    cbtnSU.Execute
    End Sub</pre>

    Please note that the machine I am sending this from is set to C/W. (If you want to explore further controls, you might like to start with the second piece of code in this post.) HTH
    Gre

  6. #6
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and different accounts (Outlook 2000 SR1)

    Thanks - I'll see what happens...

    Does this actually give something visible for the user to see or not?

    James

  7. #7
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and different accounts (Outlook 2000 SR1)

    Having looked at this a bit further, you'll want to work something on the basis of this code:<pre>Sub TestPopDialogByID()
    Dim cbtn As CommandBarPopup
    Set cbtn = ActiveInspector.CommandBars.FindControl(, 31144)
    cbtn.CommandBar.Controls(2).Execute
    Set cbtn = Nothing
    End Sub
    </pre>

    The Controls(2) finds the second of your listed accounts and "Sends Using" that account. If this is not enough to get you down the road to what you were looking for, please post back. HTH
    Gre

  8. #8
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and different accounts (Outlook 2000 SR1)

    That's pretty cool. See, Olddogs can learn new tricks!

Posting Permissions

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