justanotheruser
Board Regular
- Joined
- Aug 14, 2010
- Messages
- 96
Hi guys,
I've got a rounded rectangle shape that I have "added text" to, and it is formatted in a particular way. The contents of the shape will usually be something like this:
Ref: Online Order 1234567890123456789 - Extra comments go here.
I was wondering if it is possible to have a macro that can clear the contents of the text box, and then re-add the "Ref: Online Order" bit, and then add the order number from cell O9, whilst keeping the original formatting.
I tried to record a macro to do it, but the order number is fixed, not the value of cell O9.
The shape is called "TextBox 1" on the sheet.
The reason I'm asking for this is that there is a template where the user can just copy and paste all details from an order confirmation email and everything will be automatically put in the right place (in Proper Case too) - the only thing which I can't figure out is the order number!
Thanks in advance for your help.
I've got a rounded rectangle shape that I have "added text" to, and it is formatted in a particular way. The contents of the shape will usually be something like this:
Ref: Online Order 1234567890123456789 - Extra comments go here.
I was wondering if it is possible to have a macro that can clear the contents of the text box, and then re-add the "Ref: Online Order" bit, and then add the order number from cell O9, whilst keeping the original formatting.
I tried to record a macro to do it, but the order number is fixed, not the value of cell O9.
Code:
Sub Macro1()
'
' Macro1 Macro
'
'
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = _
"Ref: Online Order "
Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 19).ParagraphFormat. _
FirstLineIndent = 0
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 19).Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "Arial"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 16
.Name = "Arial"
End With
Range("O9").Select
Selection.Copy
ActiveSheet.Shapes.Range(Array("TextBox 1")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = _
"Ref: Online Order 1234567890123456789 "
Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 40).ParagraphFormat. _
FirstLineIndent = 0
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 40).Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "Arial"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 16
.Name = "Arial"
End With
End Sub
The shape is called "TextBox 1" on the sheet.
The reason I'm asking for this is that there is a template where the user can just copy and paste all details from an order confirmation email and everything will be automatically put in the right place (in Proper Case too) - the only thing which I can't figure out is the order number!
Thanks in advance for your help.
Last edited: