I wrote a small vb6 program that works fine on w2000. When i try on w95 i get “this program performed illegal operation” when i hit the submit button.
Private Sub imgSubmit_click()
Dim xlsApp As Excel.Application
Dim wb As Workbook
‘code to make sure no other instance of excel is open
‘open the contact xls
Set xlsApp = New Excel.Application
‘ xlsApp.Visible = True
Workbooks.Open FileName:=”c:contacts.xls”
Call AddToExcel
ActiveWorkbook.Close SaveChanges:=True
xlsApp.Quit
Set xlsApp = Nothing
Call ClearTextBoxes
If MsgBox(“Contact has been entered, do you want to enter another?”, vbYesNo) = vbNo Then
End
End If
End Sub
Private Sub AddToExcel()
Dim rngData As Range
Dim rngRow As Range
Dim lastRow As Integer
Worksheets(“Data”).Activate
Set rngData = Range(“A3”).CurrentRegion
lastRow = rngData.Rows.Count + 1
Range(“A” & lastRow) = txtDate.Text
end sub
What am i doing wrong? thank you for the help