Link to home
Start Free TrialLog in
Avatar of LeighWardle
LeighWardleFlag for Australia

asked on

Problem with Conditional Compilation (VB6)

Hi:

I have the following code at the start of my application:

#If conBetaVersion = 1 Then 'Beta version
    MsgBox "Beta Version"
    '#Const conUseExcel = 0
#Else                   'Production version
    MsgBox "Production Version"
    #Const conUseExcel = 1
#End If

#If conUseExcel = 1 Then
    MsgBox "Using Excel"
#Else
    MsgBox "Using ProEssentials"
#End If

If I run the code WITHOUT setting any Conditioal Compilation Arguments, it works as intended, i.e. it outputs the two messages, "Production Version" then "Using Excel".

When I set the Conditioal Compilation Arguments
field to "conBetaVersion=1" (without the quotes), it outputs the message "Beta Version" (as expected).
But it then also outputs the message "Using Excel".

I cannot work out why this is happening!

Regards

Leigh

ASKER CERTIFIED SOLUTION
Avatar of marconovaro
marconovaro

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Because conUseExcel is never defined anywhere.
Try this

Set your Conditioal Compilation Arguments to

conBetaVersion = 1 : conUseExcel = 0



#If conBetaVersion = 1 Then 'Beta version
   MsgBox "Beta Version"
#Else                   'Production version
   MsgBox "Production Version"
#End If

#If conUseExcel = 1 Then
   MsgBox "Using Excel"
#Else
   MsgBox "Using ProEssentials"
#End If
Avatar of DanRollins
Hi LeighWardle,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept marconovaro's comment(s) as an answer.

LeighWardle, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Avatar of Netminder
Netminder

Per recommendation, force-accepted.

Netminder
EE Admin