Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Thoght I had this Application.Version solved??

Hi;

My friend has Excel version 9.0 (from Application.Version in a MsgBox). I
have version 10.

I have the following in my startup code:

If Application.Version = "10" Then
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=False, _
AllowFormattingRows:=False, _
AllowInsertingColumns:=False, _
AllowInsertingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=False, _
AllowDeletingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True
Else
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True
End If

It works perfectly on my version 10 machine. His keeps giving an error; the
debugger shows that his machine is not making the jump over the 'Then'
statement to the 'Else' and his error always comes about when his compiler
tries to read the version 10 Protect block (I know the commands are different
in the two versions). I have googled and searched this list. I can find no
hints. The only thing I haven't tried is 'Val(Application.Version) = 10 but
that shouldn't be necessary, should it?

I am baffled.

Regards Bill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Thoght I had this Application.Version solved??

Bill,
Application.Version returns a string not a numeric.

You need to use the numeric 10, not the string "10"
Otherwise, you are comparing the strings "9.0" and "10". And Asc(9)Asc(1)

NickHK

"Bill Case" wrote in message
...
Hi;

My friend has Excel version 9.0 (from Application.Version in a MsgBox). I
have version 10.

I have the following in my startup code:

If Application.Version = "10" Then
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=False, _
AllowFormattingRows:=False, _
AllowInsertingColumns:=False, _
AllowInsertingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=False, _
AllowDeletingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True
Else
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True
End If

It works perfectly on my version 10 machine. His keeps giving an error;

the
debugger shows that his machine is not making the jump over the 'Then'
statement to the 'Else' and his error always comes about when his compiler
tries to read the version 10 Protect block (I know the commands are

different
in the two versions). I have googled and searched this list. I can find

no
hints. The only thing I haven't tried is 'Val(Application.Version) = 10

but
that shouldn't be necessary, should it?

I am baffled.

Regards Bill



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Thoght I had this Application.Version solved??

From the immediate window:

? "9.0" "10"
True

Your doing a string compare. Use Val to do a numerical comparison.

--
Regards,
Tom Ogilvy


"Bill Case" wrote in message
...
Hi;

My friend has Excel version 9.0 (from Application.Version in a MsgBox). I
have version 10.

I have the following in my startup code:

If Application.Version = "10" Then
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=False, _
AllowFormattingRows:=False, _
AllowInsertingColumns:=False, _
AllowInsertingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=False, _
AllowDeletingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True
Else
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True
End If

It works perfectly on my version 10 machine. His keeps giving an error;
the
debugger shows that his machine is not making the jump over the 'Then'
statement to the 'Else' and his error always comes about when his compiler
tries to read the version 10 Protect block (I know the commands are
different
in the two versions). I have googled and searched this list. I can find
no
hints. The only thing I haven't tried is 'Val(Application.Version) = 10
but
that shouldn't be necessary, should it?

I am baffled.

Regards Bill



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Thoght I had this Application.Version solved??

Use Val(Application.Version) and test for 10

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Bill Case" wrote in message
...
Hi;

My friend has Excel version 9.0 (from Application.Version in a MsgBox). I
have version 10.

I have the following in my startup code:

If Application.Version = "10" Then
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=False, _
AllowFormattingRows:=False, _
AllowInsertingColumns:=False, _
AllowInsertingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=False, _
AllowDeletingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True
Else
MembSheet.Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True
End If

It works perfectly on my version 10 machine. His keeps giving an error;

the
debugger shows that his machine is not making the jump over the 'Then'
statement to the 'Else' and his error always comes about when his compiler
tries to read the version 10 Protect block (I know the commands are

different
in the two versions). I have googled and searched this list. I can find

no
hints. The only thing I haven't tried is 'Val(Application.Version) = 10

but
that shouldn't be necessary, should it?

I am baffled.

Regards Bill



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Office application version does not match. Joy Excel Discussion (Misc queries) 0 February 16th 09 01:22 PM
Application.VBE.Version on Excel XP Jeremy Excel Programming 5 May 30th 05 11:03 AM
Conditional Compilation using Application.Version Stephen Bullen[_4_] Excel Programming 0 November 9th 04 08:48 AM
Conditional Compilation using Application.Version Dave Peterson[_4_] Excel Programming 0 November 9th 04 01:13 AM
Help in using Application.Version Tom Ogilvy Excel Programming 0 April 1st 04 04:21 AM


All times are GMT +1. The time now is 08:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"