Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   populate body with Word data (http://www.outlookbanter.com/outlook-vba/90224-populate-body-word-data.html)

J. Freed May 12th 09 08:47 PM

populate body with Word data
 
I have an Access DB with a field containing a Word doc as an embedded object.
I think I can retrieve the contents but I can't seem to figure out how to
populate them into the body of the message in VBA. I've seen a few postings
on this subject and I seem to be missing how to actually populate the body.
Any ideas? TIA.....

Sue Mosher [MVP][_3_] May 12th 09 10:40 PM

populate body with Word data
 
Once you have your Word.Document object, you can use the technique shown at
http://www.outlookcode.com/codedetail.aspx?id=1333.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
I have an Access DB with a field containing a Word doc as an embedded
object.
I think I can retrieve the contents but I can't seem to figure out how to
populate them into the body of the message in VBA. I've seen a few
postings
on this subject and I seem to be missing how to actually populate the
body.
Any ideas? TIA.....




J. Freed May 14th 09 09:27 PM

populate body with Word data
 
It worked. Thanks!

"Sue Mosher [MVP]" wrote:

Once you have your Word.Document object, you can use the technique shown at
http://www.outlookcode.com/codedetail.aspx?id=1333.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
I have an Access DB with a field containing a Word doc as an embedded
object.
I think I can retrieve the contents but I can't seem to figure out how to
populate them into the body of the message in VBA. I've seen a few
postings
on this subject and I seem to be missing how to actually populate the
body.
Any ideas? TIA.....





J. Freed June 12th 09 03:41 PM

populate body with Word data
 
This is working well. Now, I need to be able to add data from tables/forms in
addition to the Word data. When I try to add to the body the Word data
disappears, so I'm guessing I need a way to add the data I want to the Word
doc before it gets posted to the note.

TIA.

"J. Freed" wrote:

It worked. Thanks!

"Sue Mosher [MVP]" wrote:

Once you have your Word.Document object, you can use the technique shown at
http://www.outlookcode.com/codedetail.aspx?id=1333.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
I have an Access DB with a field containing a Word doc as an embedded
object.
I think I can retrieve the contents but I can't seem to figure out how to
populate them into the body of the message in VBA. I've seen a few
postings
on this subject and I seem to be missing how to actually populate the
body.
Any ideas? TIA.....





Sue Mosher [MVP][_3_] June 13th 09 07:14 PM

populate body with Word data
 
That's probably the best way to do it, to preserve formatting, etc.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
This is working well. Now, I need to be able to add data from tables/forms
in
addition to the Word data. When I try to add to the body the Word data
disappears, so I'm guessing I need a way to add the data I want to the
Word
doc before it gets posted to the note.

TIA.

"J. Freed" wrote:

It worked. Thanks!

"Sue Mosher [MVP]" wrote:

Once you have your Word.Document object, you can use the technique
shown at
http://www.outlookcode.com/codedetail.aspx?id=1333.



"J. Freed" wrote in message
...
I have an Access DB with a field containing a Word doc as an embedded
object.
I think I can retrieve the contents but I can't seem to figure out
how to
populate them into the body of the message in VBA. I've seen a few
postings
on this subject and I seem to be missing how to actually populate the
body.
Any ideas? TIA.....






J. Freed June 15th 09 08:46 PM

populate body with Word data
 
I agree. Problem is, I have no idea how to do it. How would I take a field in
a form (or a table) and copy it into the Word doc generated by the code below:

Forms!fcp_new!wire.Verb = 0
Forms!fcp_new!wire.Action = 7
Forms!fcp_new!wire.Object.Application.ActiveDocume nt.Content.Select
Forms!fcp_new!wire.Object.Application.Selection.Ra nge.Copy
Forms!fcp_new!wire.Action = 9
wd.ActiveDocument.SaveAs "L:\Operate1\ELPD_Middle_Office_Reports\OTC
Payments\eos.doc"
Set doc = wd.Documents.Open("L:\Operate1\ELPD_Middle_Office_ Reports\OTC
Payments\eos.doc")
wd.Selection.Range.Paste
wd.ActiveDocument.SaveAs "L:\Operate1\ELPD_Middle_Office_Reports\OTC
Payments\eos.doc"
End If

which takes data from an OLE object in a table and copies it into a Word
doc, which then gets posted to the body using

Set itm = doc.MailEnvelope.Item

TIA......

"Sue Mosher [MVP]" wrote:

That's probably the best way to do it, to preserve formatting, etc.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
This is working well. Now, I need to be able to add data from tables/forms
in
addition to the Word data. When I try to add to the body the Word data
disappears, so I'm guessing I need a way to add the data I want to the
Word
doc before it gets posted to the note.

TIA.

"J. Freed" wrote:

It worked. Thanks!

"Sue Mosher [MVP]" wrote:

Once you have your Word.Document object, you can use the technique
shown at
http://www.outlookcode.com/codedetail.aspx?id=1333.



"J. Freed" wrote in message
...
I have an Access DB with a field containing a Word doc as an embedded
object.
I think I can retrieve the contents but I can't seem to figure out
how to
populate them into the body of the message in VBA. I've seen a few
postings
on this subject and I seem to be missing how to actually populate the
body.
Any ideas? TIA.....







Sue Mosher [MVP][_3_] June 16th 09 11:29 AM

populate body with Word data
 
Instead of wd.Selection.Range.Paste, you can use:

wd.Selection.Range.InsertAfter "some text"

or

wd.Selection.Range.InsertAfter some_string_variable_value

Also, the Word macro recorder can be your friend in these situations to show
the useful methods for a given scenario.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
I agree. Problem is, I have no idea how to do it. How would I take a field
in
a form (or a table) and copy it into the Word doc generated by the code
below:

Forms!fcp_new!wire.Verb = 0
Forms!fcp_new!wire.Action = 7
Forms!fcp_new!wire.Object.Application.ActiveDocume nt.Content.Select
Forms!fcp_new!wire.Object.Application.Selection.Ra nge.Copy
Forms!fcp_new!wire.Action = 9
wd.ActiveDocument.SaveAs "L:\Operate1\ELPD_Middle_Office_Reports\OTC
Payments\eos.doc"
Set doc = wd.Documents.Open("L:\Operate1\ELPD_Middle_Office_ Reports\OTC
Payments\eos.doc")
wd.Selection.Range.Paste
wd.ActiveDocument.SaveAs "L:\Operate1\ELPD_Middle_Office_Reports\OTC
Payments\eos.doc"
End If

which takes data from an OLE object in a table and copies it into a Word
doc, which then gets posted to the body using

Set itm = doc.MailEnvelope.Item

TIA......

"Sue Mosher [MVP]" wrote:

That's probably the best way to do it, to preserve formatting, etc.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
This is working well. Now, I need to be able to add data from
tables/forms
in
addition to the Word data. When I try to add to the body the Word data
disappears, so I'm guessing I need a way to add the data I want to the
Word
doc before it gets posted to the note.

TIA.

"J. Freed" wrote:

It worked. Thanks!

"Sue Mosher [MVP]" wrote:

Once you have your Word.Document object, you can use the technique
shown at
http://www.outlookcode.com/codedetail.aspx?id=1333.



"J. Freed" wrote in message
...
I have an Access DB with a field containing a Word doc as an
embedded
object.
I think I can retrieve the contents but I can't seem to figure out
how to
populate them into the body of the message in VBA. I've seen a few
postings
on this subject and I seem to be missing how to actually populate
the
body.
Any ideas? TIA.....









J. Freed June 16th 09 03:16 PM

populate body with Word data
 
That did the trick. Thanks again!

"Sue Mosher [MVP]" wrote:

Instead of wd.Selection.Range.Paste, you can use:

wd.Selection.Range.InsertAfter "some text"

or

wd.Selection.Range.InsertAfter some_string_variable_value

Also, the Word macro recorder can be your friend in these situations to show
the useful methods for a given scenario.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
I agree. Problem is, I have no idea how to do it. How would I take a field
in
a form (or a table) and copy it into the Word doc generated by the code
below:

Forms!fcp_new!wire.Verb = 0
Forms!fcp_new!wire.Action = 7
Forms!fcp_new!wire.Object.Application.ActiveDocume nt.Content.Select
Forms!fcp_new!wire.Object.Application.Selection.Ra nge.Copy
Forms!fcp_new!wire.Action = 9
wd.ActiveDocument.SaveAs "L:\Operate1\ELPD_Middle_Office_Reports\OTC
Payments\eos.doc"
Set doc = wd.Documents.Open("L:\Operate1\ELPD_Middle_Office_ Reports\OTC
Payments\eos.doc")
wd.Selection.Range.Paste
wd.ActiveDocument.SaveAs "L:\Operate1\ELPD_Middle_Office_Reports\OTC
Payments\eos.doc"
End If

which takes data from an OLE object in a table and copies it into a Word
doc, which then gets posted to the body using

Set itm = doc.MailEnvelope.Item

TIA......

"Sue Mosher [MVP]" wrote:

That's probably the best way to do it, to preserve formatting, etc.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"J. Freed" wrote in message
...
This is working well. Now, I need to be able to add data from
tables/forms
in
addition to the Word data. When I try to add to the body the Word data
disappears, so I'm guessing I need a way to add the data I want to the
Word
doc before it gets posted to the note.

TIA.

"J. Freed" wrote:

It worked. Thanks!

"Sue Mosher [MVP]" wrote:

Once you have your Word.Document object, you can use the technique
shown at
http://www.outlookcode.com/codedetail.aspx?id=1333.


"J. Freed" wrote in message
...
I have an Access DB with a field containing a Word doc as an
embedded
object.
I think I can retrieve the contents but I can't seem to figure out
how to
populate them into the body of the message in VBA. I've seen a few
postings
on this subject and I seem to be missing how to actually populate
the
body.
Any ideas? TIA.....











All times are GMT +1. The time now is 06:10 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-2006 OutlookBanter.com