# Macroexpand in a module

**URL:** https://discourse.julialang.org/t/macroexpand-in-a-module/4376
**Category:** General Usage
**Created:** [June 20, 2017, 5:13pm UTC](https://discourse.julialang.org/t/macroexpand-in-a-module/4376 "2017-06-20T17:13:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bramtayl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bramtayl/32/3614_2.png) [@bramtayl](https://discourse.julialang.org/u/bramtayl)
#### Post date: [June 20, 2017, 5:13pm UTC](https://discourse.julialang.org/t/macroexpand-in-a-module/4376/1 "2017-06-20T17:13:06Z")

</div>

I saw the recent changes to macroexpand in 0.7, where you can specify a module to resolve macro names in. Is there any way to mimic this ability in 0.6 and earlier?

---

<div class="post-metadata">

### Author: ![bramtayl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bramtayl/32/3614_2.png) [@bramtayl](https://discourse.julialang.org/u/bramtayl)
#### Post date: [June 20, 2017, 5:34pm UTC](https://discourse.julialang.org/t/macroexpand-in-a-module/4376/2 "2017-06-20T17:34:09Z")

</div>

Nevermind, found the answer in a historical version of macrotools:

```julia
if VERSION < v"0.7-"
    my_macroexpand(m::Module, ex) = eval(m, :(macroexpand($(Expr(:quote, ex)))))
else
    my_macroexpand = macroexpand
end

```
