Export from Access to excel

oxicottin

Board Regular
Joined
Feb 21, 2007
Messages
126
Hello, I am exporting a query from access to excel and its working but I cant figure out why im getting the green arrows in the corners of two rows of text/numbers that i exported. The exported data looks like 1-1/32" or 1-0/32" and If I mouse on the green arrow it says

Text Date with 2-Digit Year
Convert XX to 19XX
Convert XX to 20XX
Ignore Error
Ect.....


Code:
Sub ExportToExcelXLS()
'********************************************************************************
' Exports a file named [QC_Production_Export_MM-dd-yyyy.xls] to the desktop.
'********************************************************************************

    Dim outputFileName As String
    Dim XL As Object

    outputFileName = "C:\Documents and Settings\" & Environ("username") & "\Desktop\QC_Production_Export_" & Format(Date, "MM-dd-yyyy") & ".xls"

    If Len(Dir$(outputFileName)) > 0 Then
        Kill outputFileName
    End If

    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qry_ExportToExcel", outputFileName, True

    Set XL = CreateObject("Excel.Application")
    XL.Workbooks.Open outputFileName
    XL.Visible = False

    With XL
    
        .Range("E2:E1000").NumberFormat = "h:mm AM/PM" 'specified Time format was showing 1/0/1900
        .ErrorCheckingOptions.NumberAsText = False    'Clears the green error arrows
        .Range("A1:T1").Font.Bold = True
        .Range("A1:T1").Font.Name = "Segoe UI Light"
        .Range("A1:T1").Font.Size = 12
        .Range("A1:T1").Interior.ColorIndex = 44    'http://dmcritchie.mvps.org/excel/colors.htm
        .Range("A2:T1000").Font.Name = "Segoe UI Light"
        .Range("A2:T1000").Font.Size = 10
        .Columns("A:T").EntireColumn.AutoFit    'Auto fits colums to the largest text
        

    End With
    XL.ActiveWorkbook.Save
    XL.Application.Quit
    Set XL = Nothing
    
MsgBox "Congrats your data has been uploaded to your desktop in a .xls file", vbInformation, "Upload Complete"

End Sub
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Watch MrExcel Video

Forum statistics

Threads
1,109,348
Messages
5,528,187
Members
409,807
Latest member
nicky736

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top