opening files

H

Hebe

AT work we use several different files that are stuck in
folders within folders on the network drive. I used Excel
97 to create a page with several buttons on that i use to
keep from drilling to different drives and folders. to
get to the files. I was able to use the shell command to
open specific access files but I could not get it to work
on word 97. plus i also tried to use the following code
which word bring word up but not to a specific page or
file. Would anyone have any pointers I am new to VBA and
am sort of lost on this one. Thanks

Private Sub cmd14_click()

Dim Mywrd As Object

On Error Resume Next

Set Mywrd = GetObject(, "word.Application")
If Err.Number <> 0 Then wordWasNotRunning = True
Err.Clear ' Clear Err object in case error occurred.

Set Mywrd = GetObject("C:\test\test.doc")

Mywrd.Application.Visible = True
Mywrd.Parent.Windows(1).Visible = True

End sub
 
D

Dick Kusleika

Hebe

You might want to use

ThisWorkbook.FollowHyperlink "C:\Test\Test.doc"

FollowHyperlink will pick the right program to open for whatever document
you send it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top