I am trying to drag a file attachment from Outlook onto a VB form with a text box control and get the file name. The code below works great with files from explorer.
When I drag an attached file from Outlook I get Error #461 "the message Sepcified format doesn't match format of data". Look to find the adjustment needed to drag an attached file from outlook and get the name of the file in the text box.
Private Sub Form_Load()
txt_File_Name.OLEDropMode = 1 ' Manual
Private Sub txt_File_Name_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo errorLoadingFile
'If Data.GetFormat(vbCFFiles) Then
Dim fileName As String
fileName = Data.Files(1)
Me.txt_File_Name.Text = fileName
MsgBox fileName, vbExclamation, "Error Loading File"