Hi Ken
I am trying to do thisin the MSaccess form coding
I added a button to run Excel application and the code for the button looks
like this
Private Sub Command93_Click()
On Error GoTo Err_Command93_Click
DoCmd.TransferSpreadsheet(acExport, acSpreadsheetTypeExcel9,
qKPWC_RECOUP, "C:\TRY", YES)
Exit_Command93_Click:
Exit Sub
Err_Command93_Click:
MsgBox Err.Description
Resume Exit_Command93_Click
End Sub
but the code dosent run and is giving me an error
1) It gives me a error that a = is included somewhere. Does the
transferdatasheet action return any value. If it does what datatype does it
return
I tried modifying and added a
Dim x as integer
and assigned
x = DoCmd.TransferSpreadsheet(acExport, acSpreadsheetTypeExcel9,
qKPWC_RECOUP, "C:\TRY", YES)
thinking that it might be returning a numeric value
but now while executing the code it gives me
Compile error : highlighted on Transferspreadsheet method
"Expected function or variable"
Please help
Madhuri
> Assuming that your report is using a query as its record source, you can use
> DoCmd.TransferSpreadsheet to export that query to an EXCEL file. See
[quoted text clipped - 11 lines]
> > Thanks
> > Madhuri
Ken Snell [MVP] - 07 Jul 2005 21:54 GMT
Don't put ( ) around the arguments. Also, specify the full path to the EXCEL
file, including the filename. And, use True not Yes.
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, qKPWC_RECOUP,
"C:\TRY\FileNameIs.xls", True

Signature
Ken Snell
<MS ACCESS MVP>
> Hi Ken
>
[quoted text clipped - 58 lines]
>> > Thanks
>> > Madhuri
Madhuri - 07 Jul 2005 22:04 GMT
Thanks Ken, that worked
Please also tell me how to open the excel sheet after its created without
closing msaccess.
Thanks in advance
Madhuri
> Don't put ( ) around the arguments. Also, specify the full path to the EXCEL
> file, including the filename. And, use True not Yes.
[quoted text clipped - 64 lines]
> >> > Thanks
> >> > Madhuri
Madhuri - 07 Jul 2005 22:33 GMT
Thank you,
I solved it. I used shell command to open the excel sheet.
Thanks for all the support Ken.
Madhuri
> Thanks Ken, that worked
>
[quoted text clipped - 72 lines]
> > >> > Thanks
> > >> > Madhuri
Ken Snell [MVP] - 08 Jul 2005 02:10 GMT
You're welcome.

Signature
Ken Snell
<MS ACCESS MVP>
> Thank you,
>
[quoted text clipped - 87 lines]
>> > >> > Thanks
>> > >> > Madhuri
Lee - 27 Feb 2007 20:50 GMT
I am trying to do a similar thing but I have the error msg - The MS Jet
Database Engine could not find the object (table name).
What is qKPWC_RECOUP?
Thanks for your help!
> You're welcome.
>
[quoted text clipped - 89 lines]
> >> > >> > Thanks
> >> > >> > Madhuri