Re: How do I find the Path for Win.Word?



For future reference, please follow the same posting convention that was established. For example, Bryan's reply to your original message was bottom-posted, meaning he quoted your message and wrote his reply UNDER what he quoted. In your subsequent reply, you top-posted, meaning you wrote your reply ABOVE what you quoted. So now, the "quoting flow" is your reply to Bryan, your original post, Bryan's reply to your original post. Tends to make following the quotes quite confusing, and the whole purpose of quoting is so there's a flow in the message without having to go back and re-read previously posted messages. Most people don't care which convention is used as long as it remains consistant for the message thread. So much for that.

You *should* be OK with a reference to Word 10 and your app being run on a system with Word 11 installed. In fact, this is exactly what's recommended: develop against the lowest version of Office you need to support. This is even true for the OS (IOW, if you need to support Win2000, develop on a Win2000 system). This ensures you don't use features available only in the later version. Microsoft was actually pretty good about compatibility in Office. That's not to say you *couldn't* have compatibility problems, but it's not likely. I've written many little apps and even quite large apps that use Automation with various Office products and I've had VERY few problems with those apps working when a different version of Office is installed. Maybe I've just been fortunate because I have heard of others having endless problems. However, in almost all of these, it's because they've developed using a later version of Office and uses features specific to that version, and then the app doesn't work with an earlier version of Office. This is 100% the fault of the programmer. In some cases, you do need to use late-binding rather than early-binding. If you're not familar with these as they apply to Automation, in very simplistic terms, early-binding is setting a reference to a library and using specific object types from that library (such as Word.Application) and information about the object gets compiled into your app. When late-binding, you do NOT set a reference to the library and you use the "generic" Object data type and information about the specific object gets resolved at runtime.

If you don't want to use Automation for whatever reason, then you basically have 3 alternatives. One would be to prompt the user for the location of winword.exe (and then save that so you won't need to prompt them every time). Second would be the FindExecutable Win32API function. Search the newsgroups at www.google.com for example source code for this function. Third would be to search all the hard drives installed on the user's system for "winword.exe" (and then save that so you don't need to search again). You can find example code on searching hard drives on google too.

--
Mike
Microsoft MVP Visual Basic


"Dennis Rose" <DennisRose@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:252E9299-83D3-4557-952F-12AC425AAE31@xxxxxxxxxxxxxxxx
I had to set a reference to Microsoft Word 10 in my VB pgm to get this to
work, but if I am using my VB pgm on a computer that has "Word 11" it might
fail.

Seems best if I could get the path to WinWord.exe and then use the path in
the Shell function in my code ... but I don't know how to get the path???

I still need some help.

Thanks,

Dennis

"alpine" wrote:

On Sat, 28 Oct 2006 09:42:02 -0700, Dennis Rose
<DennisRose@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>I have a VB4 application that uses the Shell function to launch >Microsoft
>Word (WinWord.exe). Since WinWord.exe may be in different locations
>depending on the version of Word that is being used, I need to use an >API or
>some means to determine the location of WinWord on a paticular computer.
>
>How can I do this? I tried "GetFullPathName" but it did not give me the
>correct location.
>
>Please help. Thanks!!!
>
>Dennis Rose


If you are trying to open a document, you should just use the
ShellExecute API function. If you actually do need to launch the Word
exe without a specific document, you can use Automation to create and
show an instance of word instead of launching the exe directly.

If you supply more info about exactly what you are trying to
accomplish, people will be able to suggest more specific solutions for
your situation.

.



Relevant Pages

  • Re: Why choose a paragraph element for a paragraph?
    ... The man visiting the blonde women in the flat above you is your ... a meaning independent of the actual reference. ... refer to or point to the very same and one thing in the world. ...
    (alt.html)
  • Re: Why choose a paragraph element for a paragraph?
    ... a meaning independent of the actual reference. ... the other is something about the world outside of language. ... The answer to these concerns about causality lies in more than mere ...
    (alt.html)
  • Re: cdt glossary 0.1.1 (repost)
    ... and /or basic database research. ... A reference is a value used to refer ... ... "Known facts that can be recorded and have implicit meaning." ... variables of a pointer type - these variables ...
    (comp.databases.theory)
  • Re: Existence and presupposition
    ... linguistic meaning but existential meaning. ... But the question is what WE mean by reference. ... the Earth, but only to a concept that the Earth, among other things, ... Mill says that "Socrates" denotes ...
    (sci.logic)
  • Re: Trying to use unmanaged with C#
    ... And you're doing this from an ASP.NET app? ... It only became the need to be a .NET object when I "imported" it into my ... The object houses all the protocol for clients. ... if you *do* need to pass a reference of some .NET class to a COM ...
    (microsoft.public.dotnet.framework.interop)

Loading