Results 1 to 13 of 13

Thread: Excel being weird !

Threaded View

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Excel being weird !

    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:
    1. Do While Not rs.EOF
    2.                     .ActiveCell.Value = rs!CON_LOCN
    3.                     .ActiveCell.Offset(0, 1).Value = RTrim(rs!CON_COMP)
    4.                     .ActiveCell.Offset(0, 2).Value = RTrim(rs!CON_ELEM)
    5.                     .ActiveCell.Offset(0, 3).Value = RTrim(rs!CON_COND)
    6.                     .ActiveCell.Offset(0, 4).Value = RTrim(rs!CON_REMW)
    7.                     .ActiveCell.Offset(0, 5).Value = RTrim(rs!CON_QUAN)
    8.                     .ActiveCell.Offset(0, 6).Value = RTrim(rs!CON_PRIO)
    9.                     .ActiveCell.Offset(0, 7).Value = RTrim(rs!CON_BUDG)
    10.                     .ActiveCell.Offset(0, 8).Value = RTrim(rs!CON_COMM)
    11.                     .ActiveCell.Offset(1, 0).Select
    12.                     RowCount = RowCount + 1 ' £££
    13.                     If RowCount > 18 Then
    14.                         ConditionPageNo = ConditionPageNo + 1
    15.                         ' Create new Page
    16.                         [B]objExcel.Sheets(objExcel.ActiveSheet.Name).Copy After:=objExcel.Sheets(objExcel.Sheets.Count)
    17.                         .ActiveSheet.Name = "Condition Data-Details" & ConditionPageNo[/B]
    18.                         ' Blank out contents
    19.                         .Range("A8:N61").Select
    20.                         .Selection.ClearContents
    21.                         .Range("A8").Select
    22.                         ' Reset row counter
    23.                         RowCount = 1
    24.                     End If
    25.                    
    26.                     rs.MoveNext
    27.                 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.
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width