PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Save eMail to file with Redemption

Reply

Save eMail to file with Redemption

 
Thread Tools Rate Thread
Old 05-11-2004, 05:28 PM   #1
Hunter
Guest
 
Posts: n/a
Default Save eMail to file with Redemption


Hello fellow corders,

I am new to VBA, redemption and outlook. :-)
I try to save an incomming message to a file so I can process it with
a C++ programm (that's the only thing I can code in).

I have Outlook 2003 and found out that I am not allowed to access the
MailItem.Body because of the latest service pack.
Therefore I am using Redemption.
With it I can dump the .Body to a message box, but not to a file!
I get an error saying "objewct required".

I would apprecitate help. Thank you!

Sub ProcessMail(objMsg As MailItem)

Set oMailItem = CreateObject("Redemption.SafeMailItem")
oMailItem.Item = objMsg
Open "D:\test.txt" For Output As #1
Print #1, onMailItem.Body.Item; ' ERROR here!
Close #1

End Sub
  Reply With Quote
Old 05-11-2004, 06:28 PM   #2
Dmitry Streblechenko \(MVP\)
Guest
 
Posts: n/a
Default Re: Save eMail to file with Redemption

Change the line
Print #1, onMailItem.Body.Item; ' ERROR here!
to
Print #1, oMailItem.Body; ' ERROR here!

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Hunter" <thexood@hotmail.com> wrote in message
news:2fd6d354.0411050928.6a91b6e9@posting.google.com...
> Hello fellow corders,
>
> I am new to VBA, redemption and outlook. :-)
> I try to save an incomming message to a file so I can process it with
> a C++ programm (that's the only thing I can code in).
>
> I have Outlook 2003 and found out that I am not allowed to access the
> MailItem.Body because of the latest service pack.
> Therefore I am using Redemption.
> With it I can dump the .Body to a message box, but not to a file!
> I get an error saying "objewct required".
>
> I would apprecitate help. Thank you!
>
> Sub ProcessMail(objMsg As MailItem)
>
> Set oMailItem = CreateObject("Redemption.SafeMailItem")
> oMailItem.Item = objMsg
> Open "D:\test.txt" For Output As #1
> Print #1, onMailItem.Body.Item; ' ERROR here!
> Close #1
>
> End Sub



  Reply With Quote
Old 07-11-2004, 06:57 PM   #3
Hunter
Guest
 
Posts: n/a
Default Re: Save eMail to file with Redemption

Thank you Dmitry,

this was quite embaressing. I just mistypes the variable! I would have
supected the compiler (or pharser) tells me about it, but now it gives
me some cryptic error message. *g*

No the oddest thing happend. I changed the macro and it is no longer
working!
As if it were empty. So I created a new function, and nothing happens.
Playing around in the VBA editor I suddenly get the message that the
macros are disabeld, yet I did not change a thing.

Turns out I had to delete the whole Module, save, exit and create a
all new one for the marcro to work again. Could this be some bug?
Maybe something jet again with a new service pack?

Do you, or anyone know any work arounds for this?

Thank you!



"Dmitry Streblechenko \(MVP\)" <dmitry@dimastr.com> wrote in message news:<eo5TEV2wEHA.2600@TK2MSFTNGP09.phx.gbl>...
> Change the line
> Print #1, onMailItem.Body.Item; ' ERROR here!
> to
> Print #1, oMailItem.Body; ' ERROR here!
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Hunter" <thexood@hotmail.com> wrote in message
> news:2fd6d354.0411050928.6a91b6e9@posting.google.com...
> > Hello fellow corders,
> >
> > I am new to VBA, redemption and outlook. :-)
> > I try to save an incomming message to a file so I can process it with
> > a C++ programm (that's the only thing I can code in).
> >
> > I have Outlook 2003 and found out that I am not allowed to access the
> > MailItem.Body because of the latest service pack.
> > Therefore I am using Redemption.
> > With it I can dump the .Body to a message box, but not to a file!
> > I get an error saying "objewct required".
> >
> > I would apprecitate help. Thank you!
> >
> > Sub ProcessMail(objMsg As MailItem)
> >
> > Set oMailItem = CreateObject("Redemption.SafeMailItem")
> > oMailItem.Item = objMsg
> > Open "D:\test.txt" For Output As #1
> > Print #1, onMailItem.Body.Item; ' ERROR here!
> > Close #1
> >
> > End Sub

  Reply With Quote
Old 08-11-2004, 05:37 PM   #4
Dmitry Streblechenko \(MVP\)
Guest
 
Posts: n/a
Default Re: Save eMail to file with Redemption

I don't know, I don't really use the Outlook VBA editor...

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Hunter" <thexood@hotmail.com> wrote in message
news:2fd6d354.0411071057.7e1dbd09@posting.google.com...
> Thank you Dmitry,
>
> this was quite embaressing. I just mistypes the variable! I would have
> supected the compiler (or pharser) tells me about it, but now it gives
> me some cryptic error message. *g*
>
> No the oddest thing happend. I changed the macro and it is no longer
> working!
> As if it were empty. So I created a new function, and nothing happens.
> Playing around in the VBA editor I suddenly get the message that the
> macros are disabeld, yet I did not change a thing.
>
> Turns out I had to delete the whole Module, save, exit and create a
> all new one for the marcro to work again. Could this be some bug?
> Maybe something jet again with a new service pack?
>
> Do you, or anyone know any work arounds for this?
>
> Thank you!
>
>
>
> "Dmitry Streblechenko \(MVP\)" <dmitry@dimastr.com> wrote in message

news:<eo5TEV2wEHA.2600@TK2MSFTNGP09.phx.gbl>...
> > Change the line
> > Print #1, onMailItem.Body.Item; ' ERROR here!
> > to
> > Print #1, oMailItem.Body; ' ERROR here!
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> > "Hunter" <thexood@hotmail.com> wrote in message
> > news:2fd6d354.0411050928.6a91b6e9@posting.google.com...
> > > Hello fellow corders,
> > >
> > > I am new to VBA, redemption and outlook. :-)
> > > I try to save an incomming message to a file so I can process it with
> > > a C++ programm (that's the only thing I can code in).
> > >
> > > I have Outlook 2003 and found out that I am not allowed to access the
> > > MailItem.Body because of the latest service pack.
> > > Therefore I am using Redemption.
> > > With it I can dump the .Body to a message box, but not to a file!
> > > I get an error saying "objewct required".
> > >
> > > I would apprecitate help. Thank you!
> > >
> > > Sub ProcessMail(objMsg As MailItem)
> > >
> > > Set oMailItem = CreateObject("Redemption.SafeMailItem")
> > > oMailItem.Item = objMsg
> > > Open "D:\test.txt" For Output As #1
> > > Print #1, onMailItem.Body.Item; ' ERROR here!
> > > Close #1
> > >
> > > End Sub



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off