Opening File for Write 
Author Message
 Opening File for Write

How does one open an existing text file for append with VBScript? The
program does not let me do the following

set txtstrm = fso.OpentextFile(ForAppend)

It doe not like the parameter but this works in VB
Any thoughts.



Mon, 14 Nov 2005 04:44:57 GMT  
 Opening File for Write
On Wed, 28 May 2003 15:44:57 -0500, Mike Marrero
Quote:

>How does one open an existing text file for append with VBscript? The
>program does not let me do the following

>set txtstrm = fso.OpentextFile(FileName, ForAppend)

>It doe not like the parameter but this works in VB
>Any thoughts.



Mon, 14 Nov 2005 04:47:50 GMT  
 Opening File for Write
Did you define "ForAppend" anywhere?

Ray at work


Quote:
> How does one open an existing text file for append with VBscript? The
> program does not let me do the following

> set txtstrm = fso.OpentextFile(ForAppend)

> It doe not like the parameter but this works in VB
> Any thoughts.



Mon, 14 Nov 2005 04:54:26 GMT  
 Opening File for Write
ForAppend is a predefined member of scripting.IOMode

On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

Quote:

>Did you define "ForAppend" anywhere?

>Ray at work



>> How does one open an existing text file for append with VBscript? The
>> program does not let me do the following

>> set txtstrm = fso.OpentextFile(ForAppend)

>> It doe not like the parameter but this works in VB
>> Any thoughts.



Mon, 14 Nov 2005 05:46:59 GMT  
 Opening File for Write
Humor me please and add "Option Explicit" to the top of your script.  Then
change "ForAppend" to "ForAppending" and try it again.  And then after that,
add "Const ForAppending = 8" to your script and try it.

Ray at home


Quote:
> ForAppend is a predefined member of scripting.IOMode

> On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

> >Did you define "ForAppend" anywhere?

> >Ray at work



> >> How does one open an existing text file for append with VBscript? The
> >> program does not let me do the following

> >> set txtstrm = fso.OpentextFile(ForAppend)

> >> It doe not like the parameter but this works in VB
> >> Any thoughts.



Mon, 14 Nov 2005 07:55:06 GMT  
 Opening File for Write

That worked. What did I do wrong? Here is the original line that
errored out

Set ExceptStrm =
fso.OpenTextFile("c:\extracts\destination\Exception.dat",
ForAppending)

This is the line that worked

Set ExceptStrm =
fso.OpenTextFile("c:\extracts\destination\Exception.dat", 8)

On Wed, 28 May 2003 19:55:06 -0400, "Ray at <%=sLocation%>"

Quote:

>Humor me please and add "Option Explicit" to the top of your script.  Then
>change "ForAppend" to "ForAppending" and try it again.  And then after that,
>add "Const ForAppending = 8" to your script and try it.

>Ray at home



>> ForAppend is a predefined member of scripting.IOMode

>> On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

>> >Did you define "ForAppend" anywhere?

>> >Ray at work



>> >> How does one open an existing text file for append with VBscript? The
>> >> program does not let me do the following

>> >> set txtstrm = fso.OpentextFile(ForAppend)

>> >> It doe not like the parameter but this works in VB
>> >> Any thoughts.



Mon, 14 Nov 2005 09:14:10 GMT  
 Opening File for Write
ForAppending is not a known constant.

Ray at work


Quote:

> That worked. What did I do wrong? Here is the original line that
> errored out

> Set ExceptStrm =
> fso.OpenTextFile("c:\extracts\destination\Exception.dat",
> ForAppending)

> This is the line that worked

> Set ExceptStrm =
> fso.OpenTextFile("c:\extracts\destination\Exception.dat", 8)

> On Wed, 28 May 2003 19:55:06 -0400, "Ray at <%=sLocation%>"

> >Humor me please and add "Option Explicit" to the top of your script.
Then
> >change "ForAppend" to "ForAppending" and try it again.  And then after
that,
> >add "Const ForAppending = 8" to your script and try it.

> >Ray at home



> >> ForAppend is a predefined member of scripting.IOMode

> >> On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

> >> >Did you define "ForAppend" anywhere?

> >> >Ray at work



> >> >> How does one open an existing text file for append with VBscript?
The
> >> >> program does not let me do the following

> >> >> set txtstrm = fso.OpentextFile(ForAppend)

> >> >> It doe not like the parameter but this works in VB
> >> >> Any thoughts.



Mon, 14 Nov 2005 23:00:24 GMT  
 Opening File for Write
