Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reference Outlook object

Posted on 2013-01-16
6
Medium Priority
?
317 Views
Last Modified: 2013-02-01
I would like to reference a object in Outlook for example the subject line in the task form.  How would I do that?
0
Comment
Question by:Kylo Ren
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38786139
Are you using interop?
0
 
LVL 5

Author Comment

by:Kylo Ren
ID: 38786157
No I'm not. Is that what You recommend?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38786217
Given that the question is in .NET zones, I assumed you are interfacing with Outlook from a .NET application. Is that correct?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Accepted Solution

by:
shorvath earned 2000 total points
ID: 38787223
Create a Macro in Outlook and paste the following code:

Dim objNameSpace As Outlook.NameSpace
Dim objTASK_Folder As Outlook.MAPIFolder
Dim objTasks As Outlook.Items
Dim objTask As Outlook.TaskItem

Set objNameSpace = Application.GetNamespace("MAPI")
Set objTASK_Folder = objNameSpace.GetDefaultFolder(olFolderTasks)
Set objTasks = objTASK_Folder.Items
Set objTask = Application.CreateItem(olTaskItem)

For Each objTask In objTasks
    MsgBox objTask.Subject
Next

Set objNameSpace = Nothing
Set objTASK_Folder = Nothing
Set objTasks = Nothing
Set objTask = Nothing

Open in new window

0
 
LVL 5

Author Comment

by:Kylo Ren
ID: 38790804
code cruiser, i am working in outlook only but i think outlook supports .net

shorvath, this may be what i am looking for.  i am assuming these lines clears the variables?

Set objNameSpace = Nothing
Set objTASK_Folder = Nothing
Set objTasks = Nothing
Set objTask = Nothing

also, can i import macros into visual studio?
0
 
LVL 9

Expert Comment

by:shorvath
ID: 38793559
it destroys the objects you created... VBA does not have garbage cleanup..

You can do most things using VBA within Outlook including COM and API calls..

You can do everything using Visual Studio and the MS Office Object Library.
    ( sample   ->   http://support.microsoft.com/default.aspx?id=310258)

It really depends on what you are doing..   developing an stand alone app or a simple solution for you Outlook users...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question