VBA to Open A File

Rastahl99

New member
Local time
Today, 01:54
Joined
Dec 24, 2008
Messages
2
Team,
I'm looking for help... I desperately need a code that when used will prompt a user to enter text and will use that text entered to search a specified folder that contains a pdf with a file name that contains that text even if it is not the full text string. Example:
In the specified folder there is a file that is named happy1234.pdf, I need a code that will prompt the user to enter the file name or a text string that is in the file name...so the user enters: "happy" and the browser pulls up happy1234.pdf. Also, if there is more than one file with "happy" then they all pull up. I hope this isn't too difficult and somebody has already mastered this...but I'm stuck and help would be greatly appreciative.
 
you could also whack something like this in there to make it only search for PDFs if need be:

Code:
if UCASE(right(thefile.path,3)) = "PDF" then
       'blah blah blah
end if
 
you could also whack something like this in there to make it only search for PDFs if need be:

Code:
if UCASE(right(thefile.path,3)) = "PDF" then
       'blah blah blah
end if

hey geezer,

I'm not sure if you know this or not (or even if it's correct), but everytime I've browsed the dirs using VBA, the file extensions have been case sensitive when ref'd in code. I have no idea why. If it has to be that way, fine. But if you didn't know, now you do! :)
 
Greetings.

That is why I use UCASE

hey old man...:D

Does that mean that you always have to use UCASE on file extensions in vba? I did not know that if you do, but I can't remember what I did the last time.

Is that a rule I should remember? thanks!
 
Not sure if you have to, for some reason I have always done it (maybe years ago I found a need to do it? Let me test this out dude.....*alters VBA in searchy.mdb*.......it appears that you don't have to. WTF, why have I always done that?

Perhaps it is because I am a spent geezer?
 

Users who are viewing this thread

Back
Top Bottom