I'm trying to change the name of an Outlook attachment and detach it to a particular directory, using Outlook VBA. Ive tried dimming ConName/1 as Variant, but it doesn't like to assign an object to a non-object variable..is there any way around this?
Here is a chunk of my code
Dim myitem As Outlook.MailItem
Dim myAttach As Outlook.Attachment
Dim ConName As String
Dim ConName1 As String
ConName = Left(myAttach.FileName, 14) & ".txt"
ConName1 = Left(myAttach.FileName, 6) & ".csv"
Set myAttach = myitem.Attachments(1)
myAttach.SaveAsFile "t:\" & myAttach.FileName
myAttach.SaveAsFile "t:\" & ConName
myAttach.SaveAsFile "j:\" & ConName1