Connecting Tech Pros Worldwide Forums | Help | Site Map

exporting access data to excel for calculations and reporting

michb@westnet.com.au
Guest
 
Posts: n/a
#1: Nov 13 '05
I need to export data from access to an excel database [logon and
logoff times] to calculate times and wages for the week but the code
that I entered doesn't seem to like either me or the database!
I need it to go to one specific sheet in an excel workbook - the code
used is following as was advised earlier - but I am having no luck and
I want to get this database working asap.
code is:

Option Compare Database
Public Function TransferSpreadsheet()
Sub SendToExcel()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
"tblLogTimes", "C:\Documents and Settings\Office\My
Documents\Employeetimesheets.xls", True
Application.FollowHyperlink "C:\Documents and Settings\Office\My
Documents\Employeetimesheets.xls"

End Sub
End Function

I have used the following macro to initiate the module
OpenModule
TransferSpreadsheet [export s/s to excel 8-10, tblname, has field
names]
StopMacro

this is not working - what have i done wrong?


Hans-Joerg Karpenstein
Guest
 
Posts: n/a
#2: Nov 13 '05

re: exporting access data to excel for calculations and reporting


Am Wed, 07 Sep 2005 20:52:33 -0700 schrieb michb:
[color=blue]
> I need to export data from access to an excel database [logon and
> logoff times] to calculate times and wages for the week but the code
> that I entered doesn't seem to like either me or the database!
> I need it to go to one specific sheet in an excel workbook - the code
> used is following as was advised earlier - but I am having no luck and
> I want to get this database working asap.
> code is:
>
> Option Compare Database
> Public Function TransferSpreadsheet()
> Sub SendToExcel()
> DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
> "tblLogTimes", "C:\Documents and Settings\Office\My
> Documents\Employeetimesheets.xls", True
> Application.FollowHyperlink "C:\Documents and Settings\Office\My
> Documents\Employeetimesheets.xls"
>
> End Sub
> End Function
>
> I have used the following macro to initiate the module
> OpenModule
> TransferSpreadsheet [export s/s to excel 8-10, tblname, has field
> names]
> StopMacro
>
> this is not working - what have i done wrong?[/color]

Hello,

maybe the following things make trouble to your module/macro
- I think you should be careful with a sub in a function
- The name of the sub is also the name of a makro.
- you should use a makro that runs a funktion (RunFunction)
"AusführenFunktion" in the German Version)
- The macro "TransferSpreadsheet" is the same as Docmd.TransferSpreadsheet.

HTH
Karpi
<fluctuat nec mergitur>



Closed Thread