Using Conditional Compilation : Conditional Compilation « Language Basics « VBA / Excel / Access / Word

Home
VBA / Excel / Access / Word
1.Access
2.Application
3.Data Type
4.Data Type Functions
5.Date Functions
6.Excel
7.File Path
8.Forms
9.Language Basics
10.Math Functions
11.Outlook
12.PowerPoint
13.String Functions
14.Windows API
15.Word
16.XML
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
VBA / Excel / Access / Word » Language Basics » Conditional Compilation 
Using Conditional Compilation
 
#Const verSpanish = True

Sub WhatDay()
    Dim dayNr As Integer
    #If verSpanish = True Then
        dayNr = Weekday(InputBox("Entre la fecha, por ejemplo 01/01/2001"))
        MsgBox "Sera " & DayOfWeek(dayNr"."
    #Else
        WeekdayName
    #End If
End Sub

Function DayOfWeek(dayNr As IntegerAs String
    DayOfWeek = Choose(dayNr, "Domingo""Lunes""Martes", _
        "Miercoles""Jueves""Viernes""Sabado")
End Function

Function WeekdayName() As String
    Select Case Weekday(InputBox("Enter date, e.g., 01/01/2000"))
        Case 1
            WeekdayName = "Sunday"
        Case 2
            WeekdayName = "Monday"
        Case 3
            WeekdayName = "Tuesday"
        Case 4
            WeekdayName = "Wednesday"
        Case 5
            WeekdayName = "Thursday"
        Case 6
            WeekdayName = "Friday"
        Case 7
            WeekdayName = "Saturday"
    End Select
    MsgBox "It will be " & WeekdayName & "."
End Function


Option Compare Database

Sub getCurrentPath()
MsgBox CurrentProject.Path

End Sub

 
Related examples in the same category
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.