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!

Wrong code ?

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
I'm using the code below in WORD2010 and it works like it should to check the actual version;

Code:
Function version_check() As Boolean 'WORD function
'define version number
Dim thisversion As Integer
thisversion = 4

'read version from external file called version.txt
Dim Vfso As FileSystemObject
Dim Vfile As File
Set Vfso = CreateObject("Scripting.FileSystemObject")
Set Vfile = Vfso.GetFile("\\cos\share\starlms1\Admin\SEMtools\version.txt")
If thisversion = System.PrivateProfileString(Vfile, "Actual_Version", "WordTools") Then
    	version_check = True
    Else
        version_check = False
End If
Set Vfso = Nothing
End Function

Transfering this code to EXCEL2010....

Code:
Function version_check() As Boolean 'EXCEL function
'define version number
Dim thisversion As Integer
thisversion = 1

'read version from external file called version.txt
Dim Vfso As FileSystemObject
Dim Vfile As File
Set Vfso = CreateObject("Scripting.FileSystemObject")
Set Vfile = Vfso.GetFile("T:\Admin\LIMStools\version.txt")

'check LIMStools version
If thisversion = System.PrivateProfileString(Vfile, "Actual_Version", "ExcelTools") Then
    	version_check = True
    Else
    	version_check = False
End If
Set Vfso = Nothing
End Function

...it produces an error in line:

Code:
If thisversion = System.PrivateProfileString(Vfile, "Actual_Version", "ExcelTools") Then

What is wrong with the EXCEL code ?
 
System is a property of the Word.Application object.
There is no such property in the Excel.Application object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you, that explains a lot !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top