×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Opening a specific Word document from a text box

Opening a specific Word document from a text box

Opening a specific Word document from a text box

(OP)
Hi all,
I am trying to open an existing specific Word document from a double click in a text box on a form. This document (which already exists) is selected from the entry in the text box on the double click.
I have tried various methods to no avail. Can anyone suggest how this might be done please?

Hampshire UK.

There is nothing so sad as an old guy trying to code.

RE: Opening a specific Word document from a text box

It would be helpful if you posted your code; otherwise all anyone can do is play a guessing game - not.

Cheers
Paul Edstein
[MS MVP - Word]

RE: Opening a specific Word document from a text box

You can use this OpenDocument logic to open any document in its default app: wiggle

CODE

Option Explicit

Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Call OpenDocument(TextBox1.Text)
End Sub

Private Sub UserForm_Activate()
TextBox1.Text = "C:\SomeFolder\SomeFile.jpg"
End Sub

Public Sub OpenDocument(strDocPath As String)
Dim G As Long
G = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & strDocPath, vbNormalFocus)
End Sub 


---- Andy

There is a great need for a sarcasm font.

RE: Opening a specific Word document from a text box

(OP)
Thanks a lot Andy. I will give it a try.

Hampshire UK.

There is nothing so sad as an old guy trying to code.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close