|
-
May 23rd, 2006, 02:35 AM
#1
Thread Starter
Hyperactive Member
Attachment To MailItem
Hi there,
How do I put an attachment (which is a mailItem) into a MailItem Object?
Like this:
Dim oAttach As Outlook.Attachment
Dim myOlMail As Outlook.MailItem
For Each oAttach In myEmail.Attachments
Set myOlMail = oAttach
Next
The problem here is that VB sees the attachment as an Attachment and not as a mailitem...
Last edited by HWijngaarD; May 23rd, 2006 at 02:44 AM.
-
May 23rd, 2006, 03:52 AM
#2
Re: Attachment To MailItem
Dont you need to use :
Code:
myEmail.Attachments.Add(....?)
(Guessing here).
You may have to make an attachment object first then add that object to the attachments collection. Should be mentioned in the help files.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
May 23rd, 2006, 03:56 AM
#3
Re: Attachment To MailItem
You need to use .CreateItemFromTemplate to open the attached mailitem.
Heres one of my c0d examples:
http://www.vbforums.com/showthread.php?t=347353
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 23rd, 2006, 03:58 AM
#4
Thread Starter
Hyperactive Member
Re: Attachment To MailItem
This is my situation:
I've got a Task Item wich contains an email as attachment.
This email I'd like to set in an EmailItem Object.
But this won't work cause the Email is an attachmentItem.
So I need somehow convert this attachment into a mailobject or something like that.
But if this cannot be done then so be it...
-
May 23rd, 2006, 03:59 AM
#5
Re: Attachment To MailItem
It can be done. Just need to modify my code example to initially get the TaskItem instead of a mailItem. Then CreateItemFromTemplate to open the saved mailitem and moved into your Inbox.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 29th, 2006, 12:59 AM
#6
Thread Starter
Hyperactive Member
Re: Attachment To MailItem
Thanks Yoda!
This is probably the only solution...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|