Eljefegeneo
Still trying to learn
- Local time
- Today, 09:54
- Joined
- Jan 10, 2011
- Messages
- 902
I know this must have been beaten to death many times, but I cannot figure out how to name the Excel Workbook using the SendTQ2Excel function.
It comes out exactly how I want it; formatting is just great, but I cannot figure out the last part:
Using SendTQ2Excel (myQry) gives me the desired results but names the workbook Book1.
I have tried the following with the results:
SendTQ2Excel (myQry, myfile) give me "Compile Error, Expected: ="
SendTQ2Excel myQry, myfile gives me "Compile Error, Syntax Error"
SendTQ2Excel (myQry, "ABCDE") gives me "Compile Error, Expected: ="
SendTQ2Excel (myQry, "ABCDE.XLsx") gives me "Compile Error, Expected: ="
SendTQ2Excel myQry, "ABCDE.xlsx" gives me "By Ref Argument type Mismatch"
I have researched this extensively and have tried just about all the variations to name the Workbook to no avail. Is there something else I should be doing?
[FONT="]The function for those not familiar with it is on:[/FONT]
http://btabdevelopment.com/export-a-table-or-query-to-excel/
It comes out exactly how I want it; formatting is just great, but I cannot figure out the last part:
Code:
[FONT="]Public Function SendTQ2Excel(strTQName As String, Optional strSheetName As String)[/FONT]
I have tried the following with the results:
SendTQ2Excel (myQry, myfile) give me "Compile Error, Expected: ="
SendTQ2Excel myQry, myfile gives me "Compile Error, Syntax Error"
SendTQ2Excel (myQry, "ABCDE") gives me "Compile Error, Expected: ="
SendTQ2Excel (myQry, "ABCDE.XLsx") gives me "Compile Error, Expected: ="
SendTQ2Excel myQry, "ABCDE.xlsx" gives me "By Ref Argument type Mismatch"
I have researched this extensively and have tried just about all the variations to name the Workbook to no avail. Is there something else I should be doing?
[FONT="]The function for those not familiar with it is on:[/FONT]
http://btabdevelopment.com/export-a-table-or-query-to-excel/