PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Displaying Email and MsgBox simultaneously
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Displaying Email and MsgBox simultaneously
![]() |
Displaying Email and MsgBox simultaneously |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
Lurking trough newsgroups, I wrote an useful macro that, starting from an Excel Db, permits me to email-merge with attachments: Sub SendMail() Dim Riga As Integer Riga = InputBox("Inserisci la riga del Negozio dal quale vuoi iniziare l'Email-Merge") Range("A" & Riga).Select Do Until ActiveCell.Value = "" Dim ol As Object Dim mailitem As Object Set ol = CreateObject("Outlook.Application") Set mailitem = ol.CreateItem(olMailItem) With mailitem .To = ActiveCell.Value .CC = ActiveCell.Offset(0, 1).Value .Subject = "Report number " & ActiveCell.Offset(0, 2).Value .Body = "Buongiorno... " .Attachments.Add (ActiveCell.Offset(0, 5).Value) .Display End With SendKeys "%s" Set ol = Nothing Set mailitem = Nothing ActiveCell.Offset(1, 0).Select Loop End Sub Everything works really fine. Anyway, I'd like to add a Msgbox opening simultaneously with the Displaying of the Email. This should be a Yes-No MsgBox saying "Check the message. Do you want to send it?" I think it's a possible task but I don't know the code that allows it. Can anybody help me? Thanks to all!!! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
.Attachments.Add (ActiveCell.Offset(0, 5).Value)
.Display intYes = MsgBox("your text", vbYesNo + vbQuestion) If intYes Then .Send End If Note that the .Send command will trigger a security prompt. See http://www.outlookcode.com/d/sec.htm -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Fercat" <fercat@libero.it> wrote in message news:J0FWd.7688$WC1.6341@tornado.fastwebnet.it... > Hi, > > Lurking trough newsgroups, I wrote an useful macro that, starting from an > Excel Db, permits me to email-merge with attachments: > > Sub SendMail() > > Dim Riga As Integer > Riga = InputBox("Inserisci la riga del Negozio dal quale vuoi iniziare > l'Email-Merge") > Range("A" & Riga).Select > > Do Until ActiveCell.Value = "" > Dim ol As Object > Dim mailitem As Object > > Set ol = CreateObject("Outlook.Application") > Set mailitem = ol.CreateItem(olMailItem) > > With mailitem > .To = ActiveCell.Value > .CC = ActiveCell.Offset(0, 1).Value > .Subject = "Report number " & ActiveCell.Offset(0, 2).Value > .Body = "Buongiorno... " > .Attachments.Add (ActiveCell.Offset(0, 5).Value) > .Display > End With > > SendKeys "%s" > > Set ol = Nothing > Set mailitem = Nothing > > ActiveCell.Offset(1, 0).Select > Loop > > End Sub > > Everything works really fine. Anyway, I'd like to add a Msgbox opening > simultaneously with the Displaying of the Email. > This should be a Yes-No MsgBox saying "Check the message. Do you want to > send it?" > I think it's a possible task but I don't know the code that allows it. > > Can anybody help me? > > Thanks to all!!! > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

