Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sende/receive email from Excel with Outlook


Hello,

I use the following subroutine to send (and a similar one to receive)
email from Excel using Outlook. My problem is that the user gets a
security alert he must confirm to proceed, with some doubts for someone
on what reply exactly, so I'ld like to disable these alerts.

I've found some posts to solve this issue using different methods to
manage the mail by Excel without using Outlook. But these methods allow
only to send and not to receive email.

I'ld like to know if there is any setting by VBA to disable these
security alerts.

Sub SendImportExport()
On Error GoTo err_hnd
Dim Percorso As String, NomeFileOrigine As String,
NomeFileDestinazione
With ThisWorkbook
Percorso = .Path
ChDir Percorso
NomeFileOrigine = Percorso & "\ImportExport.mdb"
NomeFileDestinazione = Percorso & "\ImportExport.p46"
FileCopy NomeFileOrigine, NomeFileDestinazione
Application.DisplayAlerts = False
'.SaveAs "TEMP" & NomeFile 'Salva il file con un nome preceduto da
"TEMP"
End With

'Qui comincia l’avventura, con Outlook-Bonaventura:
Dim Outlk As New Outlook.Application 'Apre un’istanza di MS Outlook
Dim MioMess As MailItem

DoEvents
'Imposta una letterina Outlook...
Set MioMess = Outlk.CreateItem(olMailItem)
'... e ne stabilisce gli estremi

With MioMess '
'.To = InputBox("Digitare l'indirizzo dei Gestori Operativi
destinatari del file (es. ; )", "Invio
ImportExport.mdb")
CC = "
Subject = "Invio file ImportExport.p46"
'.Body = InputBox("Breve comunicazione per i destinatari
(facoltativa)", "Comunicazioni")
Attachments.Add NomeFileDestinazione 'NON dimenticare la "\" !!!
Display 'Visualizza il messaggio
Send
'ISTRUZIONE EVENTUALE PER SPEDIRE IL MESSAGGIO
End With
'Libera le variabili-oggetto (istruzione qui facoltativa)
Set MioMess = Nothing
Set Outlk = Nothing
Kill NomeFileDestinazione
Exit Sub
err_hnd:
Select Case Err
Case 53 ' file non trovato
Resume Next
Case Else
MsgBox Err.Description & "/" & Err.Number & " Sub Export"
End Select
Resume Next
End Sub

Thanks


--
eggpap

Emiliano
Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile:
http://www.thecodecage.com/forumz/member.php?userid=90
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=90790

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Sende/receive email from Excel with Outlook

You should be able to find something to help you here

http://www.rondebruin.nl/sendmail.htm

"eggpap" wrote:


Hello,

I use the following subroutine to send (and a similar one to receive)
email from Excel using Outlook. My problem is that the user gets a
security alert he must confirm to proceed, with some doubts for someone
on what reply exactly, so I'ld like to disable these alerts.

I've found some posts to solve this issue using different methods to
manage the mail by Excel without using Outlook. But these methods allow
only to send and not to receive email.

I'ld like to know if there is any setting by VBA to disable these
security alerts.

Sub SendImportExport()
On Error GoTo err_hnd
Dim Percorso As String, NomeFileOrigine As String,
NomeFileDestinazione
With ThisWorkbook
Percorso = .Path
ChDir Percorso
NomeFileOrigine = Percorso & "\ImportExport.mdb"
NomeFileDestinazione = Percorso & "\ImportExport.p46"
FileCopy NomeFileOrigine, NomeFileDestinazione
Application.DisplayAlerts = False
'.SaveAs "TEMP" & NomeFile 'Salva il file con un nome preceduto da
"TEMP"
End With

'Qui comincia lavventura, con Outlook-Bonaventura:
Dim Outlk As New Outlook.Application 'Apre unistanza di MS Outlook
Dim MioMess As MailItem

DoEvents
'Imposta una letterina Outlook...
Set MioMess = Outlk.CreateItem(olMailItem)
'... e ne stabilisce gli estremi

With MioMess '
'.To = InputBox("Digitare l'indirizzo dei Gestori Operativi
destinatari del file (es. ; )", "Invio
ImportExport.mdb")
.CC = "
.Subject = "Invio file ImportExport.p46"
'.Body = InputBox("Breve comunicazione per i destinatari
(facoltativa)", "Comunicazioni")
.Attachments.Add NomeFileDestinazione 'NON dimenticare la "\" !!!
.Display 'Visualizza il messaggio
.Send
'ISTRUZIONE EVENTUALE PER SPEDIRE IL MESSAGGIO
End With
'Libera le variabili-oggetto (istruzione qui facoltativa)
Set MioMess = Nothing
Set Outlk = Nothing
Kill NomeFileDestinazione
Exit Sub
err_hnd:
Select Case Err
Case 53 ' file non trovato
Resume Next
Case Else
MsgBox Err.Description & "/" & Err.Number & " Sub Export"
End Select
Resume Next
End Sub

Thanks


--
eggpap

Emiliano
Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile:
http://www.thecodecage.com/forumz/member.php?userid=90
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=90790


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sende/receive email from Excel with Outlook


You should be able to find something to help you here

'Example Code for sending mail from Excel'

(http://www.rondebruin.nl/sendmail.htm)


Thanks Barb,

I've already examined that link, but it's too complex for me.
Since I've to send/receive only one message during every Import/Export
task, I've temporarely solved my issue disabling (sending the mail) the
..send statement and enabling instead the .display, that don't trigger
the security alert. In this manner the user gets the new message Outlook
window with attachment already attached, the default recipients and
message subject already specified. He must only specify (if he likes)
other recipients and the body message and press the send button.

For the receiving task I've got the freeware program Express ClickYes
that "press" automatically the Yes button when Outlook asks if you like
to enable the application access to the inbox folder.

This could be a simple method to solve this issue to manage only one
message per time.

Regards,


--
eggpap

Emiliano
Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=90790

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I calculate the percentage of email i receive over time Pearl[_2_] Excel Discussion (Misc queries) 1 April 17th 10 09:13 PM
how to remove the outlook confirm window when use excel to send email from outlook? Tom Cai Excel Programming 3 March 4th 09 03:35 AM
excel close everytime I receive an email with lotus notes 6.5.5 sigh Excel Discussion (Misc queries) 0 May 31st 06 06:53 AM
microsoft outlook unable to perform operation - send = receive. heibner Excel Discussion (Misc queries) 1 July 13th 05 09:05 AM
Late Binding to Outlook from Excel: Outlook modifies email body Lenny Wintfeld Excel Programming 0 December 12th 04 04:03 PM


All times are GMT +1. The time now is 09:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"