Docmd.TransferSpreadsheet

  • Thread starter Thread starter Mikey C
  • Start date Start date
M

Mikey C

Hello!

Can anybody give me some code for the Docmd.TransferSpreadsheet
command, which i can adapt for my database (or know where to get it)?

I need to be able to create a command button which will export a number

of tables into the same workbook at the same time. Ideally, I would
like
to be able to export back this way but I don't think my user-level
security will let me? (Access wont let me import from Excel - even with
an admisistrators password).

Really appreciate the help
 
Hi Mikey,

Docmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
varQuery(intLoopVar), strPath & "FileName.xls", 0, varName(intLoopVar)

The first argument (acSpreadsheetTypeExcel9) will need to be adjusted
according to what version of acccess you are using.

Good luck

Nick McMillen
 
You are a true saint - thank you very much!
Hi Mikey,

Docmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
varQuery(intLoopVar), strPath & "FileName.xls", 0, varName(intLoopVar)

The first argument (acSpreadsheetTypeExcel9) will need to be adjusted
according to what version of acccess you are using.

Good luck

Nick McMillen
 
Correction:

Although I said that the first argument would need to be adjusted
according to what version of access you were using, what I actually
meant was that would have to be adjusted depending on which version of
Excel you would like in output to.

Also I should have explained that the code I pasted in would output
varQuery(intLoopVar) to the sheet varName(intLoopVar) within
"FileName.xls"

My halo keeps slipping.

Nick
 
Sorry Nick (or anyone), i'm a bit of a wolly when it comes to code

Can you explain this a little more for me?

I have created a command button called 'Export_Tables' and inserted the
following code in the 'On-Click' value:

Private Sub Export_Tables_Click()
Docmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
varQuery (intLoopVar), strPath & "Test Export.xls", 0,
varName(intLoopVar)
End Sub

1. I am using Excel 2003 SP2
2. I want to export the following tables: Financial/Stats, Company,
Country, Game Type, Segment, Period Covering, year, Financial / KPI's,
Measure, Data Type and Currency & Format
3. The workbook I'm using at the moment (for testing) is named 'Test
Export'.

Let me know if you need any more info

Thanks
 
Ah, no problem - got it cracked! Thanks anyways

Mikey said:
Sorry Nick (or anyone), i'm a bit of a wolly when it comes to code

Can you explain this a little more for me?

I have created a command button called 'Export_Tables' and inserted the
following code in the 'On-Click' value:

Private Sub Export_Tables_Click()
Docmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
varQuery (intLoopVar), strPath & "Test Export.xls", 0,
varName(intLoopVar)
End Sub

1. I am using Excel 2003 SP2
2. I want to export the following tables: Financial/Stats, Company,
Country, Game Type, Segment, Period Covering, year, Financial / KPI's,
Measure, Data Type and Currency & Format
3. The workbook I'm using at the moment (for testing) is named 'Test
Export'.

Let me know if you need any more info

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top