View Full Version : Attach file from a certain folder.

02-16-2006, 07:32 AM
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.

02-16-2006, 08:28 AM
Hi tsonj welcome to VBAX :hi:.

I've found this thread which may help you:


02-16-2006, 11:39 AM
Hi & Welcome to VBAX! :hi:

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:

HTH! :whistle: