2017-10-05 30 views
0

我在自動化程序中遇到了障礙。下面將概述:回覆基於Excel的電子郵件價值

  1. 創建表格可在網上&允許用戶填寫Excel表格,然後點擊提交(提交後,電子郵件將被髮送&字段將被調換到Tracker在共享驅動器)
  2. 電子郵件將顯示在收件箱和Outlook規則將電子郵件到不同的文件夾斷基於主題行

    現在我停留在

    在我跟蹤的一部分,我有一些規則,以在到達排序decisio ñ。簡而言之,基於特定的單元格值(列H),我需要使用預定義的模板來響應原始電子郵件(模板具有從用戶表單引用的3個字段)。

    我堅持的部分是如何在Outlook中回覆原始電子郵件以及我的自動決定?

    請幫助:)

+0

https://stackoverflow.com/questions/31817632/outlook-reply-to-an-email – braX

+0

@braX唯一的問題是,我的預定義模板將使用3場最初的excel用戶表單。以上解決方案只會回覆電子郵件號碼?有點新的VBA,但我認爲收到新的電子郵件時,我需要觸發另一個宏也許? – selvend2

+0

只是有點不確定如何觸發/打開我的excel文件 – selvend2

回答

0

所以,你要發送的郵件,如果一個小區有一個特定的值,對吧。請嘗試下面的腳本。

Private Sub Worksheet_Change(ByVal Target As Range) 
    If Target.Cells.Count > 1 Then Exit Sub 
    If Not Application.Intersect(Range("A1"), Target) Is Nothing Then 
     If IsNumeric(Target.Value) And Target.Value > 200 Then 
      Call YourMacroName 
     End If 
    End If 
End Sub 

Sub Mail_small_Text_Outlook() 
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm 
'Working in Excel 2000-2016 
    Dim OutApp As Object 
    Dim OutMail As Object 
    Dim strbody As String 

    Set OutApp = CreateObject("Outlook.Application") 
    Set OutMail = OutApp.CreateItem(0) 

    strbody = "Hi there" & vbNewLine & vbNewLine & _ 
       "Cell A1 is changed" & vbNewLine & _ 
       "This is line 2" & vbNewLine & _ 
       "This is line 3" & vbNewLine & _ 
       "This is line 4" 

    On Error Resume Next 
    With OutMail 
     .To = "[email protected]" 
     .CC = "" 
     .BCC = "" 
     .Subject = "This is the Subject line" 
     .Body = strbody 
     'You can add a file like this 
     '.Attachments.Add ("C:\test.txt") 
     .Display 'or use .Send 
    End With 
    On Error GoTo 0 

    Set OutMail = Nothing 
    Set OutApp = Nothing 
End Sub 

https://www.rondebruin.nl/win/s1/outlook/bmail9.htm