How to Pause the code during running?

  • Thread starter Thread starter benazir
  • Start date Start date
B

benazir

Hi Everyone,

In Windows scripting we can pause the code during running.
For Example: We can use the following piece of code in window
scripting, which can pause the code during running:

Wscript.sleep 15000

Like in Windows Scripting, How should we pause the code during runnin
in VB Scripting.
Following code I am using in order to perform some operation vi
Excel.
Could someone please inform me what piece of code I add in order t
pause the code for 10 seconds in VBS scripting?
Your suggestion will be appreciated.

Regards

Benazir





Code




Sub ArchivelogChk

'This module checks you are in archivelog mode, and aborts the entir
thing
'if not. No point in trying to perform a hot backup unless you are.

strFileOut="archive.sql"
strBp="set trimspool on" & chr(10) & "set heading off" & chr(10) &"se
feedback off" & chr(10) & "set echo off" & chr(10) & "spoo
arcchk.txt"
set objFS=CreateObject("Scripting.FileSystemObject")
set objOutFile=objFS.OpenTextFile(strFileOut,2,1)
strOutput=strBp & chr(10) & "select log_mode from v$database;"
chr(10) & "spool off" & chr(10) & "exit"
objOutFile.WriteLine strOutput
Set WshShell=CreateObject("WScript.Shell")
WshShell.Run "sqlplus system/dizwell @archive.sql"

strArchive="arcchk.txt"
set objArchive=objFS.OpenTextFile(strArchive,1,0)

While Not objArchive.AtEndOfStream
strInput=objArchive.ReadLine
if strInput="" then
else
If strInput="NOARCHIVELOG" Then
title = "Fatal Error!"
possible! Aborting!"
set objFile=Nothing
set objOutFile=Nothing
set objArchive=Nothing
set objFS=CreateObject("Scripting.FileSystemObject")
objFS.DeleteFile "arcchk.txt"
objFS.DeleteFile "archive.sql"

End If
End If
wend

set objFile=Nothing
set objOutFile=Nothing
set objArchive=Nothing

End Su
 
I stole this from VBA's help:

If Application.Wait(Now + TimeValue("0:00:10")) Then
MsgBox "Time expired"
End If

Check help for a nice explanation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top