tan.ngohoangquoc
Thành viên hoạt động



			
		- Tham gia
- 10/7/14
- Bài viết
- 100
- Được thích
- 41
- Nghề nghiệp
- M&A Specialist - RM Assistant
Em dùng excel 2013 bản 32 bit, thử viết lệnh ADO dùng để lấy dữ liệu trong 1 file có format 2003 không dc. Dùng để lấy cùng file đó nếu để format xlsx thì chạy. Mọi người giúp em phần này với. 
	
	
	
		
				
			
		Mã:
		
	
	    Dim cn As Object, rst As Object
    Dim LastRow As Long
    
    Set cn = CreateObject("ADODB.Connection")
    Set rst = CreateObject("ADODB.Recordset")
    
    With cn
        If Val(Application.Version) < 12 Then
            .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
                                & "Data Source=" & iFile & ";Extended Properties=""Excel 8.0;HDR=No"";"
        Else
            .ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" _
                                & "Data Source=" & iFile & ";Extended Properties=""Excel 12.0;HDR=No"";"
        End If
        
        .Open
    End With 
	 
	  
 
 
		 
 
		
 
 
		 
 
		 
 
		 
 
		
 
 
		