It could be easily macro permission thing. Take a look at this topic
Or you can do it directly in the code, not need for macro. Just use attachment API.
The code below is not fully tested it just to give you the direction:)
(https://docs.kentico.com/api11/content-management/attachments)
<script runat="server">
protected void Page_PreRender(object sender, EventArgs e)
{
CMS.DocumentEngine.TreeProvider tree = new CMS.DocumentEngine.TreeProvider(CMS.Membership.MembershipContext.AuthenticatedUser);
// Gets a page
CMS.DocumentEngine.TreeNode page = tree.SelectNodes()
.Path("/News/%")
.OnCurrentSite()
.Culture("en-us")
.FirstObject;
string attachmentGUID = "";
if (page != null)
{
foreach (CMS.DocumentEngine.DocumentAttachment attachment in page.AllAttachments)
{
if (someCondition) {
attachmentGUID = attachment.AttachmentGUID.ToString();
break;
}
}
}
test.Text = attachmentGUID ;
}
</script>
<asp:Literal runat="server" ID="test" Text="test" />