Solved

Type mismatch for array variable in vbs when using split to define it

Posted on 2007-03-29
5
808 Views
Last Modified: 2012-05-05
I keep getting a type mismatch error with this script for the array variable (websitearray) I'm trying to create from splitting the long text string:

OPTION EXPLICIT
dim websites
dim websitearray
Dim i
Dim domain

websites = "adamphotogallery.com addisongeary.com ambermckenzie.com amyherr.com amysphotographix.com annelizabethschlegel.com apiphotography.com arondaphotography.com ashoksinha.com avianstock.com bernicesnyder.com bigblackbag.com bigblackbag.net bigskylivingstonweddings.com bonvivantcinema.com breshearsphoto.com carolbethicard.com carolyncarr.com chrishiers.com colortecllc.com danbenner.com dancrawford.com dandelouise.com danielmartinezphoto.com daunesheriartstudio.com deanimages.com dennis-sagwitz.com dewdropphotography.com dickmanportfolio.com dillingerkovach.com dm7studios.com dmooreartist.com doughopfer.com drewcallaghanphotography.com eajphoto.com ellenrosenthal.com encamera.com figmentsphotography.com figmentsphotography.com.au fireflyfoto.net fleischmanphoto.com foxreps.com freedomphotos.net fusionphotography.biz gabrielvaningen.com griffithphotography.com growth2.net hollyhodson.com inspiredfirstbrand.com ion-photography.com jadepegler.net jamesejohnson.com janetbartlettgoodman.com janetlynnphotography.com jeffseltzerphotography.com jenmayphotography.com johnjonasweb.com jonathanbroadbent.com julianhaber.com katarinablazevic.com katemccoy.net kaythorogoodphotography.com kemperimagery.com kenkwok.com kgfineart.com kortduce.com lasalaphotos.com laurajohansen.com liakassart.com lostcoaststudio.com louisanastas.com lyndontravers.com marcialeeder.com marginadennis.com markandreani-fashion-photography.com markandreani.com marksandersonphoto.net martyjonas.com mcdonald-media.com mdmphotostudio.com midjo-pasto-gallery.com mikebullimages.com misha-mccrary.com mwestermeier.com nathansmithphoto.com nbimages.net nicolebrunsonphotography.com nitawinterandrobbadgerphotography.com oshun-jewelry.com pamlottphotoillustration.com patricklinehan.com photographertoronto.ca photosbywally.com pixlitter.com polecatmedia.com powerlunchproduction.com prismaproductions.com raeoflightphotography.com rboephoto.com robinsoneditions.com robkarosis.com robpena.com ronaldserfassartist.com rose-photography.com rossstockwellphotography.com rpughphoto.com samanthabender.com samdamico.com sealpointdesigns.com shellycastellano.com shrimptoncouture.com shrimptoncouture2.com simonrickerty.com simonryder.co.uk sl4design.com sofiaharrison.com spotstok.org steffanhacker.com stellarfilms.net stevenstills.com steveryanart.com stevetruongphotography.com tamarakay.com theartofthecurve.com thedalyblog.com thereseflanagan.com thestudioofphotography.com thomasbollinger.com thomaskosaphotography.com tpquigley.com tsirrell.com upstairsartspace.org venividiphoto.com wooddellstudio.com worksonpaper.biz yellowstonephotos.net yes.on.ca yourdreamimages.com"


websitearray = split(websites," ")

For i = 0 to ubound(websitearrray)
changethedns(websitearray(i))
Next

SUB changethedns ( domain )
WScript.Echo domain
END SUB

I have tried declaring like so:
dim websitearray()

but this fails as well.

Can you tell me why?
0
Comment
Question by:juliandormon
[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
5 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
ID: 18817060
Hi Julian,

The split works well by itself, it could be because there is an extra 'r' in 'websitearray' in the line:
For i = 0 to ubound(websitearrray)

Changing that gets your above code to work fine. I'm not sure if it was a typo while posting, if so then I'm guessing your actual changethedns sub could be different than just a wscript.echo

Matt
0
 

Author Comment

by:juliandormon
ID: 18817122
Doh! damn typos. Thanks a lot
0
 
LVL 35

Expert Comment

by:mvidas
ID: 18817133
I do it all the time :)
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

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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