Object required for (Wscript.sleep 15000)

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

benazir

Hi,



We run the following macro in EXCEL in order to perform OS Backup, but
we got the errors like:


For Example:
When we run the following macro in Excel, we got errors like:

1. Object required for (Wscript.sleep 15000)
2. Object required for (Wscript.Echo "Not in Archivelog Mode!
Hot Backups not
possible! Aborting!")
3. File Not found (strArchive = "arcchk.txt) (Set objArchive =
objFS.OpenTextFile(strArchive, 1, 0)



I think we have to define some variables in order to run that macro
successfully.
Could someone please suggest about my problem?
Below we found the code.


Regards

Benazir






CODE:


Sub ArchivelogChk

'This module checks you are in archivelog mode, and aborts the entire
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) &"set
feedback off" & chr(10) & "set echo off" & chr(10) & "spool
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/manager @archive.sql"

Wscript.sleep 15000

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

While Not objArchive.AtEndOfStream
strInput=objArchive.ReadLine
if strInput="" then
else
If strInput<>"ARCHIVELOG" Then
title = "Fatal Error!"
Wscript.Echo "Not in Archivelog Mode! Hot Backups not possible!
Aborting!"
set objFile=Nothing
set objOutFile=Nothing
set objArchive=Nothing
set objFS=CreateObject("Scripting.FileSystemObject")
objFS.DeleteFile "arcchk.txt"
objFS.DeleteFile "archive.sql"
Wscript.Quit 1
End If
End If
wend

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

End Sub
 
The first two seem to be because you don't define what WScript is. I assume
it is the scripting host, which you call WshShell earlier.

The third seems to be a simple file not found.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi!

Is there also something missing in this bit?

if strInput="" then
else

Al
 
Not necessarily, it might just be a poor way of saying

If strInput <> "" Then

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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