In my application I'm exporting an Excel file by getting the layout of a HTML page. So, in my codebehind, I'm modifying the HTML layout and inserting itens on it like if it was a webpage. Doing it that way, I don't need to use any external library and, as the data I'm exporting is just a table, I don't need nothing complex to handle it. My question is: there is a way to create an AutoFilter by just modifying the HTML tags? I mean, like if a put a < b>Column Name in the HTML, when exporting to Excel it will become Bold, it is possible to do the same thing with the AutoFilter?
A:
A macro like this may help you. Sorry for the formatting.
Sub HTMLConvert()
Dim X As Integer
Dim Y As Integer
'Make your range of rows here
For X = 1 To 50
'Make your range of columns here
For Y = 1 To 10
'Each tag that you want to look for needs one of these if statements
If InStr(1, Cells(X, 1), "<b>") > 0 Then
'Keep in mind this solution will only bold the whole cell, not part of one.
Cells(X, 1).Font.Bold = True
Cells(X, 1) = Replace(Cells(X, 1), "<b>", "")
'If you have a closing tag, like </b>, make sure you clear it too
End If
Next
Next
End Sub
DaMartyr
2010-05-22 06:14:51
Keep in mind this macro is a VBA macro to be used inside of excel after you have imported the text.
DaMartyr
2010-05-22 06:19:08