write and format a piece of text in the body using vba

  • Thread starter Screaming Eagles 101
  • Start date
Status
Not open for further replies.
S

Screaming Eagles 101

Hi,

I would like to write a piece of text inside of the message body, using a

certain font,

without losing the rest of the mail.

I tried this using

objItem.Body = "a piece of text" but then I lose all the rest, signature

included.

Using settext and gettext + the clipboard I lose all formatting of the

copied body text.

Is there a way to write a piece of text at the cursor location without

losing all the body text ?
 
Outlook version? If Outlook 2003 or earlier, is Word the email editor?

Sue Mosher

" Screaming Eagles 101" <see_my_site@online.please> wrote in message

news:4afd3504$1_1@news4us.nl...
> Hi,

> I would like to write a piece of text inside of the message body, using a
> certain font,
> without losing the rest of the mail.

> I tried this using
> objItem.Body = "a piece of text" but then I lose all the rest, signature
> included.

> Using settext and gettext + the clipboard I lose all formatting of the
> copied body text.

> Is there a way to write a piece of text at the cursor location without
> losing all the body text ?

>
 
Is indeed 2003 and I write my mails directly in Outlook

"Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message

news:e2aKRTGZKHA.5108@TK2MSFTNGP06.phx.gbl...
> Outlook version? If Outlook 2003 or earlier, is Word the email editor?

> > Sue Mosher
> > >

> " Screaming Eagles 101" <see_my_site@online.please> wrote in message
> news:4afd3504$1_1@news4us.nl...
> > Hi,
>

>> I would like to write a piece of text inside of the message body, using a
> > certain font,
> > without losing the rest of the mail.
>

>> I tried this using
> > objItem.Body = "a piece of text" but then I lose all the rest, signature
> > included.
>

>> Using settext and gettext + the clipboard I lose all formatting of the
> > copied body text.
>

>> Is there a way to write a piece of text at the cursor location without
> > losing all the body text ?
>

>
>>


>
 
You have to use a line like this:

objItem.Body = "a piece of text" & objItem.Body

--JP

On Nov 13, 5:29 am, " Screaming Eagles 101"

<see_my_s...@online.please> wrote:
> Hi,

> I would like to write a piece of text inside of the message body, using a
> certain font,
> without losing the rest of the mail.

> I tried this using
> objItem.Body = "a piece of text" but then I lose all the rest, signature
> included.

> Using settext and gettext + the clipboard I lose all formatting of the
> copied body text.

> Is there a way to write a piece of text at the cursor location without
> losing all the body text ?
 
If you're using the Outlook editor and not the Word editor, then you have to

use different approaches for HTML and RTF messages. For HTML, use

Inspector.HTMLEditor, as demonstrated in the sample at

http://www.outlookcode.com/codedetail.aspx?id=1358. For RTF, you'd have to

use the SafeInspector object from the third-party Outlook Redemption

library.

Sue Mosher

" Screaming Eagles 101" <see_my_site@online.please> wrote in message

news:4afd7bc4$1_1@news4us.nl...
> Is indeed 2003 and I write my mails directly in Outlook
> >
>>> I would like to write a piece of text inside of the message body, using
> >> a certain font,
> >> without losing the rest of the mail.
> >
>>> I tried this using
> >> objItem.Body = "a piece of text" but then I lose all the rest, signature
> >> included.
> >
>>> Using settext and gettext + the clipboard I lose all formatting of the
> >> copied body text.
> >
>>> Is there a way to write a piece of text at the cursor location without
> >> losing all the body text ?
 
HI,

yes, I tried this and it's working. Weird problem : I have a signature a

little formatted,

but using the code the formatting is removed, so this seems not a good

