Solved

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

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now