I just can't figure what I'm doing wrong with this code. Can anyone assist The spreadsheet I want to place information into has about 15 Sheets Foxdata has around 500 entries
With loExcel .Workbooks.Open(lcFile) Scan Select foxdata If !balance=0 Mdata =Alltrim(foxdata.sheet2) && EG "J16" *Msheet="SHEET"+ALLTRIM(sheet1) && EG "Expenses" Msheet="SHEET"+ALLTRIM(STR(sheetnum)) && If I use the sheet number instead .Sheet("&msheet").Select This is where it comes up with error "invalid index" .Range("&Mdata").Select I get an occasional error here .Selection=foxdata.balance Endif Endscan .ActiveWindow.Close(xlSaveChanges) .Quit() Endwith -- Kind regards, Sytze de Boer --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cag1nny8wkwzhlg+hm-tw+o0qzfqvygbn8j_p1r8amtsoxru...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.