I have a query in Access DB which I need to export to an excel workbook. In the same excel workbook I want to add 2 more excel sheet - one with no data and the other with a pre-coded (using access vba) vlookup/dlookup between sheet1 and sheet2. Below is the code i am using to create export the data but i am not able to add new sheets to it. When i click on the button which is embedded to the below script the access DB hangs. Appreciate any assistance/guidance. How to add additional sheets and how to do a lookup between them. Thanks.
Private Sub Command1679_Click()
DoCmd.TransferSpreadsheet acExport, , "SQL QueryName", "C:/Report" & "_" & Format(Date, "yyyy-mm-dd") & ".xlsx", True, "Sheet1"
Dim objexcel As Excel.Application
Dim wbexcel As Excel.Workbook
Set objexcel = CreateObject("Excel.Application")
Set wbexcel = objexcel.Workbooks.Open("C:/Report" & "_" & Format(Date, "yyyy-mm-dd"))
Set objexcel = wbexcel.Worksheets.Add()
End Sub