+ Reply to Thread
Results 1 to 3 of 3

Pastespecial before sending the report

  1. #1
    Registered User
    Join Date
    10-23-2010
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    43

    Pastespecial before sending the report

    Hi All,
    i am trying to automate the reports. I got the below code from online and its working fine.But i would like to make changes and i am not sure how to do it.

    Below macro refresh the data and Email it. What happeining is the excel with all the macros and formulas is also being send. How can i make sure that the excel with only values should be Emailed(No formulas and No macros).

    Sub OC()
    '
    ' OC Macro
    Sheets("Sheet1").Select
    Range("A3").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
    ActiveWindow.Close
    Range("A4").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
    ActiveWindow.Close
    Sheets("EOD Report").Select
    ActiveWindow.SmallScroll Down:=-18
    Range("A1").Select

    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object

    With Application
    .ScreenUpdating = False
    .EnableEvents = False
    End With

    Set Sourcewb = ThisWorkbook

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

    On Error Resume Next
    With OutMail
    .To = "My Email"
    .CC = ""
    .BCC = ""
    .Subject = "EOD Report"
    .Body = "Hi Team,Please find attached EOD Report"
    .Attachments.Add "file path"
    .Send
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
    .ScreenUpdating = True
    .EnableEvents = True
    End With
    End Sub


    Please help.
    Last edited by anto1510; 04-24-2011 at 07:27 AM.

  2. #2
    Registered User
    Join Date
    10-23-2010
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: Pastespecial before sending the report

    please let me know if you need any additional inputs to help me ?

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Pastespecial before sending the report

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

+ 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