473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Iam getting syntax error when use sub under IF, please assist

Expand|Select|Wrap|Line Numbers
  1. EL_SUCCESS = 0
  2.  
  3. EL_ERROR = 1
  4.  
  5. EL_WARNING = 2
  6.  
  7. EL_INFO = 4
  8.  
  9. EL_AUDIT_SUCCESS = 8
  10.  
  11. EL_AUDIT_FAILURE = 16
  12. Set WshShell = CreateObject("WScript.Shell") 
  13.  
  14. set oFs = WScript.CreateObject("Scripting.FileSystemObject")
  15. set oDrives = oFs.Drives
  16. for each oDrive in oDrives
  17. if odrive.driveletter = "C" then
  18. percent_used_tmp= (oDrive.freeSpace /oDrive.TotalSize)*100
  19. res1=instr(percent_used_tmp,".")
  20. percent_used = Left(percent_used_tmp,res1 + 2)
  21. if percent_used < 100 then
  22. percent_used= 100 - percent_used
  23. end if
  24. if percent_used = 100 then 
  25. MsgBox " Please Check Drive Space."& vbcrlf & _
  26. " "& vbcrlf & _ 
  27. " WARNING!" & vbcrlf & _
  28. " You are out of disk space on the server! " & vbcrlf & _
  29. " You must delete unnecessary files" & vbcrlf & _ 
  30. " You are not able to save files on the server at this time.",48, "You are out of disk space on the server!"
  31.  
  32.  
  33. elseif percent_used > 85 then
  34.  
  35. MsgBox " Please check Drive Space ."& vbcrlf & _
  36. " "& vbcrlf & _
  37. " WARNING!" & vbcrlf & _
  38. " You have utilized " & percent_used & "% of your allocated disk space on the server." & vbcrlf & _
  39. " You are not able to save files on the server at this time.",48, "You are out of disk space on the server!"
  40.  
  41. WriteToEventLog EL_Warning, "successful..."
  42.  
  43. sub WriteToEventLog(sLogEID,strELMessage)
  44.  
  45. objShell.LogEvent sLogEID, strELMessage
  46.  
  47.  
  48.  
  49. elseif percent_used < 85 then
  50. '*msgbox "it works",48, "Reminder"
  51. end if
  52. end if
  53.  
  54. next
Oct 18 '15 #1
2 1136
Im trying to log the message to windows event log, however iam getting syntax error when is inserted below lines in script

Expand|Select|Wrap|Line Numbers
  1. elseif percent_used > 20 then
  2.  
  3. MsgBox " Please check Drive Space ."& vbcrlf & _
  4. " "& vbcrlf & _
  5. " WARNING!" & vbcrlf & _
  6. " You have utilized " & percent_used & "% of your allocated disk space on the server." & vbcrlf & _
  7. " You are not able to save files on the server at this time.",48, "You are out of disk space on the server!"
  8.  
  9. WriteToEventLog EL_Warning, "successful..."
  10.  
  11. sub WriteToEventLog(sLogEID,strELMessage)
  12.  
  13. objShell.LogEvent sLogEID, strELMessage
  14.  
  15. end sub
Oct 18 '15 #2
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

You can't start a sub within another sub. You need to end the other one first.
Oct 18 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: FaYYaZ | last post by:
Hi All I am getting error "Syntax error " when trying to define a class Like Class myClass Public height Public ID Private t_width
3
by: Maciek | last post by:
All, I'm having a problem building a library (VMime) with Visual .NET 2003. It's including, among others, gnutls.h from the GNU TLS library and I'm getting syntax errors in that file. For...
4
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Why am I getting an error when I passed by ref a dataset to a new form? The message reads "cannot convert from 'ref Paimport.unixAccount' to 'ref System.Data.DataSet'. Paimport is the name of the...
0
by: dougancil | last post by:
I have the following code: Imports System.Data.SqlClient Public Class Main Protected WithEvents DataGridView1 As DataGridView Dim instForm2 As New Exceptions Private Sub...
1
by: Omendra | last post by:
I am getting an error When i am going to convert my SP as dynamic Error : Msg 403, Level 16, State 1, Line 21 Invalid operator for data type. Operator equals add, type equals text. Code : ...
1
by: Michael Taylor | last post by:
What is wrong with this sql statement? ORA-06550: line 1, column 9: PLS-00103: Encountered the symbol "01" when expecting one of the following: begin function pragma procedure subtype type current...
6
by: ahakrush | last post by:
hey, i have been writing this code (C++) in the last week, i have many classes in the .h file, but one problem with one class, which is: ___________________________________________________________...
13
Seth Schrock
by: Seth Schrock | last post by:
I am getting an error when trying to cancel my form's BeforeUpdate event. It says: You can't save this record at this time. ACH Manager may have encountered an error while trying to save a...
1
by: mknewnham | last post by:
Hello! New to the PHP/coding world so hoping to get some help :) I created a contact form on Adobe Muse and created a PHP file. I found it on a blog and copied it from there (plus changing...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.