Consulting

Results 1 to 6 of 6

Thread: Sleeper: Email Code issue

  1. #1
    VBAX Regular
    Joined
    Oct 2004
    Posts
    65
    Location

    Sleeper: Email Code issue

    Hi All I set up this code to send a workbook to a distribution list. On my system with Excel 2000 and outlook 2000 it's working fine but when I give this same sheet to some one with excel 2002 and outlook 2002 when it gets to the code in BOLD instead of sending the sheet it opens IE and locks up excel

    Any ideas if I need to add something to the code form use with office 2002 or a setting or something any help is really appreciated


    Sub Mail_SheetsArray()
    Dim Arr() As String
        Dim N As Integer
        Dim cell As Range
    N = 0
        For Each cell In Columns("G").Cells.SpecialCells(xlCellTypeConstants)
            If cell.EntireRow.Hidden = False And cell.Value Like "*@*" Then
                N = N + 1
                ReDim Preserve Arr(1 To N)
                Arr(N) = cell.Value
            End If
        Next cell
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim strdate As String
    strdate = Format(Now - 1, "dd-mm-yy")
    Application.ScreenUpdating = False
    Sheets("Summary").Select 
    ActiveSheet.Copy
    For Each ws In Worksheets
        With ws.UsedRange
            .Value = .Value
        End With
    Next
    Set wb = ActiveWorkbook
    With wb
    .SaveAs "C:\MS-EL-SAL Summary" _
    & " " & strdate & ".xls"
     On Error Resume Next
    .SendMail Arr, Subject:=Sheets("Summary").Range("A1").Value
    .ChangeFileAccess xlReadOnly
    MsgBox "Email Sent"
    On Error GoTo 0
    Kill .FullName
    .Close False
    End With
    Application.ScreenUpdating = True
    Sheets("Master").Select
    End Sub
    We are living in a world today
    where lemonade is made from
    artificial flavoring and furniture polish
    is made from real lemons...
    Alfred E Newman

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Works OK in 2003 (little consolation I know), but you get the "Office Outlook" warning. Is this a feature in 2002, or maybe it just halts the send?

    BTW, What does this bit do, as it only applies to one worksheet anyway?

    For Each ws In Worksheets
            With ws.UsedRange
                .Value = .Value
            End With
        Next

  3. #3
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Is this code not another way to replace formulas with values in a worksheet?

    For Each ws In Worksheets With ws.UsedRange .Value = .Value End With Next

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Thanks Norie
    You're right, and a lot neater than my usual method
    MD

  5. #5
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    In case I haven't said so, Norie...we're SO glad you're here!! It's so obvious that you make a HUGE contribution at MrExcel. We're thrilled to have even a teeny tiny portion of your time!

    (you too, MD. But then...I think you know that!!)
    ~Anne Troy

  6. #6
    VBAX Regular
    Joined
    Oct 2004
    Posts
    65
    Location
    Quote Originally Posted by mdmackillop
    Works OK in 2003 (little consolation I know), but you get the "Office Outlook" warning. Is this a feature in 2002, or maybe it just halts the send?
    I not sure if 2002 has that limit does any one know any code that will skip this warning? I know there are Addis but I just curious if there are any code that could accomplish this

    thanks
    We are living in a world today
    where lemonade is made from
    artificial flavoring and furniture polish
    is made from real lemons...
    Alfred E Newman

Posting Permissions

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