Chris Swann
dc8 at btinternet.com
Sat May 21 14:03:59 CDT 2011
Hi all, I have some code that runs fine on my work PC running XP SP3 with Office 2007. Wanted to do a bit of work on my home PC which is Vista with Office 2003 and 2007 installed. I thought this might be the problem. So, I thought I'd try on my laptop which only has Office 2003 installed but got the same error. It seems to be failing at this point (<<<<<<<<<<<<<<<) and I wondered if anybody might be able to shed any light on what might be causing the problem. The code completes the first two lines - correctly adds the data to the first two sheets and then fails part of code follows Do Line Input #1, theline a = Split(theline, "|") rowcount = rowcount + 1 For i = LBound(a) To UBound(a) Select Case i Case Is <= 249 sht1(rowcount, i + 1) = a(i) Case 250 To 499 sht2(rowcount, i - 249) = a(i) Case 500 To 749 sht3(rowcount, i - 499) = a(i) End Select Next i Loop While Not EOF(1) Close #1 With xlApp .Sheets("Sheet1").Range("A1:IP" & counter) = sht1 .Sheets("Sheet2").Range("A1:IP" & counter) = sht2 .Sheets("Sheet3").Range("A1:IP" & counter) = sht3 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< .Sheets("WantedData").Range("A1:IP" & counter) = sht4 End With Many thanks, Chris Swann