Solved

Access 2007 Export to Excel 2007 Formatting Error

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month2 days, 18 hours left to enroll

622 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