Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export to excel, then run a macro

Status
Not open for further replies.

gojohnnygogogogo

Programmer
May 22, 2002
161
GB
hello,
how can I do this,

click a button,
automatically open report (report1) in excel,
run code to move spread sheet into correct positioning.

I have created a macro to do the spreadsheet amendments, but would like to run it all from code from access.
the part I cant do is run the spreadsheet code from access against the spreadsheet just crreated.

any ideas ?

 
Hey,

could you tell me how you did this? I'm looking for the exact same thing :)

Greetz
 
alright flavio....,
to do this from the onclick event of the button I did :

'first open access report with data you need to move to
'excel
Dim stDocName As String
stDocName = "R_report"

'then output the data to an excel spreadsheet
DoCmd.OutputTo acOutputReport, stDocName, acFormatXLS, "C:\R_spreadsheet.xls"

'then open up the spreadsheet with the macro you wantto
'run against the new spreadsheet you created from the
'access report
Dim XL As Object
Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open "C:\spreadsheet_with_macro.xls"
XL.Run "Macro_Name"


hope this is ok for you.
Cheers Geeza.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top