Stop statement???
Posted: Sat Apr 14, 2012 11:26 pm
Hello folks, again How can I stop script from executing further code after STOP statement?For example I have wrote this code:Dim oFSO, iStart, iKraj, strMjesec, strProvjera, strPrethodniMjesec, objFolderstrMjesec = Month (Now) 'Dohavti tekuci mjeseciStart = 1 'Pocetna vrijednost brojacastrPrethodniMjesec = strMjesec - 1 'Sluzi za stvaranje foldera arhive'iKraj 'Zavrsna vrijednost brojacaiProvjera = 30 'Provjera kojeg dana se skripta izvodi! Ako se skripta pokrenula 30. ili 31. znaci da se izvodi u tekucem mj.(ako nije prijestupna god.) i u tom sulcaju izvodjenje se treba prekinuti inace Folder u kojem se sprema arhiva nece biti imenovan pravilno!If iProvjera = 30 Then Stop _End IfIf strMjesec = 4 Then iKraj = 30 _ _ else if strMjesec = 5 Then iKraj = 31 _ else if strMjesec = 6 Then iKraj = 30 _ else if strMjesec = 7 Then iKraj = 31 _ else if strMjesec = 8 Then iKraj = 31 _ else if strMjesec = 9 Then iKraj = 30 _ else if strMjesec = 10 Then iKraj = 31 _ else if strMjesec = 11 Then iKraj = 30 _ else if strMjesec = 12 Then iKraj = 31 __else Wscript.Echo "Nisam uspio saznati u kojem sam mjesecu!"Set oFSO = CreateObject ("Scripting.FileSystemObject")'Folder u kojem ce se spremiti arhiva iz prethodnog mjesecaoFSO.CreateFolder "C:Documents and SettingsTestDesktop" & strPrethodniMjesec & "." & "Mjesec" 'Dohvati folder u koji ce se spremiti arhivaSet objFolder = oFSO.GetFolder ("C:Documents and SettingsTestDesktop" & strPrethodniMjesec & "." & "Mjesec") 'Backup prethodnog mjesecaoFSO.MoveFile "C:Documents and SettingsTestDesktopNew Folder*.*", objFolder 'Popuni folder s praznim tablicama za tekuci mjesecDo while iStart <= iKrajoFSO.CopyFile "D:dokumentiExample1-Empty1.xlsx", "C:Documents and SettingsKasaDesktop" & _"New Folder" & iStart & "." & strMjesec & ".xlsx", FalseiStart = iStart + 1If iStart > iKraj Then _Exit Do _End ifLoopShouldn't script stop after "If iProvjera = 30 Then Stop _
End If" and all the code bellow shouldn't be executed?? If I'm wrong (and obviously I am) how can I stop script if above statement is true?
End If" and all the code bellow shouldn't be executed?? If I'm wrong (and obviously I am) how can I stop script if above statement is true?