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






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 Integer) As 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