Home > Blockchain >  How do I add style to a html element created with VBA?
How do I add style to a html element created with VBA?

Time:12-01

I create new TD elements as follows

Dim TD As HTMLTableCell
Set TD = HTMLdoc.createElement("TD")
Set TR = TRelements.Item(1)
TD.innerHTML = "<span>blabla</span>"
TR.insertAdjacentElement "afterbegin", TD

I know how to add styling to the span inside the to be created TD element:

<span style=""font-size:9pt"">blabla</span>

But how do I add styling (e.g. borders and background color) to the new TD element itself?

CodePudding user response:

The HTMLTableCell object has the following properties:

  • align
  • background
  • bgColor
  • borderColor
  • borderColorDark
  • borderColorLight
  • cellIndex
  • colSpan
  • height
  • noWrap
  • rowSpan
  • vAlign
  • width
  • Related