Results 1 to 3 of 3

Thread: Changing what email code does

  1. #1

    Changing what email code does

    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi Everyone

    i have this code 1 inside Code 2,

    Code 2
    'Print the invoice to PDFSub PrintPDFInvoice()
    'turn off screenupdating
    Application.ScreenUpdating = False
    If Range("N13") = "" Then
    MsgBox "Please Enter The Invoice Date"
    Exit Sub
    ElseIf Range("N16") = "" Then
    MsgBox "Please Enter The Start Date For Your Contract Hire"
    Exit Sub
    ElseIf Range("N17") = "" Then
    MsgBox "Please Enter The End Date For Your Contract Hire"
    Exit Sub
    ElseIf Range("G12") = "" Then
    MsgBox "Please add the company"
    Exit Sub
    End If
    'open dialog and set file type
    Opendialog = Application.GetSaveAsFilename(Sheet2.Range("N15") & Sheet2.Range("N14"), filefilter:="PDF Files (*.pdf), *.pdf", _
    Title:="Save Me Baby!!")
    'if no value is added for file name
    If Opendialog = False Then
    MsgBox "I take it you forgot to do something!!"
    Exit Sub
    End If
    'set the named range for the PDF
    Set MyRange = Sheet2.Range("G6:N54")
    Sheet2.PageSetup.PrintArea = "G6:N54"
    'create the PDF
    On Error Resume Next
    MyRange.ExportAsFixedFormat _
    Type:=xlTypePDF, _
    Filename:=Sheet2.Range("N15") & Sheet2.Range("N14"), _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    On Error GoTo 0
    'clear the page breaks
    ActiveSheet.DisplayPageBreaks = False
    Application.ScreenUpdating = False
    End Sub
    Code 1
    when i use code 2 it save the file as required by combining two cells "our0112". but what happens is when i add code 1 it simply opens outlook and adds the original file, and not the saved pdf. could someone please help with this.

    also id like the the email to be sent to an email address that i have to the client that is select on the invoice (vlookup, i think). so if i select KN Group then the email that i have for that client would be used. eg and if i change the client on the invoice to GE Lighting then then email for that client would be used.

    im sorry if it all sounds complicated.

    ive attached my file as i thought that would help

    thank you in advance
    Attached Files Attached Files

  2. #2
    could someone please help please.

  3. #3
    Please can someone help me with this. im getting desperate now.

Posting Permissions

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