PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Re: Open Email For Edit????

Reply

Re: Open Email For Edit????

 
Thread Tools Rate Thread
Old 14-12-2006, 06:50 PM   #1
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Open Email For Edit????


Display message modally and do not call Send, leave that to a user:
....
Report.Display(TRUE)
wdApp.Quit False
Set doc = Nothing
Set wdApp = Nothing
DoCmd.Close
Application.Quit acQuitSaveAll


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

"Jeff C" <JeffC@discussions.microsoft.com> wrote in message
news:8C8CE26D-0220-49AC-BE88-468B45C9B13C@microsoft.com...
>I am using the following to send a simple text report in the message body
>of
> an Outlook email (Office 2003) from an MS Access database tool. Because
> of
> the security features I get the warning about something trying to send an
> email which requires the user to acknowledge by clicking on the yes
> button.
> I know about the "ClickYes" program but I would much rather just have the
> email open for editing requiring the user to manually send the email
> rather
> than getting the warning message.
>
> Is there any modification or change I could implement to the code below
> that
> will make this happen? Thank you very much.
>
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>
> DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF, "Full Path
> To
> MyAccessReport"
>
> Dim wdApp As Word.Application
> Dim doc As Word.Document
> Dim Report As MailItem
>
> Set wdApp = New Word.Application
> Set doc = wdApp.Documents.Open("Full Path To MyAccessReport ")
> Set Report = doc.MailEnvelope.Item
>
> Report.To = [Forms]![MyAccessForm].[txtEmail]
> Report.Subject = "MyEmailSubject"
> Report.Display
> Report.Send
>
> wdApp.Quit False
> Set doc = Nothing
> Set wdApp = Nothing
>
> DoCmd.Close
> Application.Quit acQuitSaveAll
>
> --
> Jeff C
> Live Well .. Be Happy In All You Do



  Reply With Quote
Old 14-12-2006, 08:21 PM   #2
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

What happens when you step through the code? Do you have "on error resumee
next" anywhere?

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

"Jeff C" <JeffC@discussions.microsoft.com> wrote in message
news:C7C98739-CB25-45DD-AEDE-B336529E657E@microsoft.com...
> Thanks for your help Dmitry, but that doesn't seem to work. The code runs
> without an error but there is no email generated. What could that be??
> --
> Jeff C
> Live Well .. Be Happy In All You Do
>
>
> "Dmitry Streblechenko" wrote:
>
>> Display message modally and do not call Send, leave that to a user:
>> ....
>> Report.Display(TRUE)
>> wdApp.Quit False
>> Set doc = Nothing
>> Set wdApp = Nothing
>> DoCmd.Close
>> Application.Quit acQuitSaveAll
>>
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>> news:8C8CE26D-0220-49AC-BE88-468B45C9B13C@microsoft.com...
>> >I am using the following to send a simple text report in the message
>> >body
>> >of
>> > an Outlook email (Office 2003) from an MS Access database tool.
>> > Because
>> > of
>> > the security features I get the warning about something trying to send
>> > an
>> > email which requires the user to acknowledge by clicking on the yes
>> > button.
>> > I know about the "ClickYes" program but I would much rather just have
>> > the
>> > email open for editing requiring the user to manually send the email
>> > rather
>> > than getting the warning message.
>> >
>> > Is there any modification or change I could implement to the code below
>> > that
>> > will make this happen? Thank you very much.
>> >
>> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
>> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>> >
>> > DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF, "Full
>> > Path
>> > To
>> > MyAccessReport"
>> >
>> > Dim wdApp As Word.Application
>> > Dim doc As Word.Document
>> > Dim Report As MailItem
>> >
>> > Set wdApp = New Word.Application
>> > Set doc = wdApp.Documents.Open("Full Path To MyAccessReport ")
>> > Set Report = doc.MailEnvelope.Item
>> >
>> > Report.To = [Forms]![MyAccessForm].[txtEmail]
>> > Report.Subject = "MyEmailSubject"
>> > Report.Display
>> > Report.Send
>> >
>> > wdApp.Quit False
>> > Set doc = Nothing
>> > Set wdApp = Nothing
>> >
>> > DoCmd.Close
>> > Application.Quit acQuitSaveAll
>> >
>> > --
>> > Jeff C
>> > Live Well .. Be Happy In All You Do

