PDA

View Full Version : [SOLVED] Open Word from Excel



JeffT
10-31-2004, 11:50 AM
Hi

Probably easy or impossible, I just can't figure it out.

I want to be able to open a Word File by clicking on a Toolbar button in Excel.
I have the toolbar which works fine with my VBA code opening various forms, so I've got that far.

I'll keep the Word & Excel files in the same folder so the reference can be relative.

I want Word as a sort of Help file with hyperlinks within the document etc, though after reading previous posts I've downloaded shelpm and may give this a go.

I don't want to embed the file in excel just be able to open it.

Hope someone can help

Regards

Jeff T

I use Excel 97 at home so it has to work from this upwards.

Regards

Jeff T

mdmackillop
10-31-2004, 12:10 PM
Hi,
A sub containing a hyperlink should do the trick. Just assign the macro to a toolbar button
MD


Sub OpenDocFile()
ActiveWorkbook.FollowHyperlink Address:="C:\Atest\WordDoc.doc", _
NewWindow:=True
End Sub

JeffT
10-31-2004, 01:43 PM
Hi MD

I knew it'd be simple.

The code does exactly what I want, and even works if you leave out the C:\ etc for a local file.

Thanks

Jeff T

mdmackillop
10-31-2004, 02:02 PM
Glad to help.
If you go to Thread Tools at the top of the page, you can mark this as solved.
MD

Ivan F Moala
11-01-2004, 12:51 AM
Hi MD

I knew it'd be simple.

The code does exactly what I want, and even works if you leave out the C:\ etc for a local file.

Thanks

Jeff T

Just curious Jeff, what version of Xl are you using 97? or 2000.
If you are planing on running this on latter versions then you maybe better
off using either the Shell command or the Shellexercute API to by pass security prompts.

JeffT
11-01-2004, 03:45 PM
Ivan

I've written it at home on 97 but run it on my work machine which is 2000, but still need to run it on 97 for updates etc. It's just an automated petrol return I've written for myself to see how VBA works. I started it about 5 years ago and have updated it each time the company change the form. One day I'll do something useful with my knowledge but really I'm just doing it 'cause I can.

Thanks

Jeff T
PS I'll be asking about toolbars next as I want my toolbar to be better, but I'll get the help file done first.

Ivan F Moala
11-01-2004, 08:25 PM
Hi Jeff

Ah this is for a help file
Just a thought...but you may also consider
1) Embedding the Word doc in Excel and calling it up. Saves in having to distribute both files latter
2) Saving the Doc as html and using the Web component to display the file in a userform. You then have the help always visible to the user instaed of switching backwards and forwards.