+ Reply to Thread
Results 1 to 4 of 4

Code for turning sheet3 content into a pdf and emailing it with cell info all from sheet1

Hybrid View

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    2

    Code for turning sheet3 content into a pdf and emailing it with cell info all from sheet1

    Basically looking for code to email the content of sheet3 in PDF format while operating from within sheet1. Content of the email will include cell data from (A1) =(johnDoe@bla.com). Subject line (john Doe) in cell (B1) all the data will come from within sheet1. Plus message (Thank You)

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Code for turning sheet3 content into a pdf and emailing it with cell info all from she

    Is this solved?

    If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    08-27-2012
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Code for turning sheet3 content into a pdf and emailing it with cell info all from she

    Sub Email_Auth()
    'Variable declaration
        Dim msg As String, cell As Range
        Dim Recipient As String, Subj As String, HLink As String
        Dim Recipientcc As String, Recipientbcc As String, MailTxt As String
    
        Recipient = Range("i37").Value
        Recipientcc = ""
        Recipientbcc = ""
        'You can use a cell value also like this
        'Recipient = Sheets("mysheet").Range("A1").Value
        Subj = "Authorization for work"
        'Subj = Sheets("mysheet").Range("A2").Value
        msg = "Dear customer please sign and return the work Authorization in order to get the job started" & vbNewLine & vbNewLine
        msg = WorksheetFunction.Substitute(msg, vbNewLine, " ")
         'Turns off screen updating
        Application.ScreenUpdating = False
         
      
        
            'Create PDF of active sheet only
            ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
        Sheets("insurance authorization").Select
         strPath = Environ$("temp") & "\" 'Or any other path, but include trailing "\"
         
        strFName = ActiveWorkbook.Name
         strFName = Left(strFName, InStrRev(strFName, ".") - 1) & "_" & ActiveSheet.Name & ".pdf"
    
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
             strPath & strFName, Quality:=xlQualityStandard, _
             IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
         
          'Set up outlook
         Set OutApp = CreateObject("Outlook.Application")
         Set OutMail = OutApp.CreateItem(0)
     
         'Create message
         On Error Resume Next
         With OutMail
            .To = Recipient
            .Subject = Subj
            '.Body = ""
            .httpbody = ""
             .Attachments.Add strPath & strFName
             .Display   'Use only during debugging ##############################
             '.Send      'Uncomment to send e-mail ##############################
         End With
     
         'Delete any temp files created
         Kill strPath & strFName
         On Error GoTo 0
     
        Set OutMail = Nothing
         Set OutApp = Nothing
         Sheets("Claim Sheet").Select
    End Sub
    Last edited by arlu1201; 01-07-2013 at 09:56 AM.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Code for turning sheet3 content into a pdf and emailing it with cell info all from she

    Miasage,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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