>>
>>
>>



  Reply With Quote
Old 14-12-2006, 09:05 PM   #3
Jeff C
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

I am wondering if I somehow have to open and Outlook Application???

Sorry about the naive questions, I guess I know just enought to get
myself in trouble (but I am learning thanks to you)


Dmitry Streblechenko wrote:
> What happens when you step through the code? Do you have "on error resumee
> next" anywhere?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
> news:C7C98739-CB25-45DD-AEDE-B336529E657E@microsoft.com...
> > Thanks for your help Dmitry, but that doesn't seem to work. The code runs
> > without an error but there is no email generated. What could that be??
> > --
> > Jeff C
> > Live Well .. Be Happy In All You Do
> >
> >
> > "Dmitry Streblechenko" wrote:
> >
> >> Display message modally and do not call Send, leave that to a user:
> >> ....
> >> Report.Display(TRUE)
> >> wdApp.Quit False
> >> Set doc = Nothing
> >> Set wdApp = Nothing
> >> DoCmd.Close
> >> Application.Quit acQuitSaveAll
> >>
> >>
> >> Dmitry Streblechenko (MVP)
> >> http://www.dimastr.com/
> >> OutlookSpy - Outlook, CDO
> >> and MAPI Developer Tool
> >>
> >> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
> >> news:8C8CE26D-0220-49AC-BE88-468B45C9B13C@microsoft.com...
> >> >I am using the following to send a simple text report in the message
> >> >body
> >> >of
> >> > an Outlook email (Office 2003) from an MS Access database tool.
> >> > Because
> >> > of
> >> > the security features I get the warning about something trying to send
> >> > an
> >> > email which requires the user to acknowledge by clicking on the yes
> >> > button.
> >> > I know about the "ClickYes" program but I would much rather just have
> >> > the
> >> > email open for editing requiring the user to manually send the email
> >> > rather
> >> > than getting the warning message.
> >> >
> >> > Is there any modification or change I could implement to the code below
> >> > that
> >> > will make this happen? Thank you very much.
> >> >
> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
> >> >
> >> > DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF, "Full
> >> > Path
> >> > To
> >> > MyAccessReport"
> >> >
> >> > Dim wdApp As Word.Application
> >> > Dim doc As Word.Document
> >> > Dim Report As MailItem
> >> >
> >> > Set wdApp = New Word.Application
> >> > Set doc = wdApp.Documents.Open("Full Path To MyAccessReport ")
> >> > Set Report = doc.MailEnvelope.Item
> >> >
> >> > Report.To = [Forms]![MyAccessForm].[txtEmail]
> >> > Report.Subject = "MyEmailSubject"
> >> > Report.Display
> >> > Report.Send
> >> >
> >> > wdApp.Quit False
> >> > Set doc = Nothing
> >> > Set wdApp = Nothing
> >> >
> >> > DoCmd.Close
> >> > Application.Quit acQuitSaveAll
> >> >
> >> > --
> >> > Jeff C
> >> > Live Well .. Be Happy In All You Do
> >>
> >>
> >>


  Reply With Quote
Old 14-12-2006, 09:15 PM   #4
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

Call doc.Close beflore calling Display.

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

