读取Excel表的最后一行和最后一列的代码是什么?
早上好,
我在下面有此代码,该代码在电子邮件的正文中发送带有附件(Excel文件)的电子邮件(Excel文件)和表格。
Sub Email()
Dim outapplication As Object
Dim nEmail As Object
Set outapplication = CreateObject("outlook.application")
Set nEmail = outapplication.CreateItem(olMailItem)
strTime = Date
With nEmail
.Display
.To = "[email protected]"
.CC = ""
.Subject = "Email's title" & " " & strTime
.attachaments.Add "G:\path\test.XLSX"
With .GetInspector.WordEditor.Windows(1).Selection
.typetext "E-mail's body"
.typeParagraph
.typeParagraph
.typetext "Following the table:"
.typeParagraph
.typeParagraph
.typeParagraph
Sheets("TOP").Select
ActiveSheet.Range("a1:B21").Copy 'Here to change the code
.Paste
.typeParagraph
.typeParagraph
Application.CutCopyMode = False
End With
.Send
End With
Set outapplication = Nothing
Set nEmail = Nothing
End Sub
- 我想选择一个特定的表(因为它是从“ A1:B21”中),我希望代码检查表的最后一列和最后一行。
Good morning,
I have this code below that send an email with an attachement (excel file) and a table in email's body.
Sub Email()
Dim outapplication As Object
Dim nEmail As Object
Set outapplication = CreateObject("outlook.application")
Set nEmail = outapplication.CreateItem(olMailItem)
strTime = Date
With nEmail
.Display
.To = "[email protected]"
.CC = ""
.Subject = "Email's title" & " " & strTime
.attachaments.Add "G:\path\test.XLSX"
With .GetInspector.WordEditor.Windows(1).Selection
.typetext "E-mail's body"
.typeParagraph
.typeParagraph
.typetext "Following the table:"
.typeParagraph
.typeParagraph
.typeParagraph
Sheets("TOP").Select
ActiveSheet.Range("a1:B21").Copy 'Here to change the code
.Paste
.typeParagraph
.typeParagraph
Application.CutCopyMode = False
End With
.Send
End With
Set outapplication = Nothing
Set nEmail = Nothing
End Sub
-I would like to instead of selecting a specific table (as it is from "a1:b21"), I would like the code to check the last column and the last row of the table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论