|
-
Aug 8th, 2007, 03:55 AM
#1
Thread Starter
New Member
[Outlook 2007] How do you copy information from a field in an open mail?
As the title says.
Basically what I'm trying to do is copy information from a received email, for example, the subject, and copy it into a meeting request. The mail that is received will always be open when my code is run. However, how do I refer to the subject field in the mail to copy the information from it?
Even though it's probably really easy to do, it's giving me a minor headache at the minute, so any information you could provide would be great.
Thanks.
-
Aug 8th, 2007, 04:07 AM
#2
Re: [Outlook 2007] How do you copy information from a field in an open mail?
Welcome to the Forums.
It doesnt need to be open to read the subject. If you are doing this in Outlooks VBA then you can write VBA code in the Application_NewMailEx event which fires when there is a new mail received. The EntryIDCollection passed in argument it the unique identifier for that particular Outlook Object. When it comes in you can set a Object variable to it and check for olMail type class and read its subject and body properties.
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 
-
Aug 8th, 2007, 04:15 AM
#3
Thread Starter
New Member
Re: [Outlook 2007] How do you copy information from a field in an open mail?
Thanks! :-)
Is there an easy way to refer to a field in an open mail though?
Let me explain a little more about what I'm doing. Basically I have created a custom form in outlook based on a mail message. I intend to use this form as a holiday booking form. So the users will submit this custom for to their manager. The manager will check it, then click a button saying "Approve Holiday Request". This then copys the information from the email into a meeting request and sends the meeting request off to a Holiday calender reesource in outlook. I hope I've explained that ok.
As this is being distributed to a sizable number of end users I didn't really want to add code to everyones PC that fires in when they have a new mail. I'd rather just have a small piece of code behind a button click. I'm fairly familiar with programming in VB and VBA in Access but I've never tried it in Outlook.
-
Aug 8th, 2007, 05:05 AM
#4
Re: [Outlook 2007] How do you copy information from a field in an open mail?
Ok so if this custom Outlook Forum is a Outlook Form and not a UserForm then you can Publish the Form to that public folder for all access by users. Then we will need to write VBScript code behind the form using the code editor of the Form. VBScript is a pain and Im not very fluent with it because of that reason. But I believe you can still do it similar to the VBA way.
When the user clicks the button you would need to find the open "Inspector"'s in that session and determine which is the desired on to use by some means of unique identification. Once obtained you can set an object variable of Instector type to it so you can better access its properties and red the subject/body protgrammatically and then move to the next part - entering that info to the appointmentitems body property.
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 
-
Aug 8th, 2007, 05:10 AM
#5
Thread Starter
New Member
Re: [Outlook 2007] How do you copy information from a field in an open mail?
Excellent, thanks for you help. I'll have a bash at this and let you know how I get on.
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
|