Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook drag & drop of attachments in VB

Status
Not open for further replies.

DavidJA

Programmer
Jan 10, 2002
58
AU


I was hoping someone can point me to a tut on dragging a mail item from outlook to a vb app (perhaps with the OLEDragDrop Event).

I'm trying to implement the functionality of dragging an attachment (out of
OutLook) out of an mail item that you can select and drag to the explorer
and it will copy it to the File system where dragged (ie: the desktop), I
would like the same functionality in my application where it's dragged to my
app (ie: copied to the file system and returned the location of the file).

I've worked out the in the OLEDragDrop Event on my container that the
Data.GetData(-16370) and Data.GetData(-16268) return some data but not
really helpful in grabbing the attachment.

I tried setting the data to an email attachment object using the outlook
attach object (no good)
I have also noticed how to get the currently selected mail item in outlook
if it is open but cannot get the path to the file (I guess because it is
still part of the email message)

SOme code to see what I've been looking at.

Private Sub Frame1_OLEDragDrop(Data As DataObject, Effect As Long, Button As
Integer, Shift As Integer, X As Single, Y As Single)
'Dim oAttach As Outlook.Attachment
'Dim oApp As Outlook.Application
'Set oApp = New Outlook.Application
' Debug.Print
oApp.Explorers.Item(1).Selection.Item(1).Attachments.Item(1).FileName

If (IsObject(Data)) Then
Dim lLoop As Long

Debug.Print "This"
Debug.Print Data.GetData(-16370)
Debug.Print "That"
Debug.Print Data.GetData(-16268)

' Set oAttach = Data.GetData(-16370)
' Text1.Text = "-+-"
' For lLoop = -10000000 To 100000000
' On Error Resume Next
' '-16370, -16268
' Text1.Text = Data.GetData(lLoop)
' If (Err.Number = 0) Then
' MsgBox lLoop
' 'Exit Sub
' End If
' Next lLoop
Text1.Text = "-+-" & " Done.."
End If

End Sub

this is what is returned after a drop in the debug window
This
¼ ? À ? 4 x Microsoft Outlook File Attachment Microsoft
Outlook File Attachment
That
 ?????????????


Any help much appriciated.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top