By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,589 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,589 IT Pros & Developers. It's quick & easy.

Vb code for Exporting Access table to Excel

P: 21
Hello All,
I'm looking for the vb code that export an access table to specific worksheet in Excel. I tried to search see if this question was answered before here, but didn't find anything that really relates to this question.

I will appreciate your help,

thanks in advance.
Aug 20 '10 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,442
Sarah,

We don't generally work that way. We are happy to help you, and lead you to a certain extent, but we draw the line at simply providing boiler-plate code on request.

If you would like to share what you've already tried and possibly ask a specific question related to where you're stuck then we can help further.

I can tell you that using the following requires the table or QueryDef object being exported to have the same name as the worksheet you want to export it into :
Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferSpreadsheet()
The TableName parameter would be the important one here.
Aug 20 '10 #2

P: 21
Thanks Neopa,

Yes I'm using DoCmd.TransferSpreadsheet() .Sorry I wasn't so clear in my question. My problem was when using TransferSpreadsheet() after I open up the excel file I get error message because of the file type. The code I was using is:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "TABLE NAME", "FILE PATH", True, "WorkSheet Name"
After I did a little bit of search , I figured I have to change acSpreadsheetTypeExcel12 to acSpreadsheetTypeExcel12Xml to create *.xlsx file type.

Thanks for your reply,
Sarah
Aug 20 '10 #3

NeoPa
Expert Mod 15k+
P: 31,442
Good work Sarah :)

I'm still using 2003 so know very little about 2007 specific facilities, as this would seem to be.
Aug 20 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.