Head fogged truly by Excel worksheet move problem

alecwood

New member
Local time
Today, 15:03
Joined
Nov 6, 2007
Messages
3
Hi All

I am exporting a series of queries from my database to Excel as part of a report.

Easy stuff using the TransferSpreadsheet Method. Now the boss wants some of these queries displayed together on a singleworksheet sheet, and some on individual ones. Here's my methodology

I output a couple of queries using the TransferSpreadsheet method
Then I use ADO to read each of three queries and use the CopyFromRecordset method to dump them into a new worksheet, then a few more TransferSpreadsheet and one more set of four CopyFromRecordset

My problem is this - the two worksheets I add and fill using ADO are at the front of the workbook, not where I want them to be. I need to move these worksheets to the appropriate place in the report.

Any ideas? I got this off another forum but it does not work

oapp.worksheets("Sheet5").Move.After = "Sheet4"

I have a suspicion it's almost right, but no variation I have tried has worked yet.
 
oapp.worksheets("Sheet5").Move After:= oapp.worksheets("Sheet4")
 
Thanks

Woo Hoo !

Now I can finally get a coffee in peace

Many thanks for your help
 

Users who are viewing this thread

Back
Top Bottom