"Jeff C" <JeffC@discussions.microsoft.com> wrote in message
news:F3F9F8C6-7724-4E2F-A866-586BC2B152E9@microsoft.com...
> This is the entire code that I changed to reflect your suggestion. The
> code
> just runs without any breaks, the report is exported in rtf format but
> outlook does not open and no mail is displayed.
>
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>
> DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF,
> "FullPathOfMyAccessReportExported"
>
> Dim wdApp As Word.Application
> Dim doc As Word.Document
> Dim Report As MailItem
>
> Set wdApp = New Word.Application
> Set doc = wdApp.Documents.Open("FullPathOfMyAccessReportExported")
> Set Report = doc.MailEnvelope.Item
>
> Report.To = [Forms]![MyAccessForm].[txtEmail]
> Report.Subject = "MySubject"
> Report.Display (True)
> 'Report.Send
>
> wdApp.Quit False
> Set doc = Nothing
> Set wdApp = Nothing
> --
> Jeff C
> Live Well .. Be Happy In All You Do
>
>
> "Dmitry Streblechenko" wrote:
>
>> What happens when you step through the code? Do you have "on error
>> resumee
>> next" anywhere?
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>> news:C7C98739-CB25-45DD-AEDE-B336529E657E@microsoft.com...
>> > Thanks for your help Dmitry, but that doesn't seem to work. The code
>> > runs
>> > without an error but there is no email generated. What could that be??
>> > --
>> > Jeff C
>> > Live Well .. Be Happy In All You Do
>> >
>> >
>> > "Dmitry Streblechenko" wrote:
>> >
>> >> Display message modally and do not call Send, leave that to a user:
>> >> ....
>> >> Report.Display(TRUE)
>> >> wdApp.Quit False
>> >> Set doc = Nothing
>> >> Set wdApp = Nothing
>> >> DoCmd.Close
>> >> Application.Quit acQuitSaveAll
>> >>
>> >>
>> >> Dmitry Streblechenko (MVP)
>> >> http://www.dimastr.com/
>> >> OutlookSpy - Outlook, CDO
>> >> and MAPI Developer Tool
>> >>
>> >> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>> >> news:8C8CE26D-0220-49AC-BE88-468B45C9B13C@microsoft.com...
>> >> >I am using the following to send a simple text report in the message
>> >> >body
>> >> >of
>> >> > an Outlook email (Office 2003) from an MS Access database tool.
>> >> > Because
>> >> > of
>> >> > the security features I get the warning about something trying to
>> >> > send
>> >> > an
>> >> > email which requires the user to acknowledge by clicking on the yes
>> >> > button.
>> >> > I know about the "ClickYes" program but I would much rather just
>> >> > have
>> >> > the
>> >> > email open for editing requiring the user to manually send the email
>> >> > rather
>> >> > than getting the warning message.
>> >> >
>> >> > Is there any modification or change I could implement to the code
>> >> > below
>> >> > that
>> >> > will make this happen? Thank you very much.
>> >> >
>> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
>> >> > acMenuVer70
>> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>> >> >
>> >> > DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF, "Full
>> >> > Path
>> >> > To
>> >> > MyAccessReport"
>> >> >
>> >> > Dim wdApp As Word.Application
>> >> > Dim doc As Word.Document
>> >> > Dim Report As MailItem
>> >> >
>> >> > Set wdApp = New Word.Application
>> >> > Set doc = wdApp.Documents.Open("Full Path To MyAccessReport ")
>> >> > Set Report = doc.MailEnvelope.Item
>> >> >
>> >> > Report.To = [Forms]![MyAccessForm].[txtEmail]
>> >> > Report.Subject = "MyEmailSubject"
>> >> > Report.Display
>> >> > Report.Send
>> >> >
>> >> > wdApp.Quit False
>> >> > Set doc = Nothing
>> >> > Set wdApp = Nothing
>> >> >
>> >> > DoCmd.Close
>> >> > Application.Quit acQuitSaveAll
>> >> >
>> >> > --
>> >> > Jeff C
>> >> > Live Well .. Be Happy In All You Do
>> >>
>> >>
>> >>

>>
>>
>>



  Reply With Quote
Old 14-12-2006, 10:57 PM   #5
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

Hmmm.. I don't use Word for anything e-mail related, but it looks like you'd
be better off explicitly creating an instance of the Outlook.Application
object, creating a new message (Application.CreateItem), setting the
MailItem.HTMLBody property to the document contents exported from Word and
then displaying it (MailItem.Display)

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