Why is the constant known in VB6 and not VBScript? Don't they use the
same object Model? Is there some subtle difference between using
variant data types in VBScript variables and early binding type
variables for VB6?
Thanks for all the help. It would have taken me a long time to find
this because it worked fine in VB6. Hope I can be of help to you
sometime.

On Thu, 29 May 2003 11:00:24 -0400, "Ray at <%=sLocation%>"

Quote:

>ForAppending is not a known constant.

>Ray at work



>> That worked. What did I do wrong? Here is the original line that
>> errored out

>> Set ExceptStrm =
>> fso.OpenTextFile("c:\extracts\destination\Exception.dat",
>> ForAppending)

>> This is the line that worked

>> Set ExceptStrm =
>> fso.OpenTextFile("c:\extracts\destination\Exception.dat", 8)

>> On Wed, 28 May 2003 19:55:06 -0400, "Ray at <%=sLocation%>"

>> >Humor me please and add "Option Explicit" to the top of your script.
>Then
>> >change "ForAppend" to "ForAppending" and try it again.  And then after
>that,
>> >add "Const ForAppending = 8" to your script and try it.

>> >Ray at home



>> >> ForAppend is a predefined member of scripting.IOMode

>> >> On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

>> >> >Did you define "ForAppend" anywhere?

>> >> >Ray at work



>> >> >> How does one open an existing text file for append with VBscript?
>The
>> >> >> program does not let me do the following

>> >> >> set txtstrm = fso.OpentextFile(ForAppend)

>> >> >> It doe not like the parameter but this works in VB
>> >> >> Any thoughts.



Tue, 15 Nov 2005 02:21:28 GMT  
 Opening File for Write
Well, I don't think VB knows that constant either until you reference the
WSH model.  You'd think that VB Script wouldn't know any constants or
something, but it knows things like vbCrLf.  So, I don't really know...

Ray at work


Quote:
> Why is the constant known in VB6 and not VBScript? Don't they use the
> same object Model? Is there some subtle difference between using
> variant data types in VBScript variables and early binding type
> variables for VB6?
> Thanks for all the help. It would have taken me a long time to find
> this because it worked fine in VB6. Hope I can be of help to you
> sometime.

> On Thu, 29 May 2003 11:00:24 -0400, "Ray at <%=sLocation%>"

> >ForAppending is not a known constant.

> >Ray at work



> >> That worked. What did I do wrong? Here is the original line that
> >> errored out

> >> Set ExceptStrm =
> >> fso.OpenTextFile("c:\extracts\destination\Exception.dat",
> >> ForAppending)

> >> This is the line that worked

> >> Set ExceptStrm =
> >> fso.OpenTextFile("c:\extracts\destination\Exception.dat", 8)

> >> On Wed, 28 May 2003 19:55:06 -0400, "Ray at <%=sLocation%>"

> >> >Humor me please and add "Option Explicit" to the top of your script.
> >Then
> >> >change "ForAppend" to "ForAppending" and try it again.  And then after
> >that,
> >> >add "Const ForAppending = 8" to your script and try it.

> >> >Ray at home



> >> >> ForAppend is a predefined member of scripting.IOMode

> >> >> On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

> >> >> >Did you define "ForAppend" anywhere?

> >> >> >Ray at work



> >> >> >> How does one open an existing text file for append with VBscript?
> >The
> >> >> >> program does not let me do the following

> >> >> >> set txtstrm = fso.OpentextFile(ForAppend)

> >> >> >> It doe not like the parameter but this works in VB
> >> >> >> Any thoughts.



Tue, 15 Nov 2005 02:43:36 GMT  
 Opening File for Write
Hello Mike,

I'm working with that stuff too, and it works.
But 1 thing that I'm not sure is when I ran the code, the file created but
the page display permission denied.
I had set the permission to "write", so what am I do wrong ?

Ness



Quote:
> Well, I don't think VB knows that constant either until you reference the
> WSH model.  You'd think that VB Script wouldn't know any constants or
> something, but it knows things like vbCrLf.  So, I don't really know...

> Ray at work



> > Why is the constant known in VB6 and not VBScript? Don't they use the
> > same object Model? Is there some subtle difference between using
> > variant data types in VBScript variables and early binding type
> > variables for VB6?
> > Thanks for all the help. It would have taken me a long time to find
> > this because it worked fine in VB6. Hope I can be of help to you
> > sometime.

> > On Thu, 29 May 2003 11:00:24 -0400, "Ray at <%=sLocation%>"

