Hi Les, I tried your suggestion but it did not do anything. Here's the whole code I'm working with. I am actually calling the functions but just so you have everything, I put it all here.

Code:

$range=readexcel2('C:\test.xls',,-1,4,1,1)
if @error
"error occured: @serror (@error)"
else
for $counter=1 to ubound($range)
$GroupName = "['+$range[$counter,0]+']"
$ShareName = "['+$range[$counter,1]+']"
$SharePath = "['+$range[$counter,2]+']"
$Comment = "['+$range[$counter,3]+']"
if ingroup("$GroupName")
? "It works"
AddToMyNetworkPlaces('$ShareName','$SharePath','$Comment')
endif
next

Function fnInGroupAD($sGroup,Optional $bComputer)
Dim $objSys,$objTarget,$aMemberOf,$sMemberOf
$objSys = CreateObject("ADSystemInfo")
$objTarget = GetObject("LDAP://"+Iif($bComputer,$objSys.ComputerName,$objSys.UserName))
$aMemberOf = $objTarget.GetEx("memberOf")
For Each $sMemberOf in $aMemberOf
If InStr($sMemberOf,"CN="+$sGroup+",")
$fnInGroupAD = Not 0
Exit
EndIf
Next
$fnInGroupAD = NOT 1
EndFunction

Function AddToMyNetworkPlaces($Name,$Location,Optional $Comment)
Dim $Nethood,$Shell,$S,$D,$T
$AddToMyNetworkPlaces=1
If Exist($Location)
$Nethood=ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','NetHood')
If GetFileAttr($Nethood+'\'+$Name) & 16
; 'Link exists already. Exit the function.
Exit 80
EndIf
MD $Nethood+'\'+$Name
$D=$Nethood+'\'+$Name+'\'+'Desktop.ini'
$T=$Nethood+'\'+$Name+'\'+'target.lnk'
$S = SetFileAttr($Nethood+'\'+$Name,1)
$S = WriteProfileString ($D,'.ShellClassInfo','CLSID2','{0AFACED1-E828-11D1-9187-B532F1E9575D}')
$S = WriteProfileString ($D,'.ShellClassInfo','FLAGS','2')
$S = SetFileAttr($D,6)
$Shell = CreateObject('wscript.shell')
If @ERROR Exit @ERROR EndIf
$S = $Shell.CreateShortcut($T)
$S.TargetPath = $Location
$S.WorkingDirectory = $Location
If $Comment
$S.Description = $Comment
EndIf
$S.Save
If @ERROR Exit @ERROR Else $AddToMyNetworkPlaces=0 EndIf
Else
Exit 3
EndIf
EndFunction


;Function:
; ReadExcel2()
;
;Authors:
; Lonkero
; kdyer
;
;Version:
; 2.1
;
;Version History:
; 2.1 16.5.2003
; added ability to read full sheet (slow)
; added option to read all data (faster )
; 2.0 16.5.2003
; cleaned the code from console outputs
; added proper errorcodes
; added proper parameter-definitions
; proper closing of excel
; well, totally made this a new Xperience
;
; 1.4 (initial code = ReadExcel UDF) by kdyer
; http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000121
;
;
;Action:
; Read from Excel to 2-dimensional array
;
;Syntax:
; ReadExcel2(FILE, SHEET, ROWCOUNT, COLUMNCOUNT, [ROWSTART], [COLUMNSTART])
;
;Parameters:
; FILE
; REQUIRED STRING
; File to read from
; SHEET
; OPTIONAL INTEGER
; Sheet index from which to read.
; default = 1
; ROWCOUNT
; OPTIONAL INTEGER
; Amount of Rows to read
; if -1 reads until empty field found at the start of row
; if left out reads all rows
; COLUMNCOUNT
; OPTIONAL INTEGER
; Amount of Columns to read
; if -1 reads until empty field found at row 1 of Column
; if left out reads all Columns
; ROWSTART
; OPTIONAL INTEGER
; Row from which to start reading
; if not specified, defaults to 1
; COLUMNSTART
; OPTIONAL INTEGER
; Column from which to start reading
; if not specified, defaults to 1
;
;Remarks:
; Excel uses row and column numbers starting from 1
; thus the resulting range that starts from [0,0] might confuse a little
;
;Returns:
; 2-dimensional array (table) or
; nothing if failed (see errorcode for reason)
;
;Errorcodes:
; 0 ERROR_SUCCESS The operation was successfully completed.
; 2 ERROR_FILE_NOT_FOUND The system cannot find the file specified.
; 87 ERROR_INVALID_PARAMETER The parameter is incorrect.
; 1154 ERROR_INVALID_DLL Excel does not exist or is too old to support com.
;
;Dependencies:
; Excel -97 or newer
;
;Example:
; ;read the default sheet (1) to the first empty field (with 3 columns).
; $range=readexcel2('C:\Documents and Settings\niemjo\Työpöytä\puhluett.xls',,-1,3)
; if @error
; "error occured: @serror (@error)"
; else
; for $counter=0 to ubound($range,2)
; ? "name: " $range[$counter,0]
; ? "phonenumber: " $range[0,1]
; ? "cellular: " $range[0,2]
; ?
; next
;
;Source:
Function ReadExcel2($xlsFile,optional $xlsWS,optional $RowCount,optional $ColCount,optional $RowStart,optional $ColStart)
dim $xlObj,$Counter,$Counter2
If 0=Exist($xlsFile)
exit 2
Endif

$xlObj=Createobject('Excel.application')

If @error
Exit 1154
Endif

$= $xlObj.workbooks.open($xlsFile)

if 8<>vartype($xlsFile)
exit 87
endif

if vartype($xlsWS)
if 3<>vartype($xlsWS)
exit 87
endif

if 1>$xlsWS
exit 87
endif

$xlObj.sheets($xlsWS).Activate.

else
$xlsWS=1
endif

if vartype($RowCount)
if 3<>vartype($RowCount)
exit 87
endif

if -1=$RowCount
for $Counter=1 to $xlObj.sheets($xlsWS).rows.count
if not $xlObj.cells($Counter,1).value
$RowCount=$Counter-1
$Counter=$xlObj.sheets($xlsWS).rows.count
endif
next
endif

else
$RowCount=$xlObj.sheets($xlsWS).rows.count

endif

if vartype($ColCount)
if 3<>vartype($ColCount)
exit 87
endif

if -1=$ColCount
for $Counter=1 to $xlObj.sheets($xlsWS).columns.count
if not $xlObj.cells(1,$Counter).value
$ColCount=$Counter-1
$Counter=$xlObj.sheets($xlsWS).columns.count
endif
next
endif

else
$ColCount=$xlObj.sheets($xlsWS).columns.count

endif

if vartype($RowStart)
if 3<>vartype($RowStart)
exit 87
endif

if 1>$RowStart
exit 87
endif

else
$RowStart=1

endif

if vartype($ColStart)
if 3<>vartype($ColStart)
exit 87
endif

if 1>$ColStart
exit 87
endif

else
$ColStart=1

endif

dim $Array[$RowCount-1,$ColCount-1]

$ReadExcel2=$Array

for $Counter=1 to $RowCount-$RowStart+1
for $Counter2=1 to $ColCount-$ColStart+1
$ReadExcel2[$Counter-1,$Counter2-1]=$xlObj.cells($Counter,$Counter2).value
next
next

$xlObj.workbooks.Close
$xlObj.quit

EndFunction