473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Office Library

Does anyone know of a code sample or explanation of how to find the Office
Library (is it 8,9,10,11) on an indiviual computer.

This code detects if it is installed but I am not sure if it will detect if
the right version is installed.. My end user needs Office 2000 or above
versions of excel and word for them to use the reporting functions. If not I
need to disable them. (the reporting functions, not the end user.....:))

Public Enum MSApplications
WORD
EXCEL
End Enum

Public Function isInstalled(ByVal App As MSApplications)
Dim strSubKey As String
Select Case App
Case MSApplications.EXCEL
strSubKey = "Excel.Application"

Case MSApplications.WORD
strSubKey = "Word.Application"
End Select

Dim objKey As RegistryKey = Registry.ClassesRoot
Dim objKey1 As RegistryKey = Registry.ClassesRoot
Dim objsubKey1 As RegistryKey =
objKey1.OpenSubKey("Excel.Application")

Dim objSubKey As RegistryKey = objKey.OpenSubKey("Word.Application")
'does not work MsgBox(objKey.GetValue("Word.Application"))
Return Not objSubKey Is Nothing
objKey.Close()

Return Not objsubKey1 Is Nothing
objKey1.Close()
End Function

Nov 20 '05 #1
4 945

Would you not want to scan the registry for the correct version keys ?

To get started, using Regedit, look under the following:

HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\OFFICE

Then create the code to look for certain key bits of information in this
part of the registry.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #2
Right, this is where I am falling down.
Nov 20 '05 #3

I did a search in the help for 'Registry Key' I came across this. You
would want to change from CurrentUser to LocalMachine, but this should
get you going in the right direction.

Imports Microsoft.Win32
Dim regVersion As RegistryKey
Dim keyValue As String
keyValue = "Software\\Microsoft\\TestApp\\1.0"
regVersion = Registry.CurrentUser.OpenSubKey(keyValue, False)
Dim intVersion As Integer = 0
If (Not regVersion Is Nothing) Then
intVersion = regVersion.GetValue("Version", 0)
regVersion.Close()
End If
The following example reads, increments, and then writes a DWORD value
to HKEY_CURRENT_USER:

Imports Microsoft.Win32
Dim regVersion As RegistryKey
regVersion =
Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microso ft\\TestApp\\1.0",
True)
If regVersion Is Nothing Then
' Key doesn't exist; create it.
regVersion =
Registry.CurrentUser.CreateSubKey("SOFTWARE\\Micro soft\\TestApp\\1.0")
End If

Dim intVersion As Integer = 0
If (Not regVersion Is Nothing) Then
intVersion = regVersion.GetValue("Version", 0)
intVersion = intVersion + 1
regVersion.SetValue("Version", intVersion)
regVersion.Close()
End If

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4

Test Code... It works.... Hope this helps you.
Dim regVersion As RegistryKey
regVersion =
Registry.LocalMachine.OpenSubKey("SOFTWARE\\Micros oft\\Office\\9.0\\Exce
l", False)
If regVersion Is Nothing Then

MsgBox("Not there")
Else
MsgBox("Got it")

End If


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: zfeld | last post by:
1. Where do I get the Office 2003 PIAs? On the MSDN download site there are only downloads for XP office PIAs. Do they automatically get installed to the GAC with the installation of office 2003? ...
13
by: Rolf | last post by:
I have Office97Pro, Office2000Premium and OfficeXP Pro all installed. I'm creating an Access97 application for another person and need to set a reference to Microsoft Office 8.0 Object Library....
6
by: Steve | last post by:
What would happen if an Access97 database had a reference to Microsoft Office 10 library (but only used Access97 stuff) and it was run on a machine that only had Access97 and correspondingly only...
0
by: AllenF | last post by:
I have a library (named DSG) created in C# which other programs use to build Excel spreadsheeets. This library uses the office PIAs "Microsoft.Office.Interop.Excel.dll" and also references the...
4
by: J-T | last post by:
I'm trying to read an excell file in my .Net application using Office XP Primary Interop Assemblies (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp)....
2
by: ian | last post by:
Hi, I used to do lots of work in office, Excel mainly, with VBA, I don't have access to the latest versions of Office, and wondered if they support c#/dotnet natively. Thanks Ian
6
by: Marco Singer | last post by:
Hi all, is there any way to create a VB.NET application that automates MS Word and Excel and works with all Office versions from 97 and newer? I currently have Office XP installed. Ok, I could...
1
by: BK | last post by:
I have a .NET Solution (currently in 2003, FW 1.1) that uses Office automation for a few things (generates a Word document, dumps datagrids to Excel, etc.). One of my programmers works on the...
6
by: Excel 009 | last post by:
Hi, In my office I have Office 2003 on the PC. I created an Access application which has a component reference to Microsoft Office 12.0 Object Library. The problem that I am having now it...
3
by: Chuck | last post by:
I've been having problems with Access and Excel talking to one another. In the process of trying to add features (programs) to Access 97 I have lost the ability to export an Access query to an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.