Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 21st, 2007, 08:15 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Constant Expression Required

I am getting the 'Constant expression required' error on the following lines of code:

Public dblAlertThresholds(0 To MaxTabs - 1, 1 To NumAlertThresholds) As Double

...

Public Const MaxTabs As Integer = 20

The debugger highlights the term 'MaxTabs' on the first line above and gives the error message. I do not understand why it is doing this as it is a constant I am using to dimension the array. The exact same piece of code was working before but now it isn't and I'm going crazy trying to find out why...

Thanks in advance for help.

John

 
Old May 21st, 2007, 08:38 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just fixed this problem myself but still have no idea why it happened. I simply replaced 'MaxTabs - 1' with '20 - 1' and compiled the project. I then changed it back to 'MaxTabs - 1' and compiled again and it worked! Very odd.






Similar Threads
Thread Thread Starter Forum Replies Last Post
C# constant functions viveksrivastava C# 4 December 6th, 2007 10:44 PM
Message> in query expression <expression>. (Error ybg1 Access 5 July 15th, 2007 05:42 AM
Constant in VBScript savoym VBScript 2 May 18th, 2005 06:53 AM
Static vs constant stoneman Access 2 December 10th, 2003 09:12 PM
'Constant' Error MattLeek Access VBA 2 September 14th, 2003 08:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.