Good evening to the whole forum and happy new year, I have a problem that I assume is related to the compatibility of the two versions of excel indicated in the title. I have a macro that with Excel 2016 works perfectly while I move it to another pc where I installed excel 2019the macro starts and immediately goes to the userform ignoring all the written code. Below I'll give you the code. In case it is necessary I can also attach the file... Thanks in advance to those who want to help me.
Ciao
Sub IMPORT_DATA() Dim oExcel As Excel.Application Dim strFile As String Dim FileCorrente As Object Dim r As Integer Set FileCorrente = ActiveSheet Set oExcel = New Excel.Application ' mFolder = "E:\Bofetti\CHECK LIST\" strFile = Dir(mFolder & "*.xlsx") ' assicurasi che l'estensione del file sia corretta r = 12 'variabile riga 'inizia ciclo lettura Do While strFile <> "" ' in oExcel ci vanno a finire di volta in volta _ i file contenuti nella cartella oExcel.Workbooks.Open mFolder & strFile FileCorrente.Cells(r, 2) = oExcel.Worksheets("LGI Certificate Accessories").Cells(7, 4) 'D7 FileCorrente.Cells(r, 3) = oExcel.Worksheets("LGI Certificate Accessories").Cells(17, 1) 'A17 FileCorrente.Cells(r, 4) = oExcel.Worksheets("LGI Certificate Accessories").Cells(17, 6) 'F17 FileCorrente.Cells(r, 5) = oExcel.Worksheets("LGI Certificate Accessories").Cells(31, 4) 'D31 FileCorrente.Cells(r, 6) = oExcel.Worksheets("LGI Certificate Accessories").Cells(31, 13) 'M31 FileCorrente.Cells(r, 7) = oExcel.Worksheets("LGI Certificate Accessories").Cells(17, 16) 'P17 FileCorrente.Cells(r, 8) = oExcel.Worksheets("LGI Certificate Accessories").Cells(18, 19) 'S18 FileCorrente.Cells(r, 9) = oExcel.Worksheets("LGI Certificate Accessories").Cells(17, 23) 'W17 FileCorrente.Cells(r, 10) = oExcel.Worksheets("LGI Certificate Accessories").Cells(58, 9) 'I58 oExcel.ActiveWorkbook.Close False strFile = Dir r = r + 1 Loop ' chiude e azzera variabili oExcel.Quit Set oExcel = Nothing Range("A1").Select End Sub





					
				
                    
            
            
        
					
					
					
						
  Reply With Quote