1 Replies - 519 Views - Last Post: 11 July 2010 - 05:32 AM Rate Topic: -----

#1 raycomp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 25-August 09

Help with code to find part of text

Posted 11 July 2010 - 04:43 AM

I am developing a prog to keep track of all my movies stored in various folders, external drives and dvd's

I have manged to include code to extract the information from the movie like resolution, aspect ratio and other info.

I have now added cmd button to plat the movie from the prog in Media Player and GOM player based on the older and movie name stored in a text box.

I now need to specify not to open the player when the text field is empty or not like a valid directory.

for instance if the text box = "" or not like ":\"
(D:\Movies\Thrillers\Edge of Darkness.avi)

I have tried

Quote

If Location.Text = "" Or Location.Text not like "%:\%") Then
msgbox "No location allocated to this Movie" _
& vbCrLf & vbCrLf & "Please allocate correct location."
Exit Sub


With the not like "%:\%" I want the message to appear if :\ is not part of the text in the text box. I have tried various way without success.

Will apreciate if someone with more experience can help me out.

This post has been edited by raycomp: 11 July 2010 - 04:46 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Help with code to find part of text

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Help with code to find part of text

Posted 11 July 2010 - 05:32 AM

do you try instr() function. something like this:
If Location.Text = "" Or InStr(1,Location.Text ,":\")=0 Then
msgbox "No location allocated to this Movie" _
& vbCrLf & vbCrLf & "Please allocate correct location."



where instr():

Function InStr([Start], [String1], [String2], [Compare As VbCompareMethod = vbBinaryCompare])
Member of VBA.Strings
Returns the position of the first occurrence of one string within another

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1