Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

loading external multdimensional array from a .txt file

Posted on 2009-05-03
2
Medium Priority
?
370 Views
Last Modified: 2012-05-06
how can i display arrays in vbscript from an external txt file (.txt)
assuming the data on the txt file looks like this

houseno streetname surburb
23 James westside
1 street somewhere
0
Comment
Question by:vbsnoob
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
TakedaT earned 1000 total points
ID: 24293062
Something like this?

I always hated working with dynamic multidimensional arrays.  Not being able to redim the first dimension just makes it annoying.  I usually just go with 2 one dimensional arrays.
Const forReading = 1, forWriting = 2, forAppending = 8
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim arrAddresses()
strAddressFile = "address.txt"
 
Set readAddressFile = objFSO.OpenTextFile(strAddressFile,forReading)
 
i=0
Do while not readAddressFile.AtEndOfStream
	strLine = readAddressFile.ReadLine
	arrLine = split(strLine," ")
	ReDim preserve arrAddresses(2,i)
	arrAddresses(0,i) = arrLine(0)
	arrAddresses(1,i) = arrLine(1)
	arrAddresses(2,i) = arrLine(2)
	strAddresses = strAddresses & vbCrLf & arrAddresses(0,i) & vbTab & arrAddresses(1,i) & vbTab & arrAddresses(2,i)
	i=i+1
Loop
 
MsgBox strAddresses

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question