Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding Dashes in front of text using text formating | Excel Discussion (Misc queries) | |||
Text Formating | Excel Worksheet Functions | |||
Text Formating | Excel Discussion (Misc queries) | |||
Text formating | Excel Discussion (Misc queries) | |||
Formating some text in cells? | Excel Programming |