Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Store name of 'to:' in var (2000)

    I use this code to send an e-mail...
    Butr before to press "send" is possioble to retrive the name of "to:" and store in a var, similar: my_var_Sendto
    Sub INVIO_SOSPESI(AGENZIA_SEND, SETTORE_SEND)

    Dim SITUAZ1 As String
    Dim TESTO As String
    Dim OutApp As Object
    Dim OutMail As Object
    Dim TEMPNAME As String
    Dim DATA As Date
    Dim DRIVER As String, DATA_SALVA As String
    Dim GIORNO As String, MESE As String, ANNO As String

    SITUAZ1 = Right(Sheets("T0018").Range("L1").Value, 10)

    TESTO = "Di seguito vi rimettiamo il -REPORT ANALITICO- dei nominativi CON FIDI SCADUTI O A SCADERE NEI PROSSIMI TRE MESI rilevati dal tabulato T0018 aggiornato al " & SITUAZ1 & " ( Potrebbero quindi essere ricompresi rapporti in corso di lavorazione)." & vbCrLf & "Per le posizioni che devono essere rinnovate restiamo in attesa della documentazione ISTRUTTORIE di rito, inoltre, al fine di ottimizzare le modalità operative, sarà vostra cura richiedere, all'atto dell'inoltro della documentazione, le sole visure IPOCATASTALI. Tutte le altre richieste (CAMERALI, C.R. ecc.) restano a cura dell’A.C.A. " & vbCrLf & vbCrLf & _
    "F. FIORITTI" & vbCrLf & "DIVIS.RETAIL E PRIVATE " & vbCrLf & "DIR.TERR.RETAIL SUD " & vbCrLf & "AREA NAPOLI "

    Application.ScreenUpdating = False
    Application.EnableEvents = False

    DRIVER = "GCD01F4500DATIPUBBLICAANTIRIC"

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    DATA = Format(CDate((Now)), "MM/DD/YYYY")
    GIORNO = Left(DATA, 2)
    MESE = Mid(DATA, 4, 2)
    ANNO = Right(DATA, 4)
    DATA_SALVA = GIORNO & "-" & MESE & "-" & ANNO

    Worksheets("TEMPLATE").Copy

    TEMPNAME = DRIVER & "T0018" & AGENZIA_SEND & " - " & SETTORE_SEND & "- T0018 -" & DATA_SALVA & ".xls"

    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs TEMPNAME
    ActiveWorkbook.Close
    Application.DisplayAlerts = True

    On Error Resume Next

    With OutMail

    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "RIF. E-MAIL RESPONSABILE CLIENTELA BUSINESS DEL 26/9/2007 - TABULATO T0018 - PER L'AGENZIA " & AGENZIA_SEND & " - SETTORE -" & SETTORE_SEND & ""
    .Body = TESTO & vbCrLf & vbCrLf
    .Attachments.Add TEMPNAME
    .Display
    '.Send

    End With

    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    Application.EnableEvents = True
    Application.ScreenUpdating = True

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Store name of 'to:' in var (2000)

    No, not as far as I know.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Store name of 'to:' in var (2000)

    ok...
    My idea...
    I if i dont remeber wrong, i have see a very big time ago, is possible to find with LDAP or Vbscript if user existis or not in address list of Outlook Server...
    If yes, before to insert the name of user in "to:", i want to use a userform with box where the i insert a name tipical "user1" and scan in list of user in Outlook if existis store the name in var and put it in ".to:" in code...
    Wath you think about?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Store name of 'to:' in var (2000)

    I don't know about that. You could replace the line

    .To = ""

    with

    Dim OutRecip As Object
    Dim strName As String
    strName = InputBox("Enter recipient")
    Set OutRecip = .Recipients.Add(strName)
    If OutRecip.Resolve = False Then
    MsgBox "Recipient not recognized."
    End If

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Store name of 'to:' in var (2000)

    Tks...
    See wath i found:
    Option Explicit
    Dim NOME_TROVATO As String
    Sub CERCA_NOME()

    If ResolveName("OI24683") Then
    NOME_TROVATO = UCase(NOME_TROVATO)
    Else
    MsgBox ("NOME ERRATO")
    End If

    End Sub
    Function ResolveName(NameToTest As String) As Boolean
    Dim myOlApp As Outlook.Application
    Dim myNamespace As Outlook.NameSpace
    Dim myRecipient As Outlook.Recipient
    Dim CalendarFolder As Outlook.MAPIFolder
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNamespace = myOlApp.GetNamespace("MAPI")
    Set myRecipient = myNamespace.CreateRecipient(NameToTest)
    myRecipient.Resolve
    NOME_TROVATO = myRecipient
    ResolveName = myRecipient.Resolved

    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •