Hey I have this do until loop that takes a text file made into a string ("strnotapprovedData") and then calls this function that runs a command to delete the share. I keep getting the error object required: "xxxx". How do I fix this is the problem the function the loop statement or the string.
Function:
Function DeleteThisShare(Value)
DeleteThisShare = "net share " & Share & " \DELETE"
Set objShell = CreateObject("Wscript.Shell")
Msgbox AddQuotes(DeleteThisShare)
objShell.Run DeleteThisShare
End Function
Loop Statement:
Do Until strnotapprovedData.AtEndOfStream
Dim objShare : objShare = Split(strnotapprovedData,vbCrLf)
notapprovedShares = objShare
DeleteThisShare(notapprovedShares)
Loop
String:
Dim notapprovedList, notapprovedShares
Set notapprovedList = objFSo.OpenTextFile ("C:\Users\abro\Shares_Not_Approved.txt")
Dim strnotapprovedFile, strnotapprovedData
strnotapprovedFile = ("C:\Users\abro\Shares_Not_Approved.txt")
strnotapprovedData = objFSO.OpenTextFile(strnotapprovedFile,ForReading).ReadAll
Reply to Chris Nielsen
Well I added this and the same problem still occurs
strnotapprovedData = objFSO.OpenTextFile(strnotapprovedFile,ForReading).ReadAll
Do Until objnotapprovedLines.AtEndOfStream
objnotapprovedLines = Split(Trim(strnotapprovedData),vbCrLf)
DeleteThisShare(objnotapprovedLines)
Loop