I've got the following code, which basically adds sheets on the fly as and when required. it puts the new sheet at the end and gives it a unique name.
Problem I have is that it works on some machines and not others.
Same version of the EXE, all the right DLL's installed etc etc, but only works on some and not all![]()
VB Code:
Do While Not rs.EOF .ActiveCell.Value = rs!CON_LOCN .ActiveCell.Offset(0, 1).Value = RTrim(rs!CON_COMP) .ActiveCell.Offset(0, 2).Value = RTrim(rs!CON_ELEM) .ActiveCell.Offset(0, 3).Value = RTrim(rs!CON_COND) .ActiveCell.Offset(0, 4).Value = RTrim(rs!CON_REMW) .ActiveCell.Offset(0, 5).Value = RTrim(rs!CON_QUAN) .ActiveCell.Offset(0, 6).Value = RTrim(rs!CON_PRIO) .ActiveCell.Offset(0, 7).Value = RTrim(rs!CON_BUDG) .ActiveCell.Offset(0, 8).Value = RTrim(rs!CON_COMM) .ActiveCell.Offset(1, 0).Select RowCount = RowCount + 1 ' £££ If RowCount > 18 Then ConditionPageNo = ConditionPageNo + 1 ' Create new Page [B]objExcel.Sheets(objExcel.ActiveSheet.Name).Copy After:=objExcel.Sheets(objExcel.Sheets.Count) .ActiveSheet.Name = "Condition Data-Details" & ConditionPageNo[/B] ' Blank out contents .Range("A8:N61").Select .Selection.ClearContents .Range("A8").Select ' Reset row counter RowCount = 1 End If rs.MoveNext Loop
I've highlighted the offending bit.
On the machines it doesn't work on I get the error below.
Any help would be greatly appreciated.
Steve.




Reply With Quote