E
eggpap
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. (e-mail address removed); (e-mail address removed))", "Invio
ImportExport.mdb")
CC = "(e-mail address removed)"
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
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. (e-mail address removed); (e-mail address removed))", "Invio
ImportExport.mdb")
CC = "(e-mail address removed)"
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