HTMLProject and ForeColor

  • Thread starter Reinfried Englmair
  • Start date
R

Reinfried Englmair

With the VBA-Code:
Sub Sub CopyToXL_1()
Dim sHTML, oXL, oBook
'Replace the mso-pattern style in the HTML returned from
the PivotTable.
sHTML = ptable.HTMLData
sHTML = Replace (sHTML, "mso-pattern:auto;", "mso-
pattern:auto none;")
'Open the HTML file in Excel using Automation.
Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Tabelle1").Text =
sHTML
oBook.HTMLProject.Refreshdocument
oXL.Visible = True
oXL.UserControl = True
End SubDim sHTML, oXL, oBook
'Replace the mso-pattern style in the HTML returned from
the PivotTable.
sHTML = ptable.HTMLData
sHTML = Replace (sHTML, "mso-pattern:auto;", "mso-
pattern:auto none;")
'Open the HTML file in Excel using Automation.
Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Tabelle1").Text =
sHTML
oBook.HTMLProject.Refreshdocument
oXL.Visible = True
oXL.UserControl = True
End Sub

I copy the pivottable to Excel.

Now i need a function to modify in the code Sub CopyToXL_1
the forecolor for negativ values.
In Excel I make this by:

Dim c As Object
For Each c In ActiveSheet.UsedRange
If c.Value <= 0 Then c.Font.Color = vbRed
Next c

Is there a solution to make the same with HTMLProject????

Thank's to all
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top