View Single Post
Old 10-28-2017, 07:34 AM
GJB56 GJB56 is offline
Registered User
Join Date: Nov 2011
Posts: 22
I found this on the forum a while ago and it is a timesaver. Get a list of IPs from the clipboard and store into an array. Then your script can just loop through the array and connect to each host.

Sub Get_Hosts_From_Clipboard()
' Start of with a reasonable size for the array
	ReDim vSessionsArray(64)
	strClip = crt.Clipboard.Text
' Split up the selected text into separate lines. ' First, let's standardize the text by making sure ' each line is separated by only a carriage return.
	strClip = Replace(strClip, vbcrlf, vbcr)
	strClip = Replace(strClip, vblf, vbcr)
' Now, use Split() to create an array out of each of the lines.
	vSessionsArray = Split(strClip, vbcr)
' Remove leading and trailing spaces
	For Each strSession In vSessionsArray
		strSession = Trim(strSession)
End Sub
Reply With Quote