Consulting

Results 1 to 3 of 3

Thread: Attach file from a certain folder.

  1. #1
    VBAX Newbie
    Joined
    Feb 2006
    Posts
    1
    Location

    Solved: Attach file from a certain folder.

    When sending an email message the paperclip button opens the "Insert File" dialog box. I want to write my own code to do that.

    I found the "Insertfile method" which will automatically insert a file. However I want to be able to pick a file every time from a file list.

    What I really want is to be able make a few different insert file buttons. Each one will always go to a certain folder. The built in button (the paperclip) always goes to to last used folder. I do a lot of attaching, and I am sick of the extensive folder tree hunts I have to do to attach files.

    I use Word as me email editor.


    I thought I had a simple solution, but it does not work:

    Sub Attach1()

    ChangeFileOpenDirectory _
    "C:\Documents and Settings\tsuser\MyDocuments\Invoices\"

    SendKeys "%IL", True
    'The above line should send Alt+I, wich opens the insert menu, and
    'then the L selects the "file..." menu item.
    End Sub

    When I run that macro the "Mark Citation" box opens.

    However when I manualy type Alt+I, L the proper dialog box opens.


    Stupid mistake. The I and the L need to be lower case. I don't use sendkeys much. Now I know.
    Last edited by tsonj; 02-16-2006 at 08:27 AM. Reason: Figured out the answer.

  2. #2
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Hi tsonj welcome to VBAX .

    I've found this thread which may help you:
    http://vbaexpress.com/forum/showthread.php?t=2944

    Marcster.

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi & Welcome to VBAX!

    Use the API method Killian provided in the article Marc send you to. (which also provides a default path to look in (uncomment that part))

    For buttons on the opened email you can use this KB article of mine:
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=502

    HTH!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

Posting Permissions

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