Word-Version

T

Torsten Hansen

Hello,

how can I find out, which Word-Version is installed on the computer?
It isn't the command "Application.Version", because I'll launch Word from
another Office-Product (Access, Excel...), so the Word-Object which I create
depends on the Word-Version, which I want to find out.
My problem is, that my programm, where I start the macro is maybe older than
the word-version.

Thanks!

Torsten
 
D

Doug Robbins - Word MVP

Hi Torsten,

While it's a bit more difficult to code for Late Binding, if you use that,
it will not matter what version of Word (97 or later) is in use.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
M

Malcolm Smith

Torsten

If you have a pointer to the Word application, for example in your code:

Set oWord = New Word.Application

then you could use

sWordVersion = oWord.Version

in other words you are changing the 'Application' pointer (see a thread
with myself and Lars a little way north of this one! :) ) to use the oWord
pointer which you have created.


As Lars correctly says, use Late Binding. It is more of a pain but it is
more flexible and providing that the objects exist on the user's machine
(e.g. don't mess with the TaskPain objects if they could be using Word
2000 or less) then it will work.

What I tend to do is to define everything as Early Binding, because I am a
lazy sod, get the code working and then change the object types to Object
and then it ought to work. Mind you a little testing should be used
here...

Hilsen
Malc
www.dragondrop.com
 
H

Helmut Weber

Hi Torsten,
if it has to be:
Dim oW As Object
Set oW = CreateObject("Word.Application")
MsgBox oW.Version
....
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, Win 98
 
L

Lars-Eric Gisslén

Torsten,

Another way to find out which version the version independent identifier
points to is to query the registry like this:

Sub GetCurrentWordVersion()
Dim sKey As String
Dim nPos As Long
Dim sVersion As String

sKey = System.PrivateProfileString( _
"", _
"HKEY_CLASSES_ROOT\Word.Application\CurVer", _
"")

If sKey <> "" Then
nPos = InStrRev(sKey, ".")
sVersion = Mid(sKey, nPos + 1)
MsgBox "Current version of Word is: " & sVersion
Else
MsgBox "Seems like Word is not installed."
End If

End Sub

Regards,
Lars-Eric
 
J

Jonathan West

Torsten Hansen said:
Hello,

how can I find out, which Word-Version is installed on the computer?
It isn't the command "Application.Version", because I'll launch Word from
another Office-Product (Access, Excel...), so the Word-Object which I create
depends on the Word-Version, which I want to find out.
My problem is, that my programm, where I start the macro is maybe older than
the word-version.

Hi Torsten

Karl Peterson described a way of seeing which version of Word is installed
when cintrolling ord from outside. Take a look here
http://www.fawcette.com/vsm/2002_06/magazine/columns/qa/default_pf.asp

Scroll down until you come to "Determine If Word is Installed"

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top