Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

From an Access Button trying to open a Word Document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adam - 16 Nov 2006 15:47 GMT
Hello all,

I have a button on my form from which I would like to open up a word
document. The word document would be located in a folder in the same level as
the database. Is it possible to do this?

I noticed with the button wizard you can create a button which opens up
word, but is there any way to open up a specific document? The code for the
button created by the wizard which opens up word is (I think):

Private Sub openDoc_Click()
On Error GoTo Err_openDoc_Click

   Dim oApp As Object

   Set oApp = CreateObject("Word.Application")
   oApp.Visible = True

Exit_openDoc_Click:
   Exit Sub

Err_openDoc_Click:
   MsgBox Err.Description
   Resume Exit_openDoc_Click
   
End Sub

Many thanks in advance,

Adam
Regan - 16 Nov 2006 18:14 GMT
>Hello all,
>
>I have a button on my form from which I would like to open up a word
>document. The word document would be located in a folder in the same level as
>the database. Is it possible to do this?

>Private Sub openDoc_Click()
>On Error GoTo Err_openDoc_Click

Dim strfile AS String

strfile = "C:\PathToFile\MyWordDoctoOpen.doc"

Application.FollowHyperlink strfile

>Exit_openDoc_Click:
>    Exit Sub
[quoted text clipped - 4 lines]
>    
>End Sub

Hope thats what your looking for.

Signature

Regan,
Paeroa
World famous in New Zealand

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.