jflaurin
Technical User
- Dec 1, 2007
- 12
I'm using the following loop to get the content of reg keys and then add them to a list box, the problem is that
if a key is empty it gererates an error. How can I overcome this ?
Also Is there another way to do this beside looping 1000 times ? There's only 5-6 keys that have content at the time but they may be named anything between 1 - 1000 ( ie :
HKCR\Folder\shell\Use Zip _ Help\protect\folderpath1 or HKCR\Folder\shell\Use Zip _ Help\protect\folderpath999 )
------------------------------------
The code :
For r = 1 To 1000
folderpath = wsh.RegRead("HKCR\Folder\shell\Use Zip _ Help\protect\folderpath" & r)
foldername = wsh.RegRead("HKCR\Folder\shell\Use Zip _ Help\protect\foldername" & r)
lstfolder.ListItems.Add , , r
' now add the subitems to the listview
With lstfolder.ListItems(lstfolder.ListItems.Count)
.SubItems(1) = foldername
.SubItems(2) = folderpath
End With
Next r