Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Text Formating

Hello There,

I have created a Macro and i want it to return formated text to be appended
to a text.

For Eg. If my macro Return "I Love You" then i need it to be formated.

="My Response is " & <Bold<Italicsmacro Name</bold</Italics & ". Hope
you like it".

How can i do this?

Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Text Formating

You cannot format the text itself (that is, within the code)... what you
need to do is insert the text into a cell and then apply the formatting you
want to the characters you want. Here is a code example to give you the idea
of what I mean...

Sub Test()
Dim Answer As String
Answer = InputBox("Tell me something...")
With Range("F5")
.Value = "My Response is " & Answer & ". Hope you like it."
With .Characters(16, Len(Answer)).Font
.Bold = True
.Italic = True
End With
End With
End Sub

--
Rick (MVP - Excel)


"Rahul Gupta" wrote in message
...
Hello There,

I have created a Macro and i want it to return formated text to be
appended
to a text.

For Eg. If my macro Return "I Love You" then i need it to be formated.

="My Response is " & <Bold<Italicsmacro Name</bold</Italics & ". Hope
you like it".

How can i do this?

Regards


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Text Formating

Not too clear on what you need but maybe you can adapt this?

Sub Highlight_Word()
Dim rng As Range
Dim Cell As Range
Dim start_str As Integer
On Error GoTo endit
myword = InputBox("Enter the search string ")
If myword = "" Then Exit Sub
Mylen = Len(myword)
Set rng = Selection
With rng
.Font.FontStyle = "regular"
.Value = "My response is " & myword & ". Hope you like it"
start_str = InStr(.Value, myword)
If start_str Then
.Characters(start_str, Mylen).Font.FontStyle = "bold italic"
End If
End With
endit:
End Sub


Gord Dibben MS Excel MVP

On Sun, 24 May 2009 08:02:01 -0700, Rahul Gupta
wrote:

Hello There,

I have created a Macro and i want it to return formated text to be appended
to a text.

For Eg. If my macro Return "I Love You" then i need it to be formated.

="My Response is " & <Bold<Italicsmacro Name</bold</Italics & ". Hope
you like it".

How can i do this?

Regards


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Dashes in front of text using text formating Neal Excel Discussion (Misc queries) 1 November 27th 06 10:58 PM
Text Formating Duke Excel Worksheet Functions 0 February 15th 06 12:07 AM
Text Formating Ben Excel Discussion (Misc queries) 4 October 19th 05 08:42 PM
Text formating Brad Excel Discussion (Misc queries) 3 June 14th 05 09:32 PM
Formating some text in cells? drewdrew Excel Programming 1 November 17th 04 12:15 PM


All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"