populate body with Word data

Status
Not open for further replies.
S

Si4gRnJlZWQ

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.....
 
S

Sue Mosher [MVP]

Once you have your Word.Document object, you can use the technique shown at

http://www.outlookcode.com/codedetail.aspx?id=1333.

Sue Mosher

"J. Freed" <JFreed> wrote in message

news:D28BDE83-F73E-4E60-8605-7C1FE08B323D@microsoft.com...
> 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.....
 
S

Si4gRnJlZWQ

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

> "J. Freed" <JFreed> wrote in message
> news:D28BDE83-F73E-4E60-8605-7C1FE08B323D@microsoft.com...
> >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

J. Freed

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
> > > > > > > > "J. Freed" <JFreed> wrote in message
> > news:D28BDE83-F73E-4E60-8605-7C1FE08B323D@microsoft.com...
> > >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.....

> >
 
S

Sue Mosher [MVP]

That's probably the best way to do it, to preserve formatting, etc.

Sue Mosher

"J. Freed" <JFreed> wrote in message

news:13AB3DE1-D63A-4535-A4BA-3D56152F36AC@microsoft.com...
> 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" <JFreed> wrote in message
> > > news:D28BDE83-F73E-4E60-8605-7C1FE08B323D@microsoft.com...
> > > >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

J. Freed

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.ActiveDocument.Content.Select

Forms!fcp_new!wire.Object.Application.Selection.Range.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
> > >

> "J. Freed" <JFreed> wrote in message
> news:13AB3DE1-D63A-4535-A4BA-3D56152F36AC@microsoft.com...
> > 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" <JFreed> wrote in message
> >> > news:D28BDE83-F73E-4E60-8605-7C1FE08B323D@microsoft.com...
> >> > >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.....
> >> >> >> >


>
 
S

Sue Mosher [MVP]

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

"J. Freed" <JFreed> wrote in message

news:4657EFBE-B28D-48CC-8811-388FF2E6D2A8@microsoft.com...
> 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.ActiveDocument.Content.Select
> Forms!fcp_new!wire.Object.Application.Selection.Range.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
> > >> >> >
>
>> "J. Freed" <JFreed> wrote in message
> > news:13AB3DE1-D63A-4535-A4BA-3D56152F36AC@microsoft.com...
> > > 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" <JFreed> wrote in message
> > >> > news:D28BDE83-F73E-4E60-8605-7C1FE08B323D@microsoft.com...
> > >> > >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

J. Freed

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

> "J. Freed" <JFreed> wrote in message
> news:4657EFBE-B28D-48CC-8811-388FF2E6D2A8@microsoft.com...
> >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.ActiveDocument.Content.Select
> > Forms!fcp_new!wire.Object.Application.Selection.Range.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
> >> > >> > >> > >
> >
> >> "J. Freed" <JFreed> wrote in message
> >> news:13AB3DE1-D63A-4535-A4BA-3D56152F36AC@microsoft.com...
> >> > 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" <JFreed> wrote in message
> >> >> > news:D28BDE83-F73E-4E60-8605-7C1FE08B323D@microsoft.com...
> >> >> > >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.....
> >> >> >> >> >> >> >
> >
> >>


>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
J Live Meeting Location populate from body Outlook VBA and Custom Forms 4
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
D Cannot populate certain UserProperties in Outlook from Excel Outlook VBA and Custom Forms 2
C Custom Outlook Form - Populate Information from Radio Button / Check Box Using Outlook 0
C Trying to populate an appointment ComboBox from Excel Outlook VBA and Custom Forms 2
A Populate Listbox from Txt File Outlook VBA and Custom Forms 0
A Populate Textbox from Txt File Outlook VBA and Custom Forms 1
Diane Poremsky Outlook VBA: Use a Text File to Populate a ListBox Using Outlook 0
T populate calendar with appointments and send reminders Using Outlook 1
A Populate Excel from Outlook Userform Outlook VBA and Custom Forms 3
A How can I populate a dropdown list? BCM (Business Contact Manager) 4
rohit I want to Populate Popup box while sending any email with attachment. Outlook VBA and Custom Forms 4
rohit I want to Populate Popup box while sending any email with attachment Using Outlook 1
A Cannot populate IMAP folders Using Outlook 1
S Populate textbox values from one form to another form. Using Outlook 0
B Auto Populate From Field Using Outlook 3
G Populate an Outlook 2007 template with spreadsheet data. Outlook VBA and Custom Forms 1
R Populate Form with appointments from Calendar Outlook VBA and Custom Forms 1
J populate word template from Outlook custom form Outlook VBA and Custom Forms 2
G Populate BCC field with all Contacts within a Contact Folder Outlook VBA and Custom Forms 4
M Create new Contacts folder and populate it from Access Outlook VBA and Custom Forms 1
A Macro - Open new message, populate from and subject fields, and message text Outlook VBA and Custom Forms 1
G Macro: Create New Message and Auto populate To Field Outlook VBA and Custom Forms 5
L how to populate multiple users contacts Outlook VBA and Custom Forms 9
A Populate task field based on value of other field Outlook VBA and Custom Forms 9
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
M Autoforward just attachment OR just body. Outlook VBA and Custom Forms 0
G Place jpg in body of email Outlook VBA and Custom Forms 1
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
J Implement Keywords based on body message Outlook VBA and Custom Forms 0
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
M White square in body of Outlook Messages (O2016 Version 2012 32bit Click To Run) Using Outlook 4
P Forwarding emails issue with special characters replacing text body Using Outlook 1
witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
B Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
S Body text of Email from invite date/time Outlook VBA and Custom Forms 7
A How To Get Body of All Emails to view in Blue Using Outlook 1
A How to get body of all emails in outlook 2016 to view in blue color Using Outlook 1
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
B Programmatically force html send and insert clipboard contents into body Outlook VBA and Custom Forms 0
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8
L dynamic and static dates in Outlook contact "notes" ie. body Using Outlook 2
L Wierd Office 365 Contact unable to edit body of random contacts Using Outlook 5
P Insert link in email body to attached document in Outlook 365 Outlook VBA and Custom Forms 0
W Space in an Outlook appointment body Using Outlook 0
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1

Similar threads

Top