|
-
Sep 7th, 2005, 10:12 PM
#1
Thread Starter
Member
Removing outlook attachment from Word code
Hello everyone,
I am working on a project which is in Word. The project involves creating an Outlook mail message from Word and attaching the current word document as a PDF attachment. After the message has been sent, the attachment must be removed from the message otherwise it causes space issues for the mailbox on the server. I am able to remove the attachment by accessing the Sent Items folder.
However, my problem is, once the email message has been created, the code in word is not able to listen to the events happening with the message. So, for example, if the user decides to cancel the message, my word code has no idea that cancel has been pressed and it still keeps searching in the Sent Items folder in the hope that the message will sooner or later turn up. If after a set period of time (say 2 minutes) the message still hasn't appeared in the Sent Items folder, the code will give up. But this delay is causing word to be unavailable during that time period and is causing frustration for users. Can anyone give some ideas about how to trap the events of Outlook from Word?? I could do it from Outlook but I don't know how to let Outlook just trust my code and not run any viruses.
Thanks in Adv.
-
Sep 7th, 2005, 10:33 PM
#2
Re: Removing outlook attachment from Word code
There is no need to do it from Word. You can create a Items_Add event for the SentItems folder in Outlook. Then whenever a email is sent from Word with a certain subject or attachment name or all attachments can be removed at that time from within Outlook.
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 
-
Sep 7th, 2005, 11:16 PM
#3
Thread Starter
Member
Re: Removing outlook attachment from Word code
Thanks for your reply, RobDog888. But how can I tell Outlook to trust only my code because I don't want to set security of Outlook to low in order to allow my code to run.
-
Sep 7th, 2005, 11:21 PM
#4
Re: Removing outlook attachment from Word code
You only need to set the security to Medium - allow the user to choose to run macros or not. If you want to put it to High and have it still run then you can look at my CodeBank thread on Creating Digital Signatures and signing VBA projects.
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 
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
|