View Single Post
Old 06-17-2009   #1 (permalink)
OldDog


 
 

Trouble with finding a space useing Instr

Hi,

I am trying to use Instr to find the model number of seveal different
types of computers. I am getting and error at strC.


Here is the code:


'Determine the model number of the PC
Set CompSys = objWMIService.ExecQuery("Select * from
Win32_ComputerSystem",,48)
For Each sysItem In CompSys
fmfg = Trim(sysItem.Manufacturer)
fmm = Trim(sysItem.Model)
Wscript.Echo fmm


arrComputers = Array("D420","D430","D620","D630", _
"E4300","E6400","745","755", _
"760","490","690", _
"M4300","M4400","M65","T3400", _
"T5400","T7400","dc7600","dc7700", _
"dc7800","T60","T61")
For Each strA In arrComputers
strB = Instr(1,fmm,strA)
strC = Instr(strB,fmm,(CHr(32))) <---- Error is here
strD = Mid(fmm,strB,strC)


Wscript.Echo strD


And here is the error:


Microsoft VBScript runtime error: Invalid procedure call or argument:
'Instr'


Any help would be appriciated.


My System SpecsSystem Spec