View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Barnes[_3_] Bob Barnes[_3_] is offline
external usenet poster
 
Posts: 10
Default Error -2147417851 '"The server threw an exception"

Is there a good alternative to "CopyFromRecordset"

When I need a single value, I use an Access Recordset
& write that value (no problems), but this is a Recordse
of up to 52 records with 2 fields per Record

Parts of my code..
Set RS = CurrentDb.OpenRecordset(strSql, dbOpenSnapshot) <== No problem w/ the "strSQL
'start Exce
Set objXLApp = CreateObject("Excel.Application"
...................
'select desired workshee
Set objXLSheet = objXLWb.Worksheets(strWorkSheet) <== No problem w/ the "strWorkSheet
objXLSheet.Range(strCellRef).Clear 'Is "TheData" <== No problem w/ the "strCellRef
objXLSheet.Range(strCellRef).CopyFromRecordset RS <=== Fails there w/ "...exception" above

Funny thing...I've been using this code for a couple of months w/ no problems
Maybe a Server problem here ?

ANY insight welcomed. TIA - Bo