Vbscript 调用子vb时不能使用括号
首先,我已经在网站上看到了类似的问题,但没有发现我的方法的错误 我也是vb新手,所以这也没用 请帮助一个真正的新手 谢谢Vbscript 调用子vb时不能使用括号,vbscript,parentheses,Vbscript,Parentheses,首先,我已经在网站上看到了类似的问题,但没有发现我的方法的错误 我也是vb新手,所以这也没用 请帮助一个真正的新手 谢谢 dim profileSize dim oFS, oFolder set oFS = WScript.CreateObject("Scripting.FileSystemObject") Set wshShell = WScript.CreateObject( "WScript.Shell" ) strUserName = wshShell.ExpandEnvironment
dim profileSize
dim oFS, oFolder
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strUserName = wshShell.ExpandEnvironmentStrings( "%USERNAME%" )
set oFolder = oFS.GetFolder("\\burns\Profiles\" + strUserName + ".V2")
ShowFolderDetails oFolder
sub ShowFolderDetails(oF)
dim F
profileSize = of.Size
if profileSize > 1006582400 Then
WriteFileText(profileSize, strUserName)
End If
if profileSize > 2516582400 Then
WriteFileText(profileSize, strUserName)
wscript.echo "Your Windows user profile is too big! Please contact the IT Office"
WScript.Quit
End if
for each F in oF.Subfolders
'ShowFolderDetails(F)
next
end sub
sub WriteFileText(sText, userID)
Dim objFSO 'As FileSystemObject
Dim objTextFile 'As Object
strLogFilePath = "\\burns\Profiles\size_log.txt"
strTime = FormatDateTime(Date(), 0)
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strLogFilePath, ForAppending, True)
' Write a line.
objTextFile.WriteLine (strTime + "," + userID + "," + sText )
objTextFile.Close
'objTextFile.Close
End Sub
调用Sub时,错误消息不能使用括号表示调用Sub时不能使用括号;- 在VBA中,如果出现以下情况,则函数调用使用括号: 函数调用具有对返回值的赋值。 您有一个参数列表,并使用“call”关键字。 所以你应该可以这样称呼你的下属:
WriteFileText x,y
或者,如果您坚持使用括号:
call WriteFileText (x, y)
你的问题是什么?你哪里有问题?错误是什么?你会期待什么?你试过什么?关于更多细节,你看了吗。