"Jeff C" <JeffC@discussions.microsoft.com> wrote in message
news:207172E1-71E4-4FC9-80F2-DA47D53D8D92@microsoft.com...
> Dmitry:
>
> I have tried inserting that call on every line before Display and it does
> allow Outlook to open but the message body is empty (the mailenvelope.item
> exported report is missing)
> --
> Jeff C
> Live Well .. Be Happy In All You Do
>
>
> "Dmitry Streblechenko" wrote:
>
>> Call doc.Close beflore calling Display.
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>> news:F3F9F8C6-7724-4E2F-A866-586BC2B152E9@microsoft.com...
>> > This is the entire code that I changed to reflect your suggestion. The
>> > code
>> > just runs without any breaks, the report is exported in rtf format but
>> > outlook does not open and no mail is displayed.
>> >
>> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
>> > acMenuVer70
>> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>> >
>> > DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF,
>> > "FullPathOfMyAccessReportExported"
>> >
>> > Dim wdApp As Word.Application
>> > Dim doc As Word.Document
>> > Dim Report As MailItem
>> >
>> > Set wdApp = New Word.Application
>> > Set doc = wdApp.Documents.Open("FullPathOfMyAccessReportExported")
>> > Set Report = doc.MailEnvelope.Item
>> >
>> > Report.To = [Forms]![MyAccessForm].[txtEmail]
>> > Report.Subject = "MySubject"
>> > Report.Display (True)
>> > 'Report.Send
>> >
>> > wdApp.Quit False
>> > Set doc = Nothing
>> > Set wdApp = Nothing
>> > --
>> > Jeff C
>> > Live Well .. Be Happy In All You Do
>> >
>> >
>> > "Dmitry Streblechenko" wrote:
>> >
>> >> What happens when you step through the code? Do you have "on error
>> >> resumee
>> >> next" anywhere?
>> >>
>> >> Dmitry Streblechenko (MVP)
>> >> http://www.dimastr.com/
>> >> OutlookSpy - Outlook, CDO
>> >> and MAPI Developer Tool
>> >>
>> >> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>> >> news:C7C98739-CB25-45DD-AEDE-B336529E657E@microsoft.com...
>> >> > Thanks for your help Dmitry, but that doesn't seem to work. The
>> >> > code
>> >> > runs
>> >> > without an error but there is no email generated. What could that
>> >> > be??
>> >> > --
>> >> > Jeff C
>> >> > Live Well .. Be Happy In All You Do
>> >> >
>> >> >
>> >> > "Dmitry Streblechenko" wrote:
>> >> >
>> >> >> Display message modally and do not call Send, leave that to a user:
>> >> >> ....
>> >> >> Report.Display(TRUE)
>> >> >> wdApp.Quit False
>> >> >> Set doc = Nothing
>> >> >> Set wdApp = Nothing
>> >> >> DoCmd.Close
>> >> >> Application.Quit acQuitSaveAll
>> >> >>
>> >> >>
>> >> >> Dmitry Streblechenko (MVP)
>> >> >> http://www.dimastr.com/
>> >> >> OutlookSpy - Outlook, CDO
>> >> >> and MAPI Developer Tool
>> >> >>
>> >> >> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>> >> >> news:8C8CE26D-0220-49AC-BE88-468B45C9B13C@microsoft.com...
>> >> >> >I am using the following to send a simple text report in the
>> >> >> >message
>> >> >> >body
>> >> >> >of
>> >> >> > an Outlook email (Office 2003) from an MS Access database tool.
>> >> >> > Because
>> >> >> > of
>> >> >> > the security features I get the warning about something trying to
>> >> >> > send
>> >> >> > an
>> >> >> > email which requires the user to acknowledge by clicking on the
>> >> >> > yes
>> >> >> > button.
>> >> >> > I know about the "ClickYes" program but I would much rather just
>> >> >> > have
>> >> >> > the
>> >> >> > email open for editing requiring the user to manually send the
>> >> >> > email
>> >> >> > rather
>> >> >> > than getting the warning message.
>> >> >> >
>> >> >> > Is there any modification or change I could implement to the code
>> >> >> > below
>> >> >> > that
>> >> >> > will make this happen? Thank you very much.
>> >> >> >
>> >> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
>> >> >> > acMenuVer70
>> >> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>> >> >> >
>> >> >> > DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF,
>> >> >> > "Full
>> >> >> > Path
>> >> >> > To
>> >> >> > MyAccessReport"
>> >> >> >
>> >> >> > Dim wdApp As Word.Application
>> >> >> > Dim doc As Word.Document
>> >> >> > Dim Report As MailItem
>> >> >> >
>> >> >> > Set wdApp = New Word.Application
>> >> >> > Set doc = wdApp.Documents.Open("Full Path To MyAccessReport ")
>> >> >> > Set Report = doc.MailEnvelope.Item
>> >> >> >
>> >> >> > Report.To = [Forms]![MyAccessForm].[txtEmail]
>> >> >> > Report.Subject = "MyEmailSubject"
>> >> >> > Report.Display
>> >> >> > Report.Send
>> >> >> >
>> >> >> > wdApp.Quit False
>> >> >> > Set doc = Nothing
>> >> >> > Set wdApp = Nothing
>> >> >> >
>> >> >> > DoCmd.Close
>> >> >> > Application.Quit acQuitSaveAll
>> >> >> >
>> >> >> > --
>> >> >> > Jeff C
>> >> >> > Live Well .. Be Happy In All You Do
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>

