Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Excel 5.0 compatability problem?

Bill,

I guess that it is telling you that Default is a reserved word that you
cannot now use as a variable name.

The other looks like testing a string for False won't work. Try changing the
declaration of LotReq to variant.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bill C" wrote in message
...
I wrote a macro using Excel 5.0 and it has been running great for several
years using 5.0 but client has upgraded to newer version of Excel and
problems exist.
Dim LotReq As String
Message = "Choose ""OK"" For All Lots, Or " & Chr(13) & "Enter
Lot Number Requested."
Title = " CHOOSE LOT"
Default = "ALL"
LotReq = InputBox(Message, Title, Default)
If LotReq = "" Or LotReq = False Then EndAll

The following statements are not working:
Default = "ALL" ( get error about const assignment )
If LotReq = "" Or LotReq = False Then EndAll ( stops program )
Also Excel appears to be returning "false" on this statement when Pmts =
0.00
If Pmts = False Then EndAll

I do not have access to current Excel program. Can anyone spot the

problem?

TIA,
Bill C.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Excel 5.0 compatability problem?

Current versions of VBA support "named arguments" (equivalent to built-in variable names).

In the case of InputBox, the names of the 1st 3 arguments are Prompt, Title, and Default.

Excel is probably getting confused by your use of Title and Default as variable names. Try
changing them, perhaps by adding an underscore at the end: Title_ and Default_

Names arguments allow you to supply the arguments in any order if you use the syntax like this:

LotReq = Inputbox(Title:=Title_, Default:=Default_, Prompt:=Message)

As for the problem with the comparison, first let me say that it works for me in Excel XP. If I
write

Dim x As String
x = "0.00"
Debug.Print x = False

It prints True.

But if this isn't working for you then I would convert the string to a number using the CDbl
function, then compare with the numeric value 0:

If LotReq = "" Or CDbl(LotReq) = 0 Then EndAll

I assume EndAll is the name of another sub?

PS: It's a good idea to Dim all of your variables. There are no Dim statements for Message,
Title, and Default.


On Sun, 6 Jun 2004 13:51:01 -0700, "Bill C" wrote:

I wrote a macro using Excel 5.0 and it has been running great for several
years using 5.0 but client has upgraded to newer version of Excel and
problems exist.
Dim LotReq As String
Message = "Choose ""OK"" For All Lots, Or " & Chr(13) & "Enter
Lot Number Requested."
Title = " CHOOSE LOT"
Default = "ALL"
LotReq = InputBox(Message, Title, Default)
If LotReq = "" Or LotReq = False Then EndAll

The following statements are not working:
Default = "ALL" ( get error about const assignment )
If LotReq = "" Or LotReq = False Then EndAll ( stops program )
Also Excel appears to be returning "false" on this statement when Pmts =
0.00
If Pmts = False Then EndAll

I do not have access to current Excel program. Can anyone spot the problem?

TIA,
Bill C.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 5.0 compatability problem?

I wrote a macro using Excel 5.0 and it has been running great for several
years using 5.0 but client has upgraded to newer version of Excel and
problems exist.
Dim LotReq As String
Message = "Choose ""OK"" For All Lots, Or " & Chr(13) & "Enter
Lot Number Requested."
Title = " CHOOSE LOT"
Default = "ALL"
LotReq = InputBox(Message, Title, Default)
If LotReq = "" Or LotReq = False Then EndAll

The following statements are not working:
Default = "ALL" ( get error about const assignment )
If LotReq = "" Or LotReq = False Then EndAll ( stops program )
Also Excel appears to be returning "false" on this statement when Pmts =
0.00
If Pmts = False Then EndAll

I do not have access to current Excel program. Can anyone spot the problem?

TIA,
Bill C.


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
excel compatability stew Excel Discussion (Misc queries) 1 June 10th 09 02:08 PM
Excel Compatability mode?????? Terry Excel Discussion (Misc queries) 0 December 6th 08 09:13 PM
Excel 2007 Compatability Tintin Excel Discussion (Misc queries) 0 June 5th 06 05:19 AM
Excel VBA Backwards Compatability Problem - 2002-97 reniep Excel Programming 4 February 23rd 04 09:17 AM
Excel 2002 and 97 compatability Andy Excel Programming 2 July 22nd 03 09:39 PM


All times are GMT +1. The time now is 08:56 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"