Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dynamically Determine the SpreadsheetType value in DoCmd.TransferSpreadsheet Method

Posted on 2014-04-23
1
Medium Priority
?
4,679 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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.
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…

971 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