Another shot at Office version installed

Started by stanl, July 01, 2023, 07:11:27 AM

Previous topic - Next topic

stanl

First, have to admit I'm out of sorts with WB registry queries. But I need a way to determine if Ace 12 or Ace 16 Provider should be used in updating scripts I wrote long ago where only 12 was used, but users have upgraded to 64 bit or Office 365 or plan to...


This looks quick and possible as a function
Code (WINBATCH) Select


keys = RegQueryItem(@REGMACHINE, "Software\RegisteredApplications\")
delim = Num2Char(255)
count = ItemCount(keys, @TAB)
Message("keys",count)
If count > 0 then
   items=""
   For i = 1 to count
      items = items:ItemExtract(i, keys, @TAB):@LF
   Next
   Message("Registered Applications",items)
End if



For sanity sake I would only be interested in the number associated with Excel.Application [I have tested and it could be 12 or 16] this would be the version of Office installed and hopefully the Ace Provider is registered to match.


So, given what the code provides, how to break out the Excel.Application number?

stanl

I hacked at it and this gets what I needed. Updating some old scripts to determine if ACE OLEDB Provider should be 12.0 or 16.0
Code (WINBATCH) Select


#DefineSubRoutine OfficeVersion()
keys = RegQueryItem(@REGMACHINE, "Software\RegisteredApplications\")
delim = Num2Char(255)
count = ItemCount(keys, @TAB)
retval=""
If count > 0 then
   For i = 1 to count
      item = ItemExtract(i, keys, @TAB)
      If StrSub(item,1,5) == "Excel"
         retval = ItemExtract(3,item,"."):".0"
      Endif
   Next
End if
If retval=="" then retval = "Office may not be registered"
Return(retval)
#EndSubRoutine
oVersion =  OfficeVersion()
Message("Office Version",oVersion)