hi I am a newbie in vbscript i am stuck badly in coding of n if statement please need your help
Dim chkFl20
chkFl20 = 0
Dim cnt20
Dim mark20
cnt20 = objWorkbook.Worksheets.Count
mark20 = 1
Do While mark20 <= cnt20
If objworkbook.Worksheets(mark20).Name = "GSM Nbr Cell" and objworkbook.Worksheets(mark20).Name = "UTRAN-GSM Relation" Then
chkFl20 = 1
exit do
end if
mark20=mark20+1
Loop
if chkFl20 = 0 then
objtxtStream.Writeline "Scripts for Relations cannot be generated- Missing GSM Nbr Cell or UTRAN-GSM Relation Tab"
else
.....
In this I want the else statement to be executed only if i can the tabs GSM Nbr Cell and utran relations is found... but somehow this is not excuted..
also
<PACKAGE>
<JOB ID=Submit_Reminder>
<SCRIPT LANGUAGE="VBScript" SRC="c:\test\clearquest.bas"/>
<SCRIPT >
dim flag_rnc, objSheet, rxfl
dim flag_rxi, strRNC , strMarket, strRegion, strMarketPhase, strRXI, final_ch
sy = 0
final_ch = 0
rxfl = 0
'--------------------------------------------------------------------------------------------
Set objFSO = createobject("scripting.filesystemobject")
Set objtxtStream = objFSO.CreateTextFile("c:\test\log.txt", True)
'--------------------------------------------------------------------------------------------
Set WSHShell = WScript.CreateObject("WScript.Shell")
' We are ready to use the InputBox-function
' InputBox (prompt, title, default, xpos, ypos)
' prompt: the text shown in the input box
' title: the title shown in the input box
' default: the value shown as default in the input field
' xpos/xpos: upper left corner of the input box
' if some values are omitted, WSH uses default values
filnam = InputBox("Enter the Input file name","File Check","File name", 100, 100)
pathnm = "c:\test\"&filnam&".xls"
'dim fs
Set fs = CreateObject("scripting.filesystemobject")
if not fs.fileexists(pathnm) then
Wscript.echo "File doesn't exist - Check file name!!"
Wscript.Quit
end if
'end if
' end if 'end of successful session
'--------------------------------------------------------------------------------------------
' Bind to Excel object.
On Error Resume Next
Set objExcel = CreateObject("Excel.Application")
If (Err.Number <> 0) Then
On Error GoTo 0
Wscript.Echo "Excel application not found."
Wscript.Quit
End If
On Error GoTo 0
strExcelPath = "c:\test\"&filnam&".xls"
' Open specified spreadsheet and select the first worksheet.
objExcel.WorkBooks.Open strExcelPath
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("c:\test\"&filnam&".xls")
This basically opens up a box whch ask to enter the name of the file but i want a browse option so that i can browse what changes do i make in the code..
your help is appreciated
Dim chkFl20
chkFl20 = 0
Dim cnt20
Dim mark20
cnt20 = objWorkbook.Worksheets.Count
mark20 = 1
Do While mark20 <= cnt20
If objworkbook.Worksheets(mark20).Name = "GSM Nbr Cell" and objworkbook.Worksheets(mark20).Name = "UTRAN-GSM Relation" Then
chkFl20 = 1
exit do
end if
mark20=mark20+1
Loop
if chkFl20 = 0 then
objtxtStream.Writeline "Scripts for Relations cannot be generated- Missing GSM Nbr Cell or UTRAN-GSM Relation Tab"
else
.....
In this I want the else statement to be executed only if i can the tabs GSM Nbr Cell and utran relations is found... but somehow this is not excuted..
also
<PACKAGE>
<JOB ID=Submit_Reminder>
<SCRIPT LANGUAGE="VBScript" SRC="c:\test\clearquest.bas"/>
<SCRIPT >
dim flag_rnc, objSheet, rxfl
dim flag_rxi, strRNC , strMarket, strRegion, strMarketPhase, strRXI, final_ch
sy = 0
final_ch = 0
rxfl = 0
'--------------------------------------------------------------------------------------------
Set objFSO = createobject("scripting.filesystemobject")
Set objtxtStream = objFSO.CreateTextFile("c:\test\log.txt", True)
'--------------------------------------------------------------------------------------------
Set WSHShell = WScript.CreateObject("WScript.Shell")
' We are ready to use the InputBox-function
' InputBox (prompt, title, default, xpos, ypos)
' prompt: the text shown in the input box
' title: the title shown in the input box
' default: the value shown as default in the input field
' xpos/xpos: upper left corner of the input box
' if some values are omitted, WSH uses default values
filnam = InputBox("Enter the Input file name","File Check","File name", 100, 100)
pathnm = "c:\test\"&filnam&".xls"
'dim fs
Set fs = CreateObject("scripting.filesystemobject")
if not fs.fileexists(pathnm) then
Wscript.echo "File doesn't exist - Check file name!!"
Wscript.Quit
end if
'end if
' end if 'end of successful session
'--------------------------------------------------------------------------------------------
' Bind to Excel object.
On Error Resume Next
Set objExcel = CreateObject("Excel.Application")
If (Err.Number <> 0) Then
On Error GoTo 0
Wscript.Echo "Excel application not found."
Wscript.Quit
End If
On Error GoTo 0
strExcelPath = "c:\test\"&filnam&".xls"
' Open specified spreadsheet and select the first worksheet.
objExcel.WorkBooks.Open strExcelPath
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("c:\test\"&filnam&".xls")
This basically opens up a box whch ask to enter the name of the file but i want a browse option so that i can browse what changes do i make in the code..
your help is appreciated