vba to vb .net

O

olivier

Hi all !!

I try to build my first COM addin for outlook 2002, i retrieved an example
from microsoft web site, i tested it, it works !!

This addin just add a button in the outlook 2002 button bar , when i clic
this button a form is displayed.

So i try to modify this addin to replace the display of the form by my vba
function, here is my original vba code

Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim MsgTxt As String
Dim x As Integer
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.Count
MsgTxt = MsgTxt & myOlSel.Item(x).Subject
myOlSel.Item(x).SaveAs "c:\" & MsgTxt & ".msg", olMSG
Next x
MsgBox MsgTxt & "Has been copied ..."

This little code save to the hard disk the selected mail it works well no
problem.

I cpoied this function to my vb .net and there is an error message on the
line :
Set myOlExp = myOlApp.ActiveExplorer => error message => "Object reference
not set to an instance of an object."

the symbol olMsg must be difined but i don't know the value.

Anyone can help me ?

Thanks in advance

Olivier
 

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