Trouble connecting to microsoft Outlook via VB code

V

VBJonC

At my old job, we used a management tool that could connect to Outlook
in order to store emails that were sent or received. It was also able
to send Outlook emails from the management tool.

At my new job, I am building my own management tool using Microsoft
Access. It works great and I am able to store sent and received emails
including attachments into my DB for later review.

I want to be able to send emails as well, as above. I am able to
create an outlook email, populate the TO & Subject field, and then
display the email. The user will then add attachments & body info, as
well as additional TO, CC, & BCC as needed. When they press send, I
want to capture what they have done and add it to the DB for later
review.

Based on what I have learned, it appears the old job was opening the
outlook email: display(modal TRUE). This way the code would pause
while the user did their thing and then they could hook the email and
grab all the fields. I have been attempting to replicate this, but
have been unsuccessful. As soon as the send button is pressed, the
email is gone and cannot be accessed.

In doing my research many of you say to not open the email modally as
this can cause other problems. I have no preference as to how I get
the job done, but I want to be able to do as I have described above.
Can anyone provide some insight into how I can get this done? A code
sample would be great, I am really good at chopping up a sample to
suit my needs, but any insight would be greatly appreciated.

I am running Office 2003, on win XP.
 
V

VBJonC

Handle the Send() and Close() events on the item, Close() on the Inspector.
Then your code will know what the item is doing and your event handlers can
pick up any properties you desire.

Samples for that sort of thing are atwww.outlookcode.com, and I haveOutlook2007 templates that handle events like that athttp://www.slovaktech.com/outlook_2007_templates.htm.

--
Ken Slovak
[MVP -Outlook]http://www.slovaktech.com
Author: Professional ProgrammingOutlook2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


At my old job, we used a management tool that could connect toOutlook
in order to store emails that were sent or received. It was also able
to sendOutlookemails from the management tool.
At my new job, I am building my own management tool usingMicrosoft
Access. It works great and I am able to store sent and received emails
including attachments into my DB for later review.
I want to be able to send emails as well, as above. I am able to
create anoutlookemail, populate the TO & Subject field, and then
display theemail. The user will then add attachments & body info, as
well as additional TO, CC, & BCC as needed. When they press send, I
want to capture what they have done and add it to the DB for later
review.
Based on what I have learned, it appears the old job was opening the
outlookemail: display(modal TRUE). This way the code would pause
while the user did their thing and then they could hook theemailand
grab all the fields. I have been attempting to replicate this, but
have been unsuccessful. As soon as the send button is pressed, the
emailis gone and cannot be accessed.
In doing my research many of you say to not open theemailmodally as
this can cause other problems. I have no preference as to how I get
the job done, but I want to be able to do as I have described above.
Can anyone provide some insight into how I can get this done? A code
sample would be great, I am really good at chopping up a sample to
suit my needs, but any insight would be greatly appreciated.
I am running Office 2003, on win XP.

Ken,

This may be beyond your patience, but I have never handled events for
objects added to an MS Access development project. I downloaded your
source code, and I can see what your doing, but I am at a loss as to
where to begin. I am sure the Inspector class needs to be created, and
then somehow hooked to the inspector object tha tI have in my code,
but I dont know how to do this. Can you point me to a simple sample?

Alternatively, is there a way in access to make the events for these
objects fire so I can do as you suggest above? (or is that the same
thing?)

Your help is appreciated.

Jonathan
 
V

VBJonC

Handle the Send() and Close() events on the item, Close() on the Inspector.
Then your code will know what the item is doing and your event handlerscan
pick up any properties you desire.
Samples for that sort of thing are atwww.outlookcode.com, and I haveOutlook2007 templates that handle events like that athttp://www.slovaktech.com/outlook_2007_templates.htm.
--
Ken Slovak
[MVP -Outlook]http://www.slovaktech.com
Author: Professional ProgrammingOutlook2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm

Ken,

This may be beyond your patience, but I have never handled events for
objects added to an MS Access development project. I downloaded your
source code, and I can see what your doing, but I am at a loss as to
where to begin. I am sure the Inspector class needs to be created, and
then somehow hooked to the inspector object tha tI have in my code,
but I dont know how to do this. Can you point me to a simple sample?

Alternatively, is there a way in access to make the events for these
objects fire so I can do as you suggest above? (or is that the same
thing?)

Your help is appreciated.

Jonathan

Ken,

I believe I got your InspWrapper working. I chopped out all the code I
didn't need, and I have successfully hooked the mail Send event. Now I
will build a quick test form around this to see if I can capture all
the data I need.

Thanks so much for pointing me in the right direction.
 
K

Ken Slovak - [MVP - Outlook]

Just make sure to save the item in the Save() event handler so all of its
properties are fully populated. Properties such as EntryID are null if the
item hasn't been saved first.




Ken,

This may be beyond your patience, but I have never handled events for
objects added to an MS Access development project. I downloaded your
source code, and I can see what your doing, but I am at a loss as to
where to begin. I am sure the Inspector class needs to be created, and
then somehow hooked to the inspector object tha tI have in my code,
but I dont know how to do this. Can you point me to a simple sample?

Alternatively, is there a way in access to make the events for these
objects fire so I can do as you suggest above? (or is that the same
thing?)

Your help is appreciated.

Jonathan

Ken,

I believe I got your InspWrapper working. I chopped out all the code I
didn't need, and I have successfully hooked the mail Send event. Now I
will build a quick test form around this to see if I can capture all
the data I need.

Thanks so much for pointing me in the right direction.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top