Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Access 2007 Export to Excel 2007 Formatting Error

Posted on 2014-03-21
2
462 Views
Last Modified: 2014-03-21
I had some code that exported a query to an excel file (.xls). I attempted to update the code to export the data into a 2007 Excel file (.xlsx) and everything thing seemed to work up until I try to open the file. I keep getting this message that says that the file cannot be open because the file extension or something in not correct. I checked it 50 times I didnt see anything wrong with the file name. The file is being export to a sharepoint site although I am using the full directory path in my file name. I have included a screenshot of the error along with the code that I am running.

Any assistance with this would be much appreciated.

Screenshot of error message
Public Function ExportFormData()

    On Error GoTo ErrorHandler
    
    Dim strDashboardPath As String
    Dim strQryEmployees As String
    
    strDashboardPath = "\\teamspace\DavWWWRoot\sites\CCCoaching\"
    strQryEmployees = strDashboardPath & "QRY_EMPLOYEES_UUS.xlsx"
       
    DoCmd.TransferSpreadsheet TransferType:=acExport, SpreadsheetType:=acSpreadsheetTypeExcel12, TableName:="QRY_EMPLOYEES", Filename:=strQryEmployees, HasFieldNames:=True
   
    ErrorHandlerExit:
    Exit Function
    
ErrorHandler:
    MsgBox "Error No: " & Err.Number _
        & ";Description: " & Err.Description
    Resume ErrorHandlerExit

End Function

Open in new window


Thank you
0
Comment
Question by:spaced45
2 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39945527
Hi,



pls try
DoCmd.TransferSpreadsheet TransferType:=acExport, SpreadsheetType:=acSpreadsheetTypeExcel12Xml, TableName:="QRY_EMPLOYEES", Filename:=strQryEmployees, HasFieldNames:=True

Open in new window

Regards
0
 
LVL 1

Author Comment

by:spaced45
ID: 39946164
Worked! Thank you.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question