如何使用新的电子邮件自动运行宏到Outlook [英] How I can run macro automatically with new email arrives in outlook

查看:331
本文介绍了如何使用新的电子邮件自动运行宏到Outlook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于VBScript和宏来说,这是非常新鲜的。我有一个vbscript,它将创建电子邮件的票,但我需要每次手动运行这个脚本。为了使自动化,我将宏映射到Outlook中的运行脚本脚本规则,但是当规则运行时,它不会获取邮件中的数据是到达的。它始终使用以前的电子邮件创建票据。



我已经经历了这么多的VBscripts,但没有人将将收到的邮件转换为



如果有人遇到类似类型的问题,请告诉我完整的解决方案。

  Dim olApp As outlook.Application 
Dim objNS As outlook.NameSpace
Dim objSourceFolder As outlook.MAPIFolder
Dim objDestFolder As outlook.MAPIFolder
Dim Msg As outlook.MailItem
设置olApp = outlook.Application
设置objNS = olApp.GetNamespace(MAPI)
设置objSourceFolder = objNS.GetDefaultFolder(olFolderInbox)
设置objDestFolder = objSourceFolder.Folders(Termination)
设置Msg = objDestFolder.Items.GetLast
设置sh = CreateObject(Shell.Application)
Set ie = CreateObject(InternetExplorer.Application)
LocationURL =Ticket URL& Msg.EntryID
ie.Navigate(LocationURL)
ie.Visible = True
使用ie.Document
.getElementById(details)。Value = Msg.Body
.getElementById(short_description)。Value = Msg.Subject
.getElementById(请求者_login)Value =premchand

结束


解决方案

运行mac时从规则中,通常有一个参数触发规则的项目被传递:您不必浏览收件箱以查找该项目。

  Public Sub DoSomething(Item As Outlook.MailItem)

'代表Item

End Sub


Am very new to VBScript and macro . I have a vbscript which will create tickets for email's but I need to run this script manually every time .To make it automation I have mapped my macro to the "run a script" script rule in Outlook but when the rule runs it is not fetching the data in the mail which is arrived .It's creating tickets with previous email always .

I have gone through so many VBscripts but none worked to convert the mail that received in to ticket.

If any one faced similar type of issue please let me know the complete solution.

Dim olApp As outlook.Application
Dim objNS As outlook.NameSpace
Dim objSourceFolder As outlook.MAPIFolder
Dim objDestFolder As outlook.MAPIFolder
Dim Msg As outlook.MailItem
Set olApp = outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
Set objSourceFolder = objNS.GetDefaultFolder(olFolderInbox)
Set objDestFolder = objSourceFolder.Folders("Termination")
Set Msg = objDestFolder.Items.GetLast
Set sh = CreateObject("Shell.Application")
Set ie = CreateObject("InternetExplorer.Application")
LocationURL = "Ticket URL" & Msg.EntryID"
ie.Navigate (LocationURL)
ie.Visible = True
With ie.Document
    .getElementById("details").Value = Msg.Body
    .getElementById("short_description").Value = Msg.Subject
    .getElementById("requester_login").Value = "premchand"

End With

解决方案

When you run a macro from a rule it typically has an argument to which the item triggering the rule gets passed: you do not have to navigate through the Inbox to find the item.

Public Sub DoSomething(Item As Outlook.MailItem)

   'code which acts on "Item"

End Sub

这篇关于如何使用新的电子邮件自动运行宏到Outlook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