baker94
-
Total Posts
:
2
- Scores: 0
-
Reward points
:
0
- Joined: 1/11/2012
-
Status: offline
|
Open text file and create a new text file
Wednesday, January 11, 2012 1:45 AM
( permalink)
Hi everyone... okay, I have a text file (version.txt) with a single number (ie 704). I need to open the text file, read the number then create a new text file using that number (704.txt). I've taken bits of code from different post, but haven't got it to work yet. Thanks, Kevin
|
|
|
|
ebgreen
-
Total Posts
:
8227
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Open text file and create a new text file
Wednesday, January 11, 2012 6:09 AM
( permalink)
The first step is to post what you have so far so we can help you sort it out.
|
|
|
|
nakra
-
Total Posts
:
10
- Scores: 0
-
Reward points
:
0
- Joined: 3/16/2011
-
Status: offline
|
Re:Open text file and create a new text file
Wednesday, January 11, 2012 6:56 AM
( permalink)
If both the version.txt file and the new file are local on your computer you can use the Scripting.FileSystemObject object, it's simple to work with. Maybe this script will help you. Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("version.txt")
' Read the number
sLine = objFile.ReadLine
objFile.Close
' Create the requested file
objFSO.CreateTextFile(sLine & ".txt") The script assumes that you run it in the same directory where your version.txt file is located, creating the new file in the same directory too. If the file is located somewhere else on your local computer, you need to specify the path to it.
|
|
|
|
baker94
-
Total Posts
:
2
- Scores: 0
-
Reward points
:
0
- Joined: 1/11/2012
-
Status: offline
|
Re:Open text file and create a new text file
Thursday, January 12, 2012 12:54 AM
( permalink)
nakra - worked perfect! Thanks for the help...
|
|
|
|