meilkew
New member
- Local time
- Today, 22:03
- Joined
- Apr 14, 2020
- Messages
- 27
I have this code which open the PDF files if the filepath is available in the listbox index and msg box if "NO PDF FILE" text is found instead. I would like to clear the selection made as soon as the PDF or MsgBox fires. But somehow declaring this at the end of the code doesn't do the work.
What happen is if I made a new selection in the list box whether above or below of the previous selection, several rows are being highlighted instead.
My list box is set to multi select extended. I tried calling the Me.List_box_Data to update the record in hope to clear the selection made.
Me.ListBoxSD.Selected(i) = False
What happen is if I made a new selection in the list box whether above or below of the previous selection, several rows are being highlighted instead.
My list box is set to multi select extended. I tried calling the Me.List_box_Data to update the record in hope to clear the selection made.
Code:
Private Sub ListBoxSD_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TurnOffFunctionality
Dim strFile As String
Dim i As Long
i = Me.ListBoxSD.ListIndex
Me.ListBoxSD.Selected(i) = True
strFile = Me.ListBoxSD.List(Me.ListBoxSD.ListIndex, 17)
If Me.ListBoxSD.Selected(i) Then
If strFile = "NO PDF FILE" Then
MsgBox "No Attachment"
Else
ActiveWorkbook.FollowHyperlink strFile
End If
End If
Me.ListBoxSD.Selected(i) = False
Call Me.List_box_Data
TurnOnFunctionality
End Sub