仅从 vba 中的 Excel 中通过电子邮件发送选定范围内的可见单元格

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16934230/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 21:27:44  来源:igfitidea点击:

emailing selected range only visible cells from excell in vba

excelvbaemail

提问by murugan_kotheesan

i have th below code to send an email from excell which has the selected range of the active sheet in the body of mail

我有下面的代码来从 Excel 发送一封电子邮件,该电子邮件在邮件正文中选择了活动工作表的范围

  Sub Ticke_status_mail()

   ' Select the range of cells on the active worksheet.
   ActiveSheet.Range("A12:J74").Select

   ActiveWorkbook.EnvelopeVisible = True

   With ActiveSheet.MailEnvelope
      .Item.To = "[email protected]"
      .Item.subject = "Ticket status on " & ActiveSheet.Range("today").Value
      .Item.Send
   End With
End Sub

but is is also sending the hidden rows in the selected rang which should not come in the mail, could some one help in selectimg only visible cells in that range....

但是也在发送所选范围中不应该出现在邮件中的隐藏行,有人可以帮助选择该范围内的可见单元格....

回答by KV Ramana

try with ActiveSheet.Range("A12:J74").SpecialCells(xlCellTypeVisible).select

尝试 ActiveSheet.Range("A12:J74").SpecialCells(xlCellTypeVisible).select