Hi,

I'm getting the "Invalid procedure call or argument" error when trying to
write files what appears to be when the file is over a certain size.

I have two versions of the script. One is running in an .asp page and the
other in a .vbs file. It is only breaking when executing via wsh.

Both versions run under Windows 2003 (ie IIS6, WSH v5.6)

Any ideas on why the script breaks when writing files over a certain size in
vbscript? Thanks for any input!

--------------------------------------------------
Snippet of the code in question....

Sub WriteFile(strData, strFileName)
Dim objFileSystem, objText
If Not strFileName = "" Then
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objText = objFileSystem.CreateTextFile(strFileName, True)
objText.Write strData '<--***code breaking here***
objText.Close
Set objText = Nothing
Set objFileSystem = Nothing
End If
End Sub
-----------------------------------------------------

RE: FileSystemObject-Invalid procedure call or arg by JFord

JFord
Fri Jan 28 08:27:05 CST 2005

Approximately how big are the file sizes it would be trying to create? Using
your code I ran this which created a file a little over 2MB without any
problems.

<code>
Dim sStuffing
For i = 1 To 10000
sStuffing = sStuffing &
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" & vbcrlf
Next

WriteFile sStuffing, "filecreated.txt"
</code>

"Rob" wrote:

> Hi,
>
> I'm getting the "Invalid procedure call or argument" error when trying to
> write files what appears to be when the file is over a certain size.
>
> I have two versions of the script. One is running in an .asp page and the
> other in a .vbs file. It is only breaking when executing via wsh.
>
> Both versions run under Windows 2003 (ie IIS6, WSH v5.6)
>
> Any ideas on why the script breaks when writing files over a certain size in
> vbscript? Thanks for any input!
>
> --------------------------------------------------
> Snippet of the code in question....
>
> Sub WriteFile(strData, strFileName)
> Dim objFileSystem, objText
> If Not strFileName = "" Then
> Set objFileSystem = CreateObject("Scripting.FileSystemObject")
> Set objText = objFileSystem.CreateTextFile(strFileName, True)
> objText.Write strData '<--***code breaking here***
> objText.Close
> Set objText = Nothing
> Set objFileSystem = Nothing
> End If
> End Sub
> -----------------------------------------------------
>
>
>

Re: FileSystemObject-Invalid procedure call or arg by Rob

Rob
Fri Jan 28 11:17:00 CST 2005

Hmmm. When running the code via the .vbs file it breaks at about 1.5 Mb. I
can create the same file when the code runs from a web page (.asp) just
fine. In fact I have created files roughly 5Mb in size no problem from .asp.
Any thoughts?


"J Ford" <JFord@discussions.microsoft.com> wrote in message
news:A343594D-802D-4CEC-AB7B-AD599A537194@microsoft.com...
> Approximately how big are the file sizes it would be trying to create?
Using
> your code I ran this which created a file a little over 2MB without any
> problems.
>
> <code>
> Dim sStuffing
> For i = 1 To 10000
> sStuffing = sStuffing &
>
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" & vbcrlf
> Next
>
> WriteFile sStuffing, "filecreated.txt"
> </code>
>
> "Rob" wrote:
>
> > Hi,
> >
> > I'm getting the "Invalid procedure call or argument" error when trying
to
> > write files what appears to be when the file is over a certain size.
> >
> > I have two versions of the script. One is running in an .asp page and
the
> > other in a .vbs file. It is only breaking when executing via wsh.
> >
> > Both versions run under Windows 2003 (ie IIS6, WSH v5.6)
> >
> > Any ideas on why the script breaks when writing files over a certain
size in
> > vbscript? Thanks for any input!
> >
> > --------------------------------------------------
> > Snippet of the code in question....
> >
> > Sub WriteFile(strData, strFileName)
> > Dim objFileSystem, objText
> > If Not strFileName = "" Then
> > Set objFileSystem = CreateObject("Scripting.FileSystemObject")
> > Set objText = objFileSystem.CreateTextFile(strFileName, True)
> > objText.Write strData '<--***code breaking here***
> > objText.Close
> > Set objText = Nothing
> > Set objFileSystem = Nothing
> > End If
> > End Sub
> > -----------------------------------------------------
> >
> >
> >