Posts

Showing posts from February, 2017

Parse HTML code and save formatted text to Excel cell

I created a TFS hierarchical style report to show  User Stories Test Cases The report works well, however it lists the Test Step in HTML format.  When I export the report to Excel through VS, the HTML is not displayed in user friendly format.  I started to google around for solutions, and these are the steps: Select the HTML and send to clipboard Paste back to Excel with "Paste Special" to preserve the format When paste multiple lines of text, excel puts them in multiple rows, and the vba collects all the rows and puts them back to one row These are the protocol code: Private Sub Convert_Click() Dim rng As Range Set rng = ActiveSheet.Range("G3") Worksheet_Change rng, ActiveSheetEnd Sub Private Sub Worksheet_Change(ByVal Target As Range, ByVal sht As Worksheet) Dim objData As DataObject ' Set a reference to MS Forms 2.0 Dim sHTML As String Dim sSelAdd As String Dim i As Long Dim txt As String Application.EnableEvents = Fa