Solved

Access 2007 Export to Excel 2007 Formatting Error

Posted on 2014-03-21
2
450 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 48

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now