A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Open Email For Edit????



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 14th 06, 06:53 PM posted to microsoft.public.outlook.program_vba
Jeff C
external usenet poster
 
Posts: 32
Default Open Email For Edit????

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
Ads
  #2  
Old December 14th 06, 07:50 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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" wrote in message
...
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



  #3  
Old December 14th 06, 08:24 PM posted to microsoft.public.outlook.program_vba
Jeff C
external usenet poster
 
Posts: 32
Default Open Email For Edit????

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" wrote in message
...
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




  #4  
Old December 14th 06, 09:21 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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" wrote in message
...
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" wrote in message
...
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






  #5  
Old December 14th 06, 09:43 PM posted to microsoft.public.outlook.program_vba
Jeff C
external usenet poster
 
Posts: 32
Default Open Email For Edit????

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("FullPathOfMyAccessReportExpo rted")
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" wrote in message
...
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" wrote in message
...
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






  #6  
Old December 14th 06, 10:05 PM posted to microsoft.public.outlook.program_vba
Jeff C
external usenet poster
 
Posts: 1
Default 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" wrote in message
...
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" wrote in message
...
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




  #7  
Old December 14th 06, 10:15 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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" wrote in message
...
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("FullPathOfMyAccessReportExpo rted")
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" wrote in message
...
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" wrote in message
...
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








  #8  
Old December 14th 06, 10:57 PM posted to microsoft.public.outlook.program_vba
Jeff C
external usenet poster
 
Posts: 32
Default Open Email For Edit????

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" wrote in message
...
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("FullPathOfMyAccessReportExpo rted")
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" wrote in message
...
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" wrote in message
...
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









  #9  
Old December 14th 06, 11:57 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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" wrote in message
...
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" wrote in message
...
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("FullPathOfMyAccessReportExpo rted")
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" wrote in message
...
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" wrote in message
...
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











  #10  
Old December 15th 06, 12:24 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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 the

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" wrote in message ...
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" wrote in message
...
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" wrote in message
...
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("FullPathOfMyAccessReportExpo rted")
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" wrote in message
...
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" wrote in message
...
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











 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot edit a contact's email address [email protected] Outlook - Using Contacts 11 December 21st 06 08:52 PM
Open For Edit Jeff C Outlook and VBA 0 September 28th 06 12:34 AM
email subject edit?? Layton Traver Outlook Express 2 August 19th 06 01:44 AM
Can't use Word to edit email with Office 2003 [email protected] Outlook - General Queries 6 February 15th 06 05:14 PM
Outlook cant find Word when trying to edit email. John Outlook - Installation 0 February 6th 06 05:22 AM


All times are GMT +1. The time now is 12:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2025 Outlook Banter.
The comments are property of their posters.