Open saved file based on form textboxes

odun

Registered User.
Local time
Today, 03:32
Joined
Apr 24, 2005
Messages
108
Hello all,

Do you have a code that would open a saved file based on the contents of 2 textboxes on my form.

The saved files would be in:
C:\Documents and Settings\100310257\Desktop

I have a button on the form, but need a code that would pull up the savedfile using the name in textbox1 and the name in textbox2, like this:
textbox1-textbox2. e.g. textbox1 = Novo Group. textbox2 = AA
There is a saved file in the path above, Novo Group-AA

Thanks for helping!
 
Code:
Dim strPath as String
strPath = "C:\Documents and Settings\100310257\Desktop"

Application.FollowHyperlink strPath & "\" & txtbox1 & "-" & txtbox2

That may work if I understand your question

Scott
 
Hi Scott,
Thanks a lot.
I am getting a runtime error 490: Cannot open the specified file. And the Application.FollowHyperlink... is highlighted.
My file is saved on my desktop as Novo Group-AA
on my form, the 1st textbox name is textbox1, the 2nd textbox name is textbox2.

Any idea why the file can't be opened?

Thanks for helping.
 
You don't have any extension on the file name e.g. .doc .xls etc.

Should be:

Code:
Application.FollowHyperlink strPath & "\" & txtbox1 & "-" & txtbox2&".doc"
 
You're right again! Thanks John.
 

Users who are viewing this thread

Back
Top Bottom