Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Portland, Maine, USA
    Posts
    296
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Attaching file in Outlook (Outlook 2002)

    I need to put together something to loop through a public folder and selectively send emails based on criteria the user will select. The public folder has a custom form which includes a field for Rank. So the user will send an email to all "A" clients only. As part of preparing the email, the user will enter a subject, message body, and optionally an attachment.

    I am doing this with a VBA form and not an Outlook form and am planning to grab the information from this form to send emails to each contact which meets the selected criteria. I can not figure out how to get an "Insert Attachment" dialogue to come up and then save the path/filename back to my form.

    My questions:
    > Can anyone tell me how to do this?
    > Does anyone have a sample app that does something similiar?
    > Would I be better off customizing a mail message form instead of starting with a VBA form?

    Thank you!

  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: Attaching file in Outlook (Outlook 2002)

    Both here and the Outlook board you can find code examples for iterating through items in a folder in a PST. I don't know whether the Outlook Object Model provides similar access to public folders. What I suggest is the following. Run this procedure, and click through the namespace and see if you can locate the public folder. Then make a note of the "path" to it through the namespace.

    Sub ViewMyObjectProperties()
    Dim ns As Outlook.NameSpace
    Set ns = Application.GetNamespace("MAPI")
    Stop ' Now open the Locals window (View > Locals) and explore
    Set ns = Nothing
    End Sub

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Attaching file in Outlook (Outlook 2002)

    Jefferson, I read his request as looking to return the name and path of files selected to be inserted in the e-mail message.

    ActiveInspector.CommandBars.FindControl(, 1079).Execute <font color=448800>' (will error if there is no activeinspector)</font color=448800>

    doesn't return anything. But if he wants the folder path, I posted <!post=this,290189>this<!/post> a few days back.
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    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: Attaching file in Outlook (Outlook 2002)

    Uhhhhh, you're right, I somehow managed to miss the actual question. <img src=/S/doh.gif border=0 alt=doh width=15 height=15>

    I think one solution might be to use the built-in Windows common dialog that is the generic File>Open dialog in non-Office applications. I have read that there is a way to change its title bar to whatever you want, so it could be customized to say Insert Attachment. I'm not sure if the code was posted here or I saw it in a magazine...

    Googling... please wait... your call is very important to us... someone will be with you shortly...

    Okay, here are some samples from the web:

    HOWTO: Use a Common Dialog File Open Dialog with Win32 API (MSKB 161286)
    Display Open and Save As Dialog Boxes in Access with API Functions (Inside Microsoft Access, November 2001)

    http://officerone.tripod.com/vba/display_f...mon_dialog.html
    http://www.codeproject.com/vbscript/filebrowse.asp

    Having not tested or even read all the way through these, I can't say which would work best in this case.

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

    Re: Attaching file in Outlook (Outlook 2002)

    Thank you for the suggestions. When I have a chance to get back to this, I will let you know how I ended up doing this.

Posting Permissions

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