I've searched and searched for an answer so now I'm posting. I'm trying to append a worksheet in a particular workbook and not create a new worksheet in the workbook. Reason I MUST use the old worksheet is because the first 4 lines are structed headers...with comments and autofilters and such. I don't know how to format the spreadsheet thru code so if I could just drop the data into the formatted spreadsheet everything would be fine.
Backstory (read if you are bored) I'm in the military and just came to a new office. There is a process that one of my troops has to do everymorning...taking him/her about 1 hour. All they are doing is pulling down a report in Excel format. Then because the monkeys higher in the trees are too busy scratching their butts to filter information for themselves, my troops have to make seperate worksheets within the workbook and separate (filter) the information to each tab so that the lazy people who make more than we do don't have to hit an autofilter dropdown to find the information. So I decided to make a database do it all. I've made it pull the excel data into the main table. But when I try to export it to the formatted worksheet (in a workbook) it says the worksheet is already created and won't do it.
Dim qdf As New DAO.QueryDef
Dim db As DAO.Database
qdf.SQL = Me.RecordSource
qdf.Name = "D23"
Set db = CurrentDb()
db.QueryDefs.Append qdf
DoCmd.TransferSpreadsheet acExport, 8, qdf.Name, Forms!MAINfrm!D23OUTPUT.Value, true
db.QueryDefs.Delete qdf.Name
In the excel spreadsheet I'm transferring data to, there is a worksheet called D23. That's where I want the data going.
Anyhelp would be greatly appreciated!
Backstory (read if you are bored) I'm in the military and just came to a new office. There is a process that one of my troops has to do everymorning...taking him/her about 1 hour. All they are doing is pulling down a report in Excel format. Then because the monkeys higher in the trees are too busy scratching their butts to filter information for themselves, my troops have to make seperate worksheets within the workbook and separate (filter) the information to each tab so that the lazy people who make more than we do don't have to hit an autofilter dropdown to find the information. So I decided to make a database do it all. I've made it pull the excel data into the main table. But when I try to export it to the formatted worksheet (in a workbook) it says the worksheet is already created and won't do it.
Dim qdf As New DAO.QueryDef
Dim db As DAO.Database
qdf.SQL = Me.RecordSource
qdf.Name = "D23"
Set db = CurrentDb()
db.QueryDefs.Append qdf
DoCmd.TransferSpreadsheet acExport, 8, qdf.Name, Forms!MAINfrm!D23OUTPUT.Value, true
db.QueryDefs.Delete qdf.Name
In the excel spreadsheet I'm transferring data to, there is a worksheet called D23. That's where I want the data going.
Anyhelp would be greatly appreciated!