newbie1983
Programmer
I am reading from a text file straight into an OLE excelsheet which is on a visual basic form. The code below is what ive written so far :
Private WithEvents myExcel As Excel.Workbook
Private WithEvents mySheet As Excel.Worksheet
Public Sub Form_Load()
Dim File As TextStream
Dim DatafromFile As String
Dim ofso As New FileSystemObject
Dim ofile As File
Dim i As Integer
Set myExcel = OLE1.object
myExcel.Activate
Set mySheet = myExcel.ActiveSheet
Set File = ofs
penTextFile("I:\laceResults.txt"
For i = 1 To 3
DatafromFile = File.ReadLine
mySheet.Cells(1, 0) = Right(DatafromFile, 7)
Next i
File.Close
End Sub
It doesnt seem to like the statement :
mySheet.Cells(1, 0) = Right(DatafromFile, 7)
Any ideas?
Kind Regards
Hinesh
Private WithEvents myExcel As Excel.Workbook
Private WithEvents mySheet As Excel.Worksheet
Public Sub Form_Load()
Dim File As TextStream
Dim DatafromFile As String
Dim ofso As New FileSystemObject
Dim ofile As File
Dim i As Integer
Set myExcel = OLE1.object
myExcel.Activate
Set mySheet = myExcel.ActiveSheet
Set File = ofs
For i = 1 To 3
DatafromFile = File.ReadLine
mySheet.Cells(1, 0) = Right(DatafromFile, 7)
Next i
File.Close
End Sub
It doesnt seem to like the statement :
mySheet.Cells(1, 0) = Right(DatafromFile, 7)
Any ideas?
Kind Regards
Hinesh