option... :-(

be

nice ------------------------------------------------"JP" <jp2112@earthlink.net> wrote in message

news:11c382ce-dd02-4c1b-82bb-e8729cd4668f@o10g2000yqa.googlegroups.com...

You have to use a line like this:

objItem.Body = "a piece of text" & objItem.Body

--JP

On Nov 13, 5:29 am, " Screaming Eagles 101"

<see_my_s...@online.please> wrote:
> Hi,

> I would like to write a piece of text inside of the message body, using a
> certain font,
> without losing the rest of the mail.

> I tried this using
> objItem.Body = "a piece of text" but then I lose all the rest, signature
> included.

> Using settext and gettext + the clipboard I lose all formatting of the
> copied body text.

> Is there a way to write a piece of text at the cursor location without
> losing all the body text ?
 
Without seeing the rest of your code and knowing what format your

write your messages in, I can't assist any further.

--JP

On Nov 16, 5:47 am, " Screaming Eagles 101"

<see_my_s...@online.please> wrote:
> HI,

> yes, I tried this and it's working. Weird problem : I have a signature a
> little formatted,
> but using the code the formatting is removed, so this seems not a good
> option...  :-(

> be
> nice ---------------------------------------------------------------------------­-----"JP" <jp2...@earthlink.net> wrote in message

> news:11c382ce-dd02-4c1b-82bb-e8729cd4668f@o10g2000yqa.googlegroups.com...
> You have to use a line like this:

> objItem.Body = "a piece of text" & objItem.Body

> --JP
>
 
I made a standard signature in the Outlook client, using some formatting

(bold, italic, different text colors and fonts such as wingdings to get a

mail icon, telephone and fac icon,...)

Standard mail format is RTF, and creating a new mail adds the signature very

well,

with fonts, colors and other formatting perfectly.

When I use this code

Dim objItem As Outlook.MailItem

Set objItem = Application.ActiveInspector.CurrentItem

objItem.Body = "a piece of text" & vbcrlf & objItem.Body

it works, but all formatting, colored text, etc... in the signature is gone,

I get some ugly black text.

--------------------------------------------------------------------------------"JP" <jp2112@earthlink.net> wrote in messagenews:fba780e5-c58d-4eba-8912-899e892cb248@m38g2000yqd.googlegroups.com...Without seeing the rest of your code and knowing what format yourwrite your messages in, I can't assist any further.--JPOn Nov 16, 5:47 am, " Screaming Eagles 101"<see_my_s...@online.please> wrote:> HI,>> yes, I tried this and it's working. Weird problem : I have a signature a> little formatted,> but using the code the formatting is removed, so this seems not a good> option... :-(>> be>nice ---------------------------------------------------------------------------­-----"JP" <jp2...@earthlink.net> wrote in message>> news:11c382ce-dd02-4c1b-82bb-e8729cd4668f@o10g2000yqa.googlegroups.com...> You have to use a line like this:>> objItem.Body = "a piece of text" & objItem.Body>> --JP
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
T Customized form: The Forward option shows write layout Outlook VBA and Custom Forms 0
F VBA code to dock Styles whenever I write or edit an email Outlook VBA and Custom Forms 0
A Read and Write to Text File Outlook VBA and Custom Forms 1
F VBA routine to write new sub routine in outlook Outlook VBA and Custom Forms 0
P Is it possible to write a macro to email to all addresses of selected contacts? Using Outlook 1
D How Would I Write This Filter? Using Outlook 3
F Can I write a macro that triggers off an Outlook alert Outlook VBA and Custom Forms 1
M how do I write a plug in to send messages to a web app? Outlook VBA and Custom Forms 1
E RE: How do i write a letter to a business contact BCM (Business Contact Manager) 1
P Possible to write a macro to print all attachments with specific . Outlook VBA and Custom Forms 1
P Write a tool to generate a PST file with the same structure as old Outlook VBA and Custom Forms 1
B Write code for a button on New Form Outlook VBA and Custom Forms 1
J How to write a macro to search inbox for certain numbers Outlook VBA and Custom Forms 2
S Write custom text in outlook infobar Outlook VBA and Custom Forms 1
S Macro to Write Rules Outlook VBA and Custom Forms 4
A How to write into outlook status bar. Outlook VBA and Custom Forms 1
Q Outlook become non responsive if i write outlook item in bulk Outlook VBA and Custom Forms 20
V Outlook 2007: How to read/write Out-of-Office settings Outlook VBA and Custom Forms 3
M What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Obje Outlook VBA and Custom Forms 1
M What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Obje Outlook VBA and Custom Forms 5
e_a_g_l_e_p_i MY Outlook 2021 changed the format of the shortcuts for mail, calendar etc. Using Outlook 10
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
R How to prevent corrupted Notes format in Calendar and Contacts Using Outlook 0
S Combination Field (Date Format) Outlook VBA and Custom Forms 0
L Format Lost between Tasks and To Do Using Outlook 0
P Outlook 2016 Change Paste Special Default Format Using Outlook 8
S Format Inbox Using Outlook 0
P Short Date Format when typing in a task Using Outlook 2
D Outlook 2016 64bit, Cannot Save in 'HTML', format Using Outlook 1
K Need to convert .mmf file to .pst format Outlook VBA and Custom Forms 7
C Outlook 2016 Conditional Format for User Defined Field Using Outlook 1
C Export NSF Lotus Notes files in Outlook PST format? Using Outlook 1
L Time format in Outlook calendar and emails Using Outlook 0
Y Outlook Task View - Table Format - Customize Reminder Time to Drop-Down Selection Using Outlook 2
T How to Export mailbox from Outlook 2019 to MBOX format? Using Outlook 1
J What is the best EntryID format to set on MS Access table Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Is there a way to add something that is in the "Format Text" tab to the "basic Text" on the message tab Using Outlook 1
E Outlook 2010 Can somebody tell me , the question associated with OST format Using Outlook 1
Witzker Correct Format of custom Yes/No Checkboxes Outlook VBA and Custom Forms 0
M font format discrepancies with Quick Parts Using Outlook 1
S Email Format With Embedded Images and Tables Change Using Outlook 2
G How to filter by the format of an email address Using Outlook 6
T Format Reading Pane Outlook VBA and Custom Forms 5
R Lost PST files after format Using Outlook 6
J Outlook 2013 how to convert 2013 OST file into an another format, i m using outlook 2013 versions. Using Outlook 1
fitzgerald Lost PST files after format - how to recover deleted files? Using Outlook 3
Dr. Demento Outlook output to array -> Excel & re-format Using Outlook 2
P Outlook 2010: Missing tab - "Format/Picture Tools" HELP! Using Outlook 3
skylark53 Loss of default format on deleting signature Using Outlook 5
O Setting default format for composing/replying to emails Using Outlook 3

Similar threads

Back
Top