+ Reply to Thread
Results 1 to 5 of 5

Excel ask every time for outlook profile

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Achterhoek/Neede/Holland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Excel ask every time for outlook profile

    Every time i start this code, Outlook is asking for a profile. what do i wrong? if i start outlook first, then there are no questions, but a'm not be able to start everytime outlook first, so this code has to find the profile by itself..

    Code:

    Please Login or Register  to view this content.

    Can somebody help me out??
    kindly regards Henk
    Last edited by arlu1201; 10-24-2012 at 04:10 AM. Reason: Use code tags in future.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel ask every time for outlook profile

    help recommends you do not use logon-use
    Please Login or Register  to view this content.
    instead
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    Achterhoek/Neede/Holland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Excel ask every time for outlook profile

    hI jp,
    Please Login or Register  to view this content.
    This seems to work, everything started whit "Dim"removed

    Now testing, but THANKS, you helped me a lot!

    regards from Holland!
    Henk
    Last edited by JosephP; 10-25-2012 at 02:35 AM.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel ask every time for outlook profile

    my pleasure. please note that arlu and I have had to add code tags to your posts in accordance with forum rules-please use them in future and don't forget to mark this solved if the solution fixes your problem

  5. #5
    Registered User
    Join Date
    09-26-2012
    Location
    Achterhoek/Neede/Holland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Excel ask every time for outlook profile

    This works in excel 2010: (tested)

    Sub Open_Tab_Als_PDF_Mailen()

    Dim OutApp As Object
    Dim OutMail As Object
    Dim SubjectText As String
    Dim MailText As String
    Dim newFile As String
    Dim Vanmail As String
    Dim ToMail As String
    Dim CCmail As String

    If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
    & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then

    Vanmail = ""
    ToMail = Blad6.Range("B36")
    CCmail = Blad6.Range("B35")
    newFile = Blad6.Range("B32") & "\" & "Weekstaat-" & Blad6.Range("B4") & "-Week " & Blad3.Range("B1") & "-" & Blad6.Range("B1").Text & ".pdf"
    On Error Resume Next
    ChDir Blad6.Range("B32")
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    newFile, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    Set OutApp = CreateObject("Outlook.Application")
    Set olNs = olApp.GetNamespace("MAPI")
    Set mailFolder = olNs.GetDefaultFolder(olFolderInbox)
    Set OutMail = OutApp.CreateItem(0)


    MailText = "L.S. " & ‘Put your text here

    On Error Resume Next
    With OutMail
    .To = ToMail
    .CC = CCmail
    .BCC = ""
    .SentOnBehalfOfName = Vanmail
    .Subject = "Your text”
    .Body = MailText
    .Attachments.Add newFile
    .display 'gebruik Display / Send
    End With
    On Error GoTo 0


    Set OutMail = Nothing
    Set OutApp = Nothing
    Else
    MsgBox "PDF add-in not installed!"
    End If

    End Sub

    Thanks to everybody helping me to solve the email problemm.... :-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1