- 帖子
- 62
- 主題
- 13
- 精華
- 0
- 積分
- 109
- 點名
- 0
- 作業系統
- Win 10家用版
- 軟體版本
- Office 2013
- 閱讀權限
- 20
- 性別
- 女
- 來自
- 新北
- 註冊時間
- 2016-1-27
- 最後登錄
- 2024-8-12
|
請教各位大大:
想在excel表格AJ4欄位雙擊滑鼠後,
將M2:V27這個範圍複製成tif檔(儲存於桌面),
再開啟outlook程式新郵件後
1.將桌面的tif檔加入附件中
2.再另外複製M2:V27範圍成圖片,貼在郵件內文中
目前有問頭如下:
1.M2:V27這個範圍複製成tif檔,儲存到桌面後,檔案是空值無資料。
因老闆要求,檔案必須為tif檔
2.複製M2:V27範圍成圖片,貼在郵件內文中:
有在剪貼簿,但是新郵件時,不會出現在內文,要自己手動再按貼上才有....
請問以上程式碼該如何修正?
感謝各位大大~~~~- Sub Mail_Range()
- Dim Source As Range
- Dim temp As Object, newmail As Object, strg As String
-
- Set Source = Nothing
- On Error Resume Next
-
- '新增程式碼開始,作用中儲存格停在哪個部門別,就設定為Source
-
- If ActiveCell.Address = Cells(4, 14).Address Then
- Set Source = Range("M2:V27").SpecialCells(xlCellTypeVisible)
- ElseIf ActiveCell.Address = Cells(4, 36).Address Then
- Set Source = Range("AI2:AR27").SpecialCells(xlCellTypeVisible)
-
- Source.Copy
-
- Source.CopyPicture
- With ActiveSheet.ChartObjects.Add(1, 1, Source.Width, Source.Height) '新增圖表
- .Chart.Paste '貼上圖片
- .Chart.Export Filename:="C:\Users\paz\Desktop\" & "Paz " & "Salary " & Range("B3") & "-" & Range("D3") & ".tif" '匯出圖片
-
- .Delete '刪除圖表
- End With
-
- Set temp = CreateObject("outlook.application")
- Set newmail = temp.CreateItem(0) '使用outlook?建新?件
- With newmail
- .To = "[email protected]" '收件人
- .CC = "" '抄送人
- .Subject = "Salary " & Range("B3") & "-" & Range("D3") '?件??
- .Body = Selection.PasteSpecial
- .Attachments.Add "C:\Users\paz\Desktop\" & "Paz " & "Salary " & Range("B3") & "-" & Range("D3") & ".tif" '添加附件
- .Display
- '.Send
- End With
- Else
-
- End If
- End Sub
複製代碼
|
|