Solved

Dynamically Determine the SpreadsheetType value in DoCmd.TransferSpreadsheet Method

Posted on 2014-04-23
1
3,900 Views
Last Modified: 2014-04-24
I am having to update the value of the SpreadsheetType in DoCmd.TransferSpreadsheet based on the user's version of MS Access.  

Is there a vba code to determine the SpreadsheetType value without having to hardcode it as acSpreadsheetTypeExcel3, acSpreadsheetTypeExcel9, etc ?

Thanks.
0
Comment
Question by:yvroger
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40018814
xif access version is less than 12.0 , excel file extension .xls
use 8 for acSpreadsheetTypeExcel

docmd.transferspreadsheet acimport, 8,

you can also leave it blank

docmd.transferspreadsheet acimport, ,



for access version 12 and above, use 10 , excel file extension .xlsx

docmd.transferspreadsheet acimport, 10,
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

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