0

我在 Outlook 中有一个现有的表单,我需要为其创建一个宏。它是一种用于向我们公司办公室提交数据的表格。每次,我都必须填写我的员工编号、地址、名字和姓氏等……有人可以帮我创建一个宏来填写这些字段,这样我就不必每次都复制粘贴或输入我的信息了吗?谢谢!

4

3 回答 3

0

Sub emailfromexcel() Dim OutApp 作为对象 Dim OutMail 作为对象 Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) With OutMail .To = "person@email.com" .BCC = thebcc .Subject = "这个主题" .Body = "这个正文" .Display .Send End With Set OutMail = Nothing Set OutApp = Nothing End Sub

于 2013-06-06T15:20:54.790 回答
0
   Sub emailfromexcel()
    Dim OutApp As Object
    Dim OutMail As Object
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
    .To = "person@email.com"
    .BCC = thebcc
    .Subject = "This subject"
    .Body = "This body"
    .Display
    .Send
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
  End Sub
于 2013-06-06T15:35:23.790 回答
0
 This HTML email creater.  Insert this into the "Visual Basic Editor in Tools>Macro then run the 
 macro "emailpictures".  It will ask for validation.

Sub emailpicture()
    Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
Set objOutlookRecip = objOutlookMsg.Recipients.Add("companyemail@email.com")
objOutlookRecip.Type = olTo
objOutlookMsg.Subject = "Picture"
' add "C:\picture.png as attachment to Outlook message
Set colAttach = objOutlookMsg.Attachments
Set l_Attach = colAttach.Add("C:\path\image.jpg")
' Dereference the  attachment objects before changing their properties via CDO
Set colAttach = Nothing
Set l_Attach = Nothing
'Set body format to HTML
objOutlookMsg.BodyFormat = olFormatHTML
objOutlookMsg.HTMLBody = "<HTML><head></head><BODY><center><table><tr><td><center><h1>Title </h1></center></td></tr><tr><td><center><h1>Body</h1></center><br /></td></tr><img src=""image.jpg"" alt=image><br /><br /></td></tr><tr><td><center><h3>Hope you will have a worderous day!</h3></center><br /><br /></td></tr><tr><td><center><h3>From</h3></center><br /><br /></td></tr></table></center></BODY></HTML>"
objOutlookMsg.Send
Set objOutlookRecip = Nothing
Set objOutlookMsg = Nothing
Set objOutlook = Nothing

结束子

于 2013-06-06T14:41:25.733 回答