Onlylonely
Registered User.
- Local time
 - Today, 16:16
 
- Joined
 - Jan 18, 2017
 
- Messages
 - 43
 
Hi All, 
Appreciate if you could help me out of this .
Excel time column should have the time exactly with the access table but it doesn't turn up to be the same.
	
	
	
		
 Appreciate if you could help me out of this .
Excel time column should have the time exactly with the access table but it doesn't turn up to be the same.
		Code:
	
	
	 Dim db As Database
     Dim qdf As TableDef
     Dim rs As Recordset
     Dim oApp As Excel.Application
     Dim oBook As Excel.Workbook
     Dim xls As Excel.Worksheet
     Dim J As Long
     'Dim xls As Object    'your Excel.Application with sheet activated
     
     Set oApp = New Excel.Application
     oApp.Visible = True
     Set oBook = oApp.Workbooks.Add
     Set xls = oBook.Worksheets(1)
     
     Set db = CurrentDb()
     Set qdf = db.TableDefs("Receivingtbl")
     'Set qdf = db.QueryDefs("SupplierScrapQ")
     Set rs = qdf.OpenRecordset
     
     With xls
     
    .Name = "Database"
    .Cells.Font.Name = "Calibri"
    .Cells.Font.Size = 11
    
    .Columns("A").ColumnWidth = 12
    .Columns("B").ColumnWidth = 12
    .Columns("C").ColumnWidth = 12
    .Columns("D").ColumnWidth = 12
    .Columns("E").ColumnWidth = 12
    .Columns("F").ColumnWidth = 12
    .Columns("G").ColumnWidth = 12
    .Columns("H").ColumnWidth = 12
    .Columns("I").ColumnWidth = 12
    .Columns("J").ColumnWidth = 12
    .Columns("K").ColumnWidth = 12
 
    
    
         For J = 0 To rs.Fields.Count - 1
             .Cells(1, J + 1).Value = rs.Fields(J).Name
         Next
         .Range("A2").CopyFromRecordset rs
     End With
     rs.Close