Excel from MS v1

A Snippet from: hagchr

VBSTART
    Option Explicit
    Dim xlApp
    Dim xlBook
    Sub Main()
        Const xlSaveChanges = 1
        Set xlApp = CreateObject("Excel.application")
        Set xlBook = xlApp.Workbooks.Open("C:\Users\Christer\Desktop\test excel from ms.csv")
        xlApp.Visible = True
        CRLF_Removal()
        xlApp.ActiveWorkbook.Close xlSaveChanges
        xlApp.Quit
        Set xlBook = Nothing
        Set xlApp = Nothing
    End Sub
    Sub CRLF_Removal()
        Dim Cell
        Const xlManual=-4135
        Const xlAutomatic=-4105
        
        xlApp.ScreenUpdating = False
        xlApp.Calculation = xlManual

        For Each Cell In xlApp.Activesheet.UsedRange.Cells
            If 0 < InStr(Cell, "vbCrLf") Then
                Cell.value = Replace(Cell, "vbCrLf", "")
            End If
        Next
        xlApp.ScreenUpdating = True
        xlApp.Calculation = xlAutomatic
    End Sub
VBEND

VBRun>Main

Select the code above to paste into your macro. Or: View Raw Text

Link: http://www.mjtnet.com/snip.htm?g=537e1c9b83e81

Forum Embed Code - click to select all then copy (CTRL-C):

When pasting into the forum do NOT modify the script code or it will not match what is in the database - create a new snippet instead!