I want to export data from Access 2002 into Excel 2002 in order to run a Solver Macro on the data:

My macro is :

SolverOk SetCell:="$D$4", MaxMinVal:=3, ValueOf:="0", ByChange:="$C$5"

When I run this Macro in Excel it works fine.

When I run the following code in Access to export the data and to run the macro I get the message - "An unexpected internal error occurred, or avialable memory was exhausted". Why does this happen?

Set objXl = CreateObject("Excel.Application")

With objXl
.Visible = True

Set objWkb = objXl.Workbooks.Open(wname)
Set objSht = objWkb.Worksheets(sname)

With dataset
k = 1

Do While Not .EOF

With objSht

.Cells(k, 1) = dataset!code
.Cells(k, 2) = dataset!descrip
.Cells(k, 3) = dataset!num

End With

k = k + 1

End With

.Application.Run ("Macro3")

End With