Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DropHighLight / drag and drop error

Status
Not open for further replies.

nkyeshi01

Programmer
Nov 4, 2004
29
US
hi to all

When the target folder is missed it gives this problem:

Run-time error 91: Object variable or with blockvariable not set.

I know that it means that the TreeView.DropHighLight = nothing but yet still does not let me exit the sub if nothing is selected, it gives me the error, this is the code:

If tvTreeView.DropHighlight <> "Nothing" Then
Set tvTreeView.DropHighlight = tvTreeView.HitTest(x, Y)
tvTreeView.SelectedItem = tvTreeView.DropHighlight
path3 = tvTreeView.SelectedItem.FullPath & "\"
Else
Exit Sub
End If


if the target is selected it works fine, but if you missed the target the error pops up and it won't let me just exit the sub. How can I handle this so it can allow to exit the sub?

thank you

EP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top