Link to home
Start Free TrialLog in
Avatar of Tom Crowfoot
Tom CrowfootFlag for United Kingdom of Great Britain and Northern Ireland

asked on

If string results equals

Dear Experts

I am using a drag and drop facility (courtesy of EE) to perform various tasks. Once a document has been dragged into the drop off area  (Me.txtDrop) a string is created 'ExtensionType' which works out the file extension (eg pdf  xls etc.). This all works fine, but I need to add in an IF statement wrapper to handle user errors that basically does this:

If 'ExtensionType' is empty then bring up a message saying "No document has been dragged across"
If 'ExtensionType' is NOT 'pdf' OR 'doc' OR 'docx'  then bring up a message saying "this file format is not supported"
else carry in with the rest of the code ...

Can anyone help?
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Could be:
Dim Message As String
Select Case ExtensionType
    Case ""
        Message =  "No document has been dragged across."
    Case  "pdf", "doc", "docx"
        ' OK.
    Case Else
        Message =  "This file format is not supported."
End Select

If Message <> "" Then
    MsgBox Message
    Exit Sub
End If

Open in new window

Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tom Crowfoot


Thanks for this, apologies for the delay in accepting