1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Open word doc with command button in access

Discussion in 'Business Applications' started by jmk909er, Jan 11, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. jmk909er

    jmk909er Thread Starter

    Joined:
    May 20, 2009
    Messages:
    353
    Is there a simple way to open a word doc with a command button in access?
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Yes, do you need to browse to it?
     
  3. karlhaywood

    karlhaywood

    Joined:
    Jan 17, 2010
    Messages:
    680
    If your going to open the same word doc everytime you press the button you could try

    Dim LWordDoc As String
    Dim oApp As Object
    'Path to the word document
    LWordDoc = "c:\Doc1.doc"
    If Dir(LWordDoc) = "" Then
    MsgBox "Document not found."
    Else
    'Create an instance of MS Word
    Set oApp = CreateObject(Class:="Word.Application")
    oApp.Visible = True
    'Open the Document
    oApp.Documents.Open filename:=LWordDoc
    End If
    End Sub

    You will need to put in the correct file path of the document you want to open.
     
  4. jmk909er

    jmk909er Thread Starter

    Joined:
    May 20, 2009
    Messages:
    353
    Thanks Guy's I found a solution:

    Private Sub Command30_Click()
    Application.FollowHyperlink "T:\G4\Maint\Fac Reports\M2R2Weekly Planning Status xcel document\MCRD Projects\MCRD Projects Input Worksheet.doc"
    End Sub
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/974046