>>
>>
>>



  Reply With Quote
Old 14-12-2006, 11:24 PM   #6
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

To show the message created with MailEnvelope as an Outlook message, you'd need to save it, get the EntryID, then return a new item with Namespace.GetItemFromID and finally display that item.

Why not just open the Word doc and show the envelope there:

doc.Activate
doc.MailEnvelope.EnvelopeShow

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:uQfLMM9HHHA.3616@TK2MSFTNGP06.phx.gbl...
> Hmmm.. I don't use Word for anything e-mail related, but it looks like you'd
> be better off explicitly creating an instance of the Outlook.Application
> object, creating a new message (Application.CreateItem), setting the
> MailItem.HTMLBody property to the document contents exported from Word and
> then displaying it (MailItem.Display)
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
> news:207172E1-71E4-4FC9-80F2-DA47D53D8D92@microsoft.com...
>> Dmitry:
>>
>> I have tried inserting that call on every line before Display and it does
>> allow Outlook to open but the message body is empty (the mailenvelope.item
>> exported report is missing)
>> --
>> Jeff C
>> Live Well .. Be Happy In All You Do
>>
>>
>> "Dmitry Streblechenko" wrote:
>>
>>> Call doc.Close beflore calling Display.
>>>
>>> Dmitry Streblechenko (MVP)
>>> http://www.dimastr.com/
>>> OutlookSpy - Outlook, CDO
>>> and MAPI Developer Tool
>>>
>>> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>>> news:F3F9F8C6-7724-4E2F-A866-586BC2B152E9@microsoft.com...
>>> > This is the entire code that I changed to reflect your suggestion. The
>>> > code
>>> > just runs without any breaks, the report is exported in rtf format but
>>> > outlook does not open and no mail is displayed.
>>> >
>>> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
>>> > acMenuVer70
>>> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>>> >
>>> > DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF,
>>> > "FullPathOfMyAccessReportExported"
>>> >
>>> > Dim wdApp As Word.Application
>>> > Dim doc As Word.Document
>>> > Dim Report As MailItem
>>> >
>>> > Set wdApp = New Word.Application
>>> > Set doc = wdApp.Documents.Open("FullPathOfMyAccessReportExported")
>>> > Set Report = doc.MailEnvelope.Item
>>> >
>>> > Report.To = [Forms]![MyAccessForm].[txtEmail]
>>> > Report.Subject = "MySubject"
>>> > Report.Display (True)
>>> > 'Report.Send
>>> >
>>> > wdApp.Quit False
>>> > Set doc = Nothing
>>> > Set wdApp = Nothing
>>> > --
>>> > Jeff C
>>> > Live Well .. Be Happy In All You Do
>>> >
>>> >
>>> > "Dmitry Streblechenko" wrote:
>>> >
>>> >> What happens when you step through the code? Do you have "on error
>>> >> resumee
>>> >> next" anywhere?
>>> >>
>>> >> Dmitry Streblechenko (MVP)
>>> >> http://www.dimastr.com/
>>> >> OutlookSpy - Outlook, CDO
>>> >> and MAPI Developer Tool
>>> >>
>>> >> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>>> >> news:C7C98739-CB25-45DD-AEDE-B336529E657E@microsoft.com...
>>> >> > Thanks for your help Dmitry, but that doesn't seem to work. The
>>> >> > code
>>> >> > runs
>>> >> > without an error but there is no email generated. What could that
>>> >> > be??
>>> >> > --
>>> >> > Jeff C
>>> >> > Live Well .. Be Happy In All You Do
>>> >> >
>>> >> >
>>> >> > "Dmitry Streblechenko" wrote:
>>> >> >
>>> >> >> Display message modally and do not call Send, leave that to a user:
>>> >> >> ....
>>> >> >> Report.Display(TRUE)
>>> >> >> wdApp.Quit False
>>> >> >> Set doc = Nothing
>>> >> >> Set wdApp = Nothing
>>> >> >> DoCmd.Close
>>> >> >> Application.Quit acQuitSaveAll
>>> >> >>
>>> >> >>
>>> >> >> Dmitry Streblechenko (MVP)
>>> >> >> http://www.dimastr.com/
>>> >> >> OutlookSpy - Outlook, CDO
>>> >> >> and MAPI Developer Tool
>>> >> >>
>>> >> >> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message
>>> >> >> news:8C8CE26D-0220-49AC-BE88-468B45C9B13C@microsoft.com...
>>> >> >> >I am using the following to send a simple text report in the
>>> >> >> >message
>>> >> >> >body
>>> >> >> >of
>>> >> >> > an Outlook email (Office 2003) from an MS Access database tool.
>>> >> >> > Because
>>> >> >> > of
>>> >> >> > the security features I get the warning about something trying to
>>> >> >> > send
>>> >> >> > an
>>> >> >> > email which requires the user to acknowledge by clicking on the
>>> >> >> > yes
>>> >> >> > button.
>>> >> >> > I know about the "ClickYes" program but I would much rather just
>>> >> >> > have
>>> >> >> > the
>>> >> >> > email open for editing requiring the user to manually send the
>>> >> >> > email
>>> >> >> > rather
>>> >> >> > than getting the warning message.
>>> >> >> >
>>> >> >> > Is there any modification or change I could implement to the code
>>> >> >> > below
>>> >> >> > that
>>> >> >> > will make this happen? Thank you very much.
>>> >> >> >
>>> >> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
>>> >> >> > acMenuVer70
>>> >> >> > DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>>> >> >> >
>>> >> >> > DoCmd.OutputTo acOutputReport, "MyAccessReport", acFormatRTF,
>>> >> >> > "Full
>>> >> >> > Path
>>> >> >> > To
>>> >> >> > MyAccessReport"
>>> >> >> >
>>> >> >> > Dim wdApp As Word.Application
>>> >> >> > Dim doc As Word.Document
>>> >> >> > Dim Report As MailItem
>>> >> >> >
>>> >> >> > Set wdApp = New Word.Application
>>> >> >> > Set doc = wdApp.Documents.Open("Full Path To MyAccessReport ")
>>> >> >> > Set Report = doc.MailEnvelope.Item
>>> >> >> >
>>> >> >> > Report.To = [Forms]![MyAccessForm].[txtEmail]
>>> >> >> > Report.Subject = "MyEmailSubject"
>>> >> >> > Report.Display
>>> >> >> > Report.Send
>>> >> >> >
>>> >> >> > wdApp.Quit False
>>> >> >> > Set doc = Nothing
>>> >> >> > Set wdApp = Nothing
>>> >> >> >
>>> >> >> > DoCmd.Close
>>> >> >> > Application.Quit acQuitSaveAll
>>> >> >> >
>>> >> >> > --
>>> >> >> > Jeff C
>>> >> >> > Live Well .. Be Happy In All You Do
>>> >> >>
>>> >> >>
>>> >> >>
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>

