Solved

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

Posted on 2007-03-29
5
803 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
  • 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

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…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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