Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Version of certain apps that are installed

Status
Not open for further replies.

Shamous

IS-IT--Management
Jun 23, 2001
82
US
In our office, we have 50+ machines, some are running Outlook 98 and some Outlook 2000. Is there a way programatically check what version of Outlook(or anyother app for that matter) that is install on a given machine?

knowing this data, I can then set the appropriate referrences/librarys for the actual application.

thanks
 
It wasn't Access but I used "early-binding" at design-time and "late-binding" for the production compile of a VB program that used the WebBrowser Control with both IE 5 and IE4. My machine was IE5. I made sure to only use methods compatible with both versions, used Set ... = CreateObject... rather than any Dim ... As New or Set ... As New,
Private mobjWeb As WebBrowser
at design-time to get Intellisense etc but then changed it to
Private mobjWeb As Object 'WebBrowser
for the production compile.
MS recommends "late-binding" for EXE Automation since they realized that "binary compatibility" was pipe dream. Compare Code (Text)
Generate Sort in VB or VBScript
 
Thanks for the help. I tried what you said and it worked for the most part with word, but some of the methods don't seem to work, why? Is there different syntex structure after you change the objects. For example: For Word you have before: Dim objWord as New Word.Application
change to Dim ObjWord as Object then you add

Set objword = CreateObject("Word.Application") This works, but how do feed the 'subobjects' like objWordDocument. The following example gives an error:

objWordDoc.Protect wdAllowOnlyComments, , [somepassword]

why?
 
The only thing I see wrong is you Set ObjWord but referred later to objWordDoc.
You access the sub-objects in the same way as you did before.
If you had
Dim objWord as New Word.Application
you must have used
objWord.ActiveDocument.etc ' Notice the DOT (you left it out in your example)
You just substituted Set objWord = CreateObject("Word.Application") for "As New".
The only difference is how you set the object reference; nothing else changes except you lose intellisense with As Object. Keep the reference to Word in Project Properties so that you can use the constants like wdAllowOnlyComments. These are compile time constants.

In case you don't know, you can type the first couple of characters of a name or constant then press Ctrl-Space to complete the word or get a list of "possibles".

Compare Code (Text)
Generate Sort in VB or VBScript
 
dim objword as object
set objword = CreateObject("Word.Application")
.
.
objword.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

John, this line does not work. It does not like 'wdDoNotSaveChanges'. I get the error 'variable not define'

Thanks

Rusty
 
On my Access 2000 I created a dummy table, pressed Al+F11 to get Visual Basic. I clicked Tools / References and selected Microsoft Word 9.0 Object Library. I added this code as a module.
Option Compare Database
Option Explicit
Sub x()
Dim objword As Object
Set objword = CreateObject("Word.Application")
objword.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
End Sub

I pressed Debug / Compile with no problems.

Do you have a reference to Word so that the wdconstants are available. You can use Word Object Library for constants and still be "late-bound" because the constants aree conmverted at compiled time to the appropriate number.


Compare Code (Text)
Generate Sort in VB or VBScript
 
I turned off the Word9.0 library. Thats sort of the point isn't it. I want to send my application out with as few librarys as possible. Anyway, I got it to work. If the referrences are not set, the CONST within that library won't work. You either have to set

Const wdDoNotSaveChanges = 0

or just use the number 0.

This works fine now. Than you for all your help. The same principle should work with Outlook any version, but it seems to be trickier.

You were right about Early vs. Late binding. Microsoft is now backpeddling with that issue. In a multi-version world, its impossible and even though Late binding is slower, its much more easy to administrate.

thanks again,

Rusty
 
Well, at least you got it working BUT you went further than you had to.

You don't get the point yet about the libraries. You NEVER ship libraries anyway, even with early-binding (although the VB6 PDW erroneously, according to MS, includes the libraries). They are for compile time ONLY. I use the libraries ALL the time so that I can get the constants without looking them up AND I can switch back to "As Word.Application" in design-mode to get Intellisense. It is the "As Object" that gives you late-binding, not the absence of the library in references. Compare Code (Text)
Generate Sort in VB or VBScript
 
Yes, that is true for compiled VB Applications, but not Access running real time on 50 machines. True?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top