kate middleton
Board Regular
- Joined
- Aug 4, 2012
- Messages
- 188
Hello Everybody
I want to do something like this
But it does not works. But when i give something like this
then it works. But i dont want to give the fix path, i alway want to add the new workbook.
I want to do something like this
Code:
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim wks As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = True
Set xlWB = Workbooks.Add
Set wks = xlWB.Worksheets("Sheet1")
End With
DoCmd.OutputTo acOutputQuery, "Query_123", acFormatXLS _
, "wks", False, "", 0
Code:
DoCmd.OutputTo acOutputQuery, "Query_123", acFormatXLS _
, "C:\ABC\test1.xls", False, "", 0