Results 1 to 7 of 7

Thread: Word Application version

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    Does anyone know a good way to find out what version of Word the current machine is running. I know it is a registry thing but I am not sure how to figure it out.

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    This is how I check for 95 or 97. I don't use 2000 yet.


    Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long

    Dim nlKeyHandle As Long

    If RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Office\8.0", 0, KEY_ALL_ACCESS, nlKeyHandle) = ERROR_NONE Then
    appmain_sGetWordVersion = "Word97"
    RegCloseKey (nlKeyHandle)
    ElseIf RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Microsoft Office\95", 0, KEY_ALL_ACCESS, nlKeyHandle) = ERROR_NONE Then
    appmain_sGetWordVersion = "Word95"
    RegCloseKey (nlKeyHandle)
    Else
    appmain_sGetWordVersion = "None"
    End If

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    I understand that code perfectly. I even went into the MSDN library to get the low down on all of the parameters. However, the machine that i tested that code on has Office 97 on it and I went into regedit and checked everything, and it is in there correctly BUT I get error value 6 every time I run this code. Any ideas of what I should do now.

  4. #4
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    This is what Microsoft says about an err.number of 6:


    6 Overflow
    --------------------------------
    Possible causes for this error are:
    - The result of an assignment, calculation, or data type conversion is too large to be represented within the range allowed for that type of variable.
    - An assignment to a property exceeds the maximum value the property can accept.
    - The value specified is outside the allowed range of values for this data type.
    - PRINT method output has exceeded the 0 - 254 print range determined by the CurrentX and CurrentY property values.

    POSSIBLE SOLUTIONS:
    - When creating a new index on an ISAM table, if 28 indexes already exist for the table, delete an index before creating a new one. The combined width of the column(s) you name for the index cannot exceed 255 bytes.
    - When opening an ISAM table, you can have a maximum of 60 long columns (arrays, user-defined types, or strings longer than 255 bytes) open.

    None of that seems to apply. Could you post the code you are playing with so we can see if we can find it?

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    First of all I just want to say thank you for trying to help me find my problem. What a cool site to goto when you are having problems with you code. It is good to be able to take a problem to someone else, if you have been working on something for awhile it is hard to step away and look at it from a different angle.

    OK, i just set up a new, little project with one command button. I put the declarations at the top of the code. Then in command1_click event i put the rest of the code that you(HDR) posted. I wet a watch on the line:

    RegOpenKey
    (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Office\8.0", 0, KEY_ALL_ACCESS, nlKeyHandle)

    and it value is 6
    i checked the registry and the path DOES exist.
    i am not sure why it does not recognize it.
    any suggestions.


  6. #6
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    Maybe it would have helped if I would have put all of the variable definitions in the post. I will play with your code in the mean time. Here they are:


    Public Const HKEY_LOCAL_MACHINE = &H80000002
    Public Const KEY_ALL_ACCESS = &H3F
    Public Const ERROR_NONE = 0
    Public Const ERROR_BADDB = 1
    Public Const ERROR_BADKEY = 2

  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    That is funny HDR, that was going to be my next question. I looked at HKEY_LOCAL_MACHINE and it said empty so I came to ask about setting that up and when I got here to post reply you already answered my question.

    So thank you alot for your help. It is greatly appreciated.

Posting Permissions

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



Click Here to Expand Forum to Full Width