The following subroutine runs well and generates the textbox shape where I want, but it won't populate the textbox with the referenced cell information.
I get the following error:
Run-time error '438':
Object doesn't support this property or method
Which occurs at: .TextFrame.Formula = "=Wells!$J$2"
Private Sub Label()
Dim rStart As Range
Dim pStart_X As Double
Dim pStart_Y As Double
Dim wks As Worksheet
Set wks = Worksheets("Plat")
Set rStart = wks.Range(Me.TxtStart.Value)
With rStart
pStart_X = .Left + (.Width / 2) - 10
pStart_Y = .Top + (.Height / 2) - 10
End With
With wks.Shapes.AddTextbox(msoTextOrientationHorizontal, pStart_X, pStart_Y, 20, 20)
.Fill.Visible = msoFalse
.Line.Visible = msoFalse
.TextFrame.AutoSize = msoAutoSizeShapeToFitText
.TextFrame.Formula = "=Wells!$J$2"
.TextFrame.TextRange.Font.Size = 10
.TextFrame.TextRange.ParagraphFormat.Alignment = msoAlignCenter
End With
End Sub
Bookmarks