> > >ForAppending is not a known constant.

> > >Ray at work



> > >> That worked. What did I do wrong? Here is the original line that
> > >> errored out

> > >> Set ExceptStrm =
> > >> fso.OpenTextFile("c:\extracts\destination\Exception.dat",
> > >> ForAppending)

> > >> This is the line that worked

> > >> Set ExceptStrm =
> > >> fso.OpenTextFile("c:\extracts\destination\Exception.dat", 8)

> > >> On Wed, 28 May 2003 19:55:06 -0400, "Ray at <%=sLocation%>"

> > >> >Humor me please and add "Option Explicit" to the top of your script.
> > >Then
> > >> >change "ForAppend" to "ForAppending" and try it again.  And then
after
> > >that,
> > >> >add "Const ForAppending = 8" to your script and try it.

> > >> >Ray at home



> > >> >> ForAppend is a predefined member of scripting.IOMode

> > >> >> On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

> > >> >> >Did you define "ForAppend" anywhere?

> > >> >> >Ray at work



> > >> >> >> How does one open an existing text file for append with
VBscript?
> > >The
> > >> >> >> program does not let me do the following

> > >> >> >> set txtstrm = fso.OpentextFile(ForAppend)

> > >> >> >> It doe not like the parameter but this works in VB
> > >> >> >> Any thoughts.



Sun, 25 Dec 2005 03:00:52 GMT  
 Opening File for Write
You set the permissions to "write" for what user?  IUSR? Is this in ASP or
just a .vbs file?  And what about modify permissions for the directory to
create a file?

Ray at home


Quote:
> Hello Mike,

> I'm working with that stuff too, and it works.
> But 1 thing that I'm not sure is when I ran the code, the file created but
> the page display permission denied.
> I had set the permission to "write", so what am I do wrong ?

> Ness



> > Well, I don't think VB knows that constant either until you reference
the
> > WSH model.  You'd think that VB Script wouldn't know any constants or
> > something, but it knows things like vbCrLf.  So, I don't really know...

> > Ray at work



> > > Why is the constant known in VB6 and not VBScript? Don't they use the
> > > same object Model? Is there some subtle difference between using
> > > variant data types in VBScript variables and early binding type
> > > variables for VB6?
> > > Thanks for all the help. It would have taken me a long time to find
> > > this because it worked fine in VB6. Hope I can be of help to you
> > > sometime.

> > > On Thu, 29 May 2003 11:00:24 -0400, "Ray at <%=sLocation%>"

> > > >ForAppending is not a known constant.

> > > >Ray at work



> > > >> That worked. What did I do wrong? Here is the original line that
> > > >> errored out

> > > >> Set ExceptStrm =
> > > >> fso.OpenTextFile("c:\extracts\destination\Exception.dat",
> > > >> ForAppending)

> > > >> This is the line that worked

> > > >> Set ExceptStrm =
> > > >> fso.OpenTextFile("c:\extracts\destination\Exception.dat", 8)

> > > >> On Wed, 28 May 2003 19:55:06 -0400, "Ray at <%=sLocation%>"

> > > >> >Humor me please and add "Option Explicit" to the top of your
script.
> > > >Then
> > > >> >change "ForAppend" to "ForAppending" and try it again.  And then
> after
> > > >that,
> > > >> >add "Const ForAppending = 8" to your script and try it.

> > > >> >Ray at home



> > > >> >> ForAppend is a predefined member of scripting.IOMode

> > > >> >> On Wed, 28 May 2003 16:54:26 -0400, "Ray at <%=sLocation%>"

> > > >> >> >Did you define "ForAppend" anywhere?

> > > >> >> >Ray at work



> > > >> >> >> How does one open an existing text file for append with
> VBscript?
> > > >The
> > > >> >> >> program does not let me do the following

> > > >> >> >> set txtstrm = fso.OpentextFile(ForAppend)

> > > >> >> >> It doe not like the parameter but this works in VB
> > > >> >> >> Any thoughts.



Mon, 26 Dec 2005 12:01:13 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Table is read only with TUpdateSql

2. How to open file for writing?

3. Open a text file, search for place holder, then write data to file

4. Searching in text..

5. Problems with graphics screens?

6. open a binary file for reading/writing

7. Opening a File in Read&Write mode

8. Open a file for binary write

9. Open a file for binary write

10. Open a file for binary write in WSH

11. How to open files for read/write in .aspx

12. Opening / Writing To Files In PDS 7.1

 

 
Powered by phpBB® Forum Software