Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Get location of Word application

Discussion in 'Information Technology' started by Si, Nov 11, 2005.

  1. Si

    Si
    Expand Collapse
    Guest

    I use the Shell function to open MS Word (winword.exe) but for some PCs the
    install path of Winword.exe is different. Is there any way to get the
    directory path of Winword.exe and use that to access the file (rather than
    hardcode "C:\Program Files\Microsoft Office\... " etc.)?

    Thanks.
     
  2. Loading...

    Similar Threads Forum Date
    India SC Directs Probe Into 2G Allocation Since 2001 Breaking News Dec 17, 2010
    Sikh News Sikh groups elated by allocation (The New Straits Times) Breaking News Oct 30, 2009
    Sikh News Punjab allocates more than 1/3 of total allocation on shining the power sector (I Breaking News Nov 26, 2007
    Buddhism New Web Site Offers Material From Religious and Sacred Locations - Originally Collected in the 1920s Interfaith Dialogues Jul 12, 2005
    Origin Of Word Waheguru Sikh Sikhi Sikhism Aug 3, 2016

  3. Albert D.Kallal

    Albert D.Kallal
    Expand Collapse
    Guest

    Why not just shell out to the actual document name?

    You can use


    application.FollowHyperlink "c:\path name to your docuemnt\test.doc"

    Note with the above one line of code, you can launch word, excel, a pdf
    file...it really don't matter where, the application is installed, as the
    above just launches the file as if you clicked on it...


    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKallal@msn.com
    http://www.members.shaw.ca/AlbertKallal
     
  4. Si

    Si
    Expand Collapse
    Guest

    "Albert D.Kallal" <PleaseNOOOsPAMmkallal@msn.com> wrote in message
    news:ehjF1Oq5FHA.2576@TK2MSFTNGP10.phx.gbl...
    > Why not just shell out to the actual document name?
    >
    > You can use
    >
    >
    > application.FollowHyperlink "c:\path name to your docuemnt\test.doc"
    >
    > Note with the above one line of code, you can launch word, excel, a pdf
    > file...it really don't matter where, the application is installed, as the
    > above just launches the file as if you clicked on it...


    It's an empty/new Word document I want to open. The only way I can see your
    suggestion working is if I create a blank Word document and put it as
    Read-only on a network resource, so everyone can accesss it. Suppose that
    would work OK but it relies on the file being accessible by all.
     
  5. Edo

    Edo
    Expand Collapse
    Guest

    You're in the wrong newsgroup.

    "Si" wrote:

    > I use the Shell function to open MS Word (winword.exe) but for some PCs the
    > install path of Winword.exe is different. Is there any way to get the
    > directory path of Winword.exe and use that to access the file (rather than
    > hardcode "C:\Program Files\Microsoft Office\... " etc.)?
    >
    > Thanks.
    >
    >
    >
     
  6. Si

    Si
    Expand Collapse
    Guest

    "Edo" <Edo@discussions.microsoft.com> wrote in message
    news:F360E925-0751-423E-BA9D-4D06FD13B1F4@microsoft.com...
    > You're in the wrong newsgroup.


    No I'm not.
     
  7. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    There's code to do this at the following URL ...

    http://www.mvps.org/access/api/api0023.htm

    --
    Brendan Reynolds

    "Si" <si@hello.com> wrote in message
    news:%23Kt%23zKq5FHA.4012@TK2MSFTNGP14.phx.gbl...
    >I use the Shell function to open MS Word (winword.exe) but for some PCs the
    >install path of Winword.exe is different. Is there any way to get the
    >directory path of Winword.exe and use that to access the file (rather than
    >hardcode "C:\Program Files\Microsoft Office\... " etc.)?
    >
    > Thanks.
    >
     
  8. Albert D.Kallal

    Albert D.Kallal
    Expand Collapse
    Guest

    >
    > It's an empty/new Word document I want to open. The only way I can see
    > your suggestion working is if I create a blank Word document and put it as
    > Read-only on a network resource, so everyone can accesss it. Suppose that
    > would work OK but it relies on the file being accessible by all.


    Ah, ok, we don't really just want to launch word, but want to launch word,
    and create a new blank document (different problem, and a different
    solution!!).

    First, you could just include a blank word document with the application
    that
    you deploy? (no need to place a blank document on a shared network
    resource?). I mention this, since it sounds like you might be deploying your
    application wrong. Since you can NOT allow multiple users into the same
    front
    end of the applications, then one has to assume than EACH user has a copy
    of
    the front end application installed on EACH pc. Thus, why not include a
    blank document on each pc?

    In the above case that you might be deploying your application incorrect,
    you can
    read the following article of mine on how to do this correctly:

    http://www.members.shaw.ca/AlbertKallal/Articles/split/index.htm


    However, the above is not the issue here (except that you might be
    deploying your application Wong), it is MUCH easer to
    launch word and THEN TELL word to create a blank document
    for.

    You can use the following code:

    Dim wordApp As Object 'Word.Applicaton
    Dim WordDoc As Object 'Word.Document

    Set wordApp = CreateObject("Word.Application")

    Set WordDoc = wordApp.Documents.Add

    wordApp.Visible = True
    wordApp.Activate
    wordApp.WindowState = 0 'wdWindowStateRestore

    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKallal@msn.com
    http://www.members.shaw.ca/AlbertKallal
     

Share This Page