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
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top