Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automatic excel open

2 views
Skip to first unread message

Siva - Hyderabad

unread,
May 15, 2006, 6:39:01 AM5/15/06
to
I have done a project in access and created Report with the help of Macros to
export into Excel sheet. After creating Excel sheet I have created one more
Macro to create good look in Excel. Should I do it from Access itself to
operate excel macro.?

I mean my excel macro should work when I export from access itself. Pl.
provide example also...When I export with the help of access macros, it
saves excel file in C:\ as c:\ss.xls and then I am accessing ss macro in
Excel.

Thanks, Siva from India...

Ron2006

unread,
May 30, 2006, 5:27:24 PM5/30/06
to
here is code that runs an excel macro from within access:

Set xlApp1 = CreateObject("Excel.application")
xlApp1.Application.Visible = True
Set xlWb2 = xlApp1.Workbooks.Open("path\BOM2.xls") ' macro was
here
Set xlWb1 = xlApp1.Workbooks.Open("path\" & filename & ".xls")
'sheet to run in
Set xlWs = xlWb2.Worksheets("Sheet1")
xlApp1.UserControl = True
xlWs.Activate
xlApp1.Run "BOM2!macroname"
xlApp1.Save
xlApp1.Quit

0 new messages