Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to open a text file through VB scripting.?
#3
Not Solved
Hi Vivek,

Not sure if I understood your query correctly. But let me give it a try. You intend to store the link name in a text file and then parse the text file to get the detail and then use it to identify the link.

If this is what you intend to do, you can try the following piece of code.

'************************************************************************

Code:
Option Explicit

Dim i, fileName, resultArr

Function readLinkName(ByVal fileName)

    Dim resArr(7)

    Dim objFSO, objFile, lineItem, i

    i = 0

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(fileName)

    Do Until objFile.AtEndOfStream
        lineItem = objFile.ReadLine
        resArr(i) = split(lineitem," ")(2)
        i = i +1
    Loop

    readLinkName = resArr

End Function

fileName = "E:\InputFolder\InputFile.txt"

resultArr = readLinkName(fileName)

For i = 0 to UBound(resultArr) - 1
    MsgBox resultArr(i)
Next

'************************************************************************

Let me know if this is what you intended to do and if this works as you expect it to.

The input file is in the following format as you had specified.

unique_id1 Link1 A
unique_id2 Link2 B
unique_id3 Link3 C
unique_id4 Link4 D
unique_id5 Link5 E
unique_id6 Link6 F
unique_id7 Link7 G

Thank You,
Ravi Shankar
Reply


Messages In This Thread
RE: How to open a text file through VB scripting.? - by ravs@788 - 06-22-2012, 01:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Scripting spixol 0 1,507 12-15-2019, 01:14 PM
Last Post: spixol
  VB scripting Aisha2015 0 2,384 08-07-2015, 02:21 PM
Last Post: Aisha2015
  Regarding Shell Scripting demoqtp 2 4,358 03-31-2015, 12:34 AM
Last Post: demoqtp
  How to read a text file using FSO from bottom to up order?? vallalarasu.p 0 2,509 10-13-2014, 11:14 AM
Last Post: vallalarasu.p
  how to create text file swayam 1 2,852 05-29-2014, 01:25 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)