Link to home
Start Free TrialLog in
Avatar of daveglassenbury
daveglassenbury

asked on

How do I drag or attach files into a outlook email message from a VB form

I have a VB .net 2 form that provides the abilty to view various files that are in a listtree in the form. When selecting an item from the listtree it displays the picture,PDF or Word document beside the listree.

What I want to be able to do is somehow get the current picture,PDF or Word document from the VB form into a currently open outlook email message, preferably as a attachment. An example is if you drag and drop a file from windows explorer into an email message.
I've tried to use DoDragDrop but nothing seems to happen at the outlook end. I tried the office clipboard but it said JPEG format was not supported by the office clipboard.  

Dim doDataObject As New DataObject()
Dim sFiles As String = "C:\test\file.jpg"
doDataObject.SetData(System.Windows.Forms.DataFormats.FileDrop, sFiles)
PicBox.DoDragDrop(doDataObject, DragDropEffects.Copy)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of TSmooth
TSmooth

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of daveglassenbury
daveglassenbury

ASKER

Excellent, Thats exactly what I was after and I have got it going in my app.
Thanks