I want to export data from Access 2002 to Excel 2002 in order to run a Solver procedure on the data. I have created an macro in Excel called "Macro3" as follows:

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

Whn I run this Macro in Excel it owrks fine.

When I run the following code in Access I get the message - "Solver - An unexpected internal error occurred - or available memory was exhausted" :-

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