If you are calling a simple subroutine, or a function that has no return value, you omitted the CALL keyword before the function/sub call, or added parentheses. For example, the following code:
<% set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile("c:\test.txt", "c:\test.bak") set fso = nothing %> |
Produces the following error:
Error Type: Microsoft VBScript compilation (0x800A0414) Cannot use parentheses when calling a Sub /<file>.asp, line <line>, column <column> fso.CopyFile("c:\test.txt", "c:\test.bak") -----------------------------------------^ |
The solution, according to MSDN:
- Remove the parentheses from the subroutine invocation.
- Use the Call statement to invoke the subroutine instead.
So, you would re-write the above code as follows:
<% set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile "c:\test.txt", "c:\test.bak" set fso = nothing %> |
or
<% set fso = CreateObject("Scripting.FileSystemObject") CALL fso.CopyFile("c:\test.txt", "c:\test.bak") set fso = nothing %> |