OptionExplicit Const path1 ="C: emp" Const path2 ="C: empCsvToExcel" Const sPattern ="*.csv" PrivateSub Form_Load() OnErrorGoTo err Dim xlApp AsNew Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet Dim xlSheet1 As Excel.Worksheet Dim excelname AsString excelname =Replace(DateTime.Now, ":", "-") &".xls"