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


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

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


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

>

>
>>
 
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
C Populate form data into message body Outlook VBA and Custom Forms 1
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
cbufacchi Outlook 365 Populate custom Outlook Appoint form Outlook VBA and Custom Forms 2
B Outlook 365 Populate Outlook Task UDFs from a UDF text string Outlook VBA and Custom Forms 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
G Retaining Tabs in outlook body Using Outlook 2
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
G Get current open draft message body from VBA Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
D Delete selected text in outgoing email body Outlook VBA and Custom Forms 0
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
K Incorporate selection from combobox into body of email Outlook VBA and Custom Forms 0
J Outlook 365 Add keywords from Listbox to the message body where cursor is placed Outlook VBA and Custom Forms 0
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 6
T 1:1 Datatransfer from incoming mail body to customs form body Outlook VBA and Custom Forms 0
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
Beeto Replace a string in body Outlook VBA and Custom Forms 2
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
Z Copy specific email body text Outlook VBA and Custom Forms 0
J How do you disable address search box when typing @ in body of email? Using Outlook 0
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

Similar threads

Back
Top