Consulting

Results 1 to 7 of 7

Thread: Open Word from Excel

  1. #1
    VBAX Contributor JeffT's Avatar
    Joined
    Oct 2004
    Location
    Maidenhead, Nr London UK
    Posts
    105
    Location

    Open Word from Excel

    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

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    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

  3. #3
    VBAX Contributor JeffT's Avatar
    Joined
    Oct 2004
    Location
    Maidenhead, Nr London UK
    Posts
    105
    Location
    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

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Glad to help.
    If you go to Thread Tools at the top of the page, you can mark this as solved.
    MD

  5. #5
    VBAX Contributor Ivan F Moala's Avatar
    Joined
    May 2004
    Location
    Auckland New Zealand
    Posts
    185
    Location
    Quote Originally Posted by JeffT
    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.
    Kind Regards,
    Ivan F Moala From the City of Sails

  6. #6
    VBAX Contributor JeffT's Avatar
    Joined
    Oct 2004
    Location
    Maidenhead, Nr London UK
    Posts
    105
    Location
    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.

  7. #7
    VBAX Contributor Ivan F Moala's Avatar
    Joined
    May 2004
    Location
    Auckland New Zealand
    Posts
    185
    Location
    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.
    Kind Regards,
    Ivan F Moala From the City of Sails

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •