-
1 Attachment(s)
Haven't got too much time - I've attached a file "utility.bas" that has a few registry functions in it...select the one you want and use that (I think GetRegistrySetting will be the one you want).
I'm not sure what the actual version or word you'll be looking for will be (I was only 'logic-ing' your question....) but I'm sure you can find that.
My earlier post should be able to help you with the late binding...just put the reference to the olb inside a select case statement where the cases are the possible words to come out of the registry.
Hope this helps:)
-
This is what happens when you press "send" and then go off to lunch without checking that it all went through ok.....I forgot to make it a zip and the board doesn't like .bas files. Sorry about the delay!
-
Word from VB
Right, this is what I have managed to do so far.
The first post Ive managed to use for determining what version of Word is present on the system – so it does the job!
The difficulty is this. I installed the app to run on 2 different PC;s. one has Word 2000 only, and this still doesn’t work. The other – and heres the funny bit - also has word 2000 installed and it works fine – but! – it also has word 2002 installed (using 2000 as the default word processor)
I have looked at another post, which says not to reference any .OLB at all. That’s great, but I am using early binding because I am using the range object within the app. - which is part of the word.application object. Late binding is causing me no-end of problem, and would require an extensive rebuild of the entire design of how the program works in producing its Word documents (it is a Last Will and Testament compiler – it writes your Will! – UK Law)
At present, so long as Word 2002 or higher is present, its fine, but the question is – Can I actually stipulate Word 2002 as the minimum spec – the program’s users are all Lawyers and legal buffs and wouldn’t even know Word 2002 if they saw it. I do know many are using Word 2000 (Win2K on their networks etc..)
I am now looking for suggestions for >>ANY<< workaround to get this thing to work correctly under word 2000, or word 2002 and up.
Microsoft’s website is telling me to simply distribute the MSWORD.OLB (for 2002 and up) with the app., or simply don’t reference any .OLB at all (for late bind) But neither solution is working.
I’m pulling my hair (what’s left of it now) out here!!
Jason.
-
Forgot to include the error message.. (on the Word 2000 machine)
it is 'Error in loading DLL' - different from last time, so we might be onto something
-
Well done sotoasty and Twodogs.
The problem has been fixed.
I needed to create the word object (with a reference to msword9.OLB - and not MSWORD.OLB) before creating the properties of the word.application object, all within the sub/functions that use the word object instead of a public global word.application object.
The program has to use early binding because it uses properties of the word.aplication object (the range object) - as Microsofts website states, otherwise late binding would suffice without any reference to any .OLB object at all as Cimperiali's earlier post and code example explains.
For anyone in a similar situation, i also found the following useful.
http://www.carobit.com/ShowThread/Vi...%20Carafa.html
It was a bit of a fiddle cleaning up the code, but at least it now does the job.
Thanks once again.
Jason.
-
Good to hear you have it fixed....I could've probably helped a little more if I was unscrupulous enough to have kept the code from a previous job - it made financial plans (word doc) after going out and getting all the info from various stock exchanges around the world...from the sound of it, it was doing exactly what you are!
(Oh - you still could've used late binding, you just don't get the 'auto-complete' happening, so you have to know the object model pretty much inside out!)
-
I know this is an old thread. But i finally got to the bottom of it.
I had a problem using automation with word (I had to use early binding - I was using the range object - but it made no difference if I used late-binding anyway)
Word 2002 (and MSWORD.OLB) worked fine. But it just wouldn’t work with Word 2000 (with MSWORD9.OLB).
I uninstalled MS Word 2002 (which VB reference MSWORD.OLB) and installed Word 2000 and allowed VB to reference MSWORD9.OLB be default on the development machine. Compiled and packaged it, and it worked! on everything! Win 98 and up. Word 2000 and up - you name it!
If you find a similar problem, just use an earlier version of Word on the development machine. Microsoft are aware of a back-compatibility problem (XP returns a message 'illegal instruction and needs to close') with Word and VBA, but do stress it is forward compatible.
Once again, thanks for everyone that helped me out.
J.