MacroDir$ Function

Syntax

MacroDir[$]

Group

Flow Control

Description

Returns the directory of the current macro. A runtime error occurs if the current macro is not saved.

Sandbox

Sandbox mode can block this function.

Example


Sub Main
    ' open the file called Data that is in the
    ' same directory as the macro
    Open MacroDir & "\Data" For Input As #1
    Line Input #1, S$
    Debug.Print S$
    Close #1
End Sub

See also

MacroRun