TrungChinhs
Thành viên tích cực


			
		- Tham gia
- 18/2/08
- Bài viết
- 1,475
- Được thích
- 2,470
- Nghề nghiệp
- Công chức
Chào các bạn! 
Tôi viết code sau để lấy dữ liệu từ một file không mở (File đang đóng thực sự):
	
	
	
		
Tôi muốn Data Source D:\DaTa.xls được tùy biến khi người dùng chọn file từ Application.FileDialog(1).Show hoặc Application.FileDialog(3).Show).
Thanks !
				
			Tôi viết code sau để lấy dữ liệu từ một file không mở (File đang đóng thực sự):
		Mã:
		
	
	Sub ImPortDaTa_FileClose()
    Application.ScreenUpdating = 0
    On Error Resume Next
     With ActiveSheet
        Cells.Clear
         With .QueryTables.Add(Connection:=Array("OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[COLOR="red"]D:\DaTa.xls[/COLOR];Jet OLEDB:Engine Type=35"), Destination:=Selection)
            .CommandType = xlCmdTable
            .CommandText = Array("TongHop$")
            .Refresh BackgroundQuery:=False
        End With
        Selection.EntireRow.Delete
        .UsedRange.Columns.AutoFit
    End With
End SubThanks !
 
	 
	  
 
 
		 
 
		 
 
		
 
 
		

 
 
		 
 
		 
 
		 
 
		
 
 
		 
 
		 
 
		 
 
		
 
 
		