468,243 Members | 1,860 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,243 developers. It's quick & easy.

Vb code for Exporting Access table to Excel

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
3 3268
NeoPa
32,053 Expert Mod 16PB
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
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
32,053 Expert Mod 16PB
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.

Similar topics

1 post views Thread by setterst | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.