opening an existing Word document in Access 2003?

K

Kushum

Hi everyone,

I would like to know is it actually possible to open an existing word
document by clicking a button on a form or as such. I have created a database
and have mail merged few letters using the records from that database...I
need to know how I can open and view those letters (which are in Word 2000)
in FORMS as a direct access for the user!

Thankyou. p.s I would be grateful if you avoid VB codes as I am not too good
with VB codes.
 
A

Albert D.Kallal

You only need one line of code. The code requited to open a Excel, Word, pdf
etc is:

Application.FollowHyperlink "C:\my documents\test.doc"

To open a excel, you would go:


Application.FollowHyperlink "C:\test data\test.xls"

So, using the above code, you can open ANY TYPE of document...
 
K

Kushum

Hi Albert,
I tried the code but as you see i'm not very good with codes and this is
what i did:
I created an empty command button and on that I right clicked and under
properties for "On Click" I used code builder where I entered the following:
Private Sub Command61_Click()
On Error GoTo Err_Command61_Click

Dim oApp As Object

Set oApp = Application.FollowHyperlink "C:\my documents\test.doc"
oApp.Visible = True

Exit_Command61_Click:
Exit Sub

Err_Command61_Click:
MsgBox Err.Description
Resume Exit_Command61_Click

But this is giving me errors and the Private Sub Command61_Click()
turns yellow . Could you please kindly correct this for me as i'm a complete
newbie to VB. Is there any way I can open the document without coding.
 
K

Kushum

Hi Albert,
Please ignore my previous reply to you. i have finaly opened the document as:
Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open " C:\Documents and Settings\User\My
Documents\test.doc"

and it works. But in the long run could the above code give me errors later
on, or be corrupted?
Thanks.
 
A

Albert D.Kallal

The following should have worked:


Application.FollowHyperlink "C:\Documents and Settings\User\My
Documents\test.doc"
 
Top