1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Save CSV with HTML cells

Discussion in 'VBA Macros' started by Mathew@B, Jan 11, 2017.

  1. Mathew@B

    Mathew@B New Member

    Hey Guys,

    I have a client who is trying to convert an excel document to a csv which contains html.

    Does anyone know how to export html within Excel to a csv so that each item is a single common detonator. Also how do you remove the line break that it is adding?

    I have attached the file which are using.

    Please help.



    Attached Files:

    Last edited: Jan 11, 2017
  2. Chihiro

    Chihiro Excel Ninja

    What's the expected output csv file from your sample?
  3. Mathew@B

    Mathew@B New Member

    Hi Chihiro

    Thank you for getting back to me, I have done the first one as an example but I am unable to upload the csv.

    Action;Entry Type;Category Code;Code/SKU;Brand;Display Name;DownloadDocuments;Product Info (Basic);Product Info (More);Short Description:;TemplateName
    Update;Variation;102;FOC-ITRSOLO;Focusrite;Focusrite ITRSOLO Lightning Audio Interface;<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>;<section class="details"><div class="container-fluid container-fluid-outer"><div class="product-info"><div class="tab-content"><div id="info" class="tab-pane active hidden-mobile"><div class="rte"><p>With deluxe appointments, solid-top construction and great performance features including a Venetian-style cutaway and Takamine electronics system, the GC5CE is an acoustic-electric classical guitar that’s built to bring your music center stage.</p><p>Ready for the demands of any performance situation, the GC5CE features a fan-braced solid spruce top and rosewood back and sides that produce warm, rich nylon-string sound. The slim mahogany neck and rosewood fingerboard provide great feel and playability, while the onboard Takamine TP-4T preamp system gives you a built-in tuner with three-band EQ and gain controls for rock-solid amplified performance and versatility.</p><p>Other great features include a dovetail neck joint, beautiful inlaid mosaic rosette, synthetic bone nut and bridge saddle, rosewood headcap, gold tuners with white pearl buttons and a luxurious gloss finish.</p></div></div></div></div></div></section><section class="slider-section"><div class="container-fluid container-fluid-outer"><div class="title-row"><div class="row"></div></div></div></section>;<table class="table table-responsive"><thead><tr><th colspan="4">Specifications</th></tr></thead><tbody><tr><th>Dimensions (H x W x D)</th><td>522 x 329 x 294 mm (20.6 x 12.9 x 11.6")</td><th>Construction</th><td>Injection-moulded polypropylene enclosure. Recessed carrying handle. Integral dual-angle pole mount socket</td></tr><tr><th>Net Weight</th><td>13.3 kg (29.3 lbs)</td><th>Grille</th><td>Powder coated galvanised perforated steel mesh with foam backing</td></tr><tr><th>Components</th><td>1 x 10" (254 mm) LF driver, 1 x 1" (25 mm) HF compression driver</td><th>Connectors</th><td>Mic/Line input: combo jack/female XLR wired pin 2 hot</td></tr></tbody></table>;2x2 iOS Audio Interface with Lightning Connector, 1 x Mic Input, 1 x hi-Z Input, Direct Monitoring, and Monitor Volume Control;default

    Let me know if this helps.



    ▬▬▬▬▬▬▬▬▬ Mod edit : thread moved to appropriate forum !

  4. Marc L

    Marc L Excel Ninja

    Hi !
    Attach you csv text file as .csv.txt …
  5. Mathew@B

    Mathew@B New Member

    Thank you Marc,

    It is attached.

    Is this what you are looking for?


    Attached Files:

  6. Chihiro

    Chihiro Excel Ninja

    Does type of character used for delimiter matter?

    If just standard csv you can do something like below.
    Code (vb):
    Sub exportCSV()
    Dim wb As Workbook
    Dim i As Integer, j As Integer

    myArray = Cells(1, 1).CurrentRegion

    For i = LBound(myArray, 1) To UBound(myArray, 1)
        For j = LBound(myArray, 2) To UBound(myArray, 2)
            myArray(i, j) = Replace(myArray(i, j), Chr(10), "") 'Eliminate Chr(10) in each cell that's causing export issue
       Next j
    Next i

    Set wb = Workbooks.Add 'Create new Workbook

    wb.Sheets(1).Cells(1, 1).Resize(UBound(myArray, 1), UBound(myArray, 2)) = myArray 'write array to sheet1

    wb.SaveAs "C:\Test\hohoho.csv", xlCSV 'save as csv
    wb.Close False 'kill new workbook

    End Sub

Share This Page