Hi,
as some of you will already know, I don't have much knowledge with VBScript....
I am in need of a script that will take a file, open it and on the top line of that file, add the name of the file to it. For instance...
The name of the file is "DTF0001.txt" and the file might contain...
Guys,
thank-you VERY much! I'm not in the office at the moment, but I'll have a go when I get in tonight and will report back the results.
Once again you've saved my life!
I keep on & on asking my boss to send me on some courses to learn VB but the answer? Always the same, "We'll look at...
HI all,
I'm back pleading with you guys for some more help! Regular visitors will know I'm completely dumb s'far as VB goes :(
I need to be able to delete a line of text in a file that contains the word "projected". It can appear anywhere on the line.
I have been looking at this script...
PHV,
thank-you! That is doing *exactly* what I want it to do :-) One question - how can I make it work so that it opens every file in a specified directory? I usually have 9 files that I need to do and would like to be able to get the script to open each one in turn (and order) rather than...
Hi,
some of you may have seen my name pop up occasionally. For those that have, "Hi"! For those that haven't, "Hi, you'll soon realise I don't know the slightest thing about VB :-(".
I have a requirement at work to "edit" a text file and delete some lines of...
I have a need to work out "yesterdays" Julian date and then write that out to a file. Does anyone know how this could be achieved? At first I was thinking of just having a file that had the number incremented by 1 every day. Of course this wouldn't work due the need to reset it on...
In the meanwhile, I spoke to a friend who suggested:
if acontents(ubound(acontents)) = "" then
redim preserve acontents(ubound(acontents) - 1)
end if
and that seems to work ok - only that's working on any empty lines within the data I think?
Will try your solution ;-)
Thanks once again for the quick reply!
It still appears to be doing the same thing...Here's the script in full:
const sPath = "c:\testarena" 'some path you specify
const ForReading = 1, ForWriting = 2, ForAppending = 8
set fso=createobject("scripting.filesystemobject")
on...
Eek! One more thing...It's working great except for one thing - it's adding one number too many - for instance, if I have a 5 line file, it's putting a 6 at the top of the file. If it's a 1 line file, it's putting a 2 and so on..
I don't know if it's reading an extra CRLF or something in the...
Thanks again for that, really making progress!
I just tried running that script and I received (my first!) error message:
Script: c:\linecount.vbs
Line: 13
Char: 1
Error: Object required: 'sfolder'
Code: 800A01A8
Source: Microsoft VBScript runtime error
?
Sorry for all the questions...
Hi again!
Just realised that the above code always opens the same file - "abc_def.txt"..How do I make it so that it will open any file it sees in a particular directory? I will have somewhere in the region of 100-200 files that I will need to run this script against and will have no...
tsuji,
that works fantastically well! (Not that I ever doubted you!).
That is extremely helpful and I'll be using it a lot!
Many thanks...
I am <so> glad I've found you guys!
Hi,
I've just found this page as it's exactly what I need...Well, almost!
Is there a way of modifying the code to read in several files and also, create several output files?
I have a directory that will contain several files, but the filenames are uniquely created and I have no way of...
Yep, have checked as you said and right at the very top, I have:
Option Compare Database
Option Explicit
Dim Records As DAO.Recordset
Dim Totalrecords
and then the line.
Where would I find the "Order By" option? I go to design view, right click on my form, select Properties and...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.