troubleshooting Question

Write to Excel97 using DAO

Avatar of lewisg
lewisgFlag for United States of America asked on
Visual Basic Classic
5 Comments1 Solution158 ViewsLast Modified:
I need to write a series of values to a Excel worksheet. The problem that I am having is how to refer to the cells where I want to write the data. I want to start on page PC in column 10 (K) row 2 and write to successive rows.

Here is what I have so far:

  Set Db = DBEngine(0).OpenDatabase(App.Path & "\" & "O_Rate.xls", False,
False, "Excel 8.0; HDR=1")
  Set Rs = Db.OpenRecordset("PC$")

  If Rs.RecordCount > 0 Then
    Rs.MoveLast                                           'size the array
    Rs.MoveFirst
  End If
  Debug.Print Rs(0)                                    'this works, I get the
correct value for A,2

  With Rs
    For i = 1 To 33
      Debug.Print i; " * "; lngAVinTotal(i)
      .Edit
      ![K,1+i] = lngAVinTotal(i)                    'this is the problem, how
do I refer to the cell?
      .Update
    Next i
  .Close
  End With
  Db.Close

I get a Run-time error '3265' Item not found in this collection.


ThanksInAdvance!!!
ASKER CERTIFIED SOLUTION
SpideyMod

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros