Hi
I have following code ...Don't know where is problem. Can anybody guide me ? I am getting error at line 64 and char 5 and code 800A0009
'==========================================================================
'
' VBScript Source File -- Created and maintained
'
'
' COMMENT: version 4.0
'
'==========================================================================
Option Explicit
Dim fs,objTextFile,newdate,newlocation,sctape,iResponce,strLogFile,progr
Dim strText0, arrStr,objExcel,objSpread,intRow,X,exlsheet,objSheet,newnum
Set fs=CreateObject("Scripting.FileSystemObject")
'ForReading=1, you must use values
Set objTextFile = fs.OpenTextFile("list.txt", 1)
' Open the Excel spreadsheet
'
exlsheet = "C:\Documents and Settings\brw-operator\my documents\vb\totaltapes.xls"
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks. Open exlsheet
Set objSheet = objExcel.ActiveWorkbook.WorkSheets(1)
progr = "progressbar.txt"
Set strLogFile = Fs.OpenTextFile("update.log", 8, True)
Do
newdate = inputbox ("New date for these tapes", "Enter New date ")
If newdate = "" Then
Wscript.Echo "You must enter a Date."
Else
Exit Do
End If
Loop
Do
newlocation = inputbox ("New location for these tapes", "Enter New location for these Tapes ")
If newlocation = "" Then
Wscript.Echo "You must enter Newlocation for Tapes."
Else
Exit Do
End If
Loop
iResponce = MsgBox("Do You want to continue updating sheet ???", vbYesNo, "Updating sheet with date and location.")
If iResponce = vbYes Then ' They Clicked YES!
Else
objExcel.Application.Quit
If fs.FileExists (progr) Then
fs.DeleteFile progr, True
End If
set fs = Nothing
wscript.quit(1)
End If
Do Until objTextFile.AtEndOfStream
'You should check rather than guessing
intRow = 2 'Row 1 often contains headings
arrStr = Split(objTextFile.ReadLine,vbcrlf)
strText0 = arrStr(0)
' Here is the loop that cycles through the cells
strLogFile.WriteLine strText0 & " Done"
Do Until objExcel.Cells(intRow, 1).Value = ""
sctape = objExcel.Cells(intRow, 2).Value
If InStr(sctape,strText0) Then
objExcel.Cells(intRow, 5) = newdate
objExcel.Cells(intRow, 4) = newlocation
End If
intRow = intRow + 1
Loop
objExcel.ActiveWorkbook.Save
Loop
'Clean Up
objTextFile.Close
set objTextFile = Nothing
'Save, close, and exit.
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
strLogFile.close
If fs.FileExists (progr) Then
fs.DeleteFile progr, True
End If
set fs = Nothing
set arrstr = nothing
wscript.quit
I have following code ...Don't know where is problem. Can anybody guide me ? I am getting error at line 64 and char 5 and code 800A0009
'==========================================================================
'
' VBScript Source File -- Created and maintained
'
'
' COMMENT: version 4.0
'
'==========================================================================
Option Explicit
Dim fs,objTextFile,newdate,newlocation,sctape,iResponce,strLogFile,progr
Dim strText0, arrStr,objExcel,objSpread,intRow,X,exlsheet,objSheet,newnum
Set fs=CreateObject("Scripting.FileSystemObject")
'ForReading=1, you must use values
Set objTextFile = fs.OpenTextFile("list.txt", 1)
' Open the Excel spreadsheet
'
exlsheet = "C:\Documents and Settings\brw-operator\my documents\vb\totaltapes.xls"
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks. Open exlsheet
Set objSheet = objExcel.ActiveWorkbook.WorkSheets(1)
progr = "progressbar.txt"
Set strLogFile = Fs.OpenTextFile("update.log", 8, True)
Do
newdate = inputbox ("New date for these tapes", "Enter New date ")
If newdate = "" Then
Wscript.Echo "You must enter a Date."
Else
Exit Do
End If
Loop
Do
newlocation = inputbox ("New location for these tapes", "Enter New location for these Tapes ")
If newlocation = "" Then
Wscript.Echo "You must enter Newlocation for Tapes."
Else
Exit Do
End If
Loop
iResponce = MsgBox("Do You want to continue updating sheet ???", vbYesNo, "Updating sheet with date and location.")
If iResponce = vbYes Then ' They Clicked YES!
Else
objExcel.Application.Quit
If fs.FileExists (progr) Then
fs.DeleteFile progr, True
End If
set fs = Nothing
wscript.quit(1)
End If
Do Until objTextFile.AtEndOfStream
'You should check rather than guessing
intRow = 2 'Row 1 often contains headings
arrStr = Split(objTextFile.ReadLine,vbcrlf)
strText0 = arrStr(0)
' Here is the loop that cycles through the cells
strLogFile.WriteLine strText0 & " Done"
Do Until objExcel.Cells(intRow, 1).Value = ""
sctape = objExcel.Cells(intRow, 2).Value
If InStr(sctape,strText0) Then
objExcel.Cells(intRow, 5) = newdate
objExcel.Cells(intRow, 4) = newlocation
End If
intRow = intRow + 1
Loop
objExcel.ActiveWorkbook.Save
Loop
'Clean Up
objTextFile.Close
set objTextFile = Nothing
'Save, close, and exit.
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
strLogFile.close
If fs.FileExists (progr) Then
fs.DeleteFile progr, True
End If
set fs = Nothing
set arrstr = nothing
wscript.quit