populate word template from Outlook custom form

Status
Not open for further replies.
J

Joel Allen

Outlook 2003 SP3

Hi,

I have a script that populates a Word template with Item.Body. The

following DOES work:

Set objSel = objDoc.Windows(1).Selection

Set objTable = objDoc.Tables(1)

objDoc.Bookmarks("Body").Range.InsertBefore Item.Body

The problem is that it doesn't keep the formatting. So I tried to do this

and it DOES NOT work. What am I missing?

Set objSel = objDoc.Windows(1).Selection

Set objTable = objDoc.Tables(1)

objSel.Copy Item.Body

objSel.PasteAndFormat (wdPasteDefault)

Thank you very much for your help,

Joel
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
If you use Word as email editor in Outlook, you could try to pass

Item.Getinspector.WordEditor (which returns a Word.Document) to objDoc.

Else this workaround could also work: Save the html email as a file, and

open that file with Word.

Best regards

Michael Bauer

Am Tue, 16 Feb 2010 13:52:09 -0800 schrieb Joel Allen:


> Outlook 2003 SP3

> Hi,

> I have a script that populates a Word template with Item.Body. The
> following DOES work:

> Set objSel = objDoc.Windows(1).Selection
> Set objTable = objDoc.Tables(1)
> objDoc.Bookmarks("Body").Range.InsertBefore Item.Body

> The problem is that it doesn't keep the formatting. So I tried to do this
> and it DOES NOT work. What am I missing?

> Set objSel = objDoc.Windows(1).Selection
> Set objTable = objDoc.Tables(1)
> objSel.Copy Item.Body
> objSel.PasteAndFormat (wdPasteDefault)

> Thank you very much for your help,
> Joel
 
J

Joel Allen

I'm sorry Michael, I'm still kind of lost. Can you point me to some more

sample code that might help me?

Thank you again,

Joel

"Michael Bauer " <mb@mvps.org> wrote in message

news:1m3rcda2dxu5l$.1tkoggf7ch3c3$.dlg@40tude.net...

> If you use Word as email editor in Outlook, you could try to pass
> Item.Getinspector.WordEditor (which returns a Word.Document) to objDoc.

> Else this workaround could also work: Save the html email as a file, and
> open that file with Word.

> > Best regards
> Michael Bauer
>

>

> Am Tue, 16 Feb 2010 13:52:09 -0800 schrieb Joel Allen:
>
> > Outlook 2003 SP3
>

>> Hi,
>

>> I have a script that populates a Word template with Item.Body. The
> > following DOES work:
>

>> Set objSel = objDoc.Windows(1).Selection
> > Set objTable = objDoc.Tables(1)
> > objDoc.Bookmarks("Body").Range.InsertBefore Item.Body
>

>> The problem is that it doesn't keep the formatting. So I tried to do
> > this
> > and it DOES NOT work. What am I missing?
>

>> Set objSel = objDoc.Windows(1).Selection
> > Set objTable = objDoc.Tables(1)
> > objSel.Copy Item.Body
> > objSel.PasteAndFormat (wdPasteDefault)
>

>
>> Thank you very much for your help,
> > Joel
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S populate body with Word data Outlook VBA and Custom Forms 7
C Populate form data into message body Outlook VBA and Custom Forms 1
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
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
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
J Live Meeting Location populate from body Outlook VBA and Custom Forms 4
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 Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
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
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
S Outlook 2021 Can you make emails from 3 word domains "safe" by entering top 2 word domain into Safe List in Outlook? Using Outlook 1
O How to find and replace a word in Outlook-Agenda-Subject and Message? Using Outlook 0
V Embedding hyperlink into Word document Using Outlook 2
glnz Can Word Normal.dotm interfere with Outlook? Office 2016 Using Outlook 5
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
C blocking two or more word domains separated by period/dot Using Outlook 3
P Outlook 2013 Word Share doc as Email Attachment now brings up Eudora. Using Outlook 1
Jennifer Murphy Ctrl+Tab sometimes will not move through text a word at a time Using Outlook 1
N How to remove signature formatting from Text in Word (accidentally taken from Outlook) Using Outlook 0
C replace subject line generated by converting a word document to PDF and sending it to an email Using Outlook 8
Diane Poremsky Use Word Macro to Apply Formatting to Email Using Outlook 0
iwshim word shortcut to search outlook Using Outlook 3
C Outlook 2016 - converting Word VBA to default Outlook message Outlook VBA and Custom Forms 0
C Merging Word and Access into Outlook Using Outlook 4
Q Why can't I copy image with embedded hyperlink from email to Word Using Outlook 0
Mark Foley Emailing attachment from Word/Excel sends attachment but no message body Using Outlook 0
Diane Poremsky Disable Live Preview in Outlook and Word Using Outlook 0
Philip Rose Recreating a WORD Editing Macro to use in Outlook VBA Outlook VBA and Custom Forms 4
D Need to extract a line from a word attachment, and add it to the subject line Outlook VBA and Custom Forms 3
M Unable to email from Word or Excel Using Outlook 11
P Macros in Word 2003 - how to transfer to another Word 2003? Using Outlook 1

Similar threads

Top