Because msheet could be msheet1, or msheet2 etc If I take the "" away, it comes up with Variable sheet6 is not found
On Thu, May 5, 2016 at 7:02 PM, Allen <pro...@gatwicksoftware.com> wrote: > why have you got "" as well as & ? > Al > > -----Original Message----- From: Sytze de Boer > Sent: Thursday, May 5, 2016 2:09 AM > To: profoxt...@leafe.com > Subject: VFP to XLSX file > > > 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 > --- > [excessive quoting removed by server] _______________________________________________ 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/cag1nny8lf4vvco1qi72zuycxbhcnri1h+3cor+wghpzy9_a...@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.