So it worked for some cases but not for all cases and I figured out that's because CurrentBrowser.URLReferrer only takes the previous link if it was a selection from the site. When an error in entering the url through the address bar occurs this isn't recorded by CurrentBrowser.URLReferrer and I can't seem to find another macro that checks instead through the currentbrowser's live url eg. www.mainsite/microsite/pagentofound showing pagentofound instead of the actual document's path or name of pagenotfound.