+ Reply to Thread
Results 1 to 2 of 2

Code problem

Hybrid View

  1. #1
    Registered User
    Join Date
    07-04-2014
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    44

    Code problem

    Sub Email4(control As IRibbonControl)
      Dim IsCreated As Boolean
      Dim i As Long
      Dim PdfFile As String
      Dim OutlApp As Object
      PdfFile = ActiveWorkbook.FullName
      i = InStrRev(PdfFile, ".")
      If i > 1 Then PdfFile = Left(PdfFile, i - 1)
      PdfFile = PdfFile & "-" &  ActiveSheet.Name & ".pdf"
      With Sheet3
        .ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
      End With
      On Error Resume Next
      Set OutlApp = GetObject(, "Outlook.Application")
      If Err Then
        Set OutlApp = CreateObject("Outlook.Application")
        IsCreated = True
      End If
      OutlApp.Visible = True
      On Error GoTo 0
    With OutlApp.CreateItem(0)
        .Subject = Range("Email!B4").Value
        .To = Range("Email!B1").Value
        .CC = Range("Email!B2").Value
        .BCC = Range("Email!B3").Value
        .Body = Range("Email!B5").Value
        .Attachments.Add PdfFile
        .Display
        Application.Visible = True
        On Error GoTo 0
     End With
     Kill PdfFile
    End Sub
    I do not want the name of the workbook included in the email
    " PdfFile = ActiveWorkbook.FullName"
    Nor the "ActiveSheet.Name "





    Thanks for your help
    Last edited by wayneao; 03-18-2015 at 07:40 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Adjust Email code

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Adjust the code in the Web Query
    By win1980 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2013, 11:21 PM
  2. Auto Adjust VBA Code
    By skankingpigeon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2012, 04:31 PM
  3. How to adjust this code to import a csv file rather than xml
    By scantron in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2012, 09:10 AM
  4. Adjust code to allow multi choice please?
    By garyi in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-16-2012, 03:51 PM
  5. VBA Code to adjust for dynamic file name
    By patelh9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2010, 12:23 PM

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