J
Jaded in Cali
I have a spreadsheet copied from a web page table, using Internet Explorer,
and pasted into an Excel Spreadsheet.
One of the data fields I need data from was presented as HTML Text Box form
objects. These apparently pasted into the spread sheet as HTMLText Objects.
They show the data, but it is not accessible to formulas or copying as long
as it is shown as entries in the text boxes.
There are 440 records (rows) in the table. I need to write a VBA script to
extract the data from the HTMLText boxes and write it to cells in the table.
Dim thisbox As textbox
Dim strThisBoxName As String
Dim intValue As Integer
Dim g As Integer
For g = 1 To 1
strThisBoxName = "HTMLText" & g
Set thisbox = Me.[strThisBoxName]
intValue = thisbox.Value
Cells(g, "L").Value = intValue
Next g
returns an Object Required error on the Set... line
Set thisbox = ActiveSheet(strThisBoxName)
and
Set thisbox = Me(strThisBoxName)
both return an "Object doesn't support this property or method" error.
A simple one line assignment:
Cells(g, "L").Value = Me.["HTMLText"& g].Value
returns an Object Required error, although the same line for a single
instance of the HTMLText box:
Cells(g, "L").Value = Me.HTMLText1.Value
works exactly as it should.
I cannot find the magic combination of brackets, parentheses, and periods to
successfully use a script-generated name for the HTMLText objects to access
their values.
Thank you in advance for any suggestions.
and pasted into an Excel Spreadsheet.
One of the data fields I need data from was presented as HTML Text Box form
objects. These apparently pasted into the spread sheet as HTMLText Objects.
They show the data, but it is not accessible to formulas or copying as long
as it is shown as entries in the text boxes.
There are 440 records (rows) in the table. I need to write a VBA script to
extract the data from the HTMLText boxes and write it to cells in the table.
Dim thisbox As textbox
Dim strThisBoxName As String
Dim intValue As Integer
Dim g As Integer
For g = 1 To 1
strThisBoxName = "HTMLText" & g
Set thisbox = Me.[strThisBoxName]
intValue = thisbox.Value
Cells(g, "L").Value = intValue
Next g
returns an Object Required error on the Set... line
Set thisbox = ActiveSheet(strThisBoxName)
and
Set thisbox = Me(strThisBoxName)
both return an "Object doesn't support this property or method" error.
A simple one line assignment:
Cells(g, "L").Value = Me.["HTMLText"& g].Value
returns an Object Required error, although the same line for a single
instance of the HTMLText box:
Cells(g, "L").Value = Me.HTMLText1.Value
works exactly as it should.
I cannot find the magic combination of brackets, parentheses, and periods to
successfully use a script-generated name for the HTMLText objects to access
their values.
Thank you in advance for any suggestions.