I have received a workbook with a whole lot of ActiveX text boxes in columns with values I need to use. Is there a way to get those values and put them in the column to the right of each box location?
They are locked and "move with cells". They appear in the selection pane as "HTMLText nnn". There is one value in each text box.
I have tried this from Kutools (thank you to them, the page), it looks like it should work, but nothing happens (no values copied, no boxes deleted):
Sub TextboxesToCell_Kutools()
Dim xRg As Range
Dim xRow As Long
Dim xCol As Long
Dim xTxtBox As TextBox
Set xRg = Application.InputBox("Select a cell):", "Kutools for Excel", _
ActiveWindow.RangeSelection.AddressLocal, , , , , 8)
xRow = xRg.Row
xCol = xRg.Column
For Each xTxtBox In ActiveSheet.TextBoxes
Cells(xRow, xCol).Value = xTxtBox.text
xTxtBox.Delete
xRow = xRow + 1
Next
End Sub
Found it!
Sub H___CopyFormsHTMLBoxToSameCell()
'https://windowssecrets.com/forums/showthread.php/169760-Text-box-value-from-a-web-page-copy-and-paste (modified)
Dim OLEObj As OLEObject 'from the control toolbox toolbar
Dim DestCell As Range
Dim wks As Worksheet
Set wks = ActiveSheet
With wks
For Each OLEObj In .OLEObjects
If TypeOf OLEObj.Object Is msforms.TextBox Then
Set DestCell = OLEObj.TopLeftCell.Offset(0, 0)
DestCell.Value = OLEObj.Object.Value
OLEObj.Delete 'vp added
' ActiveCell.Activate doesnt center cell!
End If
Next OLEObj
End With
MsgBox "Done. Home, find, selection pane check for other shapes; f5, objects, Ctrl-click unselect pictures, delete."
End Sub