Results 1 to 14 of 14

Thread: Object variable or with block variable not set

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    146

    Object variable or with block variable not set

    My program uses only one activeX, which is Ms Interent Control
    shdocvw.dll



    I tested my program (without using P&D) on 10 computers. The thing is that it runs perfectly on 9 computers. But on the last computer, it gives "object varible not set" error.

    I cant seem to locate the line of error.
    The error seems to appear while the form is loading...


    I then tried P&D. It's even worse. My program didn't work on all the computers, including my computer! The same error...



    Code:
    Private Sub Form_Load()
    On Error GoTo hell
    Me.Show
    
    Dim i As Integer
    
    
    'Set CustomWB = New WBCustomizer
    'With CustomWB
         '   .EnableContextMenus = False 'Disable The Menu
         '   .EnableAllAccelerators = True
         '   Set .WebBrowser = WebBrowser1
    'End With
    
    'CustomWB.EnableContextMenus = False
    
    lbltemp.Caption = getDesktopPath
    
    
    Dim Line1 As String
    Dim num As String
    Dim score As String
    
    fileName = lbltemp.Caption & "\Model School System (" + schooltype + ").dat"
    
    
    
    If Dir(fileName) <> "" Then
                Open fileName For Input As #1
                        Do Until EOF(1)
                                Input #1, Line1
                                If Line1 = "#academic" Or Line1 = "#cocur" Then Exit Do
                                num = Left(Line1, InStr(Line1, "#") - 1)
                                element(CInt(num)) = True
                                score = Right(Line1, Len(Line1) - InStr(Line1, "#"))
                                scores(CInt(num)) = score
                                
                                If CInt(num) = 9 Then
                                        element9_count = element9_count + 1
                                        ReDim Preserve element9(1 To element9_count) As String
                                        element9(element9_count) = score
                               End If
                        
                        Loop
                        If Line1 = "#cocur" Then
                                For i = 1 To 5
                                        Input #1, cocur.kelab(i)
                                        Input #1, cocur.badan(i)
                                        Input #1, cocur.sukan(i)
                                        Input #1, cocur.kesel(i)
                                Next i
                                isCocurLoaded = True
                        End If
                       
                        While Not EOF(1)
                                Input #1, Line1
                                If Line1 = "#academic" And schooltype <> "SMK" Then
                                        isAcademicLoaded = True
                                        For i = 1 To 6
                                                Input #1, PKSR(i).a
                                                Input #1, PKSR(i).b
                                                Input #1, PKSR(i).C
                                                Input #1, PKSR(i).D
                                                Input #1, PKSR(i).E
                                                Input #1, PKSR(i).gpt
                                                Input #1, PKSR(i).total
                                        Next i
                                                         
                                        Input #1, UPSR.a
                                        Input #1, UPSR.b
                                        Input #1, UPSR.C
                                        Input #1, UPSR.D
                                        Input #1, UPSR.E
                                        Input #1, UPSR.gpt
                                        Input #1, UPSR.total
                               ElseIf Line1 = "#academic" And schooltype = "SMK" Then
                                        isAcademicLoaded = True
                                        For i = 1 To 3
                                                Input #1, PKSM1(i).a
                                                Input #1, PKSM1(i).b
                                                Input #1, PKSM1(i).C
                                                Input #1, PKSM1(i).D
                                                Input #1, PKSM1(i).E
                                                Input #1, PKSM1(i).gpt
                                                Input #1, PKSM1(i).total
                                        Next i
                                                         
                                        Input #1, PMR.a
                                        Input #1, PMR.b
                                        Input #1, PMR.C
                                        Input #1, PMR.D
                                        Input #1, PMR.E
                                        Input #1, PMR.gpt
                                        Input #1, PMR.total
                                        
                                        For i = 4 To 5
                                            Input #1, PKSM2(i).A1
                                            Input #1, PKSM2(i).A2
                                            Input #1, PKSM2(i).B3
                                            Input #1, PKSM2(i).B4
                                            Input #1, PKSM2(i).C5
                                            Input #1, PKSM2(i).C6
                                            Input #1, PKSM2(i).D7
                                            Input #1, PKSM2(i).E8
                                            Input #1, PKSM2(i).G9
                                            Input #1, PKSM2(i).gpt
                                            Input #1, PKSM2(i).total
                                        Next i
                                        
                                        Input #1, SPM.A1
                                        Input #1, SPM.A2
                                        Input #1, SPM.B3
                                        Input #1, SPM.B4
                                        Input #1, SPM.C5
                                        Input #1, SPM.C6
                                        Input #1, SPM.D7
                                        Input #1, SPM.E8
                                        Input #1, SPM.G9
                                        Input #1, SPM.gpt
                                        Input #1, SPM.total
                                        
                                        For i = 6 To 7
                                                Input #1, PKSM3(i).a
                                                Input #1, PKSM3(i).Am
                                                Input #1, PKSM3(i).Bp
                                                Input #1, PKSM3(i).b
                                                Input #1, PKSM3(i).Bm
                                                Input #1, PKSM3(i).Cp
                                                Input #1, PKSM3(i).C
                                                Input #1, PKSM3(i).Cm
                                                Input #1, PKSM3(i).Dp
                                                Input #1, PKSM3(i).D
                                                Input #1, PKSM3(i).F
                                                Input #1, PKSM3(i).gpt
                                                Input #1, PKSM3(i).total
                                        Next i
                                        
                                        Input #1, STPM.a
                                        Input #1, STPM.Am
                                        Input #1, STPM.Bp
                                        Input #1, STPM.b
                                        Input #1, STPM.Bm
                                        Input #1, STPM.Cp
                                        Input #1, STPM.C
                                        Input #1, STPM.Cm
                                        Input #1, STPM.Dp
                                        Input #1, STPM.D
                                        Input #1, STPM.F
                                        Input #1, STPM.gpt
                                        Input #1, STPM.total
                                        
                                        Input #1, STAM.a
                                        Input #1, STAM.Am
                                        Input #1, STAM.Bp
                                        Input #1, STAM.b
                                        Input #1, STAM.Bm
                                        Input #1, STAM.Cp
                                        Input #1, STAM.C
                                        Input #1, STAM.Cm
                                        Input #1, STAM.Dp
                                        Input #1, STAM.D
                                        Input #1, STAM.F
                                        Input #1, STAM.gpt
                                        Input #1, STAM.total
                                        
                                        
                                End If
                       Wend
                       
                Close #1
    Else
                Open fileName For Append As #1
                Close #1
                'We'r done here
    End If
    
    
    WebBrowser1.Navigate App.Path & "\data\index.htm"
    
    Exit Sub
    hell:
    MsgBox "Sorry, the data file " & fileName & " is damaged. You could try deleting it and running this program again", 16
    End Sub
    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