Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2007 Export to Excel 2007 Formatting Error

Posted on 2014-03-21
2
Medium Priority
?
471 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
[X]
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
2 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

704 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