简体   繁体   English

使用单元格引用通过Outlook的VBA Sendmail

[英]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) . 您正在遍历.SpecialCells(xlCellTypeConstants) By this you are excluding formulas from the loop. 这样,您就可以从循环中排除公式。 Reference to other cel is xlCellTypeFormulas 对其他cel的引用是xlCellTypeFormulas

So just change it to loop through all cells without restrictions: 因此,只需对其进行更改即可无限制地遍历所有单元:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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