>
>

  Reply With Quote
Old 14-12-2006, 11:29 PM   #7
=?Utf-8?B?SmVmZiBD?=
Guest
 
Posts: n/a
Default Re: Open Email For Edit????


--
Jeff C
Live Well .. Be Happy In All You Do


"Dmitry Streblechenko" wrote:

> Hmmm.. I don't use Word for anything e-mail related, but it looks like you'd
> be better off explicitly creating an instance of the Outlook.Application
> object, creating a new message (Application.CreateItem), setting the
> MailItem.HTMLBody property to the document contents exported from Word and
> then displaying it (MailItem.Display)
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>

Dmitry:

I am a bit knowledgeable about MS Access and just limp along with the other
pieces of MS Office Pro. From Access I am able to export the report, that is
needed in the Outlook message body, in rtf or txt format. I had worked
through the code I used on an earlier project. I do not necessarily need to
use Word, I am just trying to get the report placed in the body of the
message.

If you have time, would you please offer alternative lines of code
reflecting your suggestions so I have an idea what I should replace in what I
have now? Thanks very much, you're appreciated!


  Reply With Quote
Old 15-12-2006, 12:29 AM   #8
=?Utf-8?B?SmVmZiBD?=
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

Thanks Sue:

You originally helped me as I was assembling the code I have been using
here.

Are you saying that:

doc.Activate
doc.MailEnvelope.EnvelopeShow

Will open the Outlook email with the document in the message body there-by
avoiding the security warning???
--
Jeff C
Live Well .. Be Happy In All You Do


"Sue Mosher [MVP-Outlook]" wrote:

> To show the message created with MailEnvelope as an Outlook message, you'd need to save it, get the EntryID, then return a new item with Namespace.GetItemFromID and finally display that item.
>
> Why not just open the Word doc and show the envelope there:
>
> doc.Activate
> doc.MailEnvelope.EnvelopeShow
>


  Reply With Quote
Old 15-12-2006, 01:45 AM   #9
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

No, I'm saying that using EnvelopeShow will open the Word document with all the controls the user needs to address and send the message. If you want to show an Outlook item, you must use the other procedure I outlined.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Jeff C" <JeffC@discussions.microsoft.com> wrote in message news:69F895C7-DB59-49FD-AEDD-977F6EDED233@microsoft.com...
> Thanks Sue:
>
> You originally helped me as I was assembling the code I have been using
> here.
>
> Are you saying that:
>
> doc.Activate
> doc.MailEnvelope.EnvelopeShow
>
> Will open the Outlook email with the document in the message body there-by
> avoiding the security warning???
> --
> Jeff C
> Live Well .. Be Happy In All You Do
>
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> To show the message created with MailEnvelope as an Outlook message, you'd need to save it, get the EntryID, then return a new item with Namespace.GetItemFromID and finally display that item.
>>
>> Why not just open the Word doc and show the envelope there:
>>
>> doc.Activate
>> doc.MailEnvelope.EnvelopeShow
>>

>

  Reply With Quote
Old 15-12-2006, 02:14 AM   #10
=?Utf-8?B?SmVmZiBD?=
Guest
 
Posts: n/a
Default Re: Open Email For Edit????

Is there an example I could look at somewhere you could point me too? The
procedures you are referencing are a bit beyond my knowledge at this point.
But I would really like to figure this out. Thank you.
--
Jeff C
Live Well .. Be Happy In All You Do


"Sue Mosher [MVP-Outlook]" wrote:

> No, I'm saying that using EnvelopeShow will open the Word document with all the controls the user needs to address and send the message. If you want to show an Outlook item, you must use the other procedure I outlined.
>
> --
> Sue Mosher, Outlook MVP
> Author of Configuring Microsoft Outlook 2003
> http://www.turtleflock.com/olconfig/index.htm
> and Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
> "Jeff C" <JeffC@discussions.microsoft.com> wrote in message news:69F895C7-DB59-49FD-AEDD-977F6EDED233@microsoft.com...
> > Thanks Sue:
> >
> > You originally helped me as I was assembling the code I have been using
> > here.
> >
> > Are you saying that:
> >
> > doc.Activate
> > doc.MailEnvelope.EnvelopeShow
> >
> > Will open the Outlook email with the document in the message body there-by
> > avoiding the security warning???
> > --
> > Jeff C
> > Live Well .. Be Happy In All You Do
> >
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> To show the message created with MailEnvelope as an Outlook message, you'd need to save it, get the EntryID, then return a new item with Namespace.GetItemFromID and finally display that item.
> >>
> >> Why not just open the Word doc and show the envelope there:
> >>
> >> doc.Activate
> >> doc.MailEnvelope.EnvelopeShow
> >>

> >

>

  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