Export a table to Excel (VBA)

I want to do one simple thing.

Push a button and export "MyTable" to Excel.

To make things easy, save in my documents folder.
File name will be provided on form text box.
LVL 11
phileocaAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
Dim strDir
strDir = Environ("userprofile") & "\My Documents\"

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Mytable", strDir & Me.textboxName, True
0
 
phileocaAuthor Commented:
I knew there was a quick and easy solution to this.

Always a pleasure!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.