標題: [發問] 請問 Range 與 讀出篩選列數 ,如何改寫? [打印本頁] 作者: momo020608 時間: 2019-5-12 21:03 標題: 請問 Range 與 讀出篩選列數 ,如何改寫?
本帖最後由 momo020608 於 2019-5-12 21:04 編輯
請問各位大哥們
Sub Mail_workbook_Outlook_1()
'Working in Excel 2000-2016
'This example send the last saved version of the Activeworkbook
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
''' Copy range as picture onto Clipboard
rgExp.CopyPicture Appearance:=xlScreen, Format:=xlPrinter
''' Create an empty chart with exact size of range copied
With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
Width:=rgExp.Width, Height:=rgExp.Height)
.Name = "myChart"
.Activate
End With
''' Paste into chart area, export to file, delete chart.
ActiveChart.Paste
ActiveSheet.ChartObjects("myChart").Chart.Export ThisWorkbook.Path & "\" & Range("A" & rgExp.Row).Value & ".jpg"
ActiveSheet.ChartObjects("myChart").Delete
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "未繳款" & Date & WeekdayName(Weekday(Date)) & Time
.Body = "未繳款" & Date & WeekdayName(Weekday(Date)) & Time
'.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
.Attachments.Add ("C:\Users\tcfv\Desktop\" & Range("A" & rgExp.Row).Value & ".jpg")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Sheets("內帳管理").Select
End Sub
謝謝大家作者: momo020608 時間: 2019-5-12 21:45
Sub Mail_workbook_Outlook_1()
'Working in Excel 2000-2016
'This example send the last saved version of the Activeworkbook
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
Dim rgExp As Range
ActiveSheet.Range("輸出報表!A1:V4001").AutoFilter Field:=22, Criteria1:="<>"
Set rgExp = Range("a1", ActiveSheet.Range("v65536").End(xlUp))
''' Copy range as picture onto Clipboard
rgExp.CopyPicture Appearance:=xlScreen, Format:=xlPrinter
''' Create an empty chart with exact size of range copied
With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
Width:=rgExp.Width, Height:=rgExp.Height)
.Name = "myChart"