Problems running excel macro from access

K

Kate

I am trying to run an excel macro from access. First I open the
spreasheet, then I run the macro.

This is my code:

Dim xlx As Object, xlw As Object, xls As Object, xlc As Object
Set xlx = CreateObject("Excel.Application")
xlx.Visible = True
Set xlw = xlx.Workbooks.Open("H:\Data\Enztec Files\1300 Marketing\04 -
Pricing\Price Lists and Costings\C Costing Database\Route Card
Template.xls")
Set xls = xlw.Worksheets("Route Card")

Dim strFile As String, strMacro As String
strFile = "Route Card Template"
strMacro = "RouteCard"
Set xlx = CreateObject("Excel.Application")
xlx.Visible = True
xlx.Run strFile & "!" & strMacro

But it won't run the macro? How Come?
Thanks
 
L

Larry Daugherty

What does "But it won't run the macro? " mean? There seems to be
some detail missing. :)

Try moving your code into a new Excel workbook and debug it there.

Once the code problems are fixed, move it back to Access.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top