I have a code that is used to enter a 'Single line' Textbox onto the worksheet, which works great in XL2003. But not in XL2007.
The end user could be using either XL2003 or 2007, so I was hoping that the width of the new Textbox would be set by the column width, (which is set to Autofit) but in XL2007, I end up with shortened textbox with the text on two lines?
Code:
MyText = InputBox("Enter text", "Single Line Text")
Set Cell = ActiveSheet.Range("BZ1")
Cell.Value = MyText
Columns("BZ:BZ").EntireColumn.AutoFit
Rows("1:1").EntireRow.AutoFit
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 40, 40, 40, 40).Select 'Create a Textbox
With Selection
.Left = Cell.Left
.TOP = Cell.TOP
.Height = Cell.Height
.Width = Cell.Width
.Characters.Text = Cell.Value
.Border.Color = vbBlack
.Font.Color = vbBlack
.Font.Name = "Arial"
.Font.FontStyle = "Regular"
End With
Can anyone offer any advice to a Newbie.
Thanks in advance.
The end user could be using either XL2003 or 2007, so I was hoping that the width of the new Textbox would be set by the column width, (which is set to Autofit) but in XL2007, I end up with shortened textbox with the text on two lines?
Code:
MyText = InputBox("Enter text", "Single Line Text")
Set Cell = ActiveSheet.Range("BZ1")
Cell.Value = MyText
Columns("BZ:BZ").EntireColumn.AutoFit
Rows("1:1").EntireRow.AutoFit
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 40, 40, 40, 40).Select 'Create a Textbox
With Selection
.Left = Cell.Left
.TOP = Cell.TOP
.Height = Cell.Height
.Width = Cell.Width
.Characters.Text = Cell.Value
.Border.Color = vbBlack
.Font.Color = vbBlack
.Font.Name = "Arial"
.Font.FontStyle = "Regular"
End With
Can anyone offer any advice to a Newbie.
Thanks in advance.