简体   繁体   中英

VBA Sendmail via Outlook using cell references

The code works absolutely fine with the email address and attachment file path typed directly into the cell location. When I link the cell reference to another worksheet (ie, that same cell set = to the reference cell elsewhere), however, it won't send if either of those two aren't directly typed-in. Not sure why, as the other cells have no issue.

You are looping through .SpecialCells(xlCellTypeConstants) . By this you are excluding formulas from the loop. Reference to other cel is xlCellTypeFormulas

So just change it to loop through all cells without restrictions:

For Each cell In Sh.Columns("A").Cells

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM