Compiler constants can only be used in the compiler. This means that you need to configure constant values before deployment, for example:
sFile = Left(ThisWorkbook.FullName, InStrRev(ThisWorkbook.FullName, ".")) & "foo"
sFile = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, ".")) & "foo"
- , Excel Access, , , :
Dim app As Object 'Late-binding
Set app = Application
If app.Name = "Microsoft Excel" Then
sFile = Left(app.ThisWorkbook.FullName, InStrRev(app.ThisWorkbook.FullName, ".")) & "foo"
ElseIf app.Name = "Microsoft Access"
sFile = Left(app.CurrentDb.Name, InStrRev(app.CurrentDb.Name, ".")) & "foo"
End If