logo

img

Knowledgebase Home | Contact Knowledgebase Home | Contact
Search the Knowledgebase Browse by Category
Is there a way to create text with different fonts or font styles within the same text box from an automation script?
User Opinions
4% thumbs up 95% thumbs down

How would you rate this answer?
Helpful
Not helpful
Yes, you can create text with different font styles from automation. To do so, you need to use Math Text commands. Here are some examples:

'Add a text object that contains two lines
Shapes.AddText(5,4,"This is a text block" + vbCrLf + "with two rows.")

'Add another text object that shows how to insert a symbol
Shapes.AddText(2,6,"This is a bullet \a183 more text")

'This example shows how to include bold , italics and strikethrough text
Shapes.AddText(2,1,"This is {\b bold}, {\i italic} and {\strike strikethrough} text.")

'This example shows how to insert the current date/time
Shapes.AddText(2,7,"\date \time ")

'Insert user input data
Min = "10"
Max = "25"
Shapes.AddText(2,3,"[" + Min + "] to [" + Max + "]")

'Change font in text
Shapes.AddText(2,5,"This is some text {\f" + Chr(34) + "Wingdings" + Chr(34) + " in a different font } than the rest.")

For more information and other math text commands, open Grapher's help file and click on the Search tab. Type in "Math Text" and click on the first item (Math Text Instruction Syntax). The page displayed gives information about math text syntax. Click on the "math text instructions" link in the page for other math text commands.
Visitor Comments
No visitor comments posted. Post a comment
Related Questions
Attachments
No attachments